@plank-cms/plank 0.30.0 → 0.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,223 @@
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var u=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`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`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+j(a,u),c+=N(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+j(a,u++),c+=N(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return N(M(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function P(e,t,n){if(e==null)return e;var r=[],i=0;return N(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function F(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var I=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},L={map:P,forEach:function(e,t,n){P(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return P(e,function(){t++}),t},toArray:function(e){return P(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=L,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:F}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,I)}catch(e){I(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.5`})),d=o(((e,t)=>{t.exports=u()})),f=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}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(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),p=o(((e,t)=>{t.exports=f()})),m=o((e=>{var t=d();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;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.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=c(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=c(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.5`})),h=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=m()})),g=o((e=>{var t=p(),n=d(),r=h();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;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.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(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 s(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 c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}var m=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),D=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),k=Symbol.for(`react.activity`),A=Symbol.for(`react.memo_cache_sentinel`),j=Symbol.iterator;function M(e){return typeof e!=`object`||!e?null:(e=j&&e[j]||e[`@@iterator`],typeof e==`function`?e:null)}var N=Symbol.for(`react.client.reference`);function P(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===N?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case T:return`Suspense`;case E:return`SuspenseList`;case k:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case w:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case D:return t=e.displayName||null,t===null?P(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return P(e(t))}catch{}}return null}var F=Array.isArray,I=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,R={pending:!1,data:null,method:null,action:null},ee=[],te=-1;function ne(e){return{current:e}}function z(e){0>te||(e.current=ee[te],ee[te]=null,te--)}function B(e,t){te++,ee[te]=e.current,e.current=t}var re=ne(null),V=ne(null),ie=ne(null),ae=ne(null);function oe(e,t){switch(B(ie,t),B(V,e),B(re,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?qd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=qd(t),e=Jd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}z(re),B(re,e)}function se(){z(re),z(V),z(ie)}function ce(e){e.memoizedState!==null&&B(ae,e);var t=re.current,n=Jd(t,e.type);t!==n&&(B(V,e),B(re,n))}function le(e){V.current===e&&(z(re),z(V)),ae.current===e&&(z(ae),ip._currentValue=R)}var ue,de;function fe(e){if(ue===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ue=t&&t[1]||``,de=-1<e.stack.indexOf(`
2
+ at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
3
+ `+ue+e+de}var pe=!1;function me(e,t){if(!e||pe)return``;pe=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,`props`,{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,`name`,{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
4
+ `),l=s.split(`
5
+ `);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
6
+ `+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{pe=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?fe(n):``}function he(e,t){switch(e.tag){case 26:case 27:case 5:return fe(e.type);case 16:return fe(`Lazy`);case 13:return e.child!==t&&t!==null?fe(`Suspense Fallback`):fe(`Suspense`);case 19:return fe(`SuspenseList`);case 0:case 15:return me(e.type,!1);case 11:return me(e.type.render,!1);case 1:return me(e.type,!0);case 31:return fe(`Activity`);default:return``}}function ge(e){try{var t=``,n=null;do t+=he(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
7
+ Error generating stack: `+e.message+`
8
+ `+e.stack}}var _e=Object.prototype.hasOwnProperty,ve=t.unstable_scheduleCallback,ye=t.unstable_cancelCallback,be=t.unstable_shouldYield,xe=t.unstable_requestPaint,Se=t.unstable_now,Ce=t.unstable_getCurrentPriorityLevel,we=t.unstable_ImmediatePriority,Te=t.unstable_UserBlockingPriority,Ee=t.unstable_NormalPriority,De=t.unstable_LowPriority,Oe=t.unstable_IdlePriority,ke=t.log,Ae=t.unstable_setDisableYieldValue,je=null,Me=null;function Ne(e){if(typeof ke==`function`&&Ae(e),Me&&typeof Me.setStrictMode==`function`)try{Me.setStrictMode(je,e)}catch{}}var Pe=Math.clz32?Math.clz32:Le,Fe=Math.log,Ie=Math.LN2;function Le(e){return e>>>=0,e===0?32:31-(Fe(e)/Ie|0)|0}var Re=256,ze=262144,Be=4194304;function Ve(e){var t=e&42;if(t!==0)return t;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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function He(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Ve(n))):i=Ve(o):i=Ve(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Ve(n))):i=Ve(o)):i=Ve(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function Ue(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function We(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32: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:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ge(){var e=Be;return Be<<=1,!(Be&62914560)&&(Be=4194304),e}function Ke(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function qe(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Je(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Pe(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&Ye(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Ye(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Pe(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function Xe(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Pe(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function Ze(e,t){var n=t&-t;return n=n&42?1:Qe(n),(n&(e.suspendedLanes|t))===0?n:0}function Qe(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function $e(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function et(){var e=L.p;return e===0?(e=window.event,e===void 0?32:bp(e.type)):e}function tt(e,t){var n=L.p;try{return L.p=e,t()}finally{L.p=n}}var nt=Math.random().toString(36).slice(2),rt=`__reactFiber$`+nt,it=`__reactProps$`+nt,at=`__reactContainer$`+nt,ot=`__reactEvents$`+nt,st=`__reactListeners$`+nt,ct=`__reactHandles$`+nt,lt=`__reactResources$`+nt,ut=`__reactMarker$`+nt;function dt(e){delete e[rt],delete e[it],delete e[ot],delete e[st],delete e[ct]}function ft(e){var t=e[rt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[at]||n[rt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=_f(e);e!==null;){if(n=e[rt])return n;e=_f(e)}return t}e=n,n=e.parentNode}return null}function pt(e){if(e=e[rt]||e[at]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function mt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function ht(e){var t=e[lt];return t||=e[lt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function gt(e){e[ut]=!0}var _t=new Set,vt={};function yt(e,t){bt(e,t),bt(e+`Capture`,t)}function bt(e,t){for(vt[e]=t,e=0;e<t.length;e++)_t.add(t[e])}var xt=RegExp(`^[: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]*$`),St={},Ct={};function wt(e){return _e.call(Ct,e)?!0:_e.call(St,e)?!1:xt.test(e)?Ct[e]=!0:(St[e]=!0,!1)}function Tt(e,t,n){if(wt(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}function Et(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function Dt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function Ot(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function kt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function At(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function jt(e){if(!e._valueTracker){var t=kt(e)?`checked`:`value`;e._valueTracker=At(e,t,``+e[t])}}function Mt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=kt(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function Nt(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var Pt=/[\n"\\]/g;function Ft(e){return e.replace(Pt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function It(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+Ot(t)):e.value!==``+Ot(t)&&(e.value=``+Ot(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Rt(e,o,Ot(n)):Rt(e,o,Ot(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+Ot(s):e.removeAttribute(`name`)}function Lt(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){jt(e);return}n=n==null?``:``+Ot(n),t=t==null?n:``+Ot(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),jt(e)}function Rt(e,t,n){t===`number`&&Nt(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function zt(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+Ot(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Bt(e,t,n){if(t!=null&&(t=``+Ot(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Ot(n)}function Vt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(F(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=Ot(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),jt(e)}function Ht(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ut=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function Wt(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||Ut.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Gt(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&Wt(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&Wt(e,o,t[o])}function Kt(e){if(e.indexOf(`-`)===-1)return!1;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 qt=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),Jt=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Yt(e){return Jt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function Xt(){}var Zt=null;function Qt(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var $t=null,en=null;function tn(e){var t=pt(e);if(t&&(e=t.stateNode)){var n=e[it]||null;a:switch(e=t.stateNode,t.type){case`input`:if(It(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Ft(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[it]||null;if(!a)throw Error(i(90));It(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Mt(r)}break a;case`textarea`:Bt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&zt(e,!!n.multiple,t,!1)}}}var nn=!1;function rn(e,t,n){if(nn)return e(t,n);nn=!0;try{return e(t)}finally{if(nn=!1,($t!==null||en!==null)&&(Cu(),$t&&(t=$t,e=en,en=$t=null,tn(t),e)))for(t=0;t<e.length;t++)tn(e[t])}}function an(e,t){var n=e.stateNode;if(n===null)return null;var r=n[it]||null;if(r===null)return null;n=r[t];a: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 a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var on=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),sn=!1;if(on)try{var cn={};Object.defineProperty(cn,`passive`,{get:function(){sn=!0}}),window.addEventListener(`test`,cn,cn),window.removeEventListener(`test`,cn,cn)}catch{sn=!1}var ln=null,un=null,dn=null;function fn(){if(dn)return dn;var e,t=un,n=t.length,r,i=`value`in ln?ln.value:ln.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return dn=i.slice(e,1<r?1-r:void 0)}function pn(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 mn(){return!0}function hn(){return!1}function gn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?mn:hn,this.isPropagationStopped=hn,this}return m(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=mn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=mn)},persist:function(){},isPersistent:mn}),t}var _n={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},vn=gn(_n),yn=m({},_n,{view:0,detail:0}),bn=gn(yn),xn,Sn,Cn,wn=m({},yn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Fn,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!==Cn&&(Cn&&e.type===`mousemove`?(xn=e.screenX-Cn.screenX,Sn=e.screenY-Cn.screenY):Sn=xn=0,Cn=e),xn)},movementY:function(e){return`movementY`in e?e.movementY:Sn}}),Tn=gn(wn),En=gn(m({},wn,{dataTransfer:0})),Dn=gn(m({},yn,{relatedTarget:0})),On=gn(m({},_n,{animationName:0,elapsedTime:0,pseudoElement:0})),kn=gn(m({},_n,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),An=gn(m({},_n,{data:0})),jn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Mn={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`},Nn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Pn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Nn[e])?!!t[e]:!1}function Fn(){return Pn}var In=gn(m({},yn,{key:function(e){if(e.key){var t=jn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=pn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Mn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Fn,charCode:function(e){return e.type===`keypress`?pn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?pn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Ln=gn(m({},wn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Rn=gn(m({},yn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Fn})),zn=gn(m({},_n,{propertyName:0,elapsedTime:0,pseudoElement:0})),Bn=gn(m({},wn,{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})),Vn=gn(m({},_n,{newState:0,oldState:0})),Hn=[9,13,27,32],Un=on&&`CompositionEvent`in window,Wn=null;on&&`documentMode`in document&&(Wn=document.documentMode);var Gn=on&&`TextEvent`in window&&!Wn,Kn=on&&(!Un||Wn&&8<Wn&&11>=Wn),qn=` `,Jn=!1;function Yn(e,t){switch(e){case`keyup`:return Hn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Xn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Zn=!1;function Qn(e,t){switch(e){case`compositionend`:return Xn(t);case`keypress`:return t.which===32?(Jn=!0,qn):null;case`textInput`:return e=t.data,e===qn&&Jn?null:e;default:return null}}function $n(e,t){if(Zn)return e===`compositionend`||!Un&&Yn(e,t)?(e=fn(),dn=un=ln=null,Zn=!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 Kn&&t.locale!==`ko`?null:t.data;default:return null}}var er={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 tr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!er[e.type]:t===`textarea`}function nr(e,t,n,r){$t?en?en.push(r):en=[r]:$t=r,t=jd(t,`onChange`),0<t.length&&(n=new vn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var rr=null,ir=null;function ar(e){Cd(e,0)}function or(e){if(Mt(mt(e)))return e}function sr(e,t){if(e===`change`)return t}var cr=!1;if(on){var lr;if(on){var ur=`oninput`in document;if(!ur){var dr=document.createElement(`div`);dr.setAttribute(`oninput`,`return;`),ur=typeof dr.oninput==`function`}lr=ur}else lr=!1;cr=lr&&(!document.documentMode||9<document.documentMode)}function fr(){rr&&(rr.detachEvent(`onpropertychange`,pr),ir=rr=null)}function pr(e){if(e.propertyName===`value`&&or(ir)){var t=[];nr(t,ir,e,Qt(e)),rn(ar,t)}}function mr(e,t,n){e===`focusin`?(fr(),rr=t,ir=n,rr.attachEvent(`onpropertychange`,pr)):e===`focusout`&&fr()}function hr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return or(ir)}function gr(e,t){if(e===`click`)return or(t)}function _r(e,t){if(e===`input`||e===`change`)return or(t)}function vr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var yr=typeof Object.is==`function`?Object.is:vr;function br(e,t){if(yr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)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 i=n[r];if(!_e.call(t,i)||!yr(e[i],t[i]))return!1}return!0}function xr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Sr(e,t){var n=xr(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}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=xr(n)}}function Cr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Cr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function wr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Nt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Nt(e.document)}return t}function Tr(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`)}var Er=on&&`documentMode`in document&&11>=document.documentMode,Dr=null,Or=null,kr=null,Ar=!1;function jr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ar||Dr==null||Dr!==Nt(r)||(r=Dr,`selectionStart`in r&&Tr(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}),kr&&br(kr,r)||(kr=r,r=jd(Or,`onSelect`),0<r.length&&(t=new vn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Dr)))}function Mr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Nr={animationend:Mr(`Animation`,`AnimationEnd`),animationiteration:Mr(`Animation`,`AnimationIteration`),animationstart:Mr(`Animation`,`AnimationStart`),transitionrun:Mr(`Transition`,`TransitionRun`),transitionstart:Mr(`Transition`,`TransitionStart`),transitioncancel:Mr(`Transition`,`TransitionCancel`),transitionend:Mr(`Transition`,`TransitionEnd`)},Pr={},Fr={};on&&(Fr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Nr.animationend.animation,delete Nr.animationiteration.animation,delete Nr.animationstart.animation),`TransitionEvent`in window||delete Nr.transitionend.transition);function Ir(e){if(Pr[e])return Pr[e];if(!Nr[e])return e;var t=Nr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Fr)return Pr[e]=t[n];return e}var Lr=Ir(`animationend`),Rr=Ir(`animationiteration`),zr=Ir(`animationstart`),Br=Ir(`transitionrun`),Vr=Ir(`transitionstart`),Hr=Ir(`transitioncancel`),Ur=Ir(`transitionend`),Wr=new Map,Gr=`abort auxClick beforeToggle 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(` `);Gr.push(`scrollEnd`);function Kr(e,t){Wr.set(e,t),yt(t,[e])}var qr=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Jr=[],Yr=0,Xr=0;function Zr(){for(var e=Yr,t=Xr=Yr=0;t<e;){var n=Jr[t];Jr[t++]=null;var r=Jr[t];Jr[t++]=null;var i=Jr[t];Jr[t++]=null;var a=Jr[t];if(Jr[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&ti(n,i,a)}}function Qr(e,t,n,r){Jr[Yr++]=e,Jr[Yr++]=t,Jr[Yr++]=n,Jr[Yr++]=r,Xr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function $r(e,t,n,r){return Qr(e,t,n,r),ni(e)}function ei(e,t){return Qr(e,null,null,t),ni(e)}function ti(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Pe(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function ni(e){if(50<mu)throw mu=0,hu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var ri={};function ii(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.refCleanup=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 ai(e,t,n,r){return new ii(e,t,n,r)}function oi(e){return e=e.prototype,!(!e||!e.isReactComponent)}function si(e,t){var n=e.alternate;return n===null?(n=ai(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&65011712,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.refCleanup=e.refCleanup,n}function ci(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function li(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)oi(e)&&(s=1);else if(typeof e==`string`)s=Yf(e,n,re.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case k:return e=ai(31,n,t,a),e.elementType=k,e.lanes=o,e;case y:return ui(n.children,a,o,t);case b:s=8,a|=24;break;case x:return e=ai(12,n,t,a|2),e.elementType=x,e.lanes=o,e;case T:return e=ai(13,n,t,a),e.elementType=T,e.lanes=o,e;case E:return e=ai(19,n,t,a),e.elementType=E,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case C:s=10;break a;case S:s=9;break a;case w:s=11;break a;case D:s=14;break a;case O:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=ai(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function ui(e,t,n,r){return e=ai(7,e,r,t),e.lanes=n,e}function di(e,t,n){return e=ai(6,e,null,t),e.lanes=n,e}function fi(e){var t=ai(18,null,null,0);return t.stateNode=e,t}function pi(e,t,n){return t=ai(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var mi=new WeakMap;function hi(e,t){if(typeof e==`object`&&e){var n=mi.get(e);return n===void 0?(t={value:e,source:t,stack:ge(t)},mi.set(e,t),t):n}return{value:e,source:t,stack:ge(t)}}var gi=[],_i=0,vi=null,yi=0,bi=[],xi=0,Si=null,Ci=1,wi=``;function Ti(e,t){gi[_i++]=yi,gi[_i++]=vi,vi=e,yi=t}function Ei(e,t,n){bi[xi++]=Ci,bi[xi++]=wi,bi[xi++]=Si,Si=e;var r=Ci;e=wi;var i=32-Pe(r)-1;r&=~(1<<i),n+=1;var a=32-Pe(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Ci=1<<32-Pe(t)+i|n<<i|r,wi=a+e}else Ci=1<<a|n<<i|r,wi=e}function Di(e){e.return!==null&&(Ti(e,1),Ei(e,1,0))}function Oi(e){for(;e===vi;)vi=gi[--_i],gi[_i]=null,yi=gi[--_i],gi[_i]=null;for(;e===Si;)Si=bi[--xi],bi[xi]=null,wi=bi[--xi],bi[xi]=null,Ci=bi[--xi],bi[xi]=null}function ki(e,t){bi[xi++]=Ci,bi[xi++]=wi,bi[xi++]=Si,Ci=t.id,wi=t.overflow,Si=e}var Ai=null,ji=null,Mi=!1,Ni=null,Pi=!1,Fi=Error(i(519));function Ii(e){throw Hi(hi(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Fi}function Li(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[rt]=e,t[it]=r,n){case`dialog`:wd(`cancel`,t),wd(`close`,t);break;case`iframe`:case`object`:case`embed`:wd(`load`,t);break;case`video`:case`audio`:for(n=0;n<xd.length;n++)wd(xd[n],t);break;case`source`:wd(`error`,t);break;case`img`:case`image`:case`link`:wd(`error`,t),wd(`load`,t);break;case`details`:wd(`toggle`,t);break;case`input`:wd(`invalid`,t),Lt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:wd(`invalid`,t);break;case`textarea`:wd(`invalid`,t),Vt(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||Ld(t.textContent,n)?(r.popover!=null&&(wd(`beforetoggle`,t),wd(`toggle`,t)),r.onScroll!=null&&wd(`scroll`,t),r.onScrollEnd!=null&&wd(`scrollend`,t),r.onClick!=null&&(t.onclick=Xt),t=!0):t=!1,t||Ii(e,!0)}function Ri(e){for(Ai=e.return;Ai;)switch(Ai.tag){case 5:case 31:case 13:Pi=!1;return;case 27:case 3:Pi=!0;return;default:Ai=Ai.return}}function zi(e){if(e!==Ai)return!1;if(!Mi)return Ri(e),Mi=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!==`form`&&n!==`button`)||Yd(e.type,e.memoizedProps)),n=!n),n&&ji&&Ii(e),Ri(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));ji=gf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));ji=gf(e)}else t===27?(t=ji,rf(e.type)?(e=hf,hf=null,ji=e):ji=t):ji=Ai?mf(e.stateNode.nextSibling):null;return!0}function Bi(){ji=Ai=null,Mi=!1}function Vi(){var e=Ni;return e!==null&&(eu===null?eu=e:eu.push.apply(eu,e),Ni=null),e}function Hi(e){Ni===null?Ni=[e]:Ni.push(e)}var Ui=ne(null),Wi=null,Gi=null;function Ki(e,t,n){B(Ui,t._currentValue),t._currentValue=n}function qi(e){e._currentValue=Ui.current,z(Ui)}function Ji(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Yi(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),Ji(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),Ji(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function Xi(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;yr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===ae.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[ip]:e.push(ip))}a=a.return}e!==null&&Yi(t,e,n,r),t.flags|=262144}function Zi(e){for(e=e.firstContext;e!==null;){if(!yr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Qi(e){Wi=e,Gi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function $i(e){return ta(Wi,e)}function ea(e,t){return Wi===null&&Qi(e),ta(e,t)}function ta(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Gi===null){if(e===null)throw Error(i(308));Gi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Gi=Gi.next=t;return n}var na=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},ra=t.unstable_scheduleCallback,ia=t.unstable_NormalPriority,aa={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function oa(){return{controller:new na,data:new Map,refCount:0}}function sa(e){e.refCount--,e.refCount===0&&ra(ia,function(){e.controller.abort()})}var ca=null,la=0,ua=0,da=null;function fa(e,t){if(ca===null){var n=ca=[];la=0,ua=hd(),da={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return la++,t.then(pa,pa),t}function pa(){if(--la===0&&ca!==null){da!==null&&(da.status=`fulfilled`);var e=ca;ca=null,ua=0,da=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function H(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var ma=I.S;I.S=function(e,t){ru=Se(),typeof t==`object`&&t&&typeof t.then==`function`&&fa(e,t),ma!==null&&ma(e,t)};var ha=ne(null);function ga(){var e=ha.current;return e===null?Rl.pooledCache:e}function _a(e,t){t===null?B(ha,ha.current):B(ha,t.pool)}function va(){var e=ga();return e===null?null:{parent:aa._currentValue,pool:e}}var ya=Error(i(460)),ba=Error(i(474)),xa=Error(i(542)),Sa={then:function(){}};function Ca(e){return e=e.status,e===`fulfilled`||e===`rejected`}function wa(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Xt,Xt),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Oa(e),e;default:if(typeof t.status==`string`)t.then(Xt,Xt);else{if(e=Rl,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Oa(e),e}throw Ea=t,ya}}function Ta(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Ea=e,ya):e}}var Ea=null;function Da(){if(Ea===null)throw Error(i(459));var e=Ea;return Ea=null,e}function Oa(e){if(e===ya||e===xa)throw Error(i(483))}var ka=null,Aa=0;function ja(e){var t=Aa;return Aa+=1,ka===null&&(ka=[]),wa(ka,e,t)}function U(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Ma(e,t){throw t.$$typeof===g?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Na(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=si(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=di(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===y?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===O&&Ta(i)===t.type)?(t=a(t,n.props),U(t,n),t.return=e,t):(t=li(n.type,n.key,n.props,null,e.mode,r),U(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=pi(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=ui(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=di(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case _:return n=li(t.type,t.key,t.props,null,e.mode,n),U(n,t),n.return=e,n;case v:return t=pi(t,e.mode,n),t.return=e,t;case O:return t=Ta(t),f(e,t,n)}if(F(t)||M(t))return t=ui(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,ja(t),n);if(t.$$typeof===C)return f(e,ea(e,t),n);Ma(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case _:return n.key===i?l(e,t,n,r):null;case v:return n.key===i?u(e,t,n,r):null;case O:return n=Ta(n),p(e,t,n,r)}if(F(n)||M(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,ja(n),r);if(n.$$typeof===C)return p(e,t,ea(e,n),r);Ma(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case _:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case v:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case O:return r=Ta(r),m(e,t,n,r,i)}if(F(r)||M(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,ja(r),i);if(r.$$typeof===C)return m(e,t,n,ea(t,r),i);Ma(t,r)}return null}function h(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),Mi&&Ti(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return Mi&&Ti(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),Mi&&Ti(i,h),l}function g(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),Mi&&Ti(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return Mi&&Ti(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),Mi&&Ti(a,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===y&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case _:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===y){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===O&&Ta(l)===r.type){n(e,r.sibling),c=a(r,o.props),U(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===y?(c=ui(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=li(o.type,o.key,o.props,null,e.mode,c),U(c,o),c.return=e,e=c)}return s(e);case v:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=pi(o,e.mode,c),c.return=e,e=c}return s(e);case O:return o=Ta(o),b(e,r,o,c)}if(F(o))return h(e,r,o,c);if(M(o)){if(l=M(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,ja(o),c);if(o.$$typeof===C)return b(e,r,ea(e,o),c);Ma(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=di(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Aa=0;var i=b(e,t,n,r);return ka=null,i}catch(t){if(t===ya||t===xa)throw t;var a=ai(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Pa=Na(!0),Fa=Na(!1),Ia=!1;function La(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ra(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function za(e){return{lane:e,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,Ll&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ni(e),ti(e,null,n),t}return Qr(e,r,t,n),ni(e)}function Va(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Xe(e,n)}}function Ha(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ua=!1;function Wa(){if(Ua){var e=da;if(e!==null)throw e}}function Ga(e,t,n,r){Ua=!1;var i=e.updateQueue;Ia=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(Bl&f)===f:(r&f)===f){f!==0&&f===ua&&(Ua=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,f);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,f=typeof h==`function`?h.call(_,d,f):h,f==null)break a;d=m({},d,f);break a;case 2:Ia=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Jl|=o,e.lanes=o,e.memoizedState=d}}function Ka(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function qa(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Ka(n[e],t)}var Ja=ne(null),Ya=ne(0);function Xa(e,t){e=Kl,B(Ya,e),B(Ja,t),Kl=e|t.baseLanes}function Za(){B(Ya,Kl),B(Ja,Ja.current)}function Qa(){Kl=Ya.current,z(Ja),z(Ya)}var $a=ne(null),eo=null;function to(e){var t=e.alternate;B(oo,oo.current&1),B($a,e),eo===null&&(t===null||Ja.current!==null||t.memoizedState!==null)&&(eo=e)}function no(e){B(oo,oo.current),B($a,e),eo===null&&(eo=e)}function ro(e){e.tag===22?(B(oo,oo.current),B($a,e),eo===null&&(eo=e)):io(e)}function io(){B(oo,oo.current),B($a,$a.current)}function ao(e){z($a),eo===e&&(eo=null),z(oo)}var oo=ne(0);function so(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||df(n)||ff(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){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 co=0,lo=null,uo=null,fo=null,po=!1,mo=!1,ho=!1,go=0,_o=0,vo=null,yo=0;function bo(){throw Error(i(321))}function xo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!yr(e[n],t[n]))return!1;return!0}function So(e,t,n,r,i,a){return co=a,lo=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,I.H=e===null||e.memoizedState===null?Bs:Vs,ho=!1,a=n(r,i),ho=!1,mo&&(a=wo(t,n,r,i)),Co(e),a}function Co(e){I.H=zs;var t=uo!==null&&uo.next!==null;if(co=0,fo=uo=lo=null,po=!1,_o=0,vo=null,t)throw Error(i(300));e===null||ic||(e=e.dependencies,e!==null&&Zi(e)&&(ic=!0))}function wo(e,t,n,r){lo=e;var a=0;do{if(mo&&(vo=null),_o=0,mo=!1,25<=a)throw Error(i(301));if(a+=1,fo=uo=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}I.H=Hs,o=t(n,r)}while(mo);return o}function To(){var e=I.H,t=e.useState()[0];return t=typeof t.then==`function`?Mo(t):t,e=e.useState()[0],(uo===null?null:uo.memoizedState)!==e&&(lo.flags|=1024),t}function Eo(){var e=go!==0;return go=0,e}function Do(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Oo(e){if(po){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}po=!1}co=0,fo=uo=lo=null,mo=!1,_o=go=0,vo=null}function ko(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return fo===null?lo.memoizedState=fo=e:fo=fo.next=e,fo}function Ao(){if(uo===null){var e=lo.alternate;e=e===null?null:e.memoizedState}else e=uo.next;var t=fo===null?lo.memoizedState:fo.next;if(t!==null)fo=t,uo=e;else{if(e===null)throw lo.alternate===null?Error(i(467)):Error(i(310));uo=e,e={memoizedState:uo.memoizedState,baseState:uo.baseState,baseQueue:uo.baseQueue,queue:uo.queue,next:null},fo===null?lo.memoizedState=fo=e:fo=fo.next=e}return fo}function jo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Mo(e){var t=_o;return _o+=1,vo===null&&(vo=[]),e=wa(vo,e,t),t=lo,(fo===null?t.memoizedState:fo.next)===null&&(t=t.alternate,I.H=t===null||t.memoizedState===null?Bs:Vs),e}function No(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Mo(e);if(e.$$typeof===C)return $i(e)}throw Error(i(438,String(e)))}function Po(e){var t=null,n=lo.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=lo.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=jo(),lo.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=A;return t.index++,n}function Fo(e,t){return typeof t==`function`?t(e):t}function Io(e){return Lo(Ao(),uo,e)}function Lo(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(co&f)===f:(Bl&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===ua&&(d=!0);else if((co&p)===p){u=u.next,p===ua&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,lo.lanes|=p,Jl|=p;f=u.action,ho&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,lo.lanes|=f,Jl|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!yr(o,e.memoizedState)&&(ic=!0,d&&(n=da,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Ro(e){var t=Ao(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);yr(o,t.memoizedState)||(ic=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function zo(e,t,n){var r=lo,a=Ao(),o=Mi;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!yr((uo||a).memoizedState,n);if(s&&(a.memoizedState=n,ic=!0),a=a.queue,ds(Ho.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||fo!==null&&fo.memoizedState.tag&1){if(r.flags|=2048,as(9,{destroy:void 0},Vo.bind(null,r,a,n,t),null),Rl===null)throw Error(i(349));o||co&127||Bo(r,t,n)}return n}function Bo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=lo.updateQueue,t===null?(t=jo(),lo.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Vo(e,t,n,r){t.value=n,t.getSnapshot=r,Uo(t)&&Wo(e)}function Ho(e,t,n){return n(function(){Uo(t)&&Wo(e)})}function Uo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!yr(e,n)}catch{return!0}}function Wo(e){var t=ei(e,2);t!==null&&vu(t,e,2)}function Go(e){var t=ko();if(typeof e==`function`){var n=e;if(e=n(),ho){Ne(!0);try{n()}finally{Ne(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fo,lastRenderedState:e},t}function Ko(e,t,n,r){return e.baseState=n,Lo(e,uo,typeof r==`function`?r:Fo)}function qo(e,t,n,r,a){if(Is(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};I.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Jo(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Jo(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=I.T,o={};I.T=o;try{var s=n(i,r),c=I.S;c!==null&&c(o,s),Yo(e,t,s)}catch(n){Zo(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),I.T=a}}else try{a=n(i,r),Yo(e,t,a)}catch(n){Zo(e,t,n)}}function Yo(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Xo(e,t,n)},function(n){return Zo(e,t,n)}):Xo(e,t,n)}function Xo(e,t,n){t.status=`fulfilled`,t.value=n,Qo(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Jo(e,n)))}function Zo(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Qo(t),t=t.next;while(t!==r)}e.action=null}function Qo(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function $o(e,t){return t}function es(e,t){if(Mi){var n=Rl.formState;if(n!==null){a:{var r=lo;if(Mi){if(ji){b:{for(var i=ji,a=Pi;i.nodeType!==8;){if(!a){i=null;break b}if(i=mf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){ji=mf(i.nextSibling),r=i.data===`F!`;break a}}Ii(r)}r=!1}r&&(t=n[0])}}return n=ko(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:$o,lastRenderedState:t},n.queue=r,n=Ns.bind(null,lo,r),r.dispatch=n,r=Go(!1),a=Fs.bind(null,lo,!1,r.queue),r=ko(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=qo.bind(null,lo,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function ts(e){return ns(Ao(),uo,e)}function ns(e,t,n){if(t=Lo(e,t,$o)[0],e=Io(Fo)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Mo(t)}catch(e){throw e===ya?xa:e}else r=t;t=Ao();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(lo.flags|=2048,as(9,{destroy:void 0},rs.bind(null,i,n),null)),[r,a,e]}function rs(e,t){e.action=t}function is(e){var t=Ao(),n=uo;if(n!==null)return ns(t,n,e);Ao(),t=t.memoizedState,n=Ao();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function as(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=lo.updateQueue,t===null&&(t=jo(),lo.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function ss(){return Ao().memoizedState}function cs(e,t,n,r){var i=ko();lo.flags|=e,i.memoizedState=as(1|t,{destroy:void 0},n,r===void 0?null:r)}function ls(e,t,n,r){var i=Ao();r=r===void 0?null:r;var a=i.memoizedState.inst;uo!==null&&r!==null&&xo(r,uo.memoizedState.deps)?i.memoizedState=as(t,a,n,r):(lo.flags|=e,i.memoizedState=as(1|t,a,n,r))}function us(e,t){cs(8390656,8,e,t)}function ds(e,t){ls(2048,8,e,t)}function fs(e){lo.flags|=4;var t=lo.updateQueue;if(t===null)t=jo(),lo.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function ps(e){var t=Ao().memoizedState;return fs({ref:t,nextImpl:e}),function(){if(Ll&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function ms(e,t){return ls(4,2,e,t)}function hs(e,t){return ls(4,4,e,t)}function gs(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function _s(e,t,n){n=n==null?null:n.concat([e]),ls(4,4,gs.bind(null,t,e),n)}function vs(){}function ys(e,t){var n=Ao();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&xo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function bs(e,t){var n=Ao();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&xo(t,r[1]))return r[0];if(r=e(),ho){Ne(!0);try{e()}finally{Ne(!1)}}return n.memoizedState=[r,t],r}function xs(e,t,n){return n===void 0||co&1073741824&&!(Bl&261930)?e.memoizedState=t:(e.memoizedState=n,e=_u(),lo.lanes|=e,Jl|=e,n)}function Ss(e,t,n,r){return yr(n,t)?n:Ja.current===null?!(co&42)||co&1073741824&&!(Bl&261930)?(ic=!0,e.memoizedState=n):(e=_u(),lo.lanes|=e,Jl|=e,t):(e=xs(e,n,r),yr(e,t)||(ic=!0),e)}function Cs(e,t,n,r,i){var a=L.p;L.p=a!==0&&8>a?a:8;var o=I.T,s={};I.T=s,Fs(e,!1,t,n);try{var c=i(),l=I.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Ps(e,t,H(c,r),gu(e)):Ps(e,t,r,gu(e))}catch(n){Ps(e,t,{then:function(){},status:`rejected`,reason:n},gu())}finally{L.p=a,o!==null&&s.types!==null&&(o.types=s.types),I.T=o}}function ws(){}function Ts(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=Es(e).queue;Cs(e,a,t,R,n===null?ws:function(){return Ds(e),n(r)})}function Es(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:R,baseState:R,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fo,lastRenderedState:R},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ds(e){var t=Es(e);t.next===null&&(t=e.alternate.memoizedState),Ps(e,t.next.queue,{},gu())}function Os(){return $i(ip)}function ks(){return Ao().memoizedState}function As(){return Ao().memoizedState}function js(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=gu();e=za(n);var r=Ba(t,e,n);r!==null&&(vu(r,t,n),Va(r,t,n)),t={cache:oa()},e.payload=t;return}t=t.return}}function Ms(e,t,n){var r=gu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Is(e)?Ls(t,n):(n=$r(e,t,n,r),n!==null&&(vu(n,e,r),Rs(n,t,r)))}function Ns(e,t,n){Ps(e,t,n,gu())}function Ps(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Is(e))Ls(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,yr(s,o))return Qr(e,t,i,0),Rl===null&&Zr(),!1}catch{}if(n=$r(e,t,i,r),n!==null)return vu(n,e,r),Rs(n,t,r),!0}return!1}function Fs(e,t,n,r){if(r={lane:2,revertLane:hd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Is(e)){if(t)throw Error(i(479))}else t=$r(e,n,r,2),t!==null&&vu(t,e,2)}function Is(e){var t=e.alternate;return e===lo||t!==null&&t===lo}function Ls(e,t){mo=po=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Rs(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Xe(e,n)}}var zs={readContext:$i,use:No,useCallback:bo,useContext:bo,useEffect:bo,useImperativeHandle:bo,useLayoutEffect:bo,useInsertionEffect:bo,useMemo:bo,useReducer:bo,useRef:bo,useState:bo,useDebugValue:bo,useDeferredValue:bo,useTransition:bo,useSyncExternalStore:bo,useId:bo,useHostTransitionStatus:bo,useFormState:bo,useActionState:bo,useOptimistic:bo,useMemoCache:bo,useCacheRefresh:bo};zs.useEffectEvent=bo;var Bs={readContext:$i,use:No,useCallback:function(e,t){return ko().memoizedState=[e,t===void 0?null:t],e},useContext:$i,useEffect:us,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),cs(4194308,4,gs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return cs(4194308,4,e,t)},useInsertionEffect:function(e,t){cs(4,2,e,t)},useMemo:function(e,t){var n=ko();t=t===void 0?null:t;var r=e();if(ho){Ne(!0);try{e()}finally{Ne(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=ko();if(n!==void 0){var i=n(t);if(ho){Ne(!0);try{n(t)}finally{Ne(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Ms.bind(null,lo,e),[r.memoizedState,e]},useRef:function(e){var t=ko();return e={current:e},t.memoizedState=e},useState:function(e){e=Go(e);var t=e.queue,n=Ns.bind(null,lo,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:vs,useDeferredValue:function(e,t){return xs(ko(),e,t)},useTransition:function(){var e=Go(!1);return e=Cs.bind(null,lo,e.queue,!0,!1),ko().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=lo,a=ko();if(Mi){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Rl===null)throw Error(i(349));Bl&127||Bo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,us(Ho.bind(null,r,o,e),[e]),r.flags|=2048,as(9,{destroy:void 0},Vo.bind(null,r,o,n,t),null),n},useId:function(){var e=ko(),t=Rl.identifierPrefix;if(Mi){var n=wi,r=Ci;n=(r&~(1<<32-Pe(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=go++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=yo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Os,useFormState:es,useActionState:es,useOptimistic:function(e){var t=ko();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Fs.bind(null,lo,!0,n),n.dispatch=t,[e,t]},useMemoCache:Po,useCacheRefresh:function(){return ko().memoizedState=js.bind(null,lo)},useEffectEvent:function(e){var t=ko(),n={impl:e};return t.memoizedState=n,function(){if(Ll&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Vs={readContext:$i,use:No,useCallback:ys,useContext:$i,useEffect:ds,useImperativeHandle:_s,useInsertionEffect:ms,useLayoutEffect:hs,useMemo:bs,useReducer:Io,useRef:ss,useState:function(){return Io(Fo)},useDebugValue:vs,useDeferredValue:function(e,t){return Ss(Ao(),uo.memoizedState,e,t)},useTransition:function(){var e=Io(Fo)[0],t=Ao().memoizedState;return[typeof e==`boolean`?e:Mo(e),t]},useSyncExternalStore:zo,useId:ks,useHostTransitionStatus:Os,useFormState:ts,useActionState:ts,useOptimistic:function(e,t){return Ko(Ao(),uo,e,t)},useMemoCache:Po,useCacheRefresh:As};Vs.useEffectEvent=ps;var Hs={readContext:$i,use:No,useCallback:ys,useContext:$i,useEffect:ds,useImperativeHandle:_s,useInsertionEffect:ms,useLayoutEffect:hs,useMemo:bs,useReducer:Ro,useRef:ss,useState:function(){return Ro(Fo)},useDebugValue:vs,useDeferredValue:function(e,t){var n=Ao();return uo===null?xs(n,e,t):Ss(n,uo.memoizedState,e,t)},useTransition:function(){var e=Ro(Fo)[0],t=Ao().memoizedState;return[typeof e==`boolean`?e:Mo(e),t]},useSyncExternalStore:zo,useId:ks,useHostTransitionStatus:Os,useFormState:is,useActionState:is,useOptimistic:function(e,t){var n=Ao();return uo===null?(n.baseState=e,[e,n.queue.dispatch]):Ko(n,uo,e,t)},useMemoCache:Po,useCacheRefresh:As};Hs.useEffectEvent=ps;function Us(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:m({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Ws={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=gu(),i=za(r);i.payload=t,n!=null&&(i.callback=n),t=Ba(e,i,r),t!==null&&(vu(t,e,r),Va(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=gu(),i=za(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Ba(e,i,r),t!==null&&(vu(t,e,r),Va(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=gu(),r=za(n);r.tag=2,t!=null&&(r.callback=t),t=Ba(e,r,n),t!==null&&(vu(t,e,n),Va(t,e,n))}};function Gs(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!br(n,r)||!br(i,a):!0}function Ks(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&&Ws.enqueueReplaceState(t,t.state,null)}function qs(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=m({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Js(e){qr(e)}function Ys(e){console.error(e)}function Xs(e){qr(e)}function Zs(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Qs(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function $s(e,t,n){return n=za(n),n.tag=3,n.payload={element:null},n.callback=function(){Zs(e,t)},n}function ec(e){return e=za(e),e.tag=3,e}function tc(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Qs(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Qs(t,n,r),typeof i!=`function`&&(ou===null?ou=new Set([this]):ou.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function nc(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Xi(t,n,a,!0),n=$a.current,n!==null){switch(n.tag){case 31:case 13:return eo===null?Au():n.alternate===null&&ql===0&&(ql=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===Sa?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Yu(e,r,a)),!1;case 22:return n.flags|=65536,r===Sa?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),Yu(e,r,a)),!1}throw Error(i(435,n.tag))}return Yu(e,r,a),Au(),!1}if(Mi)return t=$a.current,t===null?(r!==Fi&&(t=Error(i(423),{cause:r}),Hi(hi(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=hi(r,n),a=$s(e.stateNode,r,a),Ha(e,a),ql!==4&&(ql=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==Fi&&(e=Error(i(422),{cause:r}),Hi(hi(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=hi(o,n),$l===null?$l=[o]:$l.push(o),ql!==4&&(ql=2),t===null)return!0;r=hi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=$s(n.stateNode,r,e),Ha(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(ou===null||!ou.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=ec(a),tc(a,e,n,r),Ha(n,a),!1}n=n.return}while(n!==null);return!1}var rc=Error(i(461)),ic=!1;function ac(e,t,n,r){t.child=e===null?Fa(t,null,n,r):Pa(t,e.child,n,r)}function oc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return Qi(t),r=So(e,t,n,o,a,i),s=Eo(),e!==null&&!ic?(Do(e,t,i),Ac(e,t,i)):(Mi&&s&&Di(t),t.flags|=1,ac(e,t,r,i),t.child)}function sc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!oi(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,cc(e,t,a,r,i)):(e=li(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!jc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?br:n,n(o,r)&&e.ref===t.ref)return Ac(e,t,i)}return t.flags|=1,e=si(a,r),e.ref=t.ref,e.return=t,t.child=e}function cc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(br(a,r)&&e.ref===t.ref)if(ic=!1,t.pendingProps=r=a,jc(e,i))e.flags&131072&&(ic=!0);else return t.lanes=e.lanes,Ac(e,t,i)}return gc(e,t,n,r,i)}function lc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return dc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&_a(t,a===null?null:a.cachePool),a===null?Za():Xa(t,a),ro(t);else return r=t.lanes=536870912,dc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&_a(t,null),Za(),io(t)):(_a(t,a.cachePool),Xa(t,a),io(t),t.memoizedState=null);return ac(e,t,i,n),t.child}function uc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function dc(e,t,n,r,i){var a=ga();return a=a===null?null:{parent:aa._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&_a(t,null),Za(),ro(t),e!==null&&Xi(e,t,r,!0),t.childLanes=i,null}function fc(e,t){return t=Tc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function pc(e,t,n){return Pa(t,e.child,null,n),e=fc(t,t.pendingProps),e.flags|=2,ao(t),t.memoizedState=null,e}function mc(e,t,n){var r=t.pendingProps,a=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(Mi){if(r.mode===`hidden`)return e=fc(t,r),t.lanes=536870912,uc(null,e);if(no(t),(e=ji)?(e=uf(e,Pi),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Si===null?null:{id:Ci,overflow:wi},retryLane:536870912,hydrationErrors:null},n=fi(e),n.return=t,t.child=n,Ai=t,ji=null)):e=null,e===null)throw Ii(t);return t.lanes=536870912,null}return fc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(no(t),a)if(t.flags&256)t.flags&=-257,t=pc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558));else if(ic||Xi(e,t,n,!1),a=(n&e.childLanes)!==0,ic||a){if(r=Rl,r!==null&&(s=Ze(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,ei(e,s),vu(r,e,s),rc;Au(),t=pc(e,t,n)}else e=o.treeContext,ji=mf(s.nextSibling),Ai=t,Mi=!0,Ni=null,Pi=!1,e!==null&&ki(t,e),t=fc(t,r),t.flags|=4096;return t}return e=si(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function hc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function gc(e,t,n,r,i){return Qi(t),n=So(e,t,n,r,void 0,i),r=Eo(),e!==null&&!ic?(Do(e,t,i),Ac(e,t,i)):(Mi&&r&&Di(t),t.flags|=1,ac(e,t,n,i),t.child)}function _c(e,t,n,r,i,a){return Qi(t),t.updateQueue=null,n=wo(t,r,n,i),Co(e),r=Eo(),e!==null&&!ic?(Do(e,t,a),Ac(e,t,a)):(Mi&&r&&Di(t),t.flags|=1,ac(e,t,n,a),t.child)}function vc(e,t,n,r,i){if(Qi(t),t.stateNode===null){var a=ri,o=n.contextType;typeof o==`object`&&o&&(a=$i(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Ws,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},La(t),o=n.contextType,a.context=typeof o==`object`&&o?$i(o):ri,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Us(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Ws.enqueueReplaceState(a,a.state,null),Ga(t,r,a,i),Wa(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=qs(n,s);a.props=c;var l=a.context,u=n.contextType;o=ri,typeof u==`object`&&u&&(o=$i(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Ks(t,a,r,o),Ia=!1;var f=t.memoizedState;a.state=f,Ga(t,r,a,i),Wa(),l=t.memoizedState,s||f!==l||Ia?(typeof d==`function`&&(Us(t,n,d,r),l=t.memoizedState),(c=Ia||Gs(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Ra(e,t),o=t.memoizedProps,u=qs(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=ri,typeof l==`object`&&l&&(c=$i(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Ks(t,a,r,c),Ia=!1,f=t.memoizedState,a.state=f,Ga(t,r,a,i),Wa();var p=t.memoizedState;o!==d||f!==p||Ia||e!==null&&e.dependencies!==null&&Zi(e.dependencies)?(typeof s==`function`&&(Us(t,n,s,r),p=t.memoizedState),(u=Ia||Gs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Zi(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,hc(e,t),r=(t.flags&128)!=0,a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=Pa(t,e.child,null,i),t.child=Pa(t,null,n,i)):ac(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Ac(e,t,i),e}function yc(e,t,n,r){return Bi(),t.flags|=256,ac(e,t,n,r),t.child}var bc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function xc(e){return{baseLanes:e,cachePool:va()}}function Sc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=Zl),e}function Cc(e,t,n){var r=t.pendingProps,a=!1,o=(t.flags&128)!=0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(oo.current&2)!=0),s&&(a=!0,t.flags&=-129),s=(t.flags&32)!=0,t.flags&=-33,e===null){if(Mi){if(a?to(t):io(t),(e=ji)?(e=uf(e,Pi),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Si===null?null:{id:Ci,overflow:wi},retryLane:536870912,hydrationErrors:null},n=fi(e),n.return=t,t.child=n,Ai=t,ji=null)):e=null,e===null)throw Ii(t);return ff(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(io(t),a=t.mode,c=Tc({mode:`hidden`,children:c},a),r=ui(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=xc(n),r.childLanes=Sc(e,s,n),t.memoizedState=bc,uc(null,r)):(to(t),wc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(to(t),t.flags&=-257,t=Ec(e,t,n)):t.memoizedState===null?(io(t),c=r.fallback,a=t.mode,r=Tc({mode:`visible`,children:r.children},a),c=ui(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Pa(t,e.child,null,n),r=t.child,r.memoizedState=xc(n),r.childLanes=Sc(e,s,n),t.memoizedState=bc,t=uc(null,r)):(io(t),t.child=e.child,t.flags|=128,t=null);else if(to(t),ff(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,Hi({value:r,source:null,stack:null}),t=Ec(e,t,n)}else if(ic||Xi(e,t,n,!1),s=(n&e.childLanes)!==0,ic||s){if(s=Rl,s!==null&&(r=Ze(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,ei(e,r),vu(s,e,r),rc;df(c)||Au(),t=Ec(e,t,n)}else df(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,ji=mf(c.nextSibling),Ai=t,Mi=!0,Ni=null,Pi=!1,e!==null&&ki(t,e),t=wc(t,r.children),t.flags|=4096);return t}return a?(io(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=si(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=ui(c,a,n,null),c.flags|=2):c=si(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,uc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=xc(n):(a=c.cachePool,a===null?a=va():(l=aa._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=Sc(e,s,n),t.memoizedState=bc,uc(e.child,r)):(to(t),n=e.child,e=n.sibling,n=si(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function wc(e,t){return t=Tc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function Tc(e,t){return e=ai(22,e,null,t),e.lanes=0,e}function Ec(e,t,n){return Pa(t,e.child,null,n),e=wc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Dc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ji(e.return,t,n)}function Oc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function kc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=oo.current,s=(o&2)!=0;if(s?(o=o&1|2,t.flags|=128):o&=1,B(oo,o),ac(e,t,r,n),r=Mi?yi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Dc(e,n,t);else if(e.tag===19)Dc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&so(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Oc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&so(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Oc(t,!0,n,null,a,r);break;case`together`:Oc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Ac(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Jl|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Xi(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=si(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=si(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function jc(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&Zi(e))):!0}function W(e,t,n){switch(t.tag){case 3:oe(t,t.stateNode.containerInfo),Ki(t,aa,e.memoizedState.cache),Bi();break;case 27:case 5:ce(t);break;case 4:oe(t,t.stateNode.containerInfo);break;case 10:Ki(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,no(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(to(t),e=Ac(e,t,n),e===null?null:e.sibling):Cc(e,t,n):(to(t),t.flags|=128,null);to(t);break;case 19:var i=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=(Xi(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return kc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),B(oo,oo.current),r)break;return null;case 22:return t.lanes=0,lc(e,t,n,t.pendingProps);case 24:Ki(t,aa,e.memoizedState.cache)}return Ac(e,t,n)}function Mc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)ic=!0;else{if(!jc(e,n)&&!(t.flags&128))return ic=!1,W(e,t,n);ic=!!(e.flags&131072)}else ic=!1,Mi&&t.flags&1048576&&Ei(t,yi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=Ta(t.elementType),t.type=e,typeof e==`function`)oi(e)?(r=qs(e,r),t.tag=1,t=vc(null,t,e,r,n)):(t.tag=0,t=gc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===w){t.tag=11,t=oc(null,t,e,r,n);break a}else if(a===D){t.tag=14,t=sc(null,t,e,r,n);break a}}throw t=P(e)||e,Error(i(306,t,``))}}return t;case 0:return gc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=qs(r,t.pendingProps),vc(e,t,r,a,n);case 3:a:{if(oe(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,Ra(e,t),Ga(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Ki(t,aa,r),r!==o.cache&&Yi(t,[aa],n,!0),Wa(),r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=yc(e,t,r,n);break a}else if(r!==a){a=hi(Error(i(424)),t),Hi(a),t=yc(e,t,r,n);break a}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(ji=mf(e.firstChild),Ai=t,Mi=!0,Ni=null,Pi=!0,n=Fa(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Bi(),r===a){t=Ac(e,t,n);break a}ac(e,t,r,n)}t=t.child}return t;case 26:return hc(e,t),e===null?(n=Ff(t.type,null,t.pendingProps,null))?t.memoizedState=n:Mi||(n=t.type,e=t.pendingProps,r=Kd(ie.current).createElement(n),r[rt]=t,r[it]=e,Bd(r,n,e),gt(r),t.stateNode=r):t.memoizedState=Ff(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ce(t),e===null&&Mi&&(r=t.stateNode=vf(t.type,t.pendingProps,ie.current),Ai=t,Pi=!0,a=ji,rf(t.type)?(hf=a,ji=mf(r.firstChild)):ji=a),ac(e,t,t.pendingProps.children,n),hc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Mi&&((a=r=ji)&&(r=cf(r,t.type,t.pendingProps,Pi),r===null?a=!1:(t.stateNode=r,Ai=t,ji=mf(r.firstChild),Pi=!1,a=!0)),a||Ii(t)),ce(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,Yd(a,o)?r=null:s!==null&&Yd(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=So(e,t,To,null,null,n),ip._currentValue=a),hc(e,t),ac(e,t,r,n),t.child;case 6:return e===null&&Mi&&((e=n=ji)&&(n=lf(n,t.pendingProps,Pi),n===null?e=!1:(t.stateNode=n,Ai=t,ji=null,e=!0)),e||Ii(t)),null;case 13:return Cc(e,t,n);case 4:return oe(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Pa(t,null,r,n):ac(e,t,r,n),t.child;case 11:return oc(e,t,t.type,t.pendingProps,n);case 7:return ac(e,t,t.pendingProps,n),t.child;case 8:return ac(e,t,t.pendingProps.children,n),t.child;case 12:return ac(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Ki(t,t.type,r.value),ac(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,Qi(t),a=$i(a),r=r(a),t.flags|=1,ac(e,t,r,n),t.child;case 14:return sc(e,t,t.type,t.pendingProps,n);case 15:return cc(e,t,t.type,t.pendingProps,n);case 19:return kc(e,t,n);case 31:return mc(e,t,n);case 22:return lc(e,t,n,t.pendingProps);case 24:return Qi(t),r=$i(aa),e===null?(a=ga(),a===null&&(a=Rl,o=oa(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},La(t),Ki(t,aa,a)):((e.lanes&n)!==0&&(Ra(e,t),Ga(t,null,null,n),Wa()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,Ki(t,aa,r),r!==a.cache&&Yi(t,[aa],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Ki(t,aa,r))),ac(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Nc(e){e.flags|=4}function Pc(e,t,n,r,i){if((t=(e.mode&32)!=0)&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(Du())e.flags|=8192;else throw Ea=Sa,ba}else e.flags&=-16777217}function Fc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Xf(t))if(Du())e.flags|=8192;else throw Ea=Sa,ba}function Ic(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:Ge(),e.lanes|=t,Ql|=t)}function Lc(e,t){if(!Mi)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 Rc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function G(e,t,n){var r=t.pendingProps;switch(Oi(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Rc(t),null;case 1:return Rc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),qi(aa),se(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(zi(t)?Nc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Vi())),Rc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(Nc(t),o===null?(Rc(t),Pc(t,a,null,r,n)):(Rc(t),Fc(t,o))):o?o===e.memoizedState?(Rc(t),t.flags&=-16777217):(Nc(t),Rc(t),Fc(t,o)):(e=e.memoizedProps,e!==r&&Nc(t),Rc(t),Pc(t,a,e,r,n)),null;case 27:if(le(t),n=ie.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Nc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Rc(t),null}e=re.current,zi(t)?Li(t,e):(e=vf(a,r,n),t.stateNode=e,Nc(t))}return Rc(t),null;case 5:if(le(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Nc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Rc(t),null}if(o=re.current,zi(t))Li(t,o);else{var s=Kd(ie.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[rt]=t,o[it]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Bd(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Nc(t)}}return Rc(t),Pc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Nc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=ie.current,zi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Ai,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[rt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Ld(e.nodeValue,n)),e||Ii(t,!0)}else e=Kd(e).createTextNode(r),e[rt]=t,t.stateNode=e}return Rc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=zi(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[rt]=t}else Bi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Rc(t),e=!1}else n=Vi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(ao(t),t):(ao(t),null);if(t.flags&128)throw Error(i(558))}return Rc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=zi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[rt]=t}else Bi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Rc(t),a=!1}else a=Vi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(ao(t),t):(ao(t),null)}return ao(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Ic(t,t.updateQueue),Rc(t),null);case 4:return se(),e===null&&Dd(t.stateNode.containerInfo),Rc(t),null;case 10:return qi(t.type),Rc(t),null;case 19:if(z(oo),r=t.memoizedState,r===null)return Rc(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)Lc(r,!1);else{if(ql!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=so(e),o!==null){for(t.flags|=128,Lc(r,!1),e=o.updateQueue,t.updateQueue=e,Ic(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ci(n,e),n=n.sibling;return B(oo,oo.current&1|2),Mi&&Ti(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Se()>iu&&(t.flags|=128,a=!0,Lc(r,!1),t.lanes=4194304)}else{if(!a)if(e=so(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Ic(t,e),Lc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!Mi)return Rc(t),null}else 2*Se()-r.renderingStartTime>iu&&n!==536870912&&(t.flags|=128,a=!0,Lc(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(Rc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Se(),e.sibling=null,n=oo.current,B(oo,a?n&1|2:n&1),Mi&&Ti(t,r.treeForkCount),e);case 22:case 23:return ao(t),Qa(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Rc(t),t.subtreeFlags&6&&(t.flags|=8192)):Rc(t),n=t.updateQueue,n!==null&&Ic(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&z(ha),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),qi(aa),Rc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function zc(e,t){switch(Oi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return qi(aa),se(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return le(t),null;case 31:if(t.memoizedState!==null){if(ao(t),t.alternate===null)throw Error(i(340));Bi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(ao(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Bi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return z(oo),null;case 4:return se(),null;case 10:return qi(t.type),null;case 22:case 23:return ao(t),Qa(),e!==null&&z(ha),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return qi(aa),null;case 25:return null;default:return null}}function Bc(e,t){switch(Oi(t),t.tag){case 3:qi(aa),se();break;case 26:case 27:case 5:le(t);break;case 4:se();break;case 31:t.memoizedState!==null&&ao(t);break;case 13:ao(t);break;case 19:z(oo);break;case 10:qi(t.type);break;case 22:case 23:ao(t),Qa(),e!==null&&z(ha);break;case 24:qi(aa)}}function Vc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Ju(t,t.return,e)}}function Hc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Ju(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Ju(t,t.return,e)}}function Uc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{qa(t,n)}catch(t){Ju(e,e.return,t)}}}function Wc(e,t,n){n.props=qs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Ju(e,t,n)}}function Gc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Ju(e,t,n)}}function Kc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){Ju(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Ju(e,t,n)}else n.current=null}function qc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Ju(e,e.return,t)}}function Jc(e,t,n){try{var r=e.stateNode;Vd(r,e.type,n,t),r[it]=t}catch(t){Ju(e,e.return,t)}}function Yc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&rf(e.type)||e.tag===4}function Xc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Yc(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.tag===27&&rf(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Zc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Xt));else if(r!==4&&(r===27&&rf(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Zc(e,t,n),e=e.sibling;e!==null;)Zc(e,t,n),e=e.sibling}function Qc(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&&(r===27&&rf(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Qc(e,t,n),e=e.sibling;e!==null;)Qc(e,t,n),e=e.sibling}function $c(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Bd(t,r,n),t[rt]=e,t[it]=n}catch(t){Ju(e,e.return,t)}}var el=!1,tl=!1,nl=!1,K=typeof WeakSet==`function`?WeakSet:Set,rl=null;function q(e,t){if(e=e.containerInfo,Wd=pp,e=wr(e),Tr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Gd={focusedElem:e,selectionRange:n},pp=!1,rl=t;rl!==null;)if(t=rl,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,rl=e;else for(;rl!==null;){switch(t=rl,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&o!==null){e=void 0,n=t,a=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=qs(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Ju(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)sf(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:sf(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(i(163))}if(e=t.sibling,e!==null){e.return=t.return,rl=e;break}rl=t.return}}function J(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:vl(e,n),r&4&&Vc(5,n);break;case 1:if(vl(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Ju(n,n.return,e)}else{var i=qs(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Ju(n,n.return,e)}}r&64&&Uc(n),r&512&&Gc(n,n.return);break;case 3:if(vl(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{qa(e,t)}catch(e){Ju(n,n.return,e)}}break;case 27:t===null&&r&4&&$c(n);case 26:case 5:vl(e,n),t===null&&r&4&&qc(n),r&512&&Gc(n,n.return);break;case 12:vl(e,n);break;case 31:vl(e,n),r&4&&ll(e,n);break;case 13:vl(e,n),r&4&&ul(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Qu.bind(null,n),pf(e,n))));break;case 22:if(r=n.memoizedState!==null||el,!r){t=t!==null&&t.memoizedState!==null||tl,i=el;var a=tl;el=r,(tl=t)&&!a?bl(e,n,(n.subtreeFlags&8772)!=0):vl(e,n),el=i,tl=a}break;case 30:break;default:vl(e,n)}}function il(e){var t=e.alternate;t!==null&&(e.alternate=null,il(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&dt(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var al=null,ol=!1;function sl(e,t,n){for(n=n.child;n!==null;)cl(e,t,n),n=n.sibling}function cl(e,t,n){if(Me&&typeof Me.onCommitFiberUnmount==`function`)try{Me.onCommitFiberUnmount(je,n)}catch{}switch(n.tag){case 26:tl||Kc(n,t),sl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:tl||Kc(n,t);var r=al,i=ol;rf(n.type)&&(al=n.stateNode,ol=!1),sl(e,t,n),yf(n.stateNode),al=r,ol=i;break;case 5:tl||Kc(n,t);case 6:if(r=al,i=ol,al=null,sl(e,t,n),al=r,ol=i,al!==null)if(ol)try{(al.nodeType===9?al.body:al.nodeName===`HTML`?al.ownerDocument.body:al).removeChild(n.stateNode)}catch(e){Ju(n,t,e)}else try{al.removeChild(n.stateNode)}catch(e){Ju(n,t,e)}break;case 18:al!==null&&(ol?(e=al,af(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),zp(e)):af(al,n.stateNode));break;case 4:r=al,i=ol,al=n.stateNode.containerInfo,ol=!0,sl(e,t,n),al=r,ol=i;break;case 0:case 11:case 14:case 15:Hc(2,n,t),tl||Hc(4,n,t),sl(e,t,n);break;case 1:tl||(Kc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Wc(n,t,r)),sl(e,t,n);break;case 21:sl(e,t,n);break;case 22:tl=(r=tl)||n.memoizedState!==null,sl(e,t,n),tl=r;break;default:sl(e,t,n)}}function ll(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{zp(e)}catch(e){Ju(t,t.return,e)}}}function ul(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{zp(e)}catch(e){Ju(t,t.return,e)}}function dl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new K),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new K),t;default:throw Error(i(435,e.tag))}}function fl(e,t){var n=dl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=$u.bind(null,e,t);t.then(r,r)}})}function pl(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r],o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(rf(c.type)){al=c.stateNode,ol=!1;break a}break;case 5:al=c.stateNode,ol=!1;break a;case 3:case 4:al=c.stateNode.containerInfo,ol=!0;break a}c=c.return}if(al===null)throw Error(i(160));cl(o,s,a),al=null,ol=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)hl(t,e),t=t.sibling}var ml=null;function hl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:pl(t,e),gl(e),r&4&&(Hc(3,e,e.return),Vc(3,e),Hc(5,e,e.return));break;case 1:pl(t,e),gl(e),r&512&&(tl||n===null||Kc(n,n.return)),r&64&&el&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var a=ml;if(pl(t,e),gl(e),r&512&&(tl||n===null||Kc(n,n.return)),r&4){var o=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null)if(r===null)if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,a=a.ownerDocument||a;b:switch(r){case`title`:o=a.getElementsByTagName(`title`)[0],(!o||o[ut]||o[rt]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),Bd(o,r,n),o[rt]=e,gt(o),r=o;break a;case`link`:var s=qf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&o.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&o.getAttribute(`title`)===(n.title==null?null:n.title)&&o.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}o=a.createElement(r),Bd(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=qf(`meta`,`content`,a).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`content`)===(n.content==null?null:``+n.content)&&o.getAttribute(`name`)===(n.name==null?null:n.name)&&o.getAttribute(`property`)===(n.property==null?null:n.property)&&o.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}o=a.createElement(r),Bd(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[rt]=e,gt(o),r=o}e.stateNode=r}else Jf(a,e.type,e.stateNode);else e.stateNode=Hf(a,r,e.memoizedProps);else o===r?r===null&&e.stateNode!==null&&Jc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Jf(a,e.type,e.stateNode):Hf(a,r,e.memoizedProps))}break;case 27:pl(t,e),gl(e),r&512&&(tl||n===null||Kc(n,n.return)),n!==null&&r&4&&Jc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(pl(t,e),gl(e),r&512&&(tl||n===null||Kc(n,n.return)),e.flags&32){a=e.stateNode;try{Ht(a,``)}catch(t){Ju(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Jc(e,a,n===null?a:n.memoizedProps)),r&1024&&(nl=!0);break;case 6:if(pl(t,e),gl(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Ju(e,e.return,t)}}break;case 3:if(Kf=null,a=ml,ml=Sf(t.containerInfo),pl(t,e),ml=a,gl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{zp(t.containerInfo)}catch(t){Ju(e,e.return,t)}nl&&(nl=!1,_l(e));break;case 4:r=ml,ml=Sf(e.stateNode.containerInfo),pl(t,e),gl(e),ml=r;break;case 12:pl(t,e),gl(e);break;case 31:pl(t,e),gl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,fl(e,r)));break;case 13:pl(t,e),gl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(nu=Se()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,fl(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=el,d=tl;if(el=u||a,tl=d||l,pl(t,e),tl=d,el=u,gl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||el||tl||yl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(o=l.stateNode,a)s=o.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){Ju(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){Ju(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?of(m,!0):of(l.stateNode,!1)}catch(e){Ju(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,fl(e,n))));break;case 19:pl(t,e),gl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,fl(e,r)));break;case 30:break;case 21:break;default:pl(t,e),gl(e)}}function gl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Yc(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;Qc(e,Xc(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(Ht(o,``),n.flags&=-33),Qc(e,Xc(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;Zc(e,Xc(e),s);break;default:throw Error(i(161))}}catch(t){Ju(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function _l(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;_l(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function vl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)J(e,t.alternate,t),t=t.sibling}function yl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Hc(4,t,t.return),yl(t);break;case 1:Kc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Wc(t,t.return,n),yl(t);break;case 27:yf(t.stateNode);case 26:case 5:Kc(t,t.return),yl(t);break;case 22:t.memoizedState===null&&yl(t);break;case 30:yl(t);break;default:yl(t)}e=e.sibling}}function bl(e,t,n){for(n&&=(t.subtreeFlags&8772)!=0,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:bl(i,a,n),Vc(4,a);break;case 1:if(bl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Ju(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)Ka(c[i],s)}catch(e){Ju(r,r.return,e)}}n&&o&64&&Uc(a),Gc(a,a.return);break;case 27:$c(a);case 26:case 5:bl(i,a,n),n&&r===null&&o&4&&qc(a),Gc(a,a.return);break;case 12:bl(i,a,n);break;case 31:bl(i,a,n),n&&o&4&&ll(i,a);break;case 13:bl(i,a,n),n&&o&4&&ul(i,a);break;case 22:a.memoizedState===null&&bl(i,a,n),Gc(a,a.return);break;case 30:break;default:bl(i,a,n)}t=t.sibling}}function xl(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&sa(n))}function Sl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&sa(e))}function Cl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)wl(e,t,n,r),t=t.sibling}function wl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Cl(e,t,n,r),i&2048&&Vc(9,t);break;case 1:Cl(e,t,n,r);break;case 3:Cl(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&sa(e)));break;case 12:if(i&2048){Cl(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){Ju(t,t.return,e)}}else Cl(e,t,n,r);break;case 31:Cl(e,t,n,r);break;case 13:Cl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?Cl(e,t,n,r):(a._visibility|=2,Tl(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?Cl(e,t,n,r):El(e,t),i&2048&&xl(o,t);break;case 24:Cl(e,t,n,r),i&2048&&Sl(t.alternate,t);break;default:Cl(e,t,n,r)}}function Tl(e,t,n,r,i){for(i&&=(t.subtreeFlags&10256)!=0||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Tl(a,o,s,c,i),Vc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Tl(a,o,s,c,i)):u._visibility&2?Tl(a,o,s,c,i):El(a,o),i&&l&2048&&xl(o.alternate,o);break;case 24:Tl(a,o,s,c,i),i&&l&2048&&Sl(o.alternate,o);break;default:Tl(a,o,s,c,i)}t=t.sibling}}function El(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:El(n,r),i&2048&&xl(r.alternate,r);break;case 24:El(n,r),i&2048&&Sl(r.alternate,r);break;default:El(n,r)}t=t.sibling}}var Dl=8192;function Ol(e,t,n){if(e.subtreeFlags&Dl)for(e=e.child;e!==null;)kl(e,t,n),e=e.sibling}function kl(e,t,n){switch(e.tag){case 26:Ol(e,t,n),e.flags&Dl&&e.memoizedState!==null&&Zf(n,ml,e.memoizedState,e.memoizedProps);break;case 5:Ol(e,t,n);break;case 3:case 4:var r=ml;ml=Sf(e.stateNode.containerInfo),Ol(e,t,n),ml=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Dl,Dl=16777216,Ol(e,t,n),Dl=r):Ol(e,t,n));break;default:Ol(e,t,n)}}function Al(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function jl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];rl=r,Pl(r,e)}Al(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Ml(e),e=e.sibling}function Ml(e){switch(e.tag){case 0:case 11:case 15:jl(e),e.flags&2048&&Hc(9,e,e.return);break;case 3:jl(e);break;case 12:jl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Nl(e)):jl(e);break;default:jl(e)}}function Nl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];rl=r,Pl(r,e)}Al(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Hc(8,t,t.return),Nl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Nl(t));break;default:Nl(t)}e=e.sibling}}function Pl(e,t){for(;rl!==null;){var n=rl;switch(n.tag){case 0:case 11:case 15:Hc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:sa(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,rl=r;else a:for(n=e;rl!==null;){r=rl;var i=r.sibling,a=r.return;if(il(r),r===n){rl=null;break a}if(i!==null){i.return=a,rl=i;break a}rl=a}}}var Fl={getCacheForType:function(e){var t=$i(aa),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return $i(aa).controller.signal}},Il=typeof WeakMap==`function`?WeakMap:Map,Ll=0,Rl=null,zl=null,Bl=0,Vl=0,Hl=null,Ul=!1,Wl=!1,Gl=!1,Kl=0,ql=0,Jl=0,Yl=0,Xl=0,Zl=0,Ql=0,$l=null,eu=null,tu=!1,nu=0,ru=0,iu=1/0,au=null,ou=null,su=0,cu=null,lu=null,uu=0,du=0,fu=null,pu=null,mu=0,hu=null;function gu(){return Ll&2&&Bl!==0?Bl&-Bl:I.T===null?et():hd()}function _u(){if(Zl===0)if(!(Bl&536870912)||Mi){var e=ze;ze<<=1,!(ze&3932160)&&(ze=262144),Zl=e}else Zl=536870912;return e=$a.current,e!==null&&(e.flags|=32),Zl}function vu(e,t,n){(e===Rl&&(Vl===2||Vl===9)||e.cancelPendingCommit!==null)&&(Tu(e,0),Su(e,Bl,Zl,!1)),qe(e,n),(!(Ll&2)||e!==Rl)&&(e===Rl&&(!(Ll&2)&&(Yl|=n),ql===4&&Su(e,Bl,Zl,!1)),sd(e))}function yu(e,t,n){if(Ll&6)throw Error(i(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||Ue(e,t),a=r?Nu(e,t):ju(e,t,!0),o=r;do{if(a===0){Wl&&!r&&Su(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!xu(n)){a=ju(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=$l;var l=c.current.memoizedState.isDehydrated;if(l&&(Tu(c,s).flags|=256),s=ju(c,s,!1),s!==2){if(Gl&&!l){c.errorRecoveryDisabledLanes|=o,Yl|=o,a=4;break a}o=eu,eu=a,o!==null&&(eu===null?eu=o:eu.push.apply(eu,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Tu(e,0),Su(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t)break;case 6:Su(r,t,Zl,!Ul);break a;case 2:eu=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=nu+300-Se(),10<a)){if(Su(r,t,Zl,!Ul),He(r,0,!0)!==0)break a;uu=t,r.timeoutHandle=Qd(bu.bind(null,r,n,eu,au,tu,t,Zl,Yl,Ql,Ul,o,`Throttled`,-0,0),a);break a}bu(r,n,eu,au,tu,t,Zl,Yl,Ql,Ul,o,null,-0,0)}}break}while(1);sd(e)}function bu(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Xt},kl(t,a,d);var m=(a&62914560)===a?nu-Se():(a&4194048)===a?ru-Se():0;if(m=$f(d,m),m!==null){uu=a,e.cancelPendingCommit=m(Bu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),Su(e,a,o,!l);return}}Bu(e,t,a,n,r,i,o,s,c)}function xu(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!yr(a(),i))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 Su(e,t,n,r){t&=~Xl,t&=~Yl,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Pe(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Ye(e,n,t)}function Cu(){return Ll&6?!0:(cd(0,!1),!1)}function wu(){if(zl!==null){if(Vl===0)var e=zl.return;else e=zl,Gi=Wi=null,Oo(e),ka=null,Aa=0,e=zl;for(;e!==null;)Bc(e.alternate,e),e=e.return;zl=null}}function Tu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,$d(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),uu=0,wu(),Rl=e,zl=n=si(e.current,null),Bl=t,Vl=0,Hl=null,Ul=!1,Wl=Ue(e,t),Gl=!1,Ql=Zl=Xl=Yl=Jl=ql=0,eu=$l=null,tu=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Pe(r),a=1<<i;t|=e[i],r&=~a}return Kl=t,Zr(),n}function Eu(e,t){lo=null,I.H=zs,t===ya||t===xa?(t=Da(),Vl=3):t===ba?(t=Da(),Vl=4):Vl=t===rc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Hl=t,zl===null&&(ql=1,Zs(e,hi(t,e.current)))}function Du(){var e=$a.current;return e===null?!0:(Bl&4194048)===Bl?eo===null:(Bl&62914560)===Bl||Bl&536870912?e===eo:!1}function Ou(){var e=I.H;return I.H=zs,e===null?zs:e}function ku(){var e=I.A;return I.A=Fl,e}function Au(){ql=4,Ul||(Bl&4194048)!==Bl&&$a.current!==null||(Wl=!0),!(Jl&134217727)&&!(Yl&134217727)||Rl===null||Su(Rl,Bl,Zl,!1)}function ju(e,t,n){var r=Ll;Ll|=2;var i=Ou(),a=ku();(Rl!==e||Bl!==t)&&(au=null,Tu(e,t)),t=!1;var o=ql;a:do try{if(Vl!==0&&zl!==null){var s=zl,c=Hl;switch(Vl){case 8:wu(),o=6;break a;case 3:case 2:case 9:case 6:$a.current===null&&(t=!0);var l=Vl;if(Vl=0,Hl=null,Lu(e,s,c,l),n&&Wl){o=0;break a}break;default:l=Vl,Vl=0,Hl=null,Lu(e,s,c,l)}}Mu(),o=ql;break}catch(t){Eu(e,t)}while(1);return t&&e.shellSuspendCounter++,Gi=Wi=null,Ll=r,I.H=i,I.A=a,zl===null&&(Rl=null,Bl=0,Zr()),o}function Mu(){for(;zl!==null;)Fu(zl)}function Nu(e,t){var n=Ll;Ll|=2;var r=Ou(),a=ku();Rl!==e||Bl!==t?(au=null,iu=Se()+500,Tu(e,t)):Wl=Ue(e,t);a:do try{if(Vl!==0&&zl!==null){t=zl;var o=Hl;b:switch(Vl){case 1:Vl=0,Hl=null,Lu(e,t,o,1);break;case 2:case 9:if(Ca(o)){Vl=0,Hl=null,Iu(t);break}t=function(){Vl!==2&&Vl!==9||Rl!==e||(Vl=7),sd(e)},o.then(t,t);break a;case 3:Vl=7;break a;case 4:Vl=5;break a;case 7:Ca(o)?(Vl=0,Hl=null,Iu(t)):(Vl=0,Hl=null,Lu(e,t,o,7));break;case 5:var s=null;switch(zl.tag){case 26:s=zl.memoizedState;case 5:case 27:var c=zl;if(s?Xf(s):c.stateNode.complete){Vl=0,Hl=null;var l=c.sibling;if(l!==null)zl=l;else{var u=c.return;u===null?zl=null:(zl=u,Ru(u))}break b}}Vl=0,Hl=null,Lu(e,t,o,5);break;case 6:Vl=0,Hl=null,Lu(e,t,o,6);break;case 8:wu(),ql=6;break a;default:throw Error(i(462))}}Pu();break}catch(t){Eu(e,t)}while(1);return Gi=Wi=null,I.H=r,I.A=a,Ll=n,zl===null?(Rl=null,Bl=0,Zr(),ql):0}function Pu(){for(;zl!==null&&!be();)Fu(zl)}function Fu(e){var t=Mc(e.alternate,e,Kl);e.memoizedProps=e.pendingProps,t===null?Ru(e):zl=t}function Iu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=_c(n,t,t.pendingProps,t.type,void 0,Bl);break;case 11:t=_c(n,t,t.pendingProps,t.type.render,t.ref,Bl);break;case 5:Oo(t);default:Bc(n,t),t=zl=ci(t,Kl),t=Mc(n,t,Kl)}e.memoizedProps=e.pendingProps,t===null?Ru(e):zl=t}function Lu(e,t,n,r){Gi=Wi=null,Oo(t),ka=null,Aa=0;var i=t.return;try{if(nc(e,i,t,n,Bl)){ql=1,Zs(e,hi(n,e.current)),zl=null;return}}catch(t){if(i!==null)throw zl=i,t;ql=1,Zs(e,hi(n,e.current)),zl=null;return}t.flags&32768?(Mi||r===1?e=!0:Wl||Bl&536870912?e=!1:(Ul=e=!0,(r===2||r===9||r===3||r===6)&&(r=$a.current,r!==null&&r.tag===13&&(r.flags|=16384))),zu(t,e)):Ru(t)}function Ru(e){var t=e;do{if(t.flags&32768){zu(t,Ul);return}e=t.return;var n=G(t.alternate,t,Kl);if(n!==null){zl=n;return}if(t=t.sibling,t!==null){zl=t;return}zl=t=e}while(t!==null);ql===0&&(ql=5)}function zu(e,t){do{var n=zc(e.alternate,e);if(n!==null){n.flags&=32767,zl=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){zl=e;return}zl=e=n}while(e!==null);ql=6,zl=null}function Bu(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Gu();while(su!==0);if(Ll&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=Xr,Je(e,n,o,s,c,l),e===Rl&&(zl=Rl=null,Bl=0),lu=t,cu=e,uu=n,du=o,fu=a,pu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,ed(Ee,function(){return Ku(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!=0,t.subtreeFlags&13878||r){r=I.T,I.T=null,a=L.p,L.p=2,s=Ll,Ll|=4;try{q(e,t,n)}finally{Ll=s,L.p=a,I.T=r}}su=1,Vu(),Hu(),Uu()}}function Vu(){if(su===1){su=0;var e=cu,t=lu,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=I.T,I.T=null;var r=L.p;L.p=2;var i=Ll;Ll|=4;try{hl(t,e);var a=Gd,o=wr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&Cr(s.ownerDocument.documentElement,s)){if(c!==null&&Tr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=Sr(s,h),v=Sr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}pp=!!Wd,Gd=Wd=null}finally{Ll=i,L.p=r,I.T=n}}e.current=t,su=2}}function Hu(){if(su===2){su=0;var e=cu,t=lu,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=I.T,I.T=null;var r=L.p;L.p=2;var i=Ll;Ll|=4;try{J(e,t.alternate,t)}finally{Ll=i,L.p=r,I.T=n}}su=3}}function Uu(){if(su===4||su===3){su=0,xe();var e=cu,t=lu,n=uu,r=pu;t.subtreeFlags&10256||t.flags&10256?su=5:(su=0,lu=cu=null,Wu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(ou=null),$e(n),t=t.stateNode,Me&&typeof Me.onCommitFiberRoot==`function`)try{Me.onCommitFiberRoot(je,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=I.T,i=L.p,L.p=2,I.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{I.T=t,L.p=i}}uu&3&&Gu(),sd(e),i=e.pendingLanes,n&261930&&i&42?e===hu?mu++:(mu=0,hu=e):mu=0,cd(0,!1)}}function Wu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,sa(t)))}function Gu(){return Vu(),Hu(),Uu(),Ku()}function Ku(){if(su!==5)return!1;var e=cu,t=du;du=0;var n=$e(uu),r=I.T,a=L.p;try{L.p=32>n?32:n,I.T=null,n=fu,fu=null;var o=cu,s=uu;if(su=0,lu=cu=null,uu=0,Ll&6)throw Error(i(331));var c=Ll;if(Ll|=4,Ml(o.current),wl(o,o.current,s,n),Ll=c,cd(0,!1),Me&&typeof Me.onPostCommitFiberRoot==`function`)try{Me.onPostCommitFiberRoot(je,o)}catch{}return!0}finally{L.p=a,I.T=r,Wu(e,t)}}function qu(e,t,n){t=hi(n,t),t=$s(e.stateNode,t,2),e=Ba(e,t,2),e!==null&&(qe(e,2),sd(e))}function Ju(e,t,n){if(e.tag===3)qu(e,e,n);else for(;t!==null;){if(t.tag===3){qu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(ou===null||!ou.has(r))){e=hi(n,e),n=ec(2),r=Ba(t,n,2),r!==null&&(tc(n,r,t,e),qe(r,2),sd(r));break}}t=t.return}}function Yu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Il;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Gl=!0,i.add(n),e=Xu.bind(null,e,t,n),t.then(e,e))}function Xu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Rl===e&&(Bl&n)===n&&(ql===4||ql===3&&(Bl&62914560)===Bl&&300>Se()-nu?!(Ll&2)&&Tu(e,0):Xl|=n,Ql===Bl&&(Ql=0)),sd(e)}function Zu(e,t){t===0&&(t=Ge()),e=ei(e,t),e!==null&&(qe(e,t),sd(e))}function Qu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Zu(e,n)}function $u(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),Zu(e,n)}function ed(e,t){return ve(e,t)}var td=null,nd=null,rd=!1,id=!1,ad=!1,od=0;function sd(e){e!==nd&&e.next===null&&(nd===null?td=nd=e:nd=nd.next=e),id=!0,rd||(rd=!0,md())}function cd(e,t){if(!ad&&id){ad=!0;do for(var n=!1,r=td;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Pe(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,pd(r,a))}else a=Bl,a=He(r,r===Rl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Ue(r,a)||(n=!0,pd(r,a));r=r.next}while(n);ad=!1}}function ld(){ud()}function ud(){id=rd=!1;var e=0;od!==0&&Zd()&&(e=od);for(var t=Se(),n=null,r=td;r!==null;){var i=r.next,a=dd(r,t);a===0?(r.next=null,n===null?td=i:n.next=i,i===null&&(nd=n)):(n=r,(e!==0||a&3)&&(id=!0)),r=i}su!==0&&su!==5||cd(e,!1),od!==0&&(od=0)}function dd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Pe(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=We(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Rl,n=Bl,n=He(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Vl===2||Vl===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&ye(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Ue(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&ye(r),$e(n)){case 2:case 8:n=Te;break;case 32:n=Ee;break;case 268435456:n=Oe;break;default:n=Ee}return r=fd.bind(null,e),n=ve(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&ye(r),e.callbackPriority=2,e.callbackNode=null,2}function fd(e,t){if(su!==0&&su!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Gu()&&e.callbackNode!==n)return null;var r=Bl;return r=He(e,e===Rl?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(yu(e,r,t),dd(e,Se()),e.callbackNode!=null&&e.callbackNode===n?fd.bind(null,e):null)}function pd(e,t){if(Gu())return null;yu(e,t,!0)}function md(){tf(function(){Ll&6?ve(we,ld):ud()})}function hd(){if(od===0){var e=ua;e===0&&(e=Re,Re<<=1,!(Re&261888)&&(Re=256)),od=e}return od}function gd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Yt(``+e)}function _d(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function vd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=gd((i[it]||null).action),o=r.submitter;o&&(t=(t=o[it]||null)?gd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new vn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(od!==0){var e=o?_d(i,o):new FormData(i);Ts(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?_d(i,o):new FormData(i),Ts(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var yd=0;yd<Gr.length;yd++){var bd=Gr[yd];Kr(bd.toLowerCase(),`on`+(bd[0].toUpperCase()+bd.slice(1)))}Kr(Lr,`onAnimationEnd`),Kr(Rr,`onAnimationIteration`),Kr(zr,`onAnimationStart`),Kr(`dblclick`,`onDoubleClick`),Kr(`focusin`,`onFocus`),Kr(`focusout`,`onBlur`),Kr(Br,`onTransitionRun`),Kr(Vr,`onTransitionStart`),Kr(Hr,`onTransitionCancel`),Kr(Ur,`onTransitionEnd`),bt(`onMouseEnter`,[`mouseout`,`mouseover`]),bt(`onMouseLeave`,[`mouseout`,`mouseover`]),bt(`onPointerEnter`,[`pointerout`,`pointerover`]),bt(`onPointerLeave`,[`pointerout`,`pointerover`]),yt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),yt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),yt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),yt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),yt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),yt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var xd=`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(` `),Sd=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(xd));function Cd(e,t){t=(t&4)!=0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){qr(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){qr(e)}i.currentTarget=null,a=c}}}}function wd(e,t){var n=t[ot];n===void 0&&(n=t[ot]=new Set);var r=e+`__bubble`;n.has(r)||(Od(t,e,2,!1),n.add(r))}function Td(e,t,n){var r=0;t&&(r|=4),Od(n,e,r,t)}var Ed=`_reactListening`+Math.random().toString(36).slice(2);function Dd(e){if(!e[Ed]){e[Ed]=!0,_t.forEach(function(t){t!==`selectionchange`&&(Sd.has(t)||Td(t,!1,e),Td(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ed]||(t[Ed]=!0,Td(`selectionchange`,!1,t))}}function Od(e,t,n,r){switch(bp(t)){case 2:var i=mp;break;case 8:i=hp;break;default:i=gp}n=i.bind(null,t,n,e),i=void 0,!sn||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function kd(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=ft(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}rn(function(){var r=a,i=Qt(n),s=[];a:{var c=Wr.get(e);if(c!==void 0){var l=vn,u=e;switch(e){case`keypress`:if(pn(n)===0)break a;case`keydown`:case`keyup`:l=In;break;case`focusin`:u=`focus`,l=Dn;break;case`focusout`:u=`blur`,l=Dn;break;case`beforeblur`:case`afterblur`:l=Dn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=Tn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=En;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Rn;break;case Lr:case Rr:case zr:l=On;break;case Ur:l=zn;break;case`scroll`:case`scrollend`:l=bn;break;case`wheel`:l=Bn;break;case`copy`:case`cut`:case`paste`:l=kn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Ln;break;case`toggle`:case`beforetoggle`:l=Vn}var d=(t&4)!=0,f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=an(m,p),g!=null&&d.push(Ad(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==Zt&&(u=n.relatedTarget||n.fromElement)&&(ft(u)||u[at]))break a;if((l||c)&&(c=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?ft(u):null,u!==null&&(f=o(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=Tn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Ln,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:mt(l),h=u==null?c:mt(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,ft(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=Md,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&Nd(s,c,l,d,!1),u!==null&&f!==null&&Nd(s,f,u,d,!0)}}a:{if(c=r?mt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=sr;else if(tr(c))if(cr)v=_r;else{v=hr;var y=mr}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&Kt(r.elementType)&&(v=sr):v=gr;if(v&&=v(e,r)){nr(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&Rt(c,`number`,c.value)}switch(y=r?mt(r):window,e){case`focusin`:(tr(y)||y.contentEditable===`true`)&&(Dr=y,Or=r,kr=null);break;case`focusout`:kr=Or=Dr=null;break;case`mousedown`:Ar=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Ar=!1,jr(s,n,i);break;case`selectionchange`:if(Er)break;case`keydown`:case`keyup`:jr(s,n,i)}var b;if(Un)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else Zn?Yn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Kn&&n.locale!==`ko`&&(Zn||x!==`onCompositionStart`?x===`onCompositionEnd`&&Zn&&(b=fn()):(ln=i,un=`value`in ln?ln.value:ln.textContent,Zn=!0)),y=jd(r,x),0<y.length&&(x=new An(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=Xn(n),b!==null&&(x.data=b)))),(b=Gn?Qn(e,n):$n(e,n))&&(x=jd(r,`onBeforeInput`),0<x.length&&(y=new An(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),vd(s,e,r,n,i)}Cd(s,t)})}function Ad(e,t,n){return{instance:e,listener:t,currentTarget:n}}function jd(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=an(e,n),i!=null&&r.unshift(Ad(e,i,a)),i=an(e,t),i!=null&&r.push(Ad(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Md(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Nd(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=an(n,a),l!=null&&o.unshift(Ad(n,l,c))):i||(l=an(n,a),l!=null&&o.push(Ad(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Pd=/\r\n?/g,Fd=/\u0000|\uFFFD/g;function Id(e){return(typeof e==`string`?e:``+e).replace(Pd,`
9
+ `).replace(Fd,``)}function Ld(e,t){return t=Id(t),Id(e)===t}function Rd(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Ht(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Ht(e,``+r);break;case`className`:Et(e,`class`,r);break;case`tabIndex`:Et(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Et(e,n,r);break;case`style`:Gt(e,r,o);break;case`data`:if(t!==`object`){Et(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Yt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}else typeof o==`function`&&(n===`formAction`?(t!==`input`&&Rd(e,t,`name`,a.name,a,null),Rd(e,t,`formEncType`,a.formEncType,a,null),Rd(e,t,`formMethod`,a.formMethod,a,null),Rd(e,t,`formTarget`,a.formTarget,a,null)):(Rd(e,t,`encType`,a.encType,a,null),Rd(e,t,`method`,a.method,a,null),Rd(e,t,`target`,a.target,a,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Yt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Xt);break;case`onScroll`:r!=null&&wd(`scroll`,e);break;case`onScrollEnd`:r!=null&&wd(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Yt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:wd(`beforetoggle`,e),wd(`toggle`,e),Tt(e,`popover`,r);break;case`xlinkActuate`:Dt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Dt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Dt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Dt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Dt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Dt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Dt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Dt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Dt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Tt(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=qt.get(n)||n,Tt(e,n,r))}}function zd(e,t,n,r,a,o){switch(n){case`style`:Gt(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Ht(e,r):(typeof r==`number`||typeof r==`bigint`)&&Ht(e,``+r);break;case`onScroll`:r!=null&&wd(`scroll`,e);break;case`onScrollEnd`:r!=null&&wd(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=Xt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!vt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[it]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):Tt(e,n,r)}}}function Bd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:wd(`error`,e),wd(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Rd(e,t,o,s,n,null)}}a&&Rd(e,t,`srcSet`,n.srcSet,n,null),r&&Rd(e,t,`src`,n.src,n,null);return;case`input`:wd(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:Rd(e,t,r,d,n,null)}}Lt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in wd(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Rd(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&zt(e,!!r,n,!0):zt(e,!!r,t,!1);return;case`textarea`:for(s in wd(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:Rd(e,t,s,c,n,null)}Vt(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Rd(e,t,l,r,n,null)}return;case`dialog`:wd(`beforetoggle`,e),wd(`toggle`,e),wd(`cancel`,e),wd(`close`,e);break;case`iframe`:case`object`:wd(`load`,e);break;case`video`:case`audio`:for(r=0;r<xd.length;r++)wd(xd[r],e);break;case`image`:wd(`error`,e),wd(`load`,e);break;case`details`:wd(`toggle`,e);break;case`embed`:case`source`:case`link`:wd(`error`,e),wd(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Rd(e,t,u,r,n,null)}return;default:if(Kt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&zd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Rd(e,t,c,r,n,null))}function Vd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Rd(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&Rd(e,t,p,m,r,f)}}It(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Rd(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Rd(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?zt(e,!!n,n?[]:``,!1):zt(e,!!n,t,!0)):zt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Rd(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&Rd(e,t,s,a,r,o)}Bt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Rd(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Rd(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Rd(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:Rd(e,t,u,p,r,m)}return;default:if(Kt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&zd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||zd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Rd(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Rd(e,t,f,p,r,m)}function Hd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Ud(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Hd(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Hd(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Wd=null,Gd=null;function Kd(e){return e.nodeType===9?e:e.ownerDocument}function qd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Jd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Yd(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Xd=null;function Zd(){var e=window.event;return e&&e.type===`popstate`?e===Xd?!1:(Xd=e,!0):(Xd=null,!1)}var Qd=typeof setTimeout==`function`?setTimeout:void 0,$d=typeof clearTimeout==`function`?clearTimeout:void 0,ef=typeof Promise==`function`?Promise:void 0,tf=typeof queueMicrotask==`function`?queueMicrotask:ef===void 0?Qd:function(e){return ef.resolve(null).then(e).catch(nf)};function nf(e){setTimeout(function(){throw e})}function rf(e){return e===`head`}function af(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),zp(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)yf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,yf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[ut]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&yf(e.ownerDocument.body);n=i}while(n);zp(t)}function of(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8)if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++;n=r}while(n)}function sf(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:sf(n),dt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function cf(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r)if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e;else if(!e[ut])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=mf(e.nextSibling),e===null)break}return null}function lf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=mf(e.nextSibling),e===null))return null;return e}function uf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=mf(e.nextSibling),e===null))return null;return e}function df(e){return e.data===`$?`||e.data===`$~`}function ff(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function pf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function mf(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===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var hf=null;function gf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return mf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function _f(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function vf(e,t,n){switch(t=Kd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function yf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);dt(e)}var bf=new Map,xf=new Set;function Sf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Cf=L.d;L.d={f:wf,r:Tf,D:Of,C:kf,L:Af,m:jf,X:Nf,S:Mf,M:Pf};function wf(){var e=Cf.f(),t=Cu();return e||t}function Tf(e){var t=pt(e);t!==null&&t.tag===5&&t.type===`form`?Ds(t):Cf.r(e)}var Ef=typeof document>`u`?null:document;function Df(e,t,n){var r=Ef;if(r&&typeof t==`string`&&t){var i=Ft(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),xf.has(i)||(xf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Bd(t,`link`,e),gt(t),r.head.appendChild(t)))}}function Of(e){Cf.D(e),Df(`dns-prefetch`,e,null)}function kf(e,t){Cf.C(e,t),Df(`preconnect`,e,t)}function Af(e,t,n){Cf.L(e,t,n);var r=Ef;if(r&&e&&t){var i=`link[rel="preload"][as="`+Ft(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Ft(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Ft(n.imageSizes)+`"]`)):i+=`[href="`+Ft(e)+`"]`;var a=i;switch(t){case`style`:a=If(e);break;case`script`:a=Bf(e)}bf.has(a)||(e=m({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),bf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Lf(a))||t===`script`&&r.querySelector(Vf(a))||(t=r.createElement(`link`),Bd(t,`link`,e),gt(t),r.head.appendChild(t)))}}function jf(e,t){Cf.m(e,t);var n=Ef;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Ft(r)+`"][href="`+Ft(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Bf(e)}if(!bf.has(a)&&(e=m({rel:`modulepreload`,href:e},t),bf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Vf(a)))return}r=n.createElement(`link`),Bd(r,`link`,e),gt(r),n.head.appendChild(r)}}}function Mf(e,t,n){Cf.S(e,t,n);var r=Ef;if(r&&e){var i=ht(r).hoistableStyles,a=If(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Lf(a)))s.loading=5;else{e=m({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=bf.get(a))&&Wf(e,n);var c=o=r.createElement(`link`);gt(c),Bd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Uf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Nf(e,t){Cf.X(e,t);var n=Ef;if(n&&e){var r=ht(n).hoistableScripts,i=Bf(e),a=r.get(i);a||(a=n.querySelector(Vf(i)),a||(e=m({src:e,async:!0},t),(t=bf.get(i))&&Gf(e,t),a=n.createElement(`script`),gt(a),Bd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Pf(e,t){Cf.M(e,t);var n=Ef;if(n&&e){var r=ht(n).hoistableScripts,i=Bf(e),a=r.get(i);a||(a=n.querySelector(Vf(i)),a||(e=m({src:e,async:!0,type:`module`},t),(t=bf.get(i))&&Gf(e,t),a=n.createElement(`script`),gt(a),Bd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Ff(e,t,n,r){var a=(a=ie.current)?Sf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=If(n.href),n=ht(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=If(n.href);var o=ht(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Lf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),bf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},bf.set(e,n),o||zf(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Bf(n),n=ht(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function If(e){return`href="`+Ft(e)+`"`}function Lf(e){return`link[rel="stylesheet"][`+e+`]`}function Rf(e){return m({},e,{"data-precedence":e.precedence,precedence:null})}function zf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Bd(t,`link`,n),gt(t),e.head.appendChild(t))}function Bf(e){return`[src="`+Ft(e)+`"]`}function Vf(e){return`script[async]`+e}function Hf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Ft(n.href)+`"]`);if(r)return t.instance=r,gt(r),r;var a=m({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),gt(r),Bd(r,`style`,a),Uf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=If(n.href);var o=e.querySelector(Lf(a));if(o)return t.state.loading|=4,t.instance=o,gt(o),o;r=Rf(n),(a=bf.get(a))&&Wf(r,a),o=(e.ownerDocument||e).createElement(`link`),gt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Bd(o,`link`,r),t.state.loading|=4,Uf(o,n.precedence,e),t.instance=o;case`script`:return o=Bf(n.src),(a=e.querySelector(Vf(o)))?(t.instance=a,gt(a),a):(r=n,(a=bf.get(o))&&(r=m({},n),Gf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),gt(a),Bd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Uf(r,n.precedence,e));return t.instance}function Uf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Wf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Gf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Kf=null;function qf(e,t,n){if(Kf===null){var r=new Map,i=Kf=new Map;i.set(n,r)}else i=Kf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[ut]||a[rt]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Jf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Yf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Xf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Zf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=If(r.href),a=t.querySelector(Lf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=ep.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,gt(a);return}a=t.ownerDocument||t,r=Rf(r),(i=bf.get(i))&&Wf(r,i),a=a.createElement(`link`),gt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Bd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=ep.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Qf=0;function $f(e,t){return e.stylesheets&&e.count===0&&np(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&np(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Qf===0&&(Qf=62500*Ud());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&np(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Qf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function ep(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)np(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var tp=null;function np(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,tp=new Map,t.forEach(rp,e),tp=null,ep.call(e))}function rp(e,t){if(!(t.state.loading&4)){var n=tp.get(e);if(n)var r=n.get(null);else{n=new Map,tp.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=ep.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var ip={$$typeof:C,Provider:null,Consumer:null,_currentValue:R,_currentValue2:R,_threadCount:0};function ap(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ke(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ke(0),this.hiddenUpdates=Ke(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function op(e,t,n,r,i,a,o,s,c,l,u,d){return e=new ap(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ai(3,null,null,t),e.current=a,a.stateNode=e,t=oa(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},La(a),e}function sp(e){return e?(e=ri,e):ri}function cp(e,t,n,r,i,a){i=sp(i),r.context===null?r.context=i:r.pendingContext=i,r=za(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Ba(e,r,t),n!==null&&(vu(n,e,t),Va(n,e,t))}function lp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function up(e,t){lp(e,t),(e=e.alternate)&&lp(e,t)}function dp(e){if(e.tag===13||e.tag===31){var t=ei(e,67108864);t!==null&&vu(t,e,67108864),up(e,67108864)}}function fp(e){if(e.tag===13||e.tag===31){var t=gu();t=Qe(t);var n=ei(e,t);n!==null&&vu(n,e,t),up(e,t)}}var pp=!0;function mp(e,t,n,r){var i=I.T;I.T=null;var a=L.p;try{L.p=2,gp(e,t,n,r)}finally{L.p=a,I.T=i}}function hp(e,t,n,r){var i=I.T;I.T=null;var a=L.p;try{L.p=8,gp(e,t,n,r)}finally{L.p=a,I.T=i}}function gp(e,t,n,r){if(pp){var i=_p(r);if(i===null)kd(e,t,r,vp,n),kp(e,r);else if(jp(i,e,t,n,r))r.stopPropagation();else if(kp(e,r),t&4&&-1<Op.indexOf(e)){for(;i!==null;){var a=pt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Ve(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Pe(o);s.entanglements[1]|=c,o&=~c}sd(a),!(Ll&6)&&(iu=Se()+500,cd(0,!1))}}break;case 31:case 13:s=ei(a,2),s!==null&&vu(s,a,2),Cu(),up(a,2)}if(a=_p(r),a===null&&kd(e,t,r,vp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else kd(e,t,r,null,n)}}function _p(e){return e=Qt(e),yp(e)}var vp=null;function yp(e){if(vp=null,e=ft(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(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 vp=e,null}function bp(e){switch(e){case`beforetoggle`: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`toggle`: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 2;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`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Ce()){case we:return 2;case Te:return 8;case Ee:case De:return 32;case Oe:return 268435456;default:return 32}default:return 32}}var xp=!1,Sp=null,Cp=null,wp=null,Tp=new Map,Ep=new Map,Dp=[],Op=`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`.split(` `);function kp(e,t){switch(e){case`focusin`:case`focusout`:Sp=null;break;case`dragenter`:case`dragleave`:Cp=null;break;case`mouseover`:case`mouseout`:wp=null;break;case`pointerover`:case`pointerout`:Tp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Ep.delete(t.pointerId)}}function Ap(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=pt(t),t!==null&&dp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function jp(e,t,n,r,i){switch(t){case`focusin`:return Sp=Ap(Sp,e,t,n,r,i),!0;case`dragenter`:return Cp=Ap(Cp,e,t,n,r,i),!0;case`mouseover`:return wp=Ap(wp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Tp.set(a,Ap(Tp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Ep.set(a,Ap(Ep.get(a)||null,e,t,n,r,i)),!0}return!1}function Mp(e){var t=ft(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,tt(e.priority,function(){fp(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,tt(e.priority,function(){fp(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 Np(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=_p(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Zt=r,n.target.dispatchEvent(r),Zt=null}else return t=pt(n),t!==null&&dp(t),e.blockedOn=n,!1;t.shift()}return!0}function Pp(e,t,n){Np(e)&&n.delete(t)}function Fp(){xp=!1,Sp!==null&&Np(Sp)&&(Sp=null),Cp!==null&&Np(Cp)&&(Cp=null),wp!==null&&Np(wp)&&(wp=null),Tp.forEach(Pp),Ep.forEach(Pp)}function Ip(e,n){e.blockedOn===n&&(e.blockedOn=null,xp||(xp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Fp)))}var Lp=null;function Rp(e){Lp!==e&&(Lp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Lp===e&&(Lp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(yp(r||n)===null)continue;break}var a=pt(n);a!==null&&(e.splice(t,3),t-=3,Ts(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function zp(e){function t(t){return Ip(t,e)}Sp!==null&&Ip(Sp,e),Cp!==null&&Ip(Cp,e),wp!==null&&Ip(wp,e),Tp.forEach(t),Ep.forEach(t);for(var n=0;n<Dp.length;n++){var r=Dp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Dp.length&&(n=Dp[0],n.blockedOn===null);)Mp(n),n.blockedOn===null&&Dp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[it]||null;if(typeof a==`function`)o||Rp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[it]||null)s=o.formAction;else if(yp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Rp(n)}}}function Bp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Vp(e){this._internalRoot=e}Hp.prototype.render=Vp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;cp(n,gu(),e,t,null,null)},Hp.prototype.unmount=Vp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;cp(e.current,2,null,e,null,null),Cu(),t[at]=null}};function Hp(e){this._internalRoot=e}Hp.prototype.unstable_scheduleHydration=function(e){if(e){var t=et();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Dp.length&&t!==0&&t<Dp[n].priority;n++);Dp.splice(n,0,e),n===0&&Mp(e)}};var Up=n.version;if(Up!==`19.2.5`)throw Error(i(527,Up,`19.2.5`));L.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:f(e),e=e===null?null:e.stateNode,e};var Wp={bundleType:0,version:`19.2.5`,rendererPackageName:`react-dom`,currentDispatcherRef:I,reconcilerVersion:`19.2.5`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Gp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Gp.isDisabled&&Gp.supportsFiber)try{je=Gp.inject(Wp),Me=Gp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Js,s=Ys,c=Xs;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=op(e,1,!1,null,null,n,r,null,o,s,c,Bp),e[at]=t.current,Dd(e),new Vp(t)}})),_=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=g()}))(),v=l(d(),1),y=(e,t,n,r,i,a,o,s)=>{let c=document.documentElement,l=[`light`,`dark`];function u(t){(Array.isArray(e)?e:[e]).forEach(e=>{let n=e===`class`,r=n&&a?i.map(e=>a[e]||e):i;n?(c.classList.remove(...r),c.classList.add(a&&a[t]?a[t]:t)):c.setAttribute(e,t)}),d(t)}function d(e){s&&l.includes(e)&&(c.style.colorScheme=e)}function f(){return window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}if(r)u(r);else try{let e=localStorage.getItem(t)||n;u(o&&e===`system`?f():e)}catch{}},b=[`light`,`dark`],x=`(prefers-color-scheme: dark)`,S=typeof window>`u`,C=v.createContext(void 0),w={setTheme:e=>{},themes:[]},T=()=>v.useContext(C)??w,E=e=>v.useContext(C)?v.createElement(v.Fragment,null,e.children):v.createElement(O,{...e}),D=[`light`,`dark`],O=({forcedTheme:e,disableTransitionOnChange:t=!1,enableSystem:n=!0,enableColorScheme:r=!0,storageKey:i=`theme`,themes:a=D,defaultTheme:o=n?`system`:`light`,attribute:s=`data-theme`,value:c,children:l,nonce:u,scriptProps:d})=>{let[f,p]=v.useState(()=>A(i,o)),[m,h]=v.useState(()=>f===`system`?M():f),g=c?Object.values(c):a,_=v.useCallback(e=>{let i=e;if(!i)return;e===`system`&&n&&(i=M());let a=c?c[i]:i,l=t?j(u):null,d=document.documentElement,f=e=>{e===`class`?(d.classList.remove(...g),a&&d.classList.add(a)):e.startsWith(`data-`)&&(a?d.setAttribute(e,a):d.removeAttribute(e))};if(Array.isArray(s)?s.forEach(f):f(s),r){let e=b.includes(o)?o:null,t=b.includes(i)?i:e;d.style.colorScheme=t}l?.()},[u]),y=v.useCallback(e=>{let t=typeof e==`function`?e(f):e;p(t);try{localStorage.setItem(i,t)}catch{}},[f]),S=v.useCallback(t=>{h(M(t)),f===`system`&&n&&!e&&_(`system`)},[f,e]);v.useEffect(()=>{let e=window.matchMedia(x);return e.addListener(S),S(e),()=>e.removeListener(S)},[S]),v.useEffect(()=>{let e=e=>{e.key===i&&(e.newValue?p(e.newValue):y(o))};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[y]),v.useEffect(()=>{_(e??f)},[e,f]);let w=v.useMemo(()=>({theme:f,setTheme:y,forcedTheme:e,resolvedTheme:f===`system`?m:f,themes:n?[...a,`system`]:a,systemTheme:n?m:void 0}),[f,y,e,m,n,a]);return v.createElement(C.Provider,{value:w},v.createElement(k,{forcedTheme:e,storageKey:i,attribute:s,enableSystem:n,enableColorScheme:r,defaultTheme:o,value:c,themes:a,nonce:u,scriptProps:d}),l)},k=v.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:r,enableColorScheme:i,defaultTheme:a,value:o,themes:s,nonce:c,scriptProps:l})=>{let u=JSON.stringify([n,t,a,e,s,o,r,i]).slice(1,-1);return v.createElement(`script`,{...l,suppressHydrationWarning:!0,nonce:typeof window>`u`?c:``,dangerouslySetInnerHTML:{__html:`(${y.toString()})(${u})`}})}),A=(e,t)=>{if(S)return;let n;try{n=localStorage.getItem(e)||void 0}catch{}return n||t},j=e=>{let t=document.createElement(`style`);return e&&t.setAttribute(`nonce`,e),t.appendChild(document.createTextNode(`*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}`)),document.head.appendChild(t),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(t)},1)}},M=e=>(e||=window.matchMedia(x),e.matches?`dark`:`light`),N=l(h(),1),P=`modulepreload`,F=function(e){return`/admin/`+e},I={},L=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=F(t,n),t in I)return;I[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:P,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},R=e=>{throw TypeError(e)},ee=(e,t,n)=>t.has(e)||R(`Cannot `+n),te=(e,t,n)=>(ee(e,t,`read from private field`),n?n.call(e):t.get(e)),ne=(e,t,n)=>t.has(e)?R(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),z=`popstate`;function B(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function re(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return se(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:ce(t)}return ue(t,n,null,e)}function V(e,t){if(e===!1||e==null)throw Error(t)}function ie(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function ae(){return Math.random().toString(36).substring(2,10)}function oe(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function se(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?le(t):t,state:n,key:t&&t.key||r||ae(),unstable_mask:i}}function ce({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function le(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function ue(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=B(e)?e:se(h.location,e,t);n&&n(r,e),l=u()+1;let d=oe(r,l),f=h.createHref(r.unstable_mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=B(e)?e:se(h.location,e,t);n&&n(r,e),l=u();let i=oe(r,l),d=h.createHref(r.unstable_mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return de(e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(z,d),c=e,()=>{i.removeEventListener(z,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function de(e,t=!1){let n=`http://localhost`;typeof window<`u`&&(n=window.location.origin===`null`?window.location.href:window.location.origin),V(n,`No window.location.(origin|href) available to create URL`);let r=typeof e==`string`?e:ce(e);return r=r.replace(/ $/,`%20`),!t&&r.startsWith(`//`)&&(r=n+r),new URL(r,n)}var fe,pe=class{constructor(e){if(ne(this,fe,new Map),e)for(let[t,n]of e)this.set(t,n)}get(e){if(te(this,fe).has(e))return te(this,fe).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw Error(`No value found for context`)}set(e,t){te(this,fe).set(e,t)}};fe=new WeakMap;var me=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`children`]);function he(e){return me.has(e)}var ge=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`middleware`,`children`]);function _e(e){return ge.has(e)}function ve(e){return e.index===!0}function ye(e,t,n=[],r={},i=!1){return e.map((e,a)=>{let o=[...n,String(a)],s=typeof e.id==`string`?e.id:o.join(`-`);if(V(e.index!==!0||!e.children,`Cannot specify children on an index route`),V(i||!r[s],`Found a route id collision on id "${s}". Route id's must be globally unique within Data Router usages`),ve(e)){let n={...e,id:s};return r[s]=be(n,t(n)),n}else{let n={...e,id:s,children:void 0};return r[s]=be(n,t(n)),e.children&&(n.children=ye(e.children,t,o,r,i)),n}})}function be(e,t){return Object.assign(e,{...t,...typeof t.lazy==`object`&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function xe(e,t,n=`/`){return Se(e,t,n,!1)}function Se(e,t,n,r){let i=Be((typeof t==`string`?le(t):t).pathname||`/`,n);if(i==null)return null;let a=we(e);Ee(a);let o=null;for(let e=0;o==null&&e<a.length;++e){let t=ze(i);o=Ie(a[e],t,r)}return o}function Ce(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function we(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;V(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=Ze([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(V(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),we(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:Pe(l,e.index),routesMeta:u})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of Te(e.path))a(e,t,!0,n)}),t}function Te(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=Te(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function Ee(e){e.sort((e,t)=>e.score===t.score?Fe(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var De=/^:[\w-]+$/,Oe=3,ke=2,Ae=1,je=10,Me=-2,Ne=e=>e===`*`;function Pe(e,t){let n=e.split(`/`),r=n.length;return n.some(Ne)&&(r+=Me),t&&(r+=ke),n.filter(e=>!Ne(e)).reduce((e,t)=>e+(De.test(t)?Oe:t===``?Ae:je),r)}function Fe(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function Ie(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u=Le({path:s.relativePath,caseSensitive:s.caseSensitive,end:c},l),d=s.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=Le({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:Ze([a,u.pathname]),pathnameBase:$e(Ze([a,u.pathnameBase])),route:d}),u.pathnameBase!==`/`&&(a=Ze([a,u.pathnameBase]))}return o}function Le(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Re(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function Re(e,t=!1,n=!0){ie(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function ze(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return ie(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Be(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function Ve({basename:e,pathname:t}){return t===`/`?e:Ze([e,t])}var He=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ue=e=>He.test(e);function We(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?le(e):e,a;return n?(n=Xe(n),a=n.startsWith(`/`)?Ge(n.substring(1),`/`):Ge(n,t)):a=t,{pathname:a,search:et(r),hash:tt(i)}}function Ge(e,t){let n=Qe(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function Ke(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function qe(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function Je(e){let t=qe(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function Ye(e,t,n,r=!1){let i;typeof e==`string`?i=le(e):(i={...e},V(!i.pathname||!i.pathname.includes(`?`),Ke(`?`,`pathname`,`search`,i)),V(!i.pathname||!i.pathname.includes(`#`),Ke(`#`,`pathname`,`hash`,i)),V(!i.search||!i.search.includes(`#`),Ke(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=We(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var Xe=e=>e.replace(/\/\/+/g,`/`),Ze=e=>Xe(e.join(`/`)),Qe=e=>e.replace(/\/+$/,``),$e=e=>Qe(e).replace(/^\/*/,`/`),et=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,tt=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,nt=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function rt(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function it(e){return Ze(e.map(e=>e.route.path).filter(Boolean))||`/`}var at=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function ot(e,t){let n=e;if(typeof n!=`string`||!He.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(at)try{let e=new URL(window.location.href),r=n.startsWith(`//`)?new URL(e.protocol+n):new URL(n),a=Be(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{ie(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}var st=Symbol(`Uninstrumented`);function ct(e,t){let n={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(e=>e({id:t.id,index:t.index,path:t.path,instrument(e){let t=Object.keys(n);for(let r of t)e[r]&&n[r].push(e[r])}}));let r={};if(typeof t.lazy==`function`&&n.lazy.length>0){let e=ut(n.lazy,t.lazy,()=>void 0);e&&(r.lazy=e)}if(typeof t.lazy==`object`){let e=t.lazy;[`middleware`,`loader`,`action`].forEach(t=>{let i=e[t],a=n[`lazy.${t}`];if(typeof i==`function`&&a.length>0){let e=ut(a,i,()=>void 0);e&&(r.lazy=Object.assign(r.lazy||{},{[t]:e}))}})}return[`loader`,`action`].forEach(e=>{let i=t[e];if(typeof i==`function`&&n[e].length>0){let t=i[st]??i,a=ut(n[e],t,(...e)=>ft(e[0]));a&&(e===`loader`&&t.hydrate===!0&&(a.hydrate=!0),a[st]=t,r[e]=a)}}),t.middleware&&t.middleware.length>0&&n.middleware.length>0&&(r.middleware=t.middleware.map(e=>{let t=e[st]??e,r=ut(n.middleware,t,(...e)=>ft(e[0]));return r?(r[st]=t,r):e})),r}function lt(e,t){let n={navigate:[],fetch:[]};if(t.forEach(e=>e({instrument(e){let t=Object.keys(e);for(let r of t)e[r]&&n[r].push(e[r])}})),n.navigate.length>0){let t=e.navigate[st]??e.navigate,r=ut(n.navigate,t,(...t)=>{let[n,r]=t;return{to:typeof n==`number`||typeof n==`string`?n:n?ce(n):`.`,...pt(e,r??{})}});r&&(r[st]=t,e.navigate=r)}if(n.fetch.length>0){let t=e.fetch[st]??e.fetch,r=ut(n.fetch,t,(...t)=>{let[n,,r,i]=t;return{href:r??`.`,fetcherKey:n,...pt(e,i??{})}});r&&(r[st]=t,e.fetch=r)}return e}function ut(e,t,n){return e.length===0?null:async(...r)=>{let i=await dt(e,n(...r),()=>t(...r),e.length-1);if(i.type===`error`)throw i.value;return i.value}}async function dt(e,t,n,r){let i=e[r],a;if(i){let o,s=async()=>(o?console.error(`You cannot call instrumented handlers more than once`):o=dt(e,t,n,r-1),a=await o,V(a,`Expected a result`),a.type===`error`&&a.value instanceof Error?{status:`error`,error:a.value}:{status:`success`,error:void 0});try{await i(s,t)}catch(e){console.error(`An instrumentation function threw an error:`,e)}o||await s(),await o}else try{a={type:`success`,value:await n()}}catch(e){a={type:`error`,value:e}}return a||{type:`error`,value:Error(`No result assigned in instrumentation chain.`)}}function ft(e){let{request:t,context:n,params:r,unstable_pattern:i}=e;return{request:mt(t),params:{...r},unstable_pattern:i,context:ht(n)}}function pt(e,t){return{currentUrl:ce(e.state.location),...`formMethod`in t?{formMethod:t.formMethod}:{},...`formEncType`in t?{formEncType:t.formEncType}:{},...`formData`in t?{formData:t.formData}:{},...`body`in t?{body:t.body}:{}}}function mt(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function ht(e){if(_t(e)){let t={...e};return Object.freeze(t),t}else return{get:t=>e.get(t)}}var gt=Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);function _t(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null||Object.getOwnPropertyNames(t).sort().join(`\0`)===gt}var vt=[`POST`,`PUT`,`PATCH`,`DELETE`],yt=new Set(vt),bt=[`GET`,...vt],xt=new Set(bt),St=new Set([301,302,303,307,308]),Ct=new Set([307,308]),wt={state:`idle`,location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Tt={state:`idle`,data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Et={state:`unblocked`,proceed:void 0,reset:void 0,location:void 0},Dt=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),Ot=`remix-router-transitions`,kt=Symbol(`ResetLoaderData`);function At(e){let t=e.window?e.window:typeof window<`u`?window:void 0,n=t!==void 0&&t.document!==void 0&&t.document.createElement!==void 0;V(e.routes.length>0,`You must provide a non-empty routes array to createRouter`);let r=e.hydrationRouteProperties||[],i=e.mapRouteProperties||Dt,a=i;if(e.unstable_instrumentations){let t=e.unstable_instrumentations;a=e=>({...i(e),...ct(t.map(e=>e.route).filter(Boolean),e)})}let o={},s=ye(e.routes,a,void 0,o),c,l=e.basename||`/`;l.startsWith(`/`)||(l=`/${l}`);let u=e.dataStrategy||qt,d={unstable_passThroughRequests:!1,...e.future},f=null,p=new Set,m=null,h=null,g=null,_=e.hydrationData!=null,v=xe(s,e.history.location,l),y=!1,b=null,x,S;if(v==null&&!e.patchRoutesOnNavigation){let t=vn(404,{pathname:e.history.location.pathname}),{matches:n,route:r}=_n(s);x=!0,S=!x,v=n,b={[r.id]:t}}else if(v&&!e.hydrationData&&et(v,s,e.history.location.pathname).active&&(v=null),!v){x=!1,S=!x,v=[];let t=et(null,s,e.history.location.pathname);t.active&&t.matches&&(y=!0,v=t.matches)}else if(v.some(e=>e.route.lazy))x=!1,S=!x;else if(!v.some(e=>Ft(e.route)))x=!0,S=!x;else{let t=e.hydrationData?e.hydrationData.loaderData:null,n=e.hydrationData?e.hydrationData.errors:null,r=v;if(n){let e=v.findIndex(e=>n[e.route.id]!==void 0);r=r.slice(0,e+1)}S=!1,x=!0,r.forEach(e=>{let r=It(e.route,t,n);S||=r.renderFallback,x&&=!r.shouldLoad})}let C,w={historyAction:e.history.action,location:e.history.location,matches:v,initialized:x,renderFallback:S,navigation:wt,restoreScrollPosition:e.hydrationData==null?null:!1,preventScrollReset:!1,revalidation:`idle`,loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||b,fetchers:new Map,blockers:new Map},T=`POP`,E=null,D=!1,O,k=!1,A=new Map,j=null,M=!1,N=!1,P=new Set,F=new Map,I=0,L=-1,R=new Map,ee=new Set,te=new Map,ne=new Map,z=new Set,B=new Map,re,ae=null;function oe(){if(f=e.history.listen(({action:t,location:n,delta:r})=>{if(re){re(),re=void 0;return}ie(B.size===0||r!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let i=Je({currentLocation:w.location,nextLocation:n,historyAction:t});if(i&&r!=null){let t=new Promise(e=>{re=e});e.history.go(r*-1),qe(i,{state:`blocked`,location:n,proceed(){qe(i,{state:`proceeding`,proceed:void 0,reset:void 0,location:n}),t.then(()=>e.history.go(r))},reset(){let e=new Map(w.blockers);e.set(i,Et),fe({blockers:e})}}),E?.resolve(),E=null;return}return _e(t,n)}),n){Hn(t,A);let e=()=>Un(t,A);t.addEventListener(`pagehide`,e),j=()=>t.removeEventListener(`pagehide`,e)}return w.initialized||_e(`POP`,w.location,{initialHydration:!0}),C}function ce(){f&&f(),j&&j(),p.clear(),O&&O.abort(),w.fetchers.forEach((e,t)=>Le(t)),w.blockers.forEach((e,t)=>Ke(t))}function ue(e){return p.add(e),()=>p.delete(e)}function fe(e,t={}){e.matches&&=e.matches.map(e=>{let t=o[e.route.id],n=e.route;return n.element!==t.element||n.errorElement!==t.errorElement||n.hydrateFallbackElement!==t.hydrateFallbackElement?{...e,route:t}:e}),w={...w,...e};let n=[],r=[];w.fetchers.forEach((e,t)=>{e.state===`idle`&&(z.has(t)?n.push(t):r.push(t))}),z.forEach(e=>{!w.fetchers.has(e)&&!F.has(e)&&n.push(e)}),[...p].forEach(r=>r(w,{deletedFetchers:n,newErrors:e.errors??null,viewTransitionOpts:t.viewTransitionOpts,flushSync:t.flushSync===!0})),n.forEach(e=>Le(e)),r.forEach(e=>w.fetchers.delete(e))}function me(t,n,{flushSync:r}={}){let i=w.actionData!=null&&w.navigation.formMethod!=null&&Nn(w.navigation.formMethod)&&w.navigation.state===`loading`&&t.state?._isRedirect!==!0,a;a=n.actionData?Object.keys(n.actionData).length>0?n.actionData:null:i?w.actionData:null;let o=n.loaderData?mn(w.loaderData,n.loaderData,n.matches||[],n.errors):w.loaderData,l=w.blockers;l.size>0&&(l=new Map(l),l.forEach((e,t)=>l.set(t,Et)));let u=M?!1:$e(t,n.matches||w.matches),d=D===!0||w.navigation.formMethod!=null&&Nn(w.navigation.formMethod)&&t.state?._isRedirect!==!0;c&&=(s=c,void 0),M||T===`POP`||(T===`PUSH`?e.history.push(t,t.state):T===`REPLACE`&&e.history.replace(t,t.state));let f;if(T===`POP`){let e=A.get(w.location.pathname);e&&e.has(t.pathname)?f={currentLocation:w.location,nextLocation:t}:A.has(t.pathname)&&(f={currentLocation:t,nextLocation:w.location})}else if(k){let e=A.get(w.location.pathname);e?e.add(t.pathname):(e=new Set([t.pathname]),A.set(w.location.pathname,e)),f={currentLocation:w.location,nextLocation:t}}fe({...n,actionData:a,loaderData:o,historyAction:T,location:t,initialized:!0,renderFallback:!1,navigation:wt,revalidation:`idle`,restoreScrollPosition:u,preventScrollReset:d,blockers:l},{viewTransitionOpts:f,flushSync:r===!0}),T=`POP`,D=!1,k=!1,M=!1,N=!1,E?.resolve(),E=null,ae?.resolve(),ae=null}async function he(t,n){if(E?.resolve(),E=null,typeof t==`number`){E||=Wn();let n=E.promise;return e.history.go(t),n}let{path:r,submission:i,error:a}=Nt(!1,Mt(w.location,w.matches,l,t,n?.fromRouteId,n?.relative),n),o;n?.unstable_mask&&(o={pathname:``,search:``,hash:``,...typeof n.unstable_mask==`string`?le(n.unstable_mask):{...w.location.unstable_mask,...n.unstable_mask}});let s=w.location,c=se(s,r,n&&n.state,void 0,o);c={...c,...e.history.encodeLocation(c)};let u=n&&n.replace!=null?n.replace:void 0,d=`PUSH`;u===!0?d=`REPLACE`:u===!1||i!=null&&Nn(i.formMethod)&&i.formAction===w.location.pathname+w.location.search&&(d=`REPLACE`);let f=n&&`preventScrollReset`in n?n.preventScrollReset===!0:void 0,p=(n&&n.flushSync)===!0,m=Je({currentLocation:s,nextLocation:c,historyAction:d});if(m){qe(m,{state:`blocked`,location:c,proceed(){qe(m,{state:`proceeding`,proceed:void 0,reset:void 0,location:c}),he(t,n)},reset(){let e=new Map(w.blockers);e.set(m,Et),fe({blockers:e})}});return}await _e(d,c,{submission:i,pendingError:a,preventScrollReset:f,replace:n&&n.replace,enableViewTransition:n&&n.viewTransition,flushSync:p,callSiteDefaultShouldRevalidate:n&&n.unstable_defaultShouldRevalidate})}function ge(){ae||=Wn(),Me(),fe({revalidation:`loading`});let e=ae.promise;return w.navigation.state===`submitting`?e:w.navigation.state===`idle`?(_e(w.historyAction,w.location,{startUninterruptedRevalidation:!0}),e):(_e(T||w.historyAction,w.navigation.location,{overrideNavigation:w.navigation,enableViewTransition:k===!0}),e)}async function _e(t,n,r){O&&O.abort(),O=null,T=t,M=(r&&r.startUninterruptedRevalidation)===!0,Qe(w.location,w.matches),D=(r&&r.preventScrollReset)===!0,k=(r&&r.enableViewTransition)===!0;let i=c||s,a=r&&r.overrideNavigation,o=r?.initialHydration&&w.matches&&w.matches.length>0&&!y?w.matches:xe(i,n,l),u=(r&&r.flushSync)===!0;if(o&&w.initialized&&!N&&xn(w.location,n)&&!(r&&r.submission&&Nn(r.submission.formMethod))){me(n,{matches:o},{flushSync:u});return}let d=et(o,i,n.pathname);if(d.active&&d.matches&&(o=d.matches),!o){let{error:e,notFoundMatches:t,route:r}=Ye(n.pathname);me(n,{matches:t,loaderData:{},errors:{[r.id]:e}},{flushSync:u});return}O=new AbortController;let f=cn(e.history,n,O.signal,r&&r.submission),p=e.getContext?await e.getContext():new pe,m;if(r&&r.pendingError)m=[gn(o).route.id,{type:`error`,error:r.pendingError}];else if(r&&r.submission&&Nn(r.submission.formMethod)){let t=await ve(f,n,r.submission,o,p,d.active,r&&r.initialHydration===!0,{replace:r.replace,flushSync:u});if(t.shortCircuited)return;if(t.pendingActionResult){let[e,r]=t.pendingActionResult;if(En(r)&&rt(r.error)&&r.error.status===404){O=null,me(n,{matches:t.matches,loaderData:{},errors:{[e]:r.error}});return}}o=t.matches||o,m=t.pendingActionResult,a=Ln(n,r.submission),u=!1,d.active=!1,f=cn(e.history,f.url,f.signal)}let{shortCircuited:h,matches:g,loaderData:_,errors:v}=await be(f,n,o,p,d.active,a,r&&r.submission,r&&r.fetcherSubmission,r&&r.replace,r&&r.initialHydration===!0,u,m,r&&r.callSiteDefaultShouldRevalidate);h||(O=null,me(n,{matches:g||o,...hn(m),loaderData:_,errors:v}))}async function ve(t,n,i,c,u,d,f,p={}){if(Me(),fe({navigation:Rn(n,i)},{flushSync:p.flushSync===!0}),d){let e=await tt(c,n.pathname,t.signal);if(e.type===`aborted`)return{shortCircuited:!0};if(e.type===`error`){if(e.partialMatches.length===0){let{matches:t,route:n}=_n(s);return{matches:t,pendingActionResult:[n.id,{type:`error`,error:e.error}]}}let t=gn(e.partialMatches).route.id;return{matches:e.partialMatches,pendingActionResult:[t,{type:`error`,error:e.error}]}}else if(e.matches)c=e.matches;else{let{notFoundMatches:e,error:t,route:r}=Ye(n.pathname);return{matches:e,pendingActionResult:[r.id,{type:`error`,error:t}]}}}let m,h=Fn(c,n);if(!h.route.action&&!h.route.lazy)m={type:`error`,error:vn(405,{method:t.method,pathname:n.pathname,routeId:h.route.id})};else{let e=await Ae(t,n,$t(a,o,t,n,c,h,f?[]:r,u),u,null);if(m=e[h.route.id],!m){for(let t of c)if(e[t.route.id]){m=e[t.route.id];break}}if(t.signal.aborted)return{shortCircuited:!0}}if(Dn(m)){let n;return n=p&&p.replace!=null?p.replace:sn(m.response.headers.get(`Location`),new URL(t.url),l,e.history)===w.location.pathname+w.location.search,await ke(t,m,!0,{submission:i,replace:n}),{shortCircuited:!0}}if(En(m)){let e=gn(c,h.route.id);return(p&&p.replace)!==!0&&(T=`PUSH`),{matches:c,pendingActionResult:[e.route.id,m,h.route.id]}}return{matches:c,pendingActionResult:[h.route.id,m]}}async function be(t,n,i,u,d,f,p,m,h,g,_,v,y){let b=f||Ln(n,p),x=p||m||In(b),S=!M&&!g;if(d){if(S){let e=we(v);fe({navigation:b,...e===void 0?{}:{actionData:e}},{flushSync:_})}let e=await tt(i,n.pathname,t.signal);if(e.type===`aborted`)return{shortCircuited:!0};if(e.type===`error`){if(e.partialMatches.length===0){let{matches:t,route:n}=_n(s);return{matches:t,loaderData:{},errors:{[n.id]:e.error}}}let t=gn(e.partialMatches).route.id;return{matches:e.partialMatches,loaderData:{},errors:{[t]:e.error}}}else if(e.matches)i=e.matches;else{let{error:e,notFoundMatches:t,route:r}=Ye(n.pathname);return{matches:t,loaderData:{},errors:{[r.id]:e}}}}let C=c||s,{dsMatches:T,revalidatingFetchers:E}=Pt(t,u,a,o,e.history,w,i,x,n,g?[]:r,g===!0,N,P,z,te,ee,C,l,e.patchRoutesOnNavigation!=null,v,y);if(L=++I,!e.dataStrategy&&!T.some(e=>e.shouldLoad)&&!T.some(e=>e.route.middleware&&e.route.middleware.length>0)&&E.length===0){let e=He();return me(n,{matches:i,loaderData:{},errors:v&&En(v[1])?{[v[0]]:v[1].error}:null,...hn(v),...e?{fetchers:new Map(w.fetchers)}:{}},{flushSync:_}),{shortCircuited:!0}}if(S){let e={};if(!d){e.navigation=b;let t=we(v);t!==void 0&&(e.actionData=t)}E.length>0&&(e.fetchers=Te(E)),fe(e,{flushSync:_})}E.forEach(e=>{ze(e.key),e.controller&&F.set(e.key,e.controller)});let D=()=>E.forEach(e=>ze(e.key));O&&O.signal.addEventListener(`abort`,D);let{loaderResults:k,fetcherResults:A}=await je(T,E,t,n,u);if(t.signal.aborted)return{shortCircuited:!0};O&&O.signal.removeEventListener(`abort`,D),E.forEach(e=>F.delete(e.key));let j=yn(k);if(j)return await ke(t,j.result,!0,{replace:h}),{shortCircuited:!0};if(j=yn(A),j)return ee.add(j.key),await ke(t,j.result,!0,{replace:h}),{shortCircuited:!0};let{loaderData:R,errors:ne}=pn(w,i,k,v,E,A);g&&w.errors&&(ne={...w.errors,...ne});let B=He(),re=We(L),V=B||re||E.length>0;return{matches:i,loaderData:R,errors:ne,...V?{fetchers:new Map(w.fetchers)}:{}}}function we(e){if(e&&!En(e[1]))return{[e[0]]:e[1].data};if(w.actionData)return Object.keys(w.actionData).length===0?null:w.actionData}function Te(e){return e.forEach(e=>{let t=w.fetchers.get(e.key),n=zn(void 0,t?t.data:void 0);w.fetchers.set(e.key,n)}),new Map(w.fetchers)}async function Ee(t,n,r,i){ze(t);let a=(i&&i.flushSync)===!0,o=c||s,u=Mt(w.location,w.matches,l,r,n,i?.relative),d=xe(o,u,l),f=et(d,o,u);if(f.active&&f.matches&&(d=f.matches),!d){Pe(t,n,vn(404,{pathname:u}),{flushSync:a});return}let{path:p,submission:m,error:h}=Nt(!0,u,i);if(h){Pe(t,n,h,{flushSync:a});return}let g=e.getContext?await e.getContext():new pe,_=(i&&i.preventScrollReset)===!0;if(m&&Nn(m.formMethod)){await De(t,n,p,d,g,f.active,a,_,m,i&&i.unstable_defaultShouldRevalidate);return}te.set(t,{routeId:n,path:p}),await Oe(t,n,p,d,g,f.active,a,_,m)}async function De(t,n,i,u,d,f,p,m,h,g){Me(),te.delete(t),Ne(t,Bn(h,w.fetchers.get(t)),{flushSync:p});let _=new AbortController,v=cn(e.history,i,_.signal,h);if(f){let e=await tt(u,new URL(v.url).pathname,v.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){Pe(t,n,e.error,{flushSync:p});return}else if(e.matches)u=e.matches;else{Pe(t,n,vn(404,{pathname:i}),{flushSync:p});return}}let y=Fn(u,i);if(!y.route.action&&!y.route.lazy){Pe(t,n,vn(405,{method:h.formMethod,pathname:i,routeId:n}),{flushSync:p});return}F.set(t,_);let b=I,x=$t(a,o,v,i,u,y,r,d),S=await Ae(v,i,x,d,t),C=S[y.route.id];if(!C){for(let e of x)if(S[e.route.id]){C=S[e.route.id];break}}if(v.signal.aborted){F.get(t)===_&&F.delete(t);return}if(z.has(t)){if(Dn(C)||En(C)){Ne(t,Vn(void 0));return}}else{if(Dn(C))if(F.delete(t),L>b){Ne(t,Vn(void 0));return}else return ee.add(t),Ne(t,zn(h)),ke(v,C,!1,{fetcherSubmission:h,preventScrollReset:m});if(En(C)){Pe(t,n,C.error);return}}let E=w.navigation.location||w.location,D=cn(e.history,E,_.signal),k=c||s,A=w.navigation.state===`idle`?w.matches:xe(k,w.navigation.location,l);V(A,`Didn't find any matches after fetcher action`);let j=++I;R.set(t,j);let M=zn(h,C.data);w.fetchers.set(t,M);let{dsMatches:ne,revalidatingFetchers:B}=Pt(D,d,a,o,e.history,w,A,h,E,r,!1,N,P,z,te,ee,k,l,e.patchRoutesOnNavigation!=null,[y.route.id,C],g);B.filter(e=>e.key!==t).forEach(e=>{let t=e.key,n=w.fetchers.get(t),r=zn(void 0,n?n.data:void 0);w.fetchers.set(t,r),ze(t),e.controller&&F.set(t,e.controller)}),fe({fetchers:new Map(w.fetchers)});let re=()=>B.forEach(e=>ze(e.key));_.signal.addEventListener(`abort`,re);let{loaderResults:ie,fetcherResults:ae}=await je(ne,B,D,E,d);if(_.signal.aborted)return;if(_.signal.removeEventListener(`abort`,re),R.delete(t),F.delete(t),B.forEach(e=>F.delete(e.key)),w.fetchers.has(t)){let e=Vn(C.data);w.fetchers.set(t,e)}let oe=yn(ie);if(oe)return ke(D,oe.result,!1,{preventScrollReset:m});if(oe=yn(ae),oe)return ee.add(oe.key),ke(D,oe.result,!1,{preventScrollReset:m});let{loaderData:se,errors:ce}=pn(w,A,ie,void 0,B,ae);We(j),w.navigation.state===`loading`&&j>L?(V(T,`Expected pending action`),O&&O.abort(),me(w.navigation.location,{matches:A,loaderData:se,errors:ce,fetchers:new Map(w.fetchers)})):(fe({errors:ce,loaderData:mn(w.loaderData,se,A,ce),fetchers:new Map(w.fetchers)}),N=!1)}async function Oe(t,n,i,s,c,l,u,d,f){let p=w.fetchers.get(t);Ne(t,zn(f,p?p.data:void 0),{flushSync:u});let m=new AbortController,h=cn(e.history,i,m.signal);if(l){let e=await tt(s,new URL(h.url).pathname,h.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){Pe(t,n,e.error,{flushSync:u});return}else if(e.matches)s=e.matches;else{Pe(t,n,vn(404,{pathname:i}),{flushSync:u});return}}let g=Fn(s,i);F.set(t,m);let _=I,v=(await Ae(h,i,$t(a,o,h,i,s,g,r,c),c,t))[g.route.id];if(F.get(t)===m&&F.delete(t),!h.signal.aborted){if(z.has(t)){Ne(t,Vn(void 0));return}if(Dn(v))if(L>_){Ne(t,Vn(void 0));return}else{ee.add(t),await ke(h,v,!1,{preventScrollReset:d});return}if(En(v)){Pe(t,n,v.error);return}Ne(t,Vn(v.data))}}async function ke(r,i,a,{submission:o,fetcherSubmission:s,preventScrollReset:c,replace:u}={}){a||(E?.resolve(),E=null),i.response.headers.has(`X-Remix-Revalidate`)&&(N=!0);let d=i.response.headers.get(`Location`);V(d,`Expected a Location header on the redirect Response`),d=sn(d,new URL(r.url),l,e.history);let f=se(w.location,d,{_isRedirect:!0});if(n){let e=!1;if(i.response.headers.has(`X-Remix-Reload-Document`))e=!0;else if(Ue(d)){let n=de(d,!0);e=n.origin!==t.location.origin||Be(n.pathname,l)==null}if(e){u?t.location.replace(d):t.location.assign(d);return}}O=null;let p=u===!0||i.response.headers.has(`X-Remix-Replace`)?`REPLACE`:`PUSH`,{formMethod:m,formAction:h,formEncType:g}=w.navigation;!o&&!s&&m&&h&&g&&(o=In(w.navigation));let _=o||s;Ct.has(i.response.status)&&_&&Nn(_.formMethod)?await _e(p,f,{submission:{..._,formAction:d},preventScrollReset:c||D,enableViewTransition:a?k:void 0}):await _e(p,f,{overrideNavigation:Ln(f,o),fetcherSubmission:s,preventScrollReset:c||D,enableViewTransition:a?k:void 0})}async function Ae(e,t,n,r,i){let a,o={};try{a=await en(u,e,t,n,i,r,!1)}catch(e){return n.filter(e=>e.shouldLoad).forEach(t=>{o[t.route.id]={type:`error`,error:e}}),o}if(e.signal.aborted)return o;if(!Nn(e.method))for(let e of n){if(a[e.route.id]?.type===`error`)break;!a.hasOwnProperty(e.route.id)&&!w.loaderData.hasOwnProperty(e.route.id)&&(!w.errors||!w.errors.hasOwnProperty(e.route.id))&&e.shouldCallHandler()&&(a[e.route.id]={type:`error`,result:Error(`No result returned from dataStrategy for route ${e.route.id}`)})}for(let[t,r]of Object.entries(a))if(Tn(r)){let i=r.result;o[t]={type:`redirect`,response:an(i,e,t,n,l)}}else o[t]=await rn(r);return o}async function je(e,t,n,r,i){let a=Ae(n,r,e,i,null),o=Promise.all(t.map(async e=>{if(e.matches&&e.match&&e.request&&e.controller){let t=(await Ae(e.request,e.path,e.matches,i,e.key))[e.match.route.id];return{[e.key]:t}}else return Promise.resolve({[e.key]:{type:`error`,error:vn(404,{pathname:e.path})}})}));return{loaderResults:await a,fetcherResults:(await o).reduce((e,t)=>Object.assign(e,t),{})}}function Me(){N=!0,te.forEach((e,t)=>{F.has(t)&&P.add(t),ze(t)})}function Ne(e,t,n={}){w.fetchers.set(e,t),fe({fetchers:new Map(w.fetchers)},{flushSync:(n&&n.flushSync)===!0})}function Pe(e,t,n,r={}){let i=gn(w.matches,t);Le(e),fe({errors:{[i.route.id]:n},fetchers:new Map(w.fetchers)},{flushSync:(r&&r.flushSync)===!0})}function Fe(e){return ne.set(e,(ne.get(e)||0)+1),z.has(e)&&z.delete(e),w.fetchers.get(e)||Tt}function Ie(e,t){ze(e,t?.reason),Ne(e,Vn(null))}function Le(e){let t=w.fetchers.get(e);F.has(e)&&!(t&&t.state===`loading`&&R.has(e))&&ze(e),te.delete(e),R.delete(e),ee.delete(e),z.delete(e),P.delete(e),w.fetchers.delete(e)}function Re(e){let t=(ne.get(e)||0)-1;t<=0?(ne.delete(e),z.add(e)):ne.set(e,t),fe({fetchers:new Map(w.fetchers)})}function ze(e,t){let n=F.get(e);n&&(n.abort(t),F.delete(e))}function Ve(e){for(let t of e){let e=Vn(Fe(t).data);w.fetchers.set(t,e)}}function He(){let e=[],t=!1;for(let n of ee){let r=w.fetchers.get(n);V(r,`Expected fetcher: ${n}`),r.state===`loading`&&(ee.delete(n),e.push(n),t=!0)}return Ve(e),t}function We(e){let t=[];for(let[n,r]of R)if(r<e){let e=w.fetchers.get(n);V(e,`Expected fetcher: ${n}`),e.state===`loading`&&(ze(n),R.delete(n),t.push(n))}return Ve(t),t.length>0}function Ge(e,t){let n=w.blockers.get(e)||Et;return B.get(e)!==t&&B.set(e,t),n}function Ke(e){w.blockers.delete(e),B.delete(e)}function qe(e,t){let n=w.blockers.get(e)||Et;V(n.state===`unblocked`&&t.state===`blocked`||n.state===`blocked`&&t.state===`blocked`||n.state===`blocked`&&t.state===`proceeding`||n.state===`blocked`&&t.state===`unblocked`||n.state===`proceeding`&&t.state===`unblocked`,`Invalid blocker state transition: ${n.state} -> ${t.state}`);let r=new Map(w.blockers);r.set(e,t),fe({blockers:r})}function Je({currentLocation:e,nextLocation:t,historyAction:n}){if(B.size===0)return;B.size>1&&ie(!1,`A router only supports one blocker at a time`);let r=Array.from(B.entries()),[i,a]=r[r.length-1],o=w.blockers.get(i);if(!(o&&o.state===`proceeding`)&&a({currentLocation:e,nextLocation:t,historyAction:n}))return i}function Ye(e){let t=vn(404,{pathname:e}),{matches:n,route:r}=_n(c||s);return{notFoundMatches:n,route:r,error:t}}function Xe(e,t,n){if(m=e,g=t,h=n||null,!_&&w.navigation===wt){_=!0;let e=$e(w.location,w.matches);e!=null&&fe({restoreScrollPosition:e})}return()=>{m=null,g=null,h=null}}function Ze(e,t){return h&&h(e,t.map(e=>Ce(e,w.loaderData)))||e.key}function Qe(e,t){if(m&&g){let n=Ze(e,t);m[n]=g()}}function $e(e,t){if(m){let n=Ze(e,t),r=m[n];if(typeof r==`number`)return r}return null}function et(t,n,r){if(e.patchRoutesOnNavigation){if(!t)return{active:!0,matches:Se(n,r,l,!0)||[]};if(Object.keys(t[0].params).length>0)return{active:!0,matches:Se(n,r,l,!0)}}return{active:!1,matches:null}}async function tt(t,n,r,i){if(!e.patchRoutesOnNavigation)return{type:`success`,matches:t};let u=t;for(;;){let t=c==null,d=c||s,f=o;try{await e.patchRoutesOnNavigation({signal:r,path:n,matches:u,fetcherKey:i,patch:(e,t)=>{r.aborted||Bt(e,t,d,f,a,!1)}})}catch(e){return{type:`error`,error:e,partialMatches:u}}finally{t&&!r.aborted&&(s=[...s])}if(r.aborted)return{type:`aborted`};let p=xe(d,n,l),m=null;if(p&&(Object.keys(p[0].params).length===0||(m=Se(d,n,l,!0),!(m&&u.length<m.length&&nt(u,m.slice(0,u.length))))))return{type:`success`,matches:p};if(m||=Se(d,n,l,!0),!m||nt(u,m))return{type:`success`,matches:null};u=m}}function nt(e,t){return e.length===t.length&&e.every((e,n)=>e.route.id===t[n].route.id)}function it(e){o={},c=ye(e,a,void 0,o)}function at(e,t,n=!1){let r=c==null;Bt(e,t,c||s,o,a,n),r&&(s=[...s],fe({}))}return C={get basename(){return l},get future(){return d},get state(){return w},get routes(){return s},get window(){return t},initialize:oe,subscribe:ue,enableScrollRestoration:Xe,navigate:he,fetch:Ee,revalidate:ge,createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:Fe,resetFetcher:Ie,deleteFetcher:Re,dispose:ce,getBlocker:Ge,deleteBlocker:Ke,patchRoutes:at,_internalFetchControllers:F,_internalSetRoutes:it,_internalSetStateDoNotUseOrYouWillBreakYourApp(e){fe(e)}},e.unstable_instrumentations&&(C=lt(C,e.unstable_instrumentations.map(e=>e.router).filter(Boolean))),C}function jt(e){return e!=null&&(`formData`in e&&e.formData!=null||`body`in e&&e.body!==void 0)}function Mt(e,t,n,r,i,a){let o,s;if(i){o=[];for(let e of t)if(o.push(e),e.route.id===i){s=e;break}}else o=t,s=t[t.length-1];let c=Ye(r||`.`,Je(o),Be(e.pathname,n)||e.pathname,a===`path`);if(r??(c.search=e.search,c.hash=e.hash),(r==null||r===``||r===`.`)&&s){let e=Pn(c.search);if(s.route.index&&!e)c.search=c.search?c.search.replace(/^\?/,`?index&`):`?index`;else if(!s.route.index&&e){let e=new URLSearchParams(c.search),t=e.getAll(`index`);e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();c.search=n?`?${n}`:``}}return n!==`/`&&(c.pathname=Ve({basename:n,pathname:c.pathname})),ce(c)}function Nt(e,t,n){if(!n||!jt(n))return{path:t};if(n.formMethod&&!Mn(n.formMethod))return{path:t,error:vn(405,{method:n.formMethod})};let r=()=>({path:t,error:vn(400,{type:`invalid-body`})}),i=(n.formMethod||`get`).toUpperCase(),a=bn(t);if(n.body!==void 0){if(n.formEncType===`text/plain`){if(!Nn(i))return r();let e=typeof n.body==`string`?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((e,[t,n])=>`${e}${t}=${n}
10
+ `,``):String(n.body);return{path:t,submission:{formMethod:i,formAction:a,formEncType:n.formEncType,formData:void 0,json:void 0,text:e}}}else if(n.formEncType===`application/json`){if(!Nn(i))return r();try{let e=typeof n.body==`string`?JSON.parse(n.body):n.body;return{path:t,submission:{formMethod:i,formAction:a,formEncType:n.formEncType,formData:void 0,json:e,text:void 0}}}catch{return r()}}}V(typeof FormData==`function`,`FormData is not available in this environment`);let o,s;if(n.formData)o=un(n.formData),s=n.formData;else if(n.body instanceof FormData)o=un(n.body),s=n.body;else if(n.body instanceof URLSearchParams)o=n.body,s=dn(o);else if(n.body==null)o=new URLSearchParams,s=new FormData;else try{o=new URLSearchParams(n.body),s=dn(o)}catch{return r()}let c={formMethod:i,formAction:a,formEncType:n&&n.formEncType||`application/x-www-form-urlencoded`,formData:s,json:void 0,text:void 0};if(Nn(c.formMethod))return{path:t,submission:c};let l=le(t);return e&&l.search&&Pn(l.search)&&o.append(`index`,``),l.search=`?${o}`,{path:ce(l),submission:c}}function Pt(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b){let x=y?En(y[1])?y[1].error:y[1].data:void 0,S=i.createURL(a.location),C=i.createURL(c),w;if(u&&a.errors){let e=Object.keys(a.errors)[0];w=o.findIndex(t=>t.route.id===e)}else if(y&&En(y[1])){let e=y[0];w=o.findIndex(t=>t.route.id===e)-1}let T=y?y[1].statusCode:void 0,E=T&&T>=400,D={currentUrl:S,currentParams:a.matches[0]?.params||{},nextUrl:C,nextParams:o[0].params,...s,actionResult:x,actionStatus:T},O=it(o),k=o.map((i,o)=>{let{route:s}=i,f=null;if(w!=null&&o>w)f=!1;else if(s.lazy)f=!0;else if(!Ft(s))f=!1;else if(u){let{shouldLoad:e}=It(s,a.loaderData,a.errors);f=e}else Lt(a.loaderData,a.matches[o],i)&&(f=!0);if(f!==null)return Qt(n,r,e,c,O,i,l,t,f);let p=!1;typeof b==`boolean`?p=b:E?p=!1:d||S.pathname+S.search===C.pathname+C.search?p=!0:S.search===C.search?Rt(a.matches[o],i)&&(p=!0):p=!0;let m={...D,defaultShouldRevalidate:p};return Qt(n,r,e,c,O,i,l,t,zt(i,m),m,b)}),A=[];return m.forEach((e,s)=>{if(u||!o.some(t=>t.route.id===e.routeId)||p.has(s))return;let c=a.fetchers.get(s),m=c&&c.state!==`idle`&&c.data===void 0,y=xe(g,e.path,_);if(!y){if(v&&m)return;A.push({key:s,routeId:e.routeId,path:e.path,matches:null,match:null,request:null,controller:null});return}if(h.has(s))return;let x=Fn(y,e.path),S=new AbortController,C=cn(i,e.path,S.signal),w=null;if(f.has(s))f.delete(s),w=$t(n,r,C,e.path,y,x,l,t);else if(m)d&&(w=$t(n,r,C,e.path,y,x,l,t));else{let i;i=typeof b==`boolean`?b:E?!1:d;let a={...D,defaultShouldRevalidate:i};zt(x,a)&&(w=$t(n,r,C,e.path,y,x,l,t,a))}w&&A.push({key:s,routeId:e.routeId,path:e.path,matches:w,match:x,request:C,controller:S})}),{dsMatches:k,revalidatingFetchers:A}}function Ft(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function It(e,t,n){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!Ft(e))return{shouldLoad:!1,renderFallback:!1};let r=t!=null&&e.id in t,i=n!=null&&n[e.id]!==void 0;if(!r&&i)return{shouldLoad:!1,renderFallback:!1};if(typeof e.loader==`function`&&e.loader.hydrate===!0)return{shouldLoad:!0,renderFallback:!r};let a=!r&&!i;return{shouldLoad:a,renderFallback:a}}function Lt(e,t,n){let r=!t||n.route.id!==t.route.id,i=!e.hasOwnProperty(n.route.id);return r||i}function Rt(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith(`*`)&&e.params[`*`]!==t.params[`*`]}function zt(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n==`boolean`)return n}return t.defaultShouldRevalidate}function Bt(e,t,n,r,i,a){let o;if(e){let t=r[e];V(t,`No route found to patch children into: routeId = ${e}`),t.children||=[],o=t.children}else o=n;let s=[],c=[];if(t.forEach(e=>{let t=o.find(t=>Vt(e,t));t?c.push({existingRoute:t,newRoute:e}):s.push(e)}),s.length>0){let t=ye(s,i,[e||`_`,`patch`,String(o?.length||`0`)],r);o.push(...t)}if(a&&c.length>0)for(let e=0;e<c.length;e++){let{existingRoute:t,newRoute:n}=c[e],r=t,[a]=ye([n],i,[],{},!0);Object.assign(r,{element:a.element?a.element:r.element,errorElement:a.errorElement?a.errorElement:r.errorElement,hydrateFallbackElement:a.hydrateFallbackElement?a.hydrateFallbackElement:r.hydrateFallbackElement})}}function Vt(e,t){return`id`in e&&`id`in t&&e.id===t.id?!0:e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children?.every((e,n)=>t.children?.some(t=>Vt(e,t)))??!1:!1}var Ht=new WeakMap,Ut=({key:e,route:t,manifest:n,mapRouteProperties:r})=>{let i=n[t.id];if(V(i,`No route found in manifest`),!i.lazy||typeof i.lazy!=`object`)return;let a=i.lazy[e];if(!a)return;let o=Ht.get(i);o||(o={},Ht.set(i,o));let s=o[e];if(s)return s;let c=(async()=>{let t=he(e),n=i[e]!==void 0&&e!==`hasErrorBoundary`;if(t)ie(!t,`Route property `+e+` is not a supported lazy route property. This property will be ignored.`),o[e]=Promise.resolve();else if(n)ie(!1,`Route "${i.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let t=await a();t!=null&&(Object.assign(i,{[e]:t}),Object.assign(i,r(i)))}typeof i.lazy==`object`&&(i.lazy[e]=void 0,Object.values(i.lazy).every(e=>e===void 0)&&(i.lazy=void 0))})();return o[e]=c,c},Wt=new WeakMap;function Gt(e,t,n,r,i){let a=n[e.id];if(V(a,`No route found in manifest`),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy==`function`){let t=Wt.get(a);if(t)return{lazyRoutePromise:t,lazyHandlerPromise:t};let n=(async()=>{V(typeof e.lazy==`function`,`No lazy route function found`);let t=await e.lazy(),n={};for(let e in t){let r=t[e];if(r===void 0)continue;let i=_e(e),o=a[e]!==void 0&&e!==`hasErrorBoundary`;i?ie(!i,`Route property `+e+` is not a supported property to be returned from a lazy route function. This property will be ignored.`):o?ie(!o,`Route "${a.id}" has a static property "${e}" defined but its lazy function is also returning a value for this property. The lazy route property "${e}" will be ignored.`):n[e]=r}Object.assign(a,n),Object.assign(a,{...r(a),lazy:void 0})})();return Wt.set(a,n),n.catch(()=>{}),{lazyRoutePromise:n,lazyHandlerPromise:n}}let o=Object.keys(e.lazy),s=[],c;for(let a of o){if(i&&i.includes(a))continue;let o=Ut({key:a,route:e,manifest:n,mapRouteProperties:r});o&&(s.push(o),a===t&&(c=o))}let l=s.length>0?Promise.all(s).then(()=>{}):void 0;return l?.catch(()=>{}),c?.catch(()=>{}),{lazyRoutePromise:l,lazyHandlerPromise:c}}async function Kt(e){let t=e.matches.filter(e=>e.shouldLoad),n={};return(await Promise.all(t.map(e=>e.resolve()))).forEach((e,r)=>{n[t[r].route.id]=e}),n}async function qt(e){return e.matches.some(e=>e.route.middleware)?Jt(e,()=>Kt(e)):Kt(e)}function Jt(e,t){return Yt(e,t,e=>{if(jn(e))throw e;return e},Cn,n);function n(t,n,r){if(r)return Promise.resolve(Object.assign(r.value,{[n]:{type:`error`,result:t}}));{let{matches:r}=e,i=gn(r,r[Math.min(Math.max(r.findIndex(e=>e.route.id===n),0),Math.max(r.findIndex(e=>e.shouldCallHandler()),0))].route.id).route.id;return Promise.resolve({[i]:{type:`error`,result:t}})}}}async function Yt(e,t,n,r,i){let{matches:a,...o}=e;return await Xt(o,a.flatMap(e=>e.route.middleware?e.route.middleware.map(t=>[e.route.id,t]):[]),t,n,r,i)}async function Xt(e,t,n,r,i,a,o=0){let{request:s}=e;if(s.signal.aborted)throw s.signal.reason??Error(`Request aborted: ${s.method} ${s.url}`);let c=t[o];if(!c)return await n();let[l,u]=c,d,f=async()=>{if(d)throw Error("You may only call `next()` once per middleware");try{return d={value:await Xt(e,t,n,r,i,a,o+1)},d.value}catch(e){return d={value:await a(e,l,d)},d.value}};try{let t=await u(e,f),n=t==null?void 0:r(t);return i(n)?n:d?n??d.value:(d={value:await f()},d.value)}catch(e){return await a(e,l,d)}}function Zt(e,t,n,r,i){let a=Ut({key:`middleware`,route:r.route,manifest:t,mapRouteProperties:e}),o=Gt(r.route,Nn(n.method)?`action`:`loader`,t,e,i);return{middleware:a,route:o.lazyRoutePromise,handler:o.lazyHandlerPromise}}function Qt(e,t,n,r,i,a,o,s,c,l=null,u){let d=!1,f=Zt(e,t,n,a,o);return{...a,_lazyPromises:f,shouldLoad:c,shouldRevalidateArgs:l,shouldCallHandler(e){return d=!0,l?typeof u==`boolean`?zt(a,{...l,defaultShouldRevalidate:u}):typeof e==`boolean`?zt(a,{...l,defaultShouldRevalidate:e}):zt(a,l):c},resolve(e){let{lazy:t,loader:o,middleware:l}=a.route,u=d||c||e&&!Nn(n.method)&&(t||o),p=l&&l.length>0&&!o&&!t;return u&&(Nn(n.method)||!p)?tn({request:n,path:r,unstable_pattern:i,match:a,lazyHandlerPromise:f?.handler,lazyRoutePromise:f?.route,handlerOverride:e,scopedContext:s}):Promise.resolve({type:`data`,result:void 0})}}}function $t(e,t,n,r,i,a,o,s,c=null){return i.map(l=>l.route.id===a.route.id?Qt(e,t,n,r,it(i),l,o,s,!0,c):{...l,shouldLoad:!1,shouldRevalidateArgs:c,shouldCallHandler:()=>!1,_lazyPromises:Zt(e,t,n,l,o),resolve:()=>Promise.resolve({type:`data`,result:void 0})})}async function en(e,t,n,r,i,a,o){r.some(e=>e._lazyPromises?.middleware)&&await Promise.all(r.map(e=>e._lazyPromises?.middleware));let s={request:t,unstable_url:ln(t,n),unstable_pattern:it(r),params:r[0].params,context:a,matches:r},c=o?()=>{throw Error("You cannot call `runClientMiddleware()` from a static handler `dataStrategy`. Middleware is run outside of `dataStrategy` during SSR in order to bubble up the Response. You can enable middleware via the `respond` API in `query`/`queryRoute`")}:e=>{let t=s;return Jt(t,()=>e({...t,fetcherKey:i,runClientMiddleware:()=>{throw Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))},l=await e({...s,fetcherKey:i,runClientMiddleware:c});try{await Promise.all(r.flatMap(e=>[e._lazyPromises?.handler,e._lazyPromises?.route]))}catch{}return l}async function tn({request:e,path:t,unstable_pattern:n,match:r,lazyHandlerPromise:i,lazyRoutePromise:a,handlerOverride:o,scopedContext:s}){let c,l,u=Nn(e.method),d=u?`action`:`loader`,f=i=>{let a,c=new Promise((e,t)=>a=t);l=()=>a(),e.signal.addEventListener(`abort`,l);let u=a=>typeof i==`function`?i({request:e,unstable_url:ln(e,t),unstable_pattern:n,params:r.params,context:s},...a===void 0?[]:[a]):Promise.reject(Error(`You cannot call the handler for a route which defines a boolean "${d}" [routeId: ${r.route.id}]`)),f=(async()=>{try{return{type:`data`,result:await(o?o(e=>u(e)):u())}}catch(e){return{type:`error`,result:e}}})();return Promise.race([f,c])};try{let t=u?r.route.action:r.route.loader;if(i||a)if(t){let e,[n]=await Promise.all([f(t).catch(t=>{e=t}),i,a]);if(e!==void 0)throw e;c=n}else{await i;let t=u?r.route.action:r.route.loader;if(t)[c]=await Promise.all([f(t),a]);else if(d===`action`){let t=new URL(e.url),n=t.pathname+t.search;throw vn(405,{method:e.method,pathname:n,routeId:r.route.id})}else return{type:`data`,result:void 0}}else if(t)c=await f(t);else{let t=new URL(e.url);throw vn(404,{pathname:t.pathname+t.search})}}catch(e){return{type:`error`,result:e}}finally{l&&e.signal.removeEventListener(`abort`,l)}return c}async function nn(e){let t=e.headers.get(`Content-Type`);return t&&/\bapplication\/json\b/.test(t)?e.body==null?null:e.json():e.text()}async function rn(e){let{result:t,type:n}=e;if(kn(t)){let e;try{e=await nn(t)}catch(e){return{type:`error`,error:e}}return n===`error`?{type:`error`,error:new nt(t.status,t.statusText,e),statusCode:t.status,headers:t.headers}:{type:`data`,data:e,statusCode:t.status,headers:t.headers}}return n===`error`?On(t)?t.data instanceof Error?{type:`error`,error:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`error`,error:Sn(t),statusCode:rt(t)?t.status:void 0,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`error`,error:t,statusCode:rt(t)?t.status:void 0}:On(t)?{type:`data`,data:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`data`,data:t}}function an(e,t,n,r,i){let a=e.headers.get(`Location`);if(V(a,`Redirects returned/thrown from loaders/actions must have a Location header`),!Ue(a)){let o=r.slice(0,r.findIndex(e=>e.route.id===n)+1);a=Mt(new URL(t.url),o,i,a),e.headers.set(`Location`,a)}return e}var on=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function sn(e,t,n,r){if(Ue(e)){let r=e,i=r.startsWith(`//`)?new URL(t.protocol+r):new URL(r);if(on.includes(i.protocol))throw Error(`Invalid redirect location`);let a=Be(i.pathname,n)!=null;if(i.origin===t.origin&&a)return Xe(i.pathname)+i.search+i.hash}try{let t=r.createURL(e);if(on.includes(t.protocol))throw Error(`Invalid redirect location`)}catch{}return e}function cn(e,t,n,r){let i=e.createURL(bn(t)).toString(),a={signal:n};if(r&&Nn(r.formMethod)){let{formMethod:e,formEncType:t}=r;a.method=e.toUpperCase(),t===`application/json`?(a.headers=new Headers({"Content-Type":t}),a.body=JSON.stringify(r.json)):t===`text/plain`?a.body=r.text:t===`application/x-www-form-urlencoded`&&r.formData?a.body=un(r.formData):a.body=r.formData}return new Request(i,a)}function ln(e,t){let n=new URL(e.url),r=typeof t==`string`?le(t):t;if(n.pathname=r.pathname||`/`,r.search){let e=new URLSearchParams(r.search),t=e.getAll(`index`);e.delete(`index`);for(let n of t.filter(Boolean))e.append(`index`,n);n.search=e.size?`?${e.toString()}`:``}else n.search=``;return n.hash=r.hash||``,n}function un(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r==`string`?r:r.name);return t}function dn(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function fn(e,t,n,r=!1,i=!1){let a={},o=null,s,c=!1,l={},u=n&&En(n[1])?n[1].error:void 0;return e.forEach(n=>{if(!(n.route.id in t))return;let d=n.route.id,f=t[d];if(V(!Dn(f),`Cannot handle redirect results in processLoaderData`),En(f)){let t=f.error;if(u!==void 0&&(t=u,u=void 0),o||={},i)o[d]=t;else{let n=gn(e,d);o[n.route.id]??(o[n.route.id]=t)}r||(a[d]=kt),c||(c=!0,s=rt(f.error)?f.error.status:500),f.headers&&(l[d]=f.headers)}else a[d]=f.data,f.statusCode&&f.statusCode!==200&&!c&&(s=f.statusCode),f.headers&&(l[d]=f.headers)}),u!==void 0&&n&&(o={[n[0]]:u},n[2]&&(a[n[2]]=void 0)),{loaderData:a,errors:o,statusCode:s||200,loaderHeaders:l}}function pn(e,t,n,r,i,a){let{loaderData:o,errors:s}=fn(t,n,r);return i.filter(e=>!e.matches||e.matches.some(e=>e.shouldLoad)).forEach(t=>{let{key:n,match:r,controller:i}=t;if(i&&i.signal.aborted)return;let o=a[n];if(V(o,`Did not find corresponding fetcher result`),En(o)){let t=gn(e.matches,r?.route.id);s&&s[t.route.id]||(s={...s,[t.route.id]:o.error}),e.fetchers.delete(n)}else if(Dn(o))V(!1,`Unhandled fetcher revalidation redirect`);else{let t=Vn(o.data);e.fetchers.set(n,t)}}),{loaderData:o,errors:s}}function mn(e,t,n,r){let i=Object.entries(t).filter(([,e])=>e!==kt).reduce((e,[t,n])=>(e[t]=n,e),{});for(let a of n){let n=a.route.id;if(!t.hasOwnProperty(n)&&e.hasOwnProperty(n)&&a.route.loader&&(i[n]=e[n]),r&&r.hasOwnProperty(n))break}return i}function hn(e){return e?En(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function gn(e,t){return(t?e.slice(0,e.findIndex(e=>e.route.id===t)+1):[...e]).reverse().find(e=>e.route.hasErrorBoundary===!0)||e[0]}function _n(e){let t=e.length===1?e[0]:e.find(e=>e.index||!e.path||e.path===`/`)||{id:`__shim-error-route__`};return{matches:[{params:{},pathname:``,pathnameBase:``,route:t}],route:t}}function vn(e,{pathname:t,routeId:n,method:r,type:i,message:a}={}){let o=`Unknown Server Error`,s=`Unknown @remix-run/router error`;return e===400?(o=`Bad Request`,r&&t&&n?s=`You made a ${r} request to "${t}" but did not provide a \`loader\` for route "${n}", so there is no way to handle the request.`:i===`invalid-body`&&(s=`Unable to encode submission body`)):e===403?(o=`Forbidden`,s=`Route "${n}" does not match URL "${t}"`):e===404?(o=`Not Found`,s=`No route matches URL "${t}"`):e===405&&(o=`Method Not Allowed`,r&&t&&n?s=`You made a ${r.toUpperCase()} request to "${t}" but did not provide an \`action\` for route "${n}", so there is no way to handle the request.`:r&&(s=`Invalid request method "${r.toUpperCase()}"`)),new nt(e||500,o,Error(s),!0)}function yn(e){let t=Object.entries(e);for(let e=t.length-1;e>=0;e--){let[n,r]=t[e];if(Dn(r))return{key:n,result:r}}}function bn(e){return ce({...typeof e==`string`?le(e):e,hash:``})}function xn(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===``?t.hash!==``:e.hash===t.hash?!0:t.hash!==``}function Sn(e){return new nt(e.init?.status??500,e.init?.statusText??`Internal Server Error`,e.data)}function Cn(e){return typeof e==`object`&&!!e&&Object.entries(e).every(([e,t])=>typeof e==`string`&&wn(t))}function wn(e){return typeof e==`object`&&!!e&&`type`in e&&`result`in e&&(e.type===`data`||e.type===`error`)}function Tn(e){return kn(e.result)&&St.has(e.result.status)}function En(e){return e.type===`error`}function Dn(e){return(e&&e.type)===`redirect`}function On(e){return typeof e==`object`&&!!e&&`type`in e&&`data`in e&&`init`in e&&e.type===`DataWithResponseInit`}function kn(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.headers==`object`&&e.body!==void 0}function An(e){return St.has(e)}function jn(e){return kn(e)&&An(e.status)&&e.headers.has(`Location`)}function Mn(e){return xt.has(e.toUpperCase())}function Nn(e){return yt.has(e.toUpperCase())}function Pn(e){return new URLSearchParams(e).getAll(`index`).some(e=>e===``)}function Fn(e,t){let n=typeof t==`string`?le(t).search:t.search;if(e[e.length-1].route.index&&Pn(n||``))return e[e.length-1];let r=qe(e);return r[r.length-1]}function In(e){let{formMethod:t,formAction:n,formEncType:r,text:i,formData:a,json:o}=e;if(!(!t||!n||!r)){if(i!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:i};if(a!=null)return{formMethod:t,formAction:n,formEncType:r,formData:a,json:void 0,text:void 0};if(o!==void 0)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:o,text:void 0}}}function Ln(e,t){return t?{state:`loading`,location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}:{state:`loading`,location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function Rn(e,t){return{state:`submitting`,location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function zn(e,t){return e?{state:`loading`,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:`loading`,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function Bn(e,t){return{state:`submitting`,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function Vn(e){return{state:`idle`,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function Hn(e,t){try{let n=e.sessionStorage.getItem(Ot);if(n){let e=JSON.parse(n);for(let[n,r]of Object.entries(e||{}))r&&Array.isArray(r)&&t.set(n,new Set(r||[]))}}catch{}}function Un(e,t){if(t.size>0){let n={};for(let[e,r]of t)n[e]=[...r];try{e.sessionStorage.setItem(Ot,JSON.stringify(n))}catch(e){ie(!1,`Failed to save applied view transitions in sessionStorage (${e}).`)}}}function Wn(){let e,t,n=new Promise((r,i)=>{e=async e=>{r(e);try{await n}catch{}},t=async e=>{i(e);try{await n}catch{}}});return{promise:n,resolve:e,reject:t}}var Gn=v.createContext(null);Gn.displayName=`DataRouter`;var Kn=v.createContext(null);Kn.displayName=`DataRouterState`;var qn=v.createContext(!1);function Jn(){return v.useContext(qn)}var Yn=v.createContext({isTransitioning:!1});Yn.displayName=`ViewTransition`;var Xn=v.createContext(new Map);Xn.displayName=`Fetchers`;var Zn=v.createContext(null);Zn.displayName=`Await`;var Qn=v.createContext(null);Qn.displayName=`Navigation`;var $n=v.createContext(null);$n.displayName=`Location`;var er=v.createContext({outlet:null,matches:[],isDataRoute:!1});er.displayName=`Route`;var tr=v.createContext(null);tr.displayName=`RouteError`;var nr=`REACT_ROUTER_ERROR`,rr=`REDIRECT`,ir=`ROUTE_ERROR_RESPONSE`;function ar(e){if(e.startsWith(`${nr}:${rr}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function or(e){if(e.startsWith(`${nr}:${ir}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new nt(t.status,t.statusText,t.data)}catch{}}function sr(e,{relative:t}={}){V(cr(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=v.useContext(Qn),{hash:i,pathname:a,search:o}=_r(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:Ze([n,a])),r.createHref({pathname:s,search:o,hash:i})}function cr(){return v.useContext($n)!=null}function lr(){return V(cr(),`useLocation() may be used only in the context of a <Router> component.`),v.useContext($n).location}var ur=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function dr(e){v.useContext(Qn).static||v.useLayoutEffect(e)}function fr(){let{isDataRoute:e}=v.useContext(er);return e?Lr():pr()}function pr(){V(cr(),`useNavigate() may be used only in the context of a <Router> component.`);let e=v.useContext(Gn),{basename:t,navigator:n}=v.useContext(Qn),{matches:r}=v.useContext(er),{pathname:i}=lr(),a=JSON.stringify(Je(r)),o=v.useRef(!1);return dr(()=>{o.current=!0}),v.useCallback((r,s={})=>{if(ie(o.current,ur),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=Ye(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:Ze([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}var mr=v.createContext(null);function hr(e){let t=v.useContext(er).outlet;return v.useMemo(()=>t&&v.createElement(mr.Provider,{value:e},t),[t,e])}function gr(){let{matches:e}=v.useContext(er),t=e[e.length-1];return t?t.params:{}}function _r(e,{relative:t}={}){let{matches:n}=v.useContext(er),{pathname:r}=lr(),i=JSON.stringify(Je(n));return v.useMemo(()=>Ye(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function vr(e,t,n){V(cr(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=v.useContext(Qn),{matches:i}=v.useContext(er),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;zr(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
11
+
12
+ Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=lr(),d;if(t){let e=typeof t==`string`?le(t):t;V(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=xe(e,{pathname:p});ie(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),ie(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let h=Tr(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:Ze([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:Ze([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?v.createElement($n.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,unstable_mask:void 0,...d},navigationType:`POP`}},h):h}function yr(){let e=Pr(),t=rt(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=v.createElement(v.Fragment,null,v.createElement(`p`,null,`💿 Hey developer 👋`),v.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,v.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,v.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),v.createElement(v.Fragment,null,v.createElement(`h2`,null,`Unexpected Application Error!`),v.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?v.createElement(`pre`,{style:i},n):null,o)}var br=v.createElement(yr,null),xr=class extends v.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=or(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:v.createElement(er.Provider,{value:this.props.routeContext},v.createElement(tr.Provider,{value:e,children:this.props.component}));return this.context?v.createElement(Cr,{error:e},t):t}};xr.contextType=qn;var Sr=new WeakMap;function Cr({children:e,error:t}){let{basename:n}=v.useContext(Qn);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=ar(t.digest);if(e){let r=Sr.get(t);if(r)throw r;let i=ot(e.location,n);if(at&&!Sr.get(t))if(i.isExternal||e.reloadDocument)window.location.href=i.absoluteURL||i.to;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw Sr.set(t,n),n}return v.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${i.absoluteURL||i.to}`})}}return e}function wr({routeContext:e,match:t,children:n}){let r=v.useContext(Gn);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),v.createElement(er.Provider,{value:e},n)}function Tr(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);V(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},unstable_pattern:it(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||br,o&&(s<0&&c===0?(zr(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?v.createElement(n.route.Component,null):n.route.element?n.route.element:e,v.createElement(wr,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?v.createElement(xr,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function Er(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Dr(e){let t=v.useContext(Gn);return V(t,Er(e)),t}function Or(e){let t=v.useContext(Kn);return V(t,Er(e)),t}function kr(e){let t=v.useContext(er);return V(t,Er(e)),t}function Ar(e){let t=kr(e),n=t.matches[t.matches.length-1];return V(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function jr(){return Ar(`useRouteId`)}function Mr(){return Or(`useNavigation`).navigation}function Nr(){let{matches:e,loaderData:t}=Or(`useMatches`);return v.useMemo(()=>e.map(e=>Ce(e,t)),[e,t])}function Pr(){let e=v.useContext(tr),t=Or(`useRouteError`),n=Ar(`useRouteError`);return e===void 0?t.errors?.[n]:e}var Fr=0;function Ir(e){let{router:t,basename:n}=Dr(`useBlocker`),r=Or(`useBlocker`),[i,a]=v.useState(``),o=v.useCallback(t=>{if(typeof e!=`function`)return!!e;if(n===`/`)return e(t);let{currentLocation:r,nextLocation:i,historyAction:a}=t;return e({currentLocation:{...r,pathname:Be(r.pathname,n)||r.pathname},nextLocation:{...i,pathname:Be(i.pathname,n)||i.pathname},historyAction:a})},[n,e]);return v.useEffect(()=>{let e=String(++Fr);return a(e),()=>t.deleteBlocker(e)},[t]),v.useEffect(()=>{i!==``&&t.getBlocker(i,o)},[t,i,o]),i&&r.blockers.has(i)?r.blockers.get(i):Et}function Lr(){let{router:e}=Dr(`useNavigate`),t=Ar(`useNavigate`),n=v.useRef(!1);return dr(()=>{n.current=!0}),v.useCallback(async(r,i={})=>{ie(n.current,ur),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var Rr={};function zr(e,t,n){!t&&!Rr[e]&&(Rr[e]=!0,ie(!1,n))}var Br={};function Vr(e,t){!e&&!Br[t]&&(Br[t]=!0,console.warn(t))}var Hr=v.useOptimistic,Ur=()=>void 0;function Wr(e){return Hr?Hr(e):[e,Ur]}function Gr(e){let t={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(e.element&&ie(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(t,{element:v.createElement(e.Component),Component:void 0})),e.HydrateFallback&&(e.hydrateFallbackElement&&ie(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(t,{hydrateFallbackElement:v.createElement(e.HydrateFallback),HydrateFallback:void 0})),e.ErrorBoundary&&(e.errorElement&&ie(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(t,{errorElement:v.createElement(e.ErrorBoundary),ErrorBoundary:void 0})),t}var Kr=[`HydrateFallback`,`hydrateFallbackElement`],qr=class{constructor(){this.status=`pending`,this.promise=new Promise((e,t)=>{this.resolve=t=>{this.status===`pending`&&(this.status=`resolved`,e(t))},this.reject=e=>{this.status===`pending`&&(this.status=`rejected`,t(e))}})}};function Jr({router:e,flushSync:t,onError:n,unstable_useTransitions:r}){r=Jn()||r;let[i,a]=v.useState(e.state),[o,s]=Wr(i),[c,l]=v.useState(),[u,d]=v.useState({isTransitioning:!1}),[f,p]=v.useState(),[m,h]=v.useState(),[g,_]=v.useState(),y=v.useRef(new Map),b=v.useCallback((i,{deletedFetchers:o,newErrors:c,flushSync:u,viewTransitionOpts:g})=>{c&&n&&Object.values(c).forEach(e=>n(e,{location:i.location,params:i.matches[0]?.params??{},unstable_pattern:it(i.matches)})),i.fetchers.forEach((e,t)=>{e.data!==void 0&&y.current.set(t,e.data)}),o.forEach(e=>y.current.delete(e)),Vr(u===!1||t!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let b=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition==`function`;if(Vr(g==null||b,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!g||!b){t&&u?t(()=>a(i)):r===!1?a(i):v.startTransition(()=>{r===!0&&s(e=>Yr(e,i)),a(i)});return}if(t&&u){t(()=>{m&&(f?.resolve(),m.skipTransition()),d({isTransitioning:!0,flushSync:!0,currentLocation:g.currentLocation,nextLocation:g.nextLocation})});let n=e.window.document.startViewTransition(()=>{t(()=>a(i))});n.finished.finally(()=>{t(()=>{p(void 0),h(void 0),l(void 0),d({isTransitioning:!1})})}),t(()=>h(n));return}m?(f?.resolve(),m.skipTransition(),_({state:i,currentLocation:g.currentLocation,nextLocation:g.nextLocation})):(l(i),d({isTransitioning:!0,flushSync:!1,currentLocation:g.currentLocation,nextLocation:g.nextLocation}))},[e.window,t,m,f,r,s,n]);v.useLayoutEffect(()=>e.subscribe(b),[e,b]);let x=o.initialized;v.useLayoutEffect(()=>{!x&&e.state.initialized&&b(e.state,{deletedFetchers:[],flushSync:!1,newErrors:null})},[x,b,e.state]),v.useEffect(()=>{u.isTransitioning&&!u.flushSync&&p(new qr)},[u]),v.useEffect(()=>{if(f&&c&&e.window){let t=c,n=f.promise,i=e.window.document.startViewTransition(async()=>{r===!1?a(t):v.startTransition(()=>{r===!0&&s(e=>Yr(e,t)),a(t)}),await n});i.finished.finally(()=>{p(void 0),h(void 0),l(void 0),d({isTransitioning:!1})}),h(i)}},[c,f,e.window,r,s]),v.useEffect(()=>{f&&c&&o.location.key===c.location.key&&f.resolve()},[f,m,o.location,c]),v.useEffect(()=>{!u.isTransitioning&&g&&(l(g.state),d({isTransitioning:!0,flushSync:!1,currentLocation:g.currentLocation,nextLocation:g.nextLocation}),_(void 0))},[u.isTransitioning,g]);let S=v.useMemo(()=>({createHref:e.createHref,encodeLocation:e.encodeLocation,go:t=>e.navigate(t),push:(t,n,r)=>e.navigate(t,{state:n,preventScrollReset:r?.preventScrollReset}),replace:(t,n,r)=>e.navigate(t,{replace:!0,state:n,preventScrollReset:r?.preventScrollReset})}),[e]),C=e.basename||`/`,w=v.useMemo(()=>({router:e,navigator:S,static:!1,basename:C,onError:n}),[e,S,C,n]);return v.createElement(v.Fragment,null,v.createElement(Gn.Provider,{value:w},v.createElement(Kn.Provider,{value:o},v.createElement(Xn.Provider,{value:y.current},v.createElement(Yn.Provider,{value:u},v.createElement(ei,{basename:C,location:o.location,navigationType:o.historyAction,navigator:S,unstable_useTransitions:r},v.createElement(Xr,{routes:e.routes,future:e.future,state:o,isStatic:!1,onError:n})))))),null)}function Yr(e,t){return{...e,navigation:t.navigation.state===`idle`?e.navigation:t.navigation,revalidation:t.revalidation===`idle`?e.revalidation:t.revalidation,actionData:t.navigation.state===`submitting`?e.actionData:t.actionData,fetchers:t.fetchers}}var Xr=v.memo(Zr);function Zr({routes:e,future:t,state:n,isStatic:r,onError:i}){return vr(e,void 0,{state:n,isStatic:r,onError:i,future:t})}function Qr({to:e,replace:t,state:n,relative:r}){V(cr(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i}=v.useContext(Qn);ie(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:a}=v.useContext(er),{pathname:o}=lr(),s=fr(),c=Ye(e,Je(a),o,r===`path`),l=JSON.stringify(c);return v.useEffect(()=>{s(JSON.parse(l),{replace:t,state:n,relative:r})},[s,l,r,t,n]),null}function $r(e){return hr(e.context)}function ei({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,unstable_useTransitions:o}){V(!cr(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=v.useMemo(()=>({basename:s,navigator:i,static:a,unstable_useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=le(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,unstable_mask:m}=n,h=v.useMemo(()=>{let e=Be(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,unstable_mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return ie(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:v.createElement(Qn.Provider,{value:c},v.createElement($n.Provider,{children:t,value:h}))}v.Component;var ti=`get`,ni=`application/x-www-form-urlencoded`;function ri(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function ii(e){return ri(e)&&e.tagName.toLowerCase()===`button`}function ai(e){return ri(e)&&e.tagName.toLowerCase()===`form`}function oi(e){return ri(e)&&e.tagName.toLowerCase()===`input`}function si(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function ci(e,t){return e.button===0&&(!t||t===`_self`)&&!si(e)}function li(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function ui(e,t){let n=li(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var di=null;function fi(){if(di===null)try{new FormData(document.createElement(`form`),0),di=!1}catch{di=!0}return di}var pi=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function mi(e){return e!=null&&!pi.has(e)?(ie(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${ni}"`),null):e}function hi(e,t){let n,r,i,a,o;if(ai(e)){let o=e.getAttribute(`action`);r=o?Be(o,t):null,n=e.getAttribute(`method`)||ti,i=mi(e.getAttribute(`enctype`))||ni,a=new FormData(e)}else if(ii(e)||oi(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?Be(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||ti,i=mi(e.getAttribute(`formenctype`))||mi(o.getAttribute(`enctype`))||ni,a=new FormData(o,e),!fi()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(ri(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=ti,r=null,i=ni,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var gi={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},_i=/[&><\u2028\u2029]/g;function vi(e){return e.replace(_i,e=>gi[e])}function yi(e,t){if(e===!1||e==null)throw Error(t)}function bi(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n?i.pathname.endsWith(`/`)?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname===`/`?i.pathname=`_root.${r}`:t&&Be(i.pathname,t)===`/`?i.pathname=`${Qe(t)}/_root.${r}`:i.pathname=`${Qe(i.pathname)}.${r}`,i}async function xi(e,t){if(e.id in t)return t[e.id];try{let n=await L(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Si(e){return e!=null&&typeof e.page==`string`}function Ci(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function wi(e,t,n){return ki((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await xi(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(Ci).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function Ti(e,t,n,r,i,a){let o=(e,t)=>n[t]?e.route.id!==n[t].route.id:!0,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function Ei(e,t,{includeHydrateFallback:n}={}){return Di(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function Di(e){return[...new Set(e)]}function Oi(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function ki(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!Si(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(Oi(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function Ai(){let e=v.useContext(Gn);return yi(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function ji(){let e=v.useContext(Kn);return yi(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var Mi=v.createContext(void 0);Mi.displayName=`FrameworkContext`;function Ni(){let e=v.useContext(Mi);return yi(e,`You must render this element inside a <HydratedRouter> element`),e}function Pi(e,t){let n=v.useContext(Mi),[r,i]=v.useState(!1),[a,o]=v.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=v.useRef(null);v.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),v.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:Fi(s,p),onBlur:Fi(c,m),onMouseEnter:Fi(l,p),onMouseLeave:Fi(u,m),onTouchStart:Fi(d,p)}]:[a,f,{}]:[!1,f,{}]}function Fi(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Ii({page:e,...t}){let n=Jn(),{router:r}=Ai(),i=v.useMemo(()=>xe(r.routes,e,r.basename),[r.routes,e,r.basename]);return i?n?v.createElement(Ri,{page:e,matches:i,...t}):v.createElement(zi,{page:e,matches:i,...t}):null}function Li(e){let{manifest:t,routeModules:n}=Ni(),[r,i]=v.useState([]);return v.useEffect(()=>{let r=!1;return wi(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function Ri({page:e,matches:t,...n}){let r=lr(),{future:i}=Ni(),{basename:a}=Ai(),o=v.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=bi(e,a,i.unstable_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.unstable_trailingSlashAwareDataRequests,e,r,t]);return v.createElement(v.Fragment,null,o.map(e=>v.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function zi({page:e,matches:t,...n}){let r=lr(),{future:i,manifest:a,routeModules:o}=Ni(),{basename:s}=Ai(),{loaderData:c,matches:l}=ji(),u=v.useMemo(()=>Ti(e,t,l,a,r,`data`),[e,t,l,a,r]),d=v.useMemo(()=>Ti(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=v.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];!t||!t.hasLoader||(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=bi(e,s,i.unstable_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.unstable_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=v.useMemo(()=>Ei(d,a),[d,a]),m=Li(d);return v.createElement(v.Fragment,null,f.map(e=>v.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>v.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>v.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function Bi(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}v.Component;var Vi=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{Vi&&(window.__reactRouterVersion=`7.14.1`)}catch{}function Hi(e,t){return At({basename:t?.basename,getContext:t?.getContext,future:t?.future,history:re({window:t?.window}),hydrationData:t?.hydrationData||Ui(),routes:e,mapRouteProperties:Gr,hydrationRouteProperties:Kr,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window,unstable_instrumentations:t?.unstable_instrumentations}).initialize()}function Ui(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:Wi(e.errors)}),e}function Wi(e){if(!e)return null;let t=Object.entries(e),n={};for(let[e,r]of t)if(r&&r.__type===`RouteErrorResponse`)n[e]=new nt(r.status,r.statusText,r.data,r.internal===!0);else if(r&&r.__type===`Error`){if(r.__subType){let t=window[r.__subType];if(typeof t==`function`)try{let i=new t(r.message);i.stack=``,n[e]=i}catch{}}if(n[e]==null){let t=Error(r.message);t.stack=``,n[e]=t}}else n[e]=r;return n}function Gi({basename:e,children:t,history:n,unstable_useTransitions:r}){let[i,a]=v.useState({action:n.action,location:n.location}),o=v.useCallback(e=>{r===!1?a(e):v.startTransition(()=>a(e))},[r]);return v.useLayoutEffect(()=>n.listen(o),[n,o]),v.createElement(ei,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,unstable_useTransitions:r})}Gi.displayName=`unstable_HistoryRouter`;var Ki=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,qi=v.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,unstable_mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,unstable_useTransitions:_}=v.useContext(Qn),y=typeof l==`string`&&Ki.test(l),b=ot(l,h);l=b.to;let x=sr(l,{relative:r}),S=lr(),C=null;if(o){let e=Ye(o,[],S.unstable_mask?S.unstable_mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:Ze([h,e.pathname])),C=g.createHref(e)}let[w,T,E]=Pi(n,p),D=ea(l,{replace:a,unstable_mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,unstable_defaultShouldRevalidate:f,unstable_useTransitions:_});function O(t){e&&e(t),t.defaultPrevented||D(t)}let k=!(b.isExternal||i),A=v.createElement(`a`,{...p,...E,href:(k?C:void 0)||b.absoluteURL||x,onClick:k?O:e,ref:Bi(m,T),target:c,"data-discover":!y&&t===`render`?`true`:void 0});return w&&!y?v.createElement(v.Fragment,null,A,v.createElement(Ii,{page:x})):A});qi.displayName=`Link`;var Ji=v.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=_r(a,{relative:c.relative}),d=lr(),f=v.useContext(Kn),{navigator:p,basename:m}=v.useContext(Qn),h=f!=null&&da(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,y=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),y=y?y.toLowerCase():null,g=g.toLowerCase()),y&&m&&(y=Be(y,m)||y);let b=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,x=_===g||!r&&_.startsWith(g)&&_.charAt(b)===`/`,S=y!=null&&(y===g||!r&&y.startsWith(g)&&y.charAt(g.length)===`/`),C={isActive:x,isPending:S,isTransitioning:h},w=x?e:void 0,T;T=typeof n==`function`?n(C):[n,x?`active`:null,S?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let E=typeof i==`function`?i(C):i;return v.createElement(qi,{...c,"aria-current":w,className:T,ref:l,style:E,to:a,viewTransition:o},typeof s==`function`?s(C):s)});Ji.displayName=`NavLink`;var Yi=v.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=ti,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f,...p},m)=>{let{unstable_useTransitions:h}=v.useContext(Qn),g=ia(),_=aa(s,{relative:l}),y=o.toLowerCase()===`get`?`get`:`post`,b=typeof s==`string`&&Ki.test(s);return v.createElement(`form`,{ref:m,method:y,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f});h&&n!==!1?v.startTransition(()=>p()):p()},...p,"data-discover":!b&&e===`render`?`true`:void 0})});Yi.displayName=`Form`;function Xi({getKey:e,storageKey:t,...n}){let r=v.useContext(Mi),{basename:i}=v.useContext(Qn),a=lr(),o=Nr();la({getKey:e,storageKey:t});let s=v.useMemo(()=>{if(!r||!e)return null;let t=ca(a,o,i,e);return t===a.key?null:t},[]);if(!r||r.isSpaMode)return null;let c=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return v.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${vi(JSON.stringify(t||oa))}, ${vi(JSON.stringify(s))})`}})}Xi.displayName=`ScrollRestoration`;function Zi(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Qi(e){let t=v.useContext(Gn);return V(t,Zi(e)),t}function $i(e){let t=v.useContext(Kn);return V(t,Zi(e)),t}function ea(e,{target:t,replace:n,unstable_mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,unstable_defaultShouldRevalidate:c,unstable_useTransitions:l}={}){let u=fr(),d=lr(),f=_r(e,{relative:o});return v.useCallback(p=>{if(ci(p,t)){p.preventDefault();let t=n===void 0?ce(d)===ce(f):n,m=()=>u(e,{replace:t,unstable_mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,unstable_defaultShouldRevalidate:c});l?v.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}function ta(e){ie(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=v.useRef(li(e)),n=v.useRef(!1),r=lr(),i=v.useMemo(()=>ui(r.search,n.current?null:t.current),[r.search]),a=fr();return[i,v.useCallback((e,t)=>{let r=li(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var na=0,ra=()=>`__${String(++na)}__`;function ia(){let{router:e}=Qi(`useSubmit`),{basename:t}=v.useContext(Qn),n=jr(),r=e.fetch,i=e.navigate;return v.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=hi(e,t);a.navigate===!1?await r(a.fetcherKey||ra(),n,a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function aa(e,{relative:t}={}){let{basename:n}=v.useContext(Qn),r=v.useContext(er);V(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={..._r(e||`.`,{relative:t})},o=lr();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:Ze([n,a.pathname])),ce(a)}var oa=`react-router-scroll-positions`,sa={};function ca(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:Be(e.pathname,n)||e.pathname},t)),i??=e.key,i}function la({getKey:e,storageKey:t}={}){let{router:n}=Qi(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=$i(`useScrollRestoration`),{basename:a}=v.useContext(Qn),o=lr(),s=Nr(),c=Mr();v.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),ua(v.useCallback(()=>{if(c.state===`idle`){let t=ca(o,s,a,e);sa[t]=window.scrollY}try{sessionStorage.setItem(t||oa,JSON.stringify(sa))}catch(e){ie(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[c.state,e,a,o,s,t])),typeof document<`u`&&(v.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||oa);e&&(sa=JSON.parse(e))}catch{}},[t]),v.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(sa,()=>window.scrollY,e?(t,n)=>ca(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),v.useLayoutEffect(()=>{if(r!==!1){if(typeof r==`number`){window.scrollTo(0,r);return}try{if(o.hash){let e=document.getElementById(decodeURIComponent(o.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{ie(!1,`"${o.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[o,r,i]))}function ua(e,t){let{capture:n}=t||{};v.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function da(e,{relative:t}={}){let n=v.useContext(Yn);V(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Qi(`useViewTransitionState`),i=_r(e,{relative:t});if(!n.isTransitioning)return!1;let a=Be(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=Be(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Le(i.pathname,o)!=null||Le(i.pathname,a)!=null}function fa(e){return v.createElement(Jr,{flushSync:N.flushSync,...e})}var pa=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),H=o(((e,t)=>{t.exports=pa()}))();function ma(e,t){switch(t.type){case`LOGIN`:return{user:t.payload.user,status:`authenticated`};case`LOGOUT`:return{user:null,status:`unauthenticated`};case`UPDATE_USER`:return{...e,user:e.user?{...e.user,...t.payload}:null}}}var ha=(0,v.createContext)(null);function ga({children:e}){let[t,n]=(0,v.useReducer)(ma,{user:null,status:`idle`});(0,v.useEffect)(()=>{fetch(`/cms/admin/users/me`,{credentials:`include`}).then(e=>e.ok?e.json():null).then(e=>{if(!e){n({type:`LOGOUT`});return}n({type:`LOGIN`,payload:{user:{id:e.id,email:e.email,role:e.role??e.role_name??`unknown`,permissions:e.permissions??[],firstName:e.first_name??null,lastName:e.last_name??null,avatarUrl:e.avatar_url??null,jobTitle:e.job_title??null,organization:e.organization??null,country:e.country??null,twoFactorEnabled:e.two_factor_enabled??!1,enabled:e.enabled??!0,modes:{editorial:!!e.modes?.editorial}}}})}).catch(()=>n({type:`LOGOUT`}))},[]);function r(e){n({type:`LOGIN`,payload:{user:e}})}function i(){fetch(`/cms/auth/logout`,{method:`POST`,credentials:`include`}).catch(()=>{}),n({type:`LOGOUT`})}function a(e){n({type:`UPDATE_USER`,payload:e})}return(0,H.jsx)(ha.Provider,{value:{...t,login:r,logout:i,updateUser:a},children:e})}function _a(){let e=(0,v.useContext)(ha);if(!e)throw Error(`useAuth must be used inside AuthProvider`);return e}var va=(0,v.createContext)({shortcuts:[],register:()=>()=>{}});function ya({children:e}){let[t,n]=(0,v.useState)([]),r=(0,v.useCallback)((e,t)=>{let r={combo:e,label:t};return n(e=>[...e,r]),()=>n(e=>e.filter(e=>e!==r))},[]);return(0,H.jsx)(va.Provider,{value:{shortcuts:t,register:r},children:e})}var ba=(0,v.createContext)({timezone:`UTC`,locales:[`en`],defaultLocale:`en`,editorialMode:!1,refreshSettings:()=>{}});function xa({children:e}){let{status:t}=_a(),[n,r]=(0,v.useState)(`UTC`),[i,a]=(0,v.useState)([`en`]),[o,s]=(0,v.useState)(`en`),[c,l]=(0,v.useState)(!1),u=(0,v.useCallback)(()=>{t===`authenticated`&&(fetch(`/cms/admin/modes`,{credentials:`include`}).then(e=>e.ok?e.json():null).then(e=>{e&&l(!!e.editorial)}).catch(()=>{}),fetch(`/cms/admin/client-settings`,{credentials:`include`}).then(e=>e.ok?e.json():null).then(e=>{e?.timezone&&r(e.timezone);try{if(e?.locales){let t=[];try{t=JSON.parse(e.locales)}catch{t=(e.locales||``).split(`,`).map(e=>e.trim()).filter(Boolean)}t.length&&a(t)}}catch{}e?.default_locale&&s(e.default_locale)}).catch(()=>{}))},[t]);return(0,v.useEffect)(()=>{if(t!==`authenticated`){l(!1);return}u()},[t,u]),(0,H.jsx)(ba.Provider,{value:{timezone:n,locales:i,defaultLocale:o,editorialMode:c,refreshSettings:u},children:e})}function Sa(){return(0,v.useContext)(ba)}var Ca=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),wa=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),Ta=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Ea=e=>{let t=Ta(e);return t.charAt(0).toUpperCase()+t.slice(1)},Da={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`},Oa=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},ka=(0,v.createContext)({}),Aa=()=>(0,v.useContext)(ka),ja=(0,v.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=Aa()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,v.createElement)(`svg`,{ref:c,...Da,width:t??l??Da.width,height:t??l??Da.height,stroke:e??f,strokeWidth:m,className:Ca(`lucide`,p,i),...!a&&!Oa(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,v.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),U=(e,t)=>{let n=(0,v.forwardRef)(({className:n,...r},i)=>(0,v.createElement)(ja,{ref:i,iconNode:t,className:Ca(`lucide-${wa(Ea(e))}`,`lucide-${e}`,n),...r}));return n.displayName=Ea(e),n},Ma=U(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),Na=U(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),Pa=U(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),Fa=U(`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`}]]),Ia=U(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),La=U(`calendar-clock`,[[`path`,{d:`M16 14v2.2l1.6 1`,key:`fo4ql5`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),Ra=U(`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`}]]),za=U(`camera`,[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]),Ba=U(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Va=U(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Ha=U(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Ua=U(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Wa=U(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Ga=U(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),Ka=U(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),qa=U(`circle-minus`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}]]),Ja=U(`circle-plus`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`M12 8v8`,key:`napkw2`}]]),Ya=U(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Xa=U(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),Za=U(`columns-3-cog`,[[`path`,{d:`M10.5 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v5.5`,key:`1g2yzs`}],[`path`,{d:`m14.3 19.6 1-.4`,key:`11sv9r`}],[`path`,{d:`M15 3v7.5`,key:`7lm50a`}],[`path`,{d:`m15.2 16.9-.9-.3`,key:`1t7mvx`}],[`path`,{d:`m16.6 21.7.3-.9`,key:`1j67ps`}],[`path`,{d:`m16.8 15.3-.4-1`,key:`1ei7r6`}],[`path`,{d:`m19.1 15.2.3-.9`,key:`18r7jp`}],[`path`,{d:`m19.6 21.7-.4-1`,key:`z2vh2`}],[`path`,{d:`m20.7 16.8 1-.4`,key:`19m87a`}],[`path`,{d:`m21.7 19.4-.9-.3`,key:`1qgwi9`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}]]),Qa=U(`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`}]]),$a=U(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),eo=U(`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`}]]),to=U(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),no=U(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),ro=U(`file-headphone`,[[`path`,{d:`M4 6.835V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-.343`,key:`1vfytu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M2 19a2 2 0 0 1 4 0v1a2 2 0 0 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 0 1-4 0v-1a2 2 0 0 1 4 0`,key:`1etmh7`}]]),io=U(`file-play`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z`,key:`1tzo1f`}]]),ao=U(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),oo=U(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),so=U(`fingerprint-pattern`,[[`path`,{d:`M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4`,key:`1nerag`}],[`path`,{d:`M14 13.12c0 2.38 0 6.38-1 8.88`,key:`o46ks0`}],[`path`,{d:`M17.29 21.02c.12-.6.43-2.3.5-3.02`,key:`ptglia`}],[`path`,{d:`M2 12a10 10 0 0 1 18-6`,key:`ydlgp0`}],[`path`,{d:`M2 16h.01`,key:`1gqxmh`}],[`path`,{d:`M21.8 16c.2-2 .131-5.354 0-6`,key:`drycrb`}],[`path`,{d:`M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2`,key:`1tidbn`}],[`path`,{d:`M8.65 22c.21-.66.45-1.32.57-2`,key:`13wd9y`}],[`path`,{d:`M9 6.8a6 6 0 0 1 9 5.2v2`,key:`1fr1j5`}]]),co=U(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),lo=U(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`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`}]]),uo=U(`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`}]]),fo=U(`grip-vertical`,[[`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`}]]),po=U(`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`}]]),mo=U(`heading-1`,[[`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`}]]),ho=U(`heading-2`,[[`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`}]]),go=U(`heading-3`,[[`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`}]]),_o=U(`house`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`r6nss1`}]]),vo=U(`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`}]]),yo=U(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),bo=U(`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`}]]),xo=U(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),So=U(`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:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),Co=U(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),wo=U(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),To=U(`layout-list`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}],[`path`,{d:`M14 4h7`,key:`3xa0d5`}],[`path`,{d:`M14 9h7`,key:`1icrd9`}],[`path`,{d:`M14 15h7`,key:`1mj8o2`}],[`path`,{d:`M14 20h7`,key:`11slyb`}]]),Eo=U(`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`}]]),Do=U(`list-ordered`,[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]),Oo=U(`list-tree`,[[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`M3 10a2 2 0 0 0 2 2h3`,key:`1npucw`}],[`path`,{d:`M3 5v12a2 2 0 0 0 2 2h3`,key:`x1gjn2`}]]),ko=U(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),Ao=U(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),jo=U(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),Mo=U(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),No=U(`octagon-x`,[[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z`,key:`2d38gg`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),Po=U(`package-check`,[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`m16 17 2 2 4-4`,key:`uh5qu3`}],[`path`,{d:`M21 11.127V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.32-.753`,key:`kpkbpo`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]),Fo=U(`package-open`,[[`path`,{d:`M12 22v-9`,key:`x3hkom`}],[`path`,{d:`M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z`,key:`2ntwy6`}],[`path`,{d:`M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13`,key:`1pmm1c`}],[`path`,{d:`M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z`,key:`12ttoo`}]]),Io=U(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),Lo=U(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Ro=U(`puzzle`,[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]),zo=U(`quote`,[[`path`,{d:`M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`rib7q0`}],[`path`,{d:`M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`1ymkrd`}]]),Bo=U(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Vo=U(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),Ho=U(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),Uo=U(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),Wo=U(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),Go=U(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),Ko=U(`square-code`,[[`path`,{d:`m10 9-3 3 3 3`,key:`1oro0q`}],[`path`,{d:`m14 15 3-3-3-3`,key:`bz13h7`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]),qo=U(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),Jo=U(`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`}]]),Yo=U(`text-align-start`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M17 19H3`,key:`z6ezky`}]]),Xo=U(`text-wrap`,[[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M3 12h14.5a1 1 0 0 1 0 7H13`,key:`18xa6z`}],[`path`,{d:`M3 19h6`,key:`1ygdsz`}],[`path`,{d:`M3 5h18`,key:`1u36vt`}]]),Zo=U(`toggle-left`,[[`circle`,{cx:`9`,cy:`12`,r:`3`,key:`u3jwor`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`7`,key:`g7kal2`}]]),Qo=U(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),$o=U(`triangle-alert`,[[`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`}]]),es=U(`type`,[[`path`,{d:`M12 4v16`,key:`1654pz`}],[`path`,{d:`M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2`,key:`e0r10z`}],[`path`,{d:`M9 20h6`,key:`s66wpe`}]]),ts=U(`underline`,[[`path`,{d:`M6 4v6a6 6 0 0 0 12 0V4`,key:`9kb039`}],[`line`,{x1:`4`,x2:`20`,y1:`20`,y2:`20`,key:`nun2al`}]]),ns=U(`unlink-2`,[[`path`,{d:`M15 7h2a5 5 0 0 1 0 10h-2m-6 0H7A5 5 0 0 1 7 7h2`,key:`1re2ne`}]]),rs=U(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),is=U(`user-round`,[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]]),as=U(`users-round`,[[`path`,{d:`M18 21a8 8 0 0 0-16 0`,key:`3ypg7q`}],[`circle`,{cx:`10`,cy:`8`,r:`5`,key:`o932ke`}],[`path`,{d:`M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3`,key:`10s06x`}]]),ss=U(`webhook`,[[`path`,{d:`M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2`,key:`q3hayz`}],[`path`,{d:`m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06`,key:`1go1hn`}],[`path`,{d:`m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8`,key:`qlwsc0`}]]),cs=U(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),ls=(0,v.createContext)(null);function us({children:e}){let[t,n]=(0,v.useState)(null);return(0,H.jsx)(ls.Provider,{value:{content:t,setContent:n},children:e})}function ds(){let e=(0,v.useContext)(ls);if(!e)throw Error(`useSecondaryPanelContext must be used within SecondaryPanelProvider`);return e}function fs({children:e}){let{content:t}=ds();return(0,H.jsx)(`div`,{className:`bg-background fixed top-0 z-50 px-4 pt-4 h-18 left-14 ${t?`right-64`:`right-0`}`,children:e})}function ps(e,t){let[n,r]=(0,v.useState)({data:null,loading:!!e,error:null}),i=(0,v.useCallback)(()=>{if(!e){r({data:null,loading:!1,error:null});return}r({data:null,loading:!0,error:null});let n={"Content-Type":`application/json`,...t?.headers};fetch(e,{...t,credentials:`include`,headers:n}).then(e=>{if(!e.ok)throw Error(`${e.status} ${e.statusText}`);return e.json()}).then(e=>r({data:e,loading:!1,error:null})).catch(e=>{r({data:null,loading:!1,error:e instanceof Error?e.message:`Unknown error`})})},[e,t]);return(0,v.useEffect)(()=>{i()},[i]),{...n,refetch:i}}function ms(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function hs(...e){return t=>{let n=!1,r=e.map(e=>{let r=ms(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():ms(e[t],null)}}}}function gs(...e){return v.useCallback(hs(...e),e)}var _s=Symbol.for(`react.lazy`),vs=v.use;function ys(e){return typeof e==`object`&&!!e&&`then`in e}function bs(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===_s&&`_payload`in e&&ys(e._payload)}function xs(e){let t=Cs(e),n=v.forwardRef((e,n)=>{let{children:r,...i}=e;bs(r)&&typeof vs==`function`&&(r=vs(r._payload));let a=v.Children.toArray(r),o=a.find(Ts);if(o){let e=o.props.children,r=a.map(t=>t===o?v.Children.count(e)>1?v.Children.only(null):v.isValidElement(e)?e.props.children:null:t);return(0,H.jsx)(t,{...i,ref:n,children:v.isValidElement(e)?v.cloneElement(e,void 0,r):null})}return(0,H.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}var Ss=xs(`Slot`);function Cs(e){let t=v.forwardRef((e,t)=>{let{children:n,...r}=e;if(bs(n)&&typeof vs==`function`&&(n=vs(n._payload)),v.isValidElement(n)){let e=Ds(n),i=Es(r,n.props);return n.type!==v.Fragment&&(i.ref=t?hs(t,e):e),v.cloneElement(n,i)}return v.Children.count(n)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ws=Symbol(`radix.slottable`);function Ts(e){return v.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===ws}function Es(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Ds(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Os(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Os(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function ks(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Os(e))&&(r&&(r+=` `),r+=t);return r}var As=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,js=ks,Ms=(e,t)=>n=>{if(t?.variants==null)return js(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=As(t)||As(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return js(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},Ns=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},Ps=(e,t)=>({classGroupId:e,validator:t}),Fs=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Is=`-`,Ls=[],Rs=`arbitrary..`,zs=e=>{let t=Hs(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return Vs(e);let n=e.split(Is);return Bs(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?Ns(i,t):t:i||Ls}return n[e]||Ls}}},Bs=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=Bs(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(Is):e.slice(t).join(Is),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},Vs=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?Rs+r:void 0})(),Hs=e=>{let{theme:t,classGroups:n}=e;return Us(n,t)},Us=(e,t)=>{let n=Fs();for(let r in e){let i=e[r];Ws(i,n,r,t)}return n},Ws=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];Gs(i,t,n,r)}},Gs=(e,t,n,r)=>{if(typeof e==`string`){Ks(e,t,n);return}if(typeof e==`function`){qs(e,t,n,r);return}Js(e,t,n,r)},Ks=(e,t,n)=>{let r=e===``?t:Ys(t,e);r.classGroupId=n},qs=(e,t,n,r)=>{if(Xs(e)){Ws(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Ps(n,e))},Js=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];Ws(o,Ys(t,a),n,r)}},Ys=(e,t)=>{let n=e,r=t.split(Is),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=Fs(),n.nextPart.set(t,i)),n=i}return n},Xs=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,Zs=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},Qs=`!`,$s=`:`,ec=[],tc=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),nc=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===$s){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(Qs)?(c=s.slice(0,-1),l=!0):s.startsWith(Qs)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return tc(t,l,c,u)};if(t){let e=t+$s,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):tc(ec,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},rc=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},ic=e=>({cache:Zs(e.cacheSize),parseClassName:nc(e),sortModifiers:rc(e),...zs(e)}),ac=/\s+/,oc=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(ac),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+Qs:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e<y.length;++e){let t=y[e];o.push(_+t)}c=t+(c.length>0?` `+c:c)}return c},sc=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=cc(n))&&(i&&(i+=` `),i+=r);return i},cc=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=cc(e[r]))&&(n&&(n+=` `),n+=t);return n},lc=(e,...t)=>{let n,r,i,a,o=o=>(n=ic(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=oc(e,n);return i(e,a),a};return a=o,(...e)=>a(sc(...e))},uc=[],dc=e=>{let t=t=>t[e]||uc;return t.isThemeGetter=!0,t},fc=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,pc=/^\((?:(\w[\w-]*):)?(.+)\)$/i,mc=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,hc=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,gc=/\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$/,_c=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,vc=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,yc=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,bc=e=>mc.test(e),xc=e=>!!e&&!Number.isNaN(Number(e)),Sc=e=>!!e&&Number.isInteger(Number(e)),Cc=e=>e.endsWith(`%`)&&xc(e.slice(0,-1)),wc=e=>hc.test(e),Tc=()=>!0,Ec=e=>gc.test(e)&&!_c.test(e),Dc=()=>!1,Oc=e=>vc.test(e),kc=e=>yc.test(e),Ac=e=>!W(e)&&!G(e),jc=e=>Kc(e,Xc,Dc),W=e=>fc.test(e),Mc=e=>Kc(e,Zc,Ec),Nc=e=>Kc(e,Qc,xc),Pc=e=>Kc(e,el,Tc),Fc=e=>Kc(e,$c,Dc),Ic=e=>Kc(e,Jc,Dc),Lc=e=>Kc(e,Yc,kc),Rc=e=>Kc(e,tl,Oc),G=e=>pc.test(e),zc=e=>qc(e,Zc),Bc=e=>qc(e,$c),Vc=e=>qc(e,Jc),Hc=e=>qc(e,Xc),Uc=e=>qc(e,Yc),Wc=e=>qc(e,tl,!0),Gc=e=>qc(e,el,!0),Kc=(e,t,n)=>{let r=fc.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},qc=(e,t,n=!1)=>{let r=pc.exec(e);return r?r[1]?t(r[1]):n:!1},Jc=e=>e===`position`||e===`percentage`,Yc=e=>e===`image`||e===`url`,Xc=e=>e===`length`||e===`size`||e===`bg-size`,Zc=e=>e===`length`,Qc=e=>e===`number`,$c=e=>e===`family-name`,el=e=>e===`number`||e===`weight`,tl=e=>e===`shadow`,nl=lc(()=>{let e=dc(`color`),t=dc(`font`),n=dc(`text`),r=dc(`font-weight`),i=dc(`tracking`),a=dc(`leading`),o=dc(`breakpoint`),s=dc(`container`),c=dc(`spacing`),l=dc(`radius`),u=dc(`shadow`),d=dc(`inset-shadow`),f=dc(`text-shadow`),p=dc(`drop-shadow`),m=dc(`blur`),h=dc(`perspective`),g=dc(`aspect`),_=dc(`ease`),v=dc(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),G,W],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[G,W,c],T=()=>[bc,`full`,`auto`,...w()],E=()=>[Sc,`none`,`subgrid`,G,W],D=()=>[`auto`,{span:[`full`,Sc,G,W]},Sc,G,W],O=()=>[Sc,`auto`,G,W],k=()=>[`auto`,`min`,`max`,`fr`,G,W],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[bc,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[bc,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],F=()=>[bc,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],I=()=>[e,G,W],L=()=>[...b(),Vc,Ic,{position:[G,W]}],R=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ee=()=>[`auto`,`cover`,`contain`,Hc,jc,{size:[G,W]}],te=()=>[Cc,zc,Mc],ne=()=>[``,`none`,`full`,l,G,W],z=()=>[``,xc,zc,Mc],B=()=>[`solid`,`dashed`,`dotted`,`double`],re=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],V=()=>[xc,Cc,Vc,Ic],ie=()=>[``,`none`,m,G,W],ae=()=>[`none`,xc,G,W],oe=()=>[`none`,xc,G,W],se=()=>[xc,G,W],ce=()=>[bc,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[wc],breakpoint:[wc],color:[Tc],container:[wc],"drop-shadow":[wc],ease:[`in`,`out`,`in-out`],font:[Ac],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[wc],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[wc],shadow:[wc],spacing:[`px`,xc],text:[wc],"text-shadow":[wc],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,bc,W,G,g]}],container:[`container`],columns:[{columns:[xc,W,G,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"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`],sr:[`sr-only`,`not-sr-only`],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:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[Sc,`auto`,G,W]}],basis:[{basis:[bc,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[xc,bc,`auto`,`initial`,`none`,W]}],grow:[{grow:[``,xc,G,W]}],shrink:[{shrink:[``,xc,G,W]}],order:[{order:[Sc,`first`,`last`,`none`,G,W]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],"inline-size":[{inline:[`auto`,...P()]}],"min-inline-size":[{"min-inline":[`auto`,...P()]}],"max-inline-size":[{"max-inline":[`none`,...P()]}],"block-size":[{block:[`auto`,...F()]}],"min-block-size":[{"min-block":[`auto`,...F()]}],"max-block-size":[{"max-block":[`none`,...F()]}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,...N()]}],"font-size":[{text:[`base`,n,zc,Mc]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Gc,Pc]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Cc,W]}],"font-family":[{font:[Bc,Fc,t]}],"font-features":[{"font-features":[W]}],"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:[i,G,W]}],"line-clamp":[{"line-clamp":[xc,`none`,G,Nc]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,G,W]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,G,W]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...B(),`wavy`]}],"text-decoration-thickness":[{decoration:[xc,`from-font`,`auto`,G,Mc]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[xc,`auto`,G,W]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,G,W]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,G,W]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:R()}],"bg-size":[{bg:ee()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Sc,G,W],radial:[``,G,W],conic:[Sc,G,W]},Uc,Lc]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:te()}],"gradient-via-pos":[{via:te()}],"gradient-to-pos":[{to:te()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:ne()}],"rounded-s":[{"rounded-s":ne()}],"rounded-e":[{"rounded-e":ne()}],"rounded-t":[{"rounded-t":ne()}],"rounded-r":[{"rounded-r":ne()}],"rounded-b":[{"rounded-b":ne()}],"rounded-l":[{"rounded-l":ne()}],"rounded-ss":[{"rounded-ss":ne()}],"rounded-se":[{"rounded-se":ne()}],"rounded-ee":[{"rounded-ee":ne()}],"rounded-es":[{"rounded-es":ne()}],"rounded-tl":[{"rounded-tl":ne()}],"rounded-tr":[{"rounded-tr":ne()}],"rounded-br":[{"rounded-br":ne()}],"rounded-bl":[{"rounded-bl":ne()}],"border-w":[{border:z()}],"border-w-x":[{"border-x":z()}],"border-w-y":[{"border-y":z()}],"border-w-s":[{"border-s":z()}],"border-w-e":[{"border-e":z()}],"border-w-bs":[{"border-bs":z()}],"border-w-be":[{"border-be":z()}],"border-w-t":[{"border-t":z()}],"border-w-r":[{"border-r":z()}],"border-w-b":[{"border-b":z()}],"border-w-l":[{"border-l":z()}],"divide-x":[{"divide-x":z()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":z()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...B(),`hidden`,`none`]}],"divide-style":[{divide:[...B(),`hidden`,`none`]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...B(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[xc,G,W]}],"outline-w":[{outline:[``,xc,zc,Mc]}],"outline-color":[{outline:I()}],shadow:[{shadow:[``,`none`,u,Wc,Rc]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":[`none`,d,Wc,Rc]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:z()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[xc,Mc]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":z()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":[`none`,f,Wc,Rc]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[xc,G,W]}],"mix-blend":[{"mix-blend":[...re(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":re()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[xc]}],"mask-image-linear-from-pos":[{"mask-linear-from":V()}],"mask-image-linear-to-pos":[{"mask-linear-to":V()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":V()}],"mask-image-t-to-pos":[{"mask-t-to":V()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":V()}],"mask-image-r-to-pos":[{"mask-r-to":V()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":V()}],"mask-image-b-to-pos":[{"mask-b-to":V()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":V()}],"mask-image-l-to-pos":[{"mask-l-to":V()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":V()}],"mask-image-x-to-pos":[{"mask-x-to":V()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":V()}],"mask-image-y-to-pos":[{"mask-y-to":V()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[G,W]}],"mask-image-radial-from-pos":[{"mask-radial-from":V()}],"mask-image-radial-to-pos":[{"mask-radial-to":V()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[xc]}],"mask-image-conic-from-pos":[{"mask-conic-from":V()}],"mask-image-conic-to-pos":[{"mask-conic-to":V()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:R()}],"mask-size":[{mask:ee()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,G,W]}],filter:[{filter:[``,`none`,G,W]}],blur:[{blur:ie()}],brightness:[{brightness:[xc,G,W]}],contrast:[{contrast:[xc,G,W]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,Wc,Rc]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:[``,xc,G,W]}],"hue-rotate":[{"hue-rotate":[xc,G,W]}],invert:[{invert:[``,xc,G,W]}],saturate:[{saturate:[xc,G,W]}],sepia:[{sepia:[``,xc,G,W]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,G,W]}],"backdrop-blur":[{"backdrop-blur":ie()}],"backdrop-brightness":[{"backdrop-brightness":[xc,G,W]}],"backdrop-contrast":[{"backdrop-contrast":[xc,G,W]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,xc,G,W]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[xc,G,W]}],"backdrop-invert":[{"backdrop-invert":[``,xc,G,W]}],"backdrop-opacity":[{"backdrop-opacity":[xc,G,W]}],"backdrop-saturate":[{"backdrop-saturate":[xc,G,W]}],"backdrop-sepia":[{"backdrop-sepia":[``,xc,G,W]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,G,W]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[xc,`initial`,G,W]}],ease:[{ease:[`linear`,`initial`,_,G,W]}],delay:[{delay:[xc,G,W]}],animate:[{animate:[`none`,v,G,W]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,G,W]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:ae()}],"rotate-x":[{"rotate-x":ae()}],"rotate-y":[{"rotate-y":ae()}],"rotate-z":[{"rotate-z":ae()}],scale:[{scale:oe()}],"scale-x":[{"scale-x":oe()}],"scale-y":[{"scale-y":oe()}],"scale-z":[{"scale-z":oe()}],"scale-3d":[`scale-3d`],skew:[{skew:se()}],"skew-x":[{"skew-x":se()}],"skew-y":[{"skew-y":se()}],transform:[{transform:[G,W,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:ce()}],"translate-x":[{"translate-x":ce()}],"translate-y":[{"translate-y":ce()}],"translate-z":[{"translate-z":ce()}],"translate-none":[`translate-none`],accent:[{accent:I()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:I()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],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`,G,W]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,G,W]}],fill:[{fill:[`none`,...I()]}],"stroke-w":[{stroke:[xc,zc,Mc,Nc]}],stroke:[{stroke:[`none`,...I()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`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`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`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-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`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-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`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`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`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-pbs`,`scroll-pbe`,`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`]},orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function K(...e){return nl(ks(e))}var rl=Ms(`inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/90`,destructive:`bg-destructive text-white hover:bg-destructive/90`,outline:`border border-input bg-background hover:bg-accent hover:text-accent-foreground`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80`,ghost:`hover:bg-accent hover:text-accent-foreground`,link:`text-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`}}),q=v.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},a)=>(0,H.jsx)(r?Ss:`button`,{className:K(rl({variant:t,size:n,className:e})),ref:a,...i}));q.displayName=`Button`,typeof window<`u`&&window.document&&window.document.createElement;function J(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function il(e,t){let n=v.createContext(t),r=e=>{let{children:t,...r}=e,i=v.useMemo(()=>r,Object.values(r));return(0,H.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=v.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function al(e,t=[]){let n=[];function r(t,r){let i=v.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=v.useMemo(()=>o,Object.values(o));return(0,H.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=v.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>v.createContext(e));return function(n){let r=n?.[e]||t;return v.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,ol(i,...t)]}function ol(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function sl(e){let t=ll(e),n=v.forwardRef((e,n)=>{let{children:r,...i}=e,a=v.Children.toArray(r),o=a.find(fl);if(o){let e=o.props.children,r=a.map(t=>t===o?v.Children.count(e)>1?v.Children.only(null):v.isValidElement(e)?e.props.children:null:t);return(0,H.jsx)(t,{...i,ref:n,children:v.isValidElement(e)?v.cloneElement(e,void 0,r):null})}return(0,H.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}var cl=sl(`Slot`);function ll(e){let t=v.forwardRef((e,t)=>{let{children:n,...r}=e;if(v.isValidElement(n)){let e=ml(n),i=pl(r,n.props);return n.type!==v.Fragment&&(i.ref=t?hs(t,e):e),v.cloneElement(n,i)}return v.Children.count(n)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ul=Symbol(`radix.slottable`);function dl(e){let t=({children:e})=>(0,H.jsx)(H.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=ul,t}function fl(e){return v.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===ul}function pl(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function ml(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var hl=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=sl(`Primitive.${t}`),r=v.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,H.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function gl(e,t){e&&N.flushSync(()=>e.dispatchEvent(t))}function _l(e){let t=v.useRef(e);return v.useEffect(()=>{t.current=e}),v.useMemo(()=>(...e)=>t.current?.(...e),[])}function vl(e,t=globalThis?.document){let n=_l(e);v.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var yl=`DismissableLayer`,bl=`dismissableLayer.update`,xl=`dismissableLayer.pointerDownOutside`,Sl=`dismissableLayer.focusOutside`,Cl,wl=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Tl=v.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=v.useContext(wl),[u,d]=v.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=v.useState({}),m=gs(t,e=>d(e)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),_=h.indexOf(g),y=u?h.indexOf(u):-1,b=l.layersWithOutsidePointerEventsDisabled.size>0,x=y>=_,S=Ol(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!x||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),C=kl(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return vl(e=>{y===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),v.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Cl=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),Al(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Cl)}},[u,f,n,l]),v.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),Al())},[u,l]),v.useEffect(()=>{let e=()=>p({});return document.addEventListener(bl,e),()=>document.removeEventListener(bl,e)},[]),(0,H.jsx)(hl.div,{...c,ref:m,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:J(e.onFocusCapture,C.onFocusCapture),onBlurCapture:J(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:J(e.onPointerDownCapture,S.onPointerDownCapture)})});Tl.displayName=yl;var El=`DismissableLayerBranch`,Dl=v.forwardRef((e,t)=>{let n=v.useContext(wl),r=v.useRef(null),i=gs(t,r);return v.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,H.jsx)(hl.div,{...e,ref:i})});Dl.displayName=El;function Ol(e,t=globalThis?.document){let n=_l(e),r=v.useRef(!1),i=v.useRef(()=>{});return v.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){jl(xl,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function kl(e,t=globalThis?.document){let n=_l(e),r=v.useRef(!1);return v.useEffect(()=>{let e=e=>{e.target&&!r.current&&jl(Sl,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Al(){let e=new CustomEvent(bl);document.dispatchEvent(e)}function jl(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?gl(i,a):i.dispatchEvent(a)}var Ml=globalThis?.document?v.useLayoutEffect:()=>{},Nl=v.useId||(()=>void 0),Pl=0;function Fl(e){let[t,n]=v.useState(Nl());return Ml(()=>{e||n(e=>e??String(Pl++))},[e]),e||(t?`radix-${t}`:``)}var Il=[`top`,`right`,`bottom`,`left`],Ll=Math.min,Rl=Math.max,zl=Math.round,Bl=Math.floor,Vl=e=>({x:e,y:e}),Hl={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Ul(e,t,n){return Rl(e,Ll(t,n))}function Wl(e,t){return typeof e==`function`?e(t):e}function Gl(e){return e.split(`-`)[0]}function Kl(e){return e.split(`-`)[1]}function ql(e){return e===`x`?`y`:`x`}function Jl(e){return e===`y`?`height`:`width`}function Yl(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Xl(e){return ql(Yl(e))}function Zl(e,t,n){n===void 0&&(n=!1);let r=Kl(e),i=Xl(e),a=Jl(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=ou(o)),[o,ou(o)]}function Ql(e){let t=ou(e);return[$l(e),t,$l(t)]}function $l(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var eu=[`left`,`right`],tu=[`right`,`left`],nu=[`top`,`bottom`],ru=[`bottom`,`top`];function iu(e,t,n){switch(e){case`top`:case`bottom`:return n?t?tu:eu:t?eu:tu;case`left`:case`right`:return t?nu:ru;default:return[]}}function au(e,t,n,r){let i=Kl(e),a=iu(Gl(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map($l)))),a}function ou(e){let t=Gl(e);return Hl[t]+e.slice(t.length)}function su(e){return{top:0,right:0,bottom:0,left:0,...e}}function cu(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:su(e)}function lu(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function uu(e,t,n){let{reference:r,floating:i}=e,a=Yl(t),o=Xl(t),s=Jl(o),c=Gl(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(Kl(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function du(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=Wl(t,e),p=cu(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=lu(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=lu(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var fu=50,pu=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:du},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=uu(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<fu&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=uu(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},mu=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=Wl(e,t)||{};if(l==null)return{};let d=cu(u),f={x:n,y:r},p=Xl(i),m=Jl(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=Ll(d[_],T),D=Ll(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=Ul(O,A,k),M=!c.arrow&&Kl(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,N=M?A<O?A-O:A-k:0;return{[p]:f[p]+N,data:{[p]:j,centerOffset:A-j-N,...M&&{alignmentOffset:N}},reset:M}}}),hu=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=Wl(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Gl(r),_=Yl(o),v=Gl(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[ou(o)]:Ql(o)),x=p!==`none`;!d&&x&&b.push(...au(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Zl(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==Yl(t))||T.every(e=>Yl(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Yl(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function gu(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function _u(e){return Il.some(t=>e[t]>=0)}var vu=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=Wl(e,t);switch(i){case`referenceHidden`:{let e=gu(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:_u(e)}}}case`escaped`:{let e=gu(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:_u(e)}}}default:return{}}}}},yu=new Set([`left`,`top`]);async function bu(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Gl(n),s=Kl(n),c=Yl(n)===`y`,l=yu.has(o)?-1:1,u=a&&c?-1:1,d=Wl(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var xu=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await bu(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Su=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Wl(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Yl(Gl(i)),p=ql(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=Ul(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=Ul(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},Cu=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=Wl(e,t),u={x:n,y:r},d=Yl(i),f=ql(d),p=u[f],m=u[d],h=Wl(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=yu.has(Gl(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},wu=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=Wl(e,t),u=await o.detectOverflow(t,l),d=Gl(i),f=Kl(i),p=Yl(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=Ll(h-u[g],v),x=Ll(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=Rl(u.left,0),t=Rl(u.right,0),n=Rl(u.top,0),r=Rl(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:Rl(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:Rl(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function Tu(){return typeof window<`u`}function Eu(e){return ku(e)?(e.nodeName||``).toLowerCase():`#document`}function Du(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ou(e){return((ku(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function ku(e){return Tu()?e instanceof Node||e instanceof Du(e).Node:!1}function Au(e){return Tu()?e instanceof Element||e instanceof Du(e).Element:!1}function ju(e){return Tu()?e instanceof HTMLElement||e instanceof Du(e).HTMLElement:!1}function Mu(e){return!Tu()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Du(e).ShadowRoot}function Nu(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Wu(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Pu(e){return/^(table|td|th)$/.test(Eu(e))}function Fu(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Iu=/transform|translate|scale|rotate|perspective|filter/,Lu=/paint|layout|strict|content/,Ru=e=>!!e&&e!==`none`,zu;function Bu(e){let t=Au(e)?Wu(e):e;return Ru(t.transform)||Ru(t.translate)||Ru(t.scale)||Ru(t.rotate)||Ru(t.perspective)||!Hu()&&(Ru(t.backdropFilter)||Ru(t.filter))||Iu.test(t.willChange||``)||Lu.test(t.contain||``)}function Vu(e){let t=Ku(e);for(;ju(t)&&!Uu(t);){if(Bu(t))return t;if(Fu(t))return null;t=Ku(t)}return null}function Hu(){return zu??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),zu}function Uu(e){return/^(html|body|#document)$/.test(Eu(e))}function Wu(e){return Du(e).getComputedStyle(e)}function Gu(e){return Au(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ku(e){if(Eu(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Mu(e)&&e.host||Ou(e);return Mu(t)?t.host:t}function qu(e){let t=Ku(e);return Uu(t)?e.ownerDocument?e.ownerDocument.body:e.body:ju(t)&&Nu(t)?t:qu(t)}function Ju(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=qu(e),i=r===e.ownerDocument?.body,a=Du(r);if(i){let e=Yu(a);return t.concat(a,a.visualViewport||[],Nu(r)?r:[],e&&n?Ju(e):[])}else return t.concat(r,Ju(r,[],n))}function Yu(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Xu(e){let t=Wu(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=ju(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=zl(n)!==a||zl(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Zu(e){return Au(e)?e:e.contextElement}function Qu(e){let t=Zu(e);if(!ju(t))return Vl(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Xu(t),o=(a?zl(n.width):n.width)/r,s=(a?zl(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var $u=Vl(0);function ed(e){let t=Du(e);return!Hu()||!t.visualViewport?$u:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function td(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Du(e)?!1:t}function nd(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Zu(e),o=Vl(1);t&&(r?Au(r)&&(o=Qu(r)):o=Qu(e));let s=td(a,n,r)?ed(a):Vl(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=Du(a),t=r&&Au(r)?Du(r):r,n=e,i=Yu(n);for(;i&&r&&t!==n;){let e=Qu(i),t=i.getBoundingClientRect(),r=Wu(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Du(i),i=Yu(n)}}return lu({width:u,height:d,x:c,y:l})}function rd(e,t){let n=Gu(e).scrollLeft;return t?t.left+n:nd(Ou(e)).left+n}function id(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-rd(e,n),y:n.top+t.scrollTop}}function ad(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Ou(r),s=t?Fu(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Vl(1),u=Vl(0),d=ju(r);if((d||!d&&!a)&&((Eu(r)!==`body`||Nu(o))&&(c=Gu(r)),d)){let e=nd(r);l=Qu(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?id(o,c):Vl(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function od(e){return Array.from(e.getClientRects())}function sd(e){let t=Ou(e),n=Gu(e),r=e.ownerDocument.body,i=Rl(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Rl(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+rd(e),s=-n.scrollTop;return Wu(r).direction===`rtl`&&(o+=Rl(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var cd=25;function ld(e,t){let n=Du(e),r=Ou(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Hu();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=rd(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=cd&&(a-=o)}else l<=cd&&(a+=l);return{width:a,height:o,x:s,y:c}}function ud(e,t){let n=nd(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=ju(e)?Qu(e):Vl(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function dd(e,t,n){let r;if(t===`viewport`)r=ld(e,n);else if(t===`document`)r=sd(Ou(e));else if(Au(t))r=ud(t,n);else{let n=ed(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return lu(r)}function fd(e,t){let n=Ku(e);return n===t||!Au(n)||Uu(n)?!1:Wu(n).position===`fixed`||fd(n,t)}function pd(e,t){let n=t.get(e);if(n)return n;let r=Ju(e,[],!1).filter(e=>Au(e)&&Eu(e)!==`body`),i=null,a=Wu(e).position===`fixed`,o=a?Ku(e):e;for(;Au(o)&&!Uu(o);){let t=Wu(o),n=Bu(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||Nu(o)&&!n&&fd(e,o))?r=r.filter(e=>e!==o):i=t,o=Ku(o)}return t.set(e,r),r}function md(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Fu(t)?[]:pd(t,this._c):[].concat(n),r],o=dd(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=dd(t,a[e],i);s=Rl(n.top,s),c=Ll(n.right,c),l=Ll(n.bottom,l),u=Rl(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function hd(e){let{width:t,height:n}=Xu(e);return{width:t,height:n}}function gd(e,t,n){let r=ju(t),i=Ou(t),a=n===`fixed`,o=nd(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Vl(0);function l(){c.x=rd(i)}if(r||!r&&!a)if((Eu(t)!==`body`||Nu(i))&&(s=Gu(t)),r){let e=nd(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?id(i,s):Vl(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function _d(e){return Wu(e).position===`static`}function vd(e,t){if(!ju(e)||Wu(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Ou(e)===n&&(n=n.ownerDocument.body),n}function yd(e,t){let n=Du(e);if(Fu(e))return n;if(!ju(e)){let t=Ku(e);for(;t&&!Uu(t);){if(Au(t)&&!_d(t))return t;t=Ku(t)}return n}let r=vd(e,t);for(;r&&Pu(r)&&_d(r);)r=vd(r,t);return r&&Uu(r)&&_d(r)&&!Bu(r)?n:r||Vu(e)||n}var bd=async function(e){let t=this.getOffsetParent||yd,n=this.getDimensions,r=await n(e.floating);return{reference:gd(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function xd(e){return Wu(e).direction===`rtl`}var Sd={convertOffsetParentRelativeRectToViewportRelativeRect:ad,getDocumentElement:Ou,getClippingRect:md,getOffsetParent:yd,getElementRects:bd,getClientRects:od,getDimensions:hd,getScale:Qu,isElement:Au,isRTL:xd};function Cd(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function wd(e,t){let n=null,r,i=Ou(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=Bl(d),h=Bl(i.clientWidth-(u+f)),g=Bl(i.clientHeight-(d+p)),_=Bl(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Rl(0,Ll(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!Cd(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function Td(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Zu(e),u=i||a?[...l?Ju(l):[],...t?Ju(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?wd(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?nd(e):null;c&&g();function g(){let t=nd(e);h&&!Cd(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Ed=xu,Dd=Su,Od=hu,kd=wu,Ad=vu,jd=mu,Md=Cu,Nd=(e,t,n)=>{let r=new Map,i={platform:Sd,...n},a={...i.platform,_c:r};return pu(e,t,{...i,platform:a})},Pd=typeof document<`u`?v.useLayoutEffect:function(){};function Fd(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,i;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(!Fd(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Fd(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Id(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ld(e,t){let n=Id(e);return Math.round(t*n)/n}function Rd(e){let t=v.useRef(e);return Pd(()=>{t.current=e}),t}function zd(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=v.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=v.useState(r);Fd(f,r)||p(r);let[m,h]=v.useState(null),[g,_]=v.useState(null),y=v.useCallback(e=>{e!==C.current&&(C.current=e,h(e))},[]),b=v.useCallback(e=>{e!==w.current&&(w.current=e,_(e))},[]),x=a||m,S=o||g,C=v.useRef(null),w=v.useRef(null),T=v.useRef(u),E=c!=null,D=Rd(c),O=Rd(i),k=Rd(l),A=v.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),Nd(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!Fd(T.current,t)&&(T.current=t,N.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);Pd(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=v.useRef(!1);Pd(()=>(j.current=!0,()=>{j.current=!1}),[]),Pd(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let M=v.useMemo(()=>({reference:C,floating:w,setReference:y,setFloating:b}),[y,b]),P=v.useMemo(()=>({reference:x,floating:S}),[x,S]),F=v.useMemo(()=>{let e={position:n,left:0,top:0};if(!P.floating)return e;let t=Ld(P.floating,u.x),r=Ld(P.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Id(P.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,P.floating,u.x,u.y]);return v.useMemo(()=>({...u,update:A,refs:M,elements:P,floatingStyles:F}),[u,A,M,P,F])}var Bd=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:jd({element:r.current,padding:i}).fn(n):r?jd({element:r,padding:i}).fn(n):{}}}},Vd=(e,t)=>{let n=Ed(e);return{name:n.name,fn:n.fn,options:[e,t]}},Hd=(e,t)=>{let n=Dd(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ud=(e,t)=>({fn:Md(e).fn,options:[e,t]}),Wd=(e,t)=>{let n=Od(e);return{name:n.name,fn:n.fn,options:[e,t]}},Gd=(e,t)=>{let n=kd(e);return{name:n.name,fn:n.fn,options:[e,t]}},Kd=(e,t)=>{let n=Ad(e);return{name:n.name,fn:n.fn,options:[e,t]}},qd=(e,t)=>{let n=Bd(e);return{name:n.name,fn:n.fn,options:[e,t]}},Jd=`Arrow`,Yd=v.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,H.jsx)(hl.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,H.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Yd.displayName=Jd;var Xd=Yd;function Zd(e){let[t,n]=v.useState(void 0);return Ml(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var Qd=`Popper`,[$d,ef]=al(Qd),[tf,nf]=$d(Qd),rf=e=>{let{__scopePopper:t,children:n}=e,[r,i]=v.useState(null);return(0,H.jsx)(tf,{scope:t,anchor:r,onAnchorChange:i,children:n})};rf.displayName=Qd;var af=`PopperAnchor`,of=v.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=nf(af,n),o=v.useRef(null),s=gs(t,o),c=v.useRef(null);return v.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,H.jsx)(hl.div,{...i,ref:s})});of.displayName=af;var sf=`PopperContent`,[cf,lf]=$d(sf),uf=v.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=nf(sf,n),[_,y]=v.useState(null),b=gs(t,e=>y(e)),[x,S]=v.useState(null),C=Zd(x),w=C?.width??0,T=C?.height??0,E=r+(a===`center`?``:`-`+a),D=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},O=Array.isArray(l)?l:[l],k=O.length>0,A={padding:D,boundary:O.filter(mf),altBoundary:k},{refs:j,floatingStyles:M,placement:N,isPositioned:P,middlewareData:F}=zd({strategy:`fixed`,placement:E,whileElementsMounted:(...e)=>Td(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[Vd({mainAxis:i+T,alignmentAxis:o}),c&&Hd({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?Ud():void 0,...A}),c&&Wd({...A}),Gd({...A,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),x&&qd({element:x,padding:s}),hf({arrowWidth:w,arrowHeight:T}),f&&Kd({strategy:`referenceHidden`,...A})]}),[I,L]=gf(N),R=_l(m);Ml(()=>{P&&R?.()},[P,R]);let ee=F.arrow?.x,te=F.arrow?.y,ne=F.arrow?.centerOffset!==0,[z,B]=v.useState();return Ml(()=>{_&&B(window.getComputedStyle(_).zIndex)},[_]),(0,H.jsx)(`div`,{ref:j.setFloating,"data-radix-popper-content-wrapper":``,style:{...M,transform:P?M.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:z,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(` `),...F.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,H.jsx)(cf,{scope:n,placedSide:I,onArrowChange:S,arrowX:ee,arrowY:te,shouldHideArrow:ne,children:(0,H.jsx)(hl.div,{"data-side":I,"data-align":L,...h,ref:b,style:{...h.style,animation:P?void 0:`none`}})})})});uf.displayName=sf;var df=`PopperArrow`,ff={top:`bottom`,right:`left`,bottom:`top`,left:`right`},pf=v.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=lf(df,n),a=ff[i.placedSide];return(0,H.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,H.jsx)(Xd,{...r,ref:t,style:{...r.style,display:`block`}})})});pf.displayName=df;function mf(e){return e!==null}var hf=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=gf(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function gf(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var _f=rf,vf=of,yf=uf,bf=pf,xf=`Portal`,Sf=v.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=v.useState(!1);Ml(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?N.createPortal((0,H.jsx)(hl.div,{...r,ref:t}),o):null});Sf.displayName=xf;function Cf(e,t){return v.useReducer((e,n)=>t[e][n]??e,e)}var wf=e=>{let{present:t,children:n}=e,r=Tf(t),i=typeof n==`function`?n({present:r.isPresent}):v.Children.only(n),a=gs(r.ref,Df(i));return typeof n==`function`||r.isPresent?v.cloneElement(i,{ref:a}):null};wf.displayName=`Presence`;function Tf(e){let[t,n]=v.useState(),r=v.useRef(null),i=v.useRef(e),a=v.useRef(`none`),[o,s]=Cf(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return v.useEffect(()=>{let e=Ef(r.current);a.current=o===`mounted`?e:`none`},[o]),Ml(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=Ef(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),Ml(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=Ef(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=Ef(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:v.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function Ef(e){return e?.animationName||`none`}function Df(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Of=v.useInsertionEffect||Ml;function kf({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=Af({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=v.useRef(e!==void 0);v.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`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.`),t.current=s},[s,r])}return[c,v.useCallback(t=>{if(s){let n=jf(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function Af({defaultProp:e,onChange:t}){let[n,r]=v.useState(e),i=v.useRef(n),a=v.useRef(t);return Of(()=>{a.current=t},[t]),v.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function jf(e){return typeof e==`function`}var Mf=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`}),Nf=`VisuallyHidden`,Pf=v.forwardRef((e,t)=>(0,H.jsx)(hl.span,{...e,ref:t,style:{...Mf,...e.style}}));Pf.displayName=Nf;var Ff=Pf,[If,Lf]=al(`Tooltip`,[ef]),Rf=ef(),zf=`TooltipProvider`,Bf=700,Vf=`tooltip.open`,[Hf,Uf]=If(zf),Wf=e=>{let{__scopeTooltip:t,delayDuration:n=Bf,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=v.useRef(!0),s=v.useRef(!1),c=v.useRef(0);return v.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,H.jsx)(Hf,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:v.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:v.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:v.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};Wf.displayName=zf;var Gf=`Tooltip`,[Kf,qf]=If(Gf),Jf=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=Uf(Gf,e.__scopeTooltip),l=Rf(t),[u,d]=v.useState(null),f=Fl(),p=v.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=v.useRef(!1),[_,y]=kf({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(Vf))):c.onClose(),a?.(e)},caller:Gf}),b=v.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),x=v.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,y(!0)},[y]),S=v.useCallback(()=>{window.clearTimeout(p.current),p.current=0,y(!1)},[y]),C=v.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,y(!0),p.current=0},h)},[h,y]);return v.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,H.jsx)(_f,{...l,children:(0,H.jsx)(Kf,{scope:t,contentId:f,open:_,stateAttribute:b,trigger:u,onTriggerChange:d,onTriggerEnter:v.useCallback(()=>{c.isOpenDelayedRef.current?C():x()},[c.isOpenDelayedRef,C,x]),onTriggerLeave:v.useCallback(()=>{m?S():(window.clearTimeout(p.current),p.current=0)},[S,m]),onOpen:x,onClose:S,disableHoverableContent:m,children:n})})};Jf.displayName=Gf;var Yf=`TooltipTrigger`,Xf=v.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=qf(Yf,n),a=Uf(Yf,n),o=Rf(n),s=gs(t,v.useRef(null),i.onTriggerChange),c=v.useRef(!1),l=v.useRef(!1),u=v.useCallback(()=>c.current=!1,[]);return v.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,H.jsx)(vf,{asChild:!0,...o,children:(0,H.jsx)(hl.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:J(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:J(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:J(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:J(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:J(e.onBlur,i.onClose),onClick:J(e.onClick,i.onClose)})})});Xf.displayName=Yf;var Zf=`TooltipPortal`,[Qf,$f]=If(Zf,{forceMount:void 0}),ep=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=qf(Zf,t);return(0,H.jsx)(Qf,{scope:t,forceMount:n,children:(0,H.jsx)(wf,{present:n||a.open,children:(0,H.jsx)(Sf,{asChild:!0,container:i,children:r})})})};ep.displayName=Zf;var tp=`TooltipContent`,np=v.forwardRef((e,t)=>{let n=$f(tp,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=qf(tp,e.__scopeTooltip);return(0,H.jsx)(wf,{present:r||o.open,children:o.disableHoverableContent?(0,H.jsx)(sp,{side:i,...a,ref:t}):(0,H.jsx)(rp,{side:i,...a,ref:t})})}),rp=v.forwardRef((e,t)=>{let n=qf(tp,e.__scopeTooltip),r=Uf(tp,e.__scopeTooltip),i=v.useRef(null),a=gs(t,i),[o,s]=v.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=v.useCallback(()=>{s(null),d(!1)},[d]),p=v.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=dp(r,up(r,n.getBoundingClientRect())),a=fp(t.getBoundingClientRect());s(mp([...i,...a])),d(!0)},[d]);return v.useEffect(()=>()=>f(),[f]),v.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),v.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!pp(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,H.jsx)(sp,{...e,ref:a})}),[ip,ap]=If(Gf,{isInside:!1}),op=dl(`TooltipContent`),sp=v.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=qf(tp,n),l=Rf(n),{onClose:u}=c;return v.useEffect(()=>(document.addEventListener(Vf,u),()=>document.removeEventListener(Vf,u)),[u]),v.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,H.jsx)(Tl,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,H.jsxs)(yf,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.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:[(0,H.jsx)(op,{children:r}),(0,H.jsx)(ip,{scope:n,isInside:!0,children:(0,H.jsx)(Ff,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});np.displayName=tp;var cp=`TooltipArrow`,lp=v.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Rf(n);return ap(cp,n).isInside?null:(0,H.jsx)(bf,{...i,...r,ref:t})});lp.displayName=cp;function up(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function dp(e,t,n=5){let 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 fp(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function pp(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function mp(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),hp(t)}function hp(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}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 gp=Wf,_p=Jf,vp=Xf,yp=ep,bp=np,xp=gp,Sp=_p,Cp=vp,wp=v.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,H.jsx)(yp,{children:(0,H.jsx)(bp,{ref:r,sideOffset:t,className:K(`z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground 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})}));wp.displayName=bp.displayName;var Tp=`focusScope.autoFocusOnMount`,Ep=`focusScope.autoFocusOnUnmount`,Dp={bubbles:!1,cancelable:!0},Op=`FocusScope`,kp=v.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=v.useState(null),l=_l(i),u=_l(a),d=v.useRef(null),f=gs(t,e=>c(e)),p=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:Ip(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||Ip(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&Ip(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),v.useEffect(()=>{if(s){Lp.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(Tp,Dp);s.addEventListener(Tp,l),s.dispatchEvent(t),t.defaultPrevented||(Ap(Bp(Mp(s)),{select:!0}),document.activeElement===e&&Ip(s))}return()=>{s.removeEventListener(Tp,l),setTimeout(()=>{let t=new CustomEvent(Ep,Dp);s.addEventListener(Ep,u),s.dispatchEvent(t),t.defaultPrevented||Ip(e??document.body,{select:!0}),s.removeEventListener(Ep,u),Lp.remove(p)},0)}}},[s,l,u,p]);let m=v.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=jp(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&Ip(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&Ip(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,H.jsx)(hl.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});kp.displayName=Op;function Ap(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(Ip(r,{select:t}),document.activeElement!==n)return}function jp(e){let t=Mp(e);return[Np(t,e),Np(t.reverse(),e)]}function Mp(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Np(e,t){for(let n of e)if(!Pp(n,{upTo:t}))return n}function Pp(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 Fp(e){return e instanceof HTMLInputElement&&`select`in e}function Ip(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Fp(e)&&t&&e.select()}}var Lp=Rp();function Rp(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=zp(e,t),e.unshift(t)},remove(t){e=zp(e,t),e[0]?.resume()}}}function zp(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Bp(e){return e.filter(e=>e.tagName!==`A`)}var Vp=0;function Hp(){v.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??Up()),document.body.insertAdjacentElement(`beforeend`,e[1]??Up()),Vp++,()=>{Vp===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),Vp--}},[])}function Up(){let 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 Wp=function(){return Wp=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Wp.apply(this,arguments)};function Gp(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 i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Kp(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var qp=`right-scroll-bar-position`,Jp=`width-before-scroll-bar`,Yp=`with-scroll-bars-hidden`,Xp=`--removed-body-scroll-bar-size`;function Zp(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Qp(e,t){var n=(0,v.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var $p=typeof window<`u`?v.useLayoutEffect:v.useEffect,em=new WeakMap;function tm(e,t){var n=Qp(t||null,function(t){return e.forEach(function(e){return Zp(e,t)})});return $p(function(){var t=em.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||Zp(e,null)}),i.forEach(function(e){r.has(e)||Zp(e,a)})}em.set(n,e)},[e]),n}function nm(e){return e}function rm(e,t){t===void 0&&(t=nm);var n=[],r=!1;return{read:function(){if(r)throw 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(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function im(e){e===void 0&&(e={});var t=rm(null);return t.options=Wp({async:!0,ssr:!1},e),t}var am=function(e){var t=e.sideCar,n=Gp(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return v.createElement(r,Wp({},n))};am.isSideCarExport=!0;function om(e,t){return e.useMedium(t),am}var sm=im(),cm=function(){},lm=v.forwardRef(function(e,t){var n=v.useRef(null),r=v.useState({onScrollCapture:cm,onWheelCapture:cm,onTouchMoveCapture:cm}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,y=_===void 0?`div`:_,b=e.gapMode,x=Gp(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),S=f,C=tm([n,t]),w=Wp(Wp({},x),i);return v.createElement(v.Fragment,null,u&&v.createElement(S,{sideCar:sm,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:b}),o?v.cloneElement(v.Children.only(s),Wp(Wp({},w),{ref:C})):v.createElement(y,Wp({},w,{className:c,ref:C}),s))});lm.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},lm.classNames={fullWidth:Jp,zeroRight:qp};var um,dm=function(){if(um)return um;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function fm(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=dm();return t&&e.setAttribute(`nonce`,t),e}function pm(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function mm(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var hm=function(){var e=0,t=null;return{add:function(n){e==0&&(t=fm())&&(pm(t,n),mm(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},gm=function(){var e=hm();return function(t,n){v.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},_m=function(){var e=gm();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},vm={left:0,top:0,right:0,gap:0},ym=function(e){return parseInt(e||``,10)||0},bm=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[ym(n),ym(r),ym(i)]},xm=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return vm;var t=bm(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])}},Sm=_m(),Cm=`data-scroll-locked`,wm=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
13
+ .${Yp} {
14
+ overflow: hidden ${r};
15
+ padding-right: ${s}px ${r};
16
+ }
17
+ body[${Cm}] {
18
+ overflow: hidden ${r};
19
+ overscroll-behavior: contain;
20
+ ${[t&&`position: relative ${r};`,n===`margin`&&`
21
+ padding-left: ${i}px;
22
+ padding-top: ${a}px;
23
+ padding-right: ${o}px;
24
+ margin-left:0;
25
+ margin-top:0;
26
+ margin-right: ${s}px ${r};
27
+ `,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
28
+ }
29
+
30
+ .${qp} {
31
+ right: ${s}px ${r};
32
+ }
33
+
34
+ .${Jp} {
35
+ margin-right: ${s}px ${r};
36
+ }
37
+
38
+ .${qp} .${qp} {
39
+ right: 0 ${r};
40
+ }
41
+
42
+ .${Jp} .${Jp} {
43
+ margin-right: 0 ${r};
44
+ }
45
+
46
+ body[${Cm}] {
47
+ ${Xp}: ${s}px;
48
+ }
49
+ `},Tm=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},Em=function(){v.useEffect(function(){return document.body.setAttribute(Cm,(Tm()+1).toString()),function(){var e=Tm()-1;e<=0?document.body.removeAttribute(Cm):document.body.setAttribute(Cm,e.toString())}},[])},Dm=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;Em();var a=v.useMemo(function(){return xm(i)},[i]);return v.createElement(Sm,{styles:wm(a,!t,i,n?``:`!important`)})},Om=!1;if(typeof window<`u`)try{var km=Object.defineProperty({},`passive`,{get:function(){return Om=!0,!0}});window.addEventListener(`test`,km,km),window.removeEventListener(`test`,km,km)}catch{Om=!1}var Am=Om?{passive:!1}:!1,jm=function(e){return e.tagName===`TEXTAREA`},Mm=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!jm(e)&&n[t]===`visible`)},Nm=function(e){return Mm(e,`overflowY`)},Pm=function(e){return Mm(e,`overflowX`)},Fm=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),Rm(e,r)){var i=zm(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Im=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},Lm=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},Rm=function(e,t){return e===`v`?Nm(t):Pm(t)},zm=function(e,t){return e===`v`?Im(t):Lm(t)},Bm=function(e,t){return e===`h`&&t===`rtl`?-1:1},Vm=function(e,t,n,r,i){var a=Bm(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=zm(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&Rm(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},Hm=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Um=function(e){return[e.deltaX,e.deltaY]},Wm=function(e){return e&&`current`in e?e.current:e},Gm=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Km=function(e){return`
50
+ .block-interactivity-${e} {pointer-events: none;}
51
+ .allow-interactivity-${e} {pointer-events: all;}
52
+ `},qm=0,Jm=[];function Ym(e){var t=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),i=v.useState(qm++)[0],a=v.useState(_m)[0],o=v.useRef(e);v.useEffect(function(){o.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Kp([e.lockRef.current],(e.shards||[]).map(Wm),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=v.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Hm(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=Fm(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Fm(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return Vm(h,t,e,h===`h`?s:c,!0)},[]),c=v.useCallback(function(e){var n=e;if(!(!Jm.length||Jm[Jm.length-1]!==a)){var r=`deltaY`in n?Um(n):Hm(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Gm(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Wm).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=v.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Xm(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=v.useCallback(function(e){n.current=Hm(e),r.current=void 0},[]),d=v.useCallback(function(t){l(t.type,Um(t),t.target,s(t,e.lockRef.current))},[]),f=v.useCallback(function(t){l(t.type,Hm(t),t.target,s(t,e.lockRef.current))},[]);v.useEffect(function(){return Jm.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,Am),document.addEventListener(`touchmove`,c,Am),document.addEventListener(`touchstart`,u,Am),function(){Jm=Jm.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,Am),document.removeEventListener(`touchmove`,c,Am),document.removeEventListener(`touchstart`,u,Am)}},[]);var p=e.removeScrollBar,m=e.inert;return v.createElement(v.Fragment,null,m?v.createElement(a,{styles:Km(i)}):null,p?v.createElement(Dm,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Xm(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Zm=om(sm,Ym),Qm=v.forwardRef(function(e,t){return v.createElement(lm,Wp({},e,{ref:t,sideCar:Zm}))});Qm.classNames=lm.classNames;var $m=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},eh=new WeakMap,th=new WeakMap,nh={},rh=0,ih=function(e){return e&&(e.host||ih(e.parentNode))},ah=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=ih(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},oh=function(e,t,n,r){var i=ah(t,Array.isArray(e)?e:[e]);nh[n]||(nh[n]=new WeakMap);var a=nh[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(eh.get(e)||0)+1,l=(a.get(e)||0)+1;eh.set(e,c),a.set(e,l),o.push(e),c===1&&i&&th.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),rh++,function(){o.forEach(function(e){var t=eh.get(e)-1,i=a.get(e)-1;eh.set(e,t),a.set(e,i),t||(th.has(e)||e.removeAttribute(r),th.delete(e)),i||e.removeAttribute(n)}),rh--,rh||(eh=new WeakMap,eh=new WeakMap,th=new WeakMap,nh={})}},sh=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||$m(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),oh(r,i,n,`aria-hidden`)):function(){return null}},ch=`Dialog`,[lh,uh]=al(ch),[dh,fh]=lh(ch),ph=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=v.useRef(null),c=v.useRef(null),[l,u]=kf({prop:r,defaultProp:i??!1,onChange:a,caller:ch});return(0,H.jsx)(dh,{scope:t,triggerRef:s,contentRef:c,contentId:Fl(),titleId:Fl(),descriptionId:Fl(),open:l,onOpenChange:u,onOpenToggle:v.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})};ph.displayName=ch;var mh=`DialogTrigger`,hh=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=fh(mh,n),a=gs(t,i.triggerRef);return(0,H.jsx)(hl.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Fh(i.open),...r,ref:a,onClick:J(e.onClick,i.onOpenToggle)})});hh.displayName=mh;var gh=`DialogPortal`,[_h,vh]=lh(gh,{forceMount:void 0}),yh=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=fh(gh,t);return(0,H.jsx)(_h,{scope:t,forceMount:n,children:v.Children.map(r,e=>(0,H.jsx)(wf,{present:n||a.open,children:(0,H.jsx)(Sf,{asChild:!0,container:i,children:e})}))})};yh.displayName=gh;var bh=`DialogOverlay`,xh=v.forwardRef((e,t)=>{let n=vh(bh,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=fh(bh,e.__scopeDialog);return a.modal?(0,H.jsx)(wf,{present:r||a.open,children:(0,H.jsx)(Ch,{...i,ref:t})}):null});xh.displayName=bh;var Sh=sl(`DialogOverlay.RemoveScroll`),Ch=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=fh(bh,n);return(0,H.jsx)(Qm,{as:Sh,allowPinchZoom:!0,shards:[i.contentRef],children:(0,H.jsx)(hl.div,{"data-state":Fh(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),wh=`DialogContent`,Th=v.forwardRef((e,t)=>{let n=vh(wh,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=fh(wh,e.__scopeDialog);return(0,H.jsx)(wf,{present:r||a.open,children:a.modal?(0,H.jsx)(Eh,{...i,ref:t}):(0,H.jsx)(Dh,{...i,ref:t})})});Th.displayName=wh;var Eh=v.forwardRef((e,t)=>{let n=fh(wh,e.__scopeDialog),r=v.useRef(null),i=gs(t,n.contentRef,r);return v.useEffect(()=>{let e=r.current;if(e)return sh(e)},[]),(0,H.jsx)(Oh,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:J(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:J(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:J(e.onFocusOutside,e=>e.preventDefault())})}),Dh=v.forwardRef((e,t)=>{let n=fh(wh,e.__scopeDialog),r=v.useRef(!1),i=v.useRef(!1);return(0,H.jsx)(Oh,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),Oh=v.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=fh(wh,n),c=v.useRef(null),l=gs(t,c);return Hp(),(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(kp,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,H.jsx)(Tl,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":Fh(s.open),...o,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(zh,{titleId:s.titleId}),(0,H.jsx)(Vh,{contentRef:c,descriptionId:s.descriptionId})]})]})}),kh=`DialogTitle`,Ah=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=fh(kh,n);return(0,H.jsx)(hl.h2,{id:i.titleId,...r,ref:t})});Ah.displayName=kh;var jh=`DialogDescription`,Mh=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=fh(jh,n);return(0,H.jsx)(hl.p,{id:i.descriptionId,...r,ref:t})});Mh.displayName=jh;var Nh=`DialogClose`,Ph=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=fh(Nh,n);return(0,H.jsx)(hl.button,{type:`button`,...r,ref:t,onClick:J(e.onClick,()=>i.onOpenChange(!1))})});Ph.displayName=Nh;function Fh(e){return e?`open`:`closed`}var Ih=`DialogTitleWarning`,[Lh,Rh]=il(Ih,{contentName:wh,titleName:kh,docsSlug:`dialog`}),zh=({titleId:e})=>{let t=Rh(Ih),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
53
+
54
+ If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
55
+
56
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return v.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Bh=`DialogDescriptionWarning`,Vh=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Rh(Bh).contentName}}.`;return v.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Hh=ph,Uh=yh,Wh=xh,Gh=Th,Kh=Ah,qh=Mh,Jh=Ph,Yh=Hh,Xh=Uh,Zh=Jh,Qh=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(Wh,{ref:n,className:K(`fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t}));Qh.displayName=Wh.displayName;var $h=v.forwardRef(({className:e,children:t,...n},r)=>(0,H.jsxs)(Xh,{children:[(0,H.jsx)(Qh,{}),(0,H.jsxs)(Gh,{ref:r,className:K(`fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 border bg-background 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 sm:rounded-lg`,e),...n,children:[(0,H.jsxs)(Zh,{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-accent data-[state=open]:text-muted-foreground`,children:[(0,H.jsx)(cs,{className:`size-4`}),(0,H.jsx)(`span`,{className:`sr-only`,children:`Close`})]}),t]})]}));$h.displayName=Gh.displayName;var eg=({className:e,...t})=>(0,H.jsx)(`div`,{className:K(`flex flex-col space-y-1.5 text-center sm:text-left`,e),...t});eg.displayName=`DialogHeader`;var tg=({className:e,...t})=>(0,H.jsx)(`div`,{className:K(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});tg.displayName=`DialogFooter`;var ng=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(Kh,{ref:n,className:K(`text-lg font-semibold leading-none tracking-tight`,e),...t}));ng.displayName=Kh.displayName;var rg=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(qh,{ref:n,className:K(`text-sm text-muted-foreground`,e),...t}));rg.displayName=qh.displayName;var ig=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=xs(`Primitive.${t}`),r=v.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,H.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),ag=`Label`,og=v.forwardRef((e,t)=>(0,H.jsx)(ig.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));og.displayName=ag;var sg=og,cg=Ms(`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`),Y=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(sg,{ref:n,className:K(cg(),e),...t}));Y.displayName=sg.displayName;function lg(e,[t,n]){return Math.min(n,Math.max(t,e))}function ug(e){let t=e+`CollectionProvider`,[n,r]=al(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=v.useRef(null),a=v.useRef(new Map).current;return(0,H.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=sl(s),l=v.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,H.jsx)(c,{ref:gs(t,a(s,n).collectionRef),children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=sl(u),p=v.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=v.useRef(null),s=gs(t,o),c=a(u,n);return v.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,H.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return v.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:p},m,r]}var dg=v.createContext(void 0);function fg(e){let t=v.useContext(dg);return e||t||`ltr`}function pg(e){let t=v.useRef({value:e,previous:e});return v.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var mg=[` `,`Enter`,`ArrowUp`,`ArrowDown`],hg=[` `,`Enter`],gg=`Select`,[_g,vg,yg]=ug(gg),[bg,xg]=al(gg,[yg,ef]),Sg=ef(),[Cg,wg]=bg(gg),[Tg,Eg]=bg(gg),Dg=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m}=e,h=Sg(t),[g,_]=v.useState(null),[y,b]=v.useState(null),[x,S]=v.useState(!1),C=fg(l),[w,T]=kf({prop:r,defaultProp:i??!1,onChange:a,caller:gg}),[E,D]=kf({prop:o,defaultProp:s,onChange:c,caller:gg}),O=v.useRef(null),k=g?m||!!g.closest(`form`):!0,[A,j]=v.useState(new Set),M=Array.from(A).map(e=>e.props.value).join(`;`);return(0,H.jsx)(_f,{...h,children:(0,H.jsxs)(Cg,{required:p,scope:t,trigger:g,onTriggerChange:_,valueNode:y,onValueNodeChange:b,valueNodeHasChildren:x,onValueNodeHasChildrenChange:S,contentId:Fl(),value:E,onValueChange:D,open:w,onOpenChange:T,dir:C,triggerPointerDownPosRef:O,disabled:f,children:[(0,H.jsx)(_g.Provider,{scope:t,children:(0,H.jsx)(Tg,{scope:e.__scopeSelect,onNativeOptionAdd:v.useCallback(e=>{j(t=>new Set(t).add(e))},[]),onNativeOptionRemove:v.useCallback(e=>{j(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),k?(0,H.jsxs)(S_,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:d,value:E,onChange:e=>D(e.target.value),disabled:f,form:m,children:[E===void 0?(0,H.jsx)(`option`,{value:``}):null,Array.from(A)]},M):null]})})};Dg.displayName=gg;var Og=`SelectTrigger`,kg=v.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=Sg(n),o=wg(Og,n),s=o.disabled||r,c=gs(t,o.onTriggerChange),l=vg(n),u=v.useRef(`touch`),[d,f,p]=w_(e=>{let t=l().filter(e=>!e.disabled),n=T_(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,H.jsx)(vf,{asChild:!0,...a,children:(0,H.jsx)(hl.button,{type:`button`,role:`combobox`,"aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":C_(o.value)?``:void 0,...i,ref:c,onClick:J(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:J(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:J(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&mg.includes(e.key)&&(m(),e.preventDefault())})})})});kg.displayName=Og;var Ag=`SelectValue`,jg=v.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=wg(Ag,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=gs(t,c.onValueNodeChange);return Ml(()=>{l(u)},[l,u]),(0,H.jsx)(hl.span,{...s,ref:d,style:{pointerEvents:`none`},children:C_(c.value)?(0,H.jsx)(H.Fragment,{children:o}):a})});jg.displayName=Ag;var Mg=`SelectIcon`,Ng=v.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,H.jsx)(hl.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});Ng.displayName=Mg;var Pg=`SelectPortal`,Fg=e=>(0,H.jsx)(Sf,{asChild:!0,...e});Fg.displayName=Pg;var Ig=`SelectContent`,Lg=v.forwardRef((e,t)=>{let n=wg(Ig,e.__scopeSelect),[r,i]=v.useState();if(Ml(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?N.createPortal((0,H.jsx)(zg,{scope:e.__scopeSelect,children:(0,H.jsx)(_g.Slot,{scope:e.__scopeSelect,children:(0,H.jsx)(`div`,{children:e.children})})}),t):null}return(0,H.jsx)(Ug,{...e,ref:t})});Lg.displayName=Ig;var Rg=10,[zg,Bg]=bg(Ig),Vg=`SelectContentImpl`,Hg=sl(`SelectContent.RemoveScroll`),Ug=v.forwardRef((e,t)=>{let{__scopeSelect:n,position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,..._}=e,y=wg(Ig,n),[b,x]=v.useState(null),[S,C]=v.useState(null),w=gs(t,e=>x(e)),[T,E]=v.useState(null),[D,O]=v.useState(null),k=vg(n),[A,j]=v.useState(!1),M=v.useRef(!1);v.useEffect(()=>{if(b)return sh(b)},[b]),Hp();let N=v.useCallback(e=>{let[t,...n]=k().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&S&&(S.scrollTop=0),n===r&&S&&(S.scrollTop=S.scrollHeight),n?.focus(),document.activeElement!==i))return},[k,S]),P=v.useCallback(()=>N([T,b]),[N,T,b]);v.useEffect(()=>{A&&P()},[A,P]);let{onOpenChange:F,triggerPointerDownPosRef:I}=y;v.useEffect(()=>{if(b){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(I.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(I.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():b.contains(n.target)||F(!1),document.removeEventListener(`pointermove`,t),I.current=null};return I.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[b,F,I]),v.useEffect(()=>{let e=()=>F(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[F]);let[L,R]=w_(e=>{let t=k().filter(e=>!e.disabled),n=T_(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),ee=v.useCallback((e,t,n)=>{let r=!M.current&&!n;(y.value!==void 0&&y.value===t||r)&&(E(e),r&&(M.current=!0))},[y.value]),te=v.useCallback(()=>b?.focus(),[b]),ne=v.useCallback((e,t,n)=>{let r=!M.current&&!n;(y.value!==void 0&&y.value===t||r)&&O(e)},[y.value]),z=r===`popper`?qg:Gg,B=z===qg?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,H.jsx)(zg,{scope:n,content:b,viewport:S,onViewportChange:C,itemRefCallback:ee,selectedItem:T,onItemLeave:te,itemTextRefCallback:ne,focusSelectedItem:P,selectedItemText:D,position:r,isPositioned:A,searchRef:L,children:(0,H.jsx)(Qm,{as:Hg,allowPinchZoom:!0,children:(0,H.jsx)(kp,{asChild:!0,trapped:y.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:J(i,e=>{y.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,H.jsx)(Tl,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:(0,H.jsx)(z,{role:`listbox`,id:y.contentId,"data-state":y.open?`open`:`closed`,dir:y.dir,onContextMenu:e=>e.preventDefault(),..._,...B,onPlaced:()=>j(!0),ref:w,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:J(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&R(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=k().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>N(t)),e.preventDefault()}})})})})})})});Ug.displayName=Vg;var Wg=`SelectItemAlignedPosition`,Gg=v.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=wg(Ig,n),o=Bg(Ig,n),[s,c]=v.useState(null),[l,u]=v.useState(null),d=gs(t,e=>u(e)),f=vg(n),p=v.useRef(!1),m=v.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:y}=o,b=v.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Rg,d=lg(a,[Rg,Math.max(Rg,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Rg,d=lg(a,[Rg,Math.max(Rg,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-Rg*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-Rg,D=c-E,O=g.offsetHeight/2,k=g.offsetTop+O,A=m+v+k,j=x-A;if(A<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+j;s.style.height=t+`px`,h.scrollTop=A-E+h.offsetTop}s.style.margin=`${Rg}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);Ml(()=>b(),[b]);let[x,S]=v.useState();return Ml(()=>{l&&S(window.getComputedStyle(l).zIndex)},[l]),(0,H.jsx)(Jg,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:v.useCallback(e=>{e&&m.current===!0&&(b(),y?.(),m.current=!1)},[b,y]),children:(0,H.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:x},children:(0,H.jsx)(hl.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});Gg.displayName=Wg;var Kg=`SelectPopperPosition`,qg=v.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Rg,...a}=e,o=Sg(n);return(0,H.jsx)(yf,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.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)`}})});qg.displayName=Kg;var[Jg,Yg]=bg(Ig,{}),Xg=`SelectViewport`,Zg=v.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=Bg(Xg,n),o=Yg(Xg,n),s=gs(t,a.onViewportChange),c=v.useRef(0);return(0,H.jsxs)(H.Fragment,{children:[(0,H.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}),(0,H.jsx)(_g.Slot,{scope:n,children:(0,H.jsx)(hl.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:J(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-Rg*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});Zg.displayName=Xg;var Qg=`SelectGroup`,[$g,e_]=bg(Qg),t_=v.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Fl();return(0,H.jsx)($g,{scope:n,id:i,children:(0,H.jsx)(hl.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});t_.displayName=Qg;var n_=`SelectLabel`,r_=v.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=e_(n_,n);return(0,H.jsx)(hl.div,{id:i.id,...r,ref:t})});r_.displayName=n_;var i_=`SelectItem`,[a_,o_]=bg(i_),s_=v.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=wg(i_,n),c=Bg(i_,n),l=s.value===r,[u,d]=v.useState(a??``),[f,p]=v.useState(!1),m=gs(t,e=>c.itemRefCallback?.(e,r,i)),h=Fl(),g=v.useRef(`touch`),_=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};if(r===``)throw 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(0,H.jsx)(a_,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:v.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,H.jsx)(_g.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,H.jsx)(hl.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:J(o.onFocus,()=>p(!0)),onBlur:J(o.onBlur,()=>p(!1)),onClick:J(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:J(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:J(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:J(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:J(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:J(o.onKeyDown,e=>{c.searchRef?.current!==``&&e.key===` `||(hg.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})});s_.displayName=i_;var c_=`SelectItemText`,l_=v.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=wg(c_,n),s=Bg(c_,n),c=o_(c_,n),l=Eg(c_,n),[u,d]=v.useState(null),f=gs(t,e=>d(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=u?.textContent,m=v.useMemo(()=>(0,H.jsx)(`option`,{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:g}=l;return Ml(()=>(h(m),()=>g(m)),[h,g,m]),(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(hl.span,{id:c.textId,...a,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?N.createPortal(a.children,o.valueNode):null]})});l_.displayName=c_;var u_=`SelectItemIndicator`,d_=v.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return o_(u_,n).isSelected?(0,H.jsx)(hl.span,{"aria-hidden":!0,...r,ref:t}):null});d_.displayName=u_;var f_=`SelectScrollUpButton`,p_=v.forwardRef((e,t)=>{let n=Bg(f_,e.__scopeSelect),r=Yg(f_,e.__scopeSelect),[i,a]=v.useState(!1),o=gs(t,r.onScrollButtonChange);return Ml(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,H.jsx)(g_,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});p_.displayName=f_;var m_=`SelectScrollDownButton`,h_=v.forwardRef((e,t)=>{let n=Bg(m_,e.__scopeSelect),r=Yg(m_,e.__scopeSelect),[i,a]=v.useState(!1),o=gs(t,r.onScrollButtonChange);return Ml(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,H.jsx)(g_,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});h_.displayName=m_;var g_=v.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=Bg(`SelectScrollButton`,n),o=v.useRef(null),s=vg(n),c=v.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return v.useEffect(()=>()=>c(),[c]),Ml(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,H.jsx)(hl.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:J(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:J(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:J(i.onPointerLeave,()=>{c()})})}),__=`SelectSeparator`,v_=v.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,H.jsx)(hl.div,{"aria-hidden":!0,...r,ref:t})});v_.displayName=__;var y_=`SelectArrow`,b_=v.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Sg(n),a=wg(y_,n),o=Bg(y_,n);return a.open&&o.position===`popper`?(0,H.jsx)(bf,{...i,...r,ref:t}):null});b_.displayName=y_;var x_=`SelectBubbleInput`,S_=v.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=v.useRef(null),a=gs(r,i),o=pg(t);return v.useEffect(()=>{let e=i.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(o!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[o,t]),(0,H.jsx)(hl.select,{...n,style:{...Mf,...n.style},ref:a,defaultValue:t})});S_.displayName=x_;function C_(e){return e===``||e===void 0}function w_(e){let t=_l(e),n=v.useRef(``),r=v.useRef(0),i=v.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=v.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function T_(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=E_(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function E_(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var D_=Dg,O_=kg,k_=jg,A_=Ng,j_=Fg,M_=Lg,N_=Zg,P_=t_,F_=r_,I_=s_,L_=l_,R_=d_,z_=p_,B_=h_,V_=v_,H_=D_,U_=P_,W_=k_,G_=v.forwardRef(({className:e,children:t,...n},r)=>(0,H.jsxs)(O_,{ref:r,className:K(`flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1`,e),...n,children:[t,(0,H.jsx)(A_,{asChild:!0,children:(0,H.jsx)(Va,{className:`size-4 opacity-50`})})]}));G_.displayName=O_.displayName;var K_=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(z_,{ref:n,className:K(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,H.jsx)(Wa,{className:`size-4`})}));K_.displayName=z_.displayName;var q_=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(B_,{ref:n,className:K(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,H.jsx)(Va,{className:`size-4`})}));q_.displayName=B_.displayName;var J_=v.forwardRef(({className:e,children:t,position:n=`popper`,...r},i)=>(0,H.jsx)(j_,{children:(0,H.jsxs)(M_,{ref:i,className:K(`relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground 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,...r,children:[(0,H.jsx)(K_,{}),(0,H.jsx)(N_,{className:K(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`),children:t}),(0,H.jsx)(q_,{})]})}));J_.displayName=M_.displayName;var Y_=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(F_,{ref:n,className:K(`px-2 py-1.5 text-sm font-semibold`,e),...t}));Y_.displayName=F_.displayName;var X_=v.forwardRef(({className:e,children:t,...n},r)=>(0,H.jsxs)(I_,{ref:r,className:K(`relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,H.jsx)(`span`,{className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,H.jsx)(R_,{children:(0,H.jsx)(Ba,{className:`size-4`})})}),(0,H.jsx)(L_,{children:t})]}));X_.displayName=I_.displayName;var Z_=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(V_,{ref:n,className:K(`-mx-1 my-1 h-px bg-muted`,e),...t}));Z_.displayName=V_.displayName;function Q_({open:e,onOpenChange:t,collectionTypes:n,entryFieldMap:r,guessDefaultField:i,setEntryFieldMap:a}){return(0,H.jsxs)(Yh,{open:e,onOpenChange:t,children:[(0,H.jsx)(q,{size:`icon`,variant:`outline`,onClick:()=>t(!0),children:(0,H.jsx)(Za,{className:`size-4`})}),(0,H.jsxs)($h,{className:`max-w-lg`,children:[(0,H.jsx)(eg,{children:(0,H.jsx)(ng,{children:`Dashboard entry fields`})}),(0,H.jsx)(`div`,{className:`space-y-4`,children:n.map(e=>(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`recent-field-${e.slug}`,children:e.name}),(0,H.jsxs)(H_,{value:r[e.slug]??i(e),onValueChange:t=>a(n=>({...n,[e.slug]:t})),children:[(0,H.jsx)(G_,{id:`recent-field-${e.slug}`,children:(0,H.jsx)(W_,{})}),(0,H.jsxs)(J_,{children:[(0,H.jsx)(X_,{value:`id`,children:`id`}),e.fields.map(e=>(0,H.jsx)(X_,{value:e.name,children:e.name},e.name))]})]})]},e.slug))})]})]})}function $_({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`card`,className:K(`flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm`,e),...t})}function ev({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`card-header`,className:K(`@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6`,e),...t})}function tv({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`card-title`,className:K(`leading-none font-semibold`,e),...t})}function nv({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`card-action`,className:K(`col-start-2 row-span-2 row-start-1 self-start justify-self-end`,e),...t})}function rv({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`card-content`,className:K(`px-6`,e),...t})}function iv({contentTypes:e,collectionCount:t,singleCount:n,stats:r}){return(0,H.jsx)(`section`,{className:`mt-24 grid grid-cols-2 gap-4 lg:grid-cols-4`,children:[{label:`Entries`,value:r?.totalEntries??`—`,context:e?`${t} Content Types`:`—`},{label:`Content Types`,value:e?.length??`—`,context:e?`${t} Collection · ${n} Single`:`—`},{label:`Drafts`,value:r?.totalDrafts??`—`,context:r?`${r.myDrafts} owned by you`:`—`},{label:`Scheduled`,value:r?.totalScheduled??`—`,context:r?`${r.myScheduled} owned by you`:`—`}].map(({label:e,value:t,context:n})=>(0,H.jsxs)($_,{className:`bg-background`,children:[(0,H.jsxs)(ev,{children:[(0,H.jsx)(tv,{className:`text-base font-bold uppercase`,children:e}),(0,H.jsx)(`div`,{className:`text-3xl font-bold`,children:t})]}),(0,H.jsx)(rv,{children:(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n})})]},e))})}var av={year:`numeric`,month:`short`,day:`numeric`},ov={year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`};function sv(e,t,n=av){let r=e instanceof Date?e:new Date(e);return isNaN(r.getTime())?String(e):new Intl.DateTimeFormat(`en-US`,{...n,timeZone:t}).format(r)}function cv(e,t){return sv(e,t,ov)}function lv(e,t){return dv(e,t).slice(11,16)}function uv(e,t,n){return fv(`${dv(e.toISOString(),n).slice(0,10)}T${t}`,n)}function dv(e,t){let n=new Date(e);if(isNaN(n.getTime()))return``;let r=new Intl.DateTimeFormat(`en-CA`,{timeZone:t,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,hour12:!1}).formatToParts(n),i=Object.fromEntries(r.map(e=>[e.type,e.value])),a=i.hour===`24`?`00`:i.hour;return`${i.year}-${i.month}-${i.day}T${a}:${i.minute}`}function fv(e,t){if(!e)return``;let n=new Date(e+`:00.000Z`),r=new Intl.DateTimeFormat(`en-CA`,{timeZone:t,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,hour12:!1}).formatToParts(n),i=Object.fromEntries(r.map(e=>[e.type,e.value])),a=i.hour===`24`?`00`:i.hour,o=new Date(`${i.year}-${i.month}-${i.day}T${a}:${i.minute}:00.000Z`).getTime(),s=n.getTime()-o;return new Date(n.getTime()+s).toISOString()}var pv=`Collapsible`,[mv,hv]=al(pv),[gv,_v]=mv(pv),vv=v.forwardRef((e,t)=>{let{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:o,...s}=e,[c,l]=kf({prop:r,defaultProp:i??!1,onChange:o,caller:pv});return(0,H.jsx)(gv,{scope:n,disabled:a,contentId:Fl(),open:c,onOpenToggle:v.useCallback(()=>l(e=>!e),[l]),children:(0,H.jsx)(hl.div,{"data-state":wv(c),"data-disabled":a?``:void 0,...s,ref:t})})});vv.displayName=pv;var yv=`CollapsibleTrigger`,bv=v.forwardRef((e,t)=>{let{__scopeCollapsible:n,...r}=e,i=_v(yv,n);return(0,H.jsx)(hl.button,{type:`button`,"aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":wv(i.open),"data-disabled":i.disabled?``:void 0,disabled:i.disabled,...r,ref:t,onClick:J(e.onClick,i.onOpenToggle)})});bv.displayName=yv;var xv=`CollapsibleContent`,Sv=v.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=_v(xv,e.__scopeCollapsible);return(0,H.jsx)(wf,{present:n||i.open,children:({present:e})=>(0,H.jsx)(Cv,{...r,ref:t,present:e})})});Sv.displayName=xv;var Cv=v.forwardRef((e,t)=>{let{__scopeCollapsible:n,present:r,children:i,...a}=e,o=_v(xv,n),[s,c]=v.useState(r),l=v.useRef(null),u=gs(t,l),d=v.useRef(0),f=d.current,p=v.useRef(0),m=p.current,h=o.open||s,g=v.useRef(h),_=v.useRef(void 0);return v.useEffect(()=>{let e=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(e)},[]),Ml(()=>{let e=l.current;if(e){_.current=_.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();d.current=t.height,p.current=t.width,g.current||(e.style.transitionDuration=_.current.transitionDuration,e.style.animationName=_.current.animationName),c(r)}},[o.open,r]),(0,H.jsx)(hl.div,{"data-state":wv(o.open),"data-disabled":o.disabled?``:void 0,id:o.contentId,hidden:!h,...a,ref:u,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...e.style},children:h&&i})});function wv(e){return e?`open`:`closed`}var Tv=vv,Ev=bv,Dv=Sv,Ov=`Accordion`,kv=[`Home`,`End`,`ArrowDown`,`ArrowUp`,`ArrowLeft`,`ArrowRight`],[Av,jv,Mv]=ug(Ov),[Nv,Pv]=al(Ov,[Mv,hv]),Fv=hv(),Iv=v.forwardRef((e,t)=>{let{type:n,...r}=e,i=r,a=r;return(0,H.jsx)(Av.Provider,{scope:e.__scopeAccordion,children:n===`multiple`?(0,H.jsx)(Hv,{...a,ref:t}):(0,H.jsx)(Vv,{...i,ref:t})})});Iv.displayName=Ov;var[Lv,Rv]=Nv(Ov),[zv,Bv]=Nv(Ov,{collapsible:!1}),Vv=v.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},collapsible:a=!1,...o}=e,[s,c]=kf({prop:n,defaultProp:r??``,onChange:i,caller:Ov});return(0,H.jsx)(Lv,{scope:e.__scopeAccordion,value:v.useMemo(()=>s?[s]:[],[s]),onItemOpen:c,onItemClose:v.useCallback(()=>a&&c(``),[a,c]),children:(0,H.jsx)(zv,{scope:e.__scopeAccordion,collapsible:a,children:(0,H.jsx)(Gv,{...o,ref:t})})})}),Hv=v.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=kf({prop:n,defaultProp:r??[],onChange:i,caller:Ov}),c=v.useCallback(e=>s((t=[])=>[...t,e]),[s]),l=v.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,H.jsx)(Lv,{scope:e.__scopeAccordion,value:o,onItemOpen:c,onItemClose:l,children:(0,H.jsx)(zv,{scope:e.__scopeAccordion,collapsible:!0,children:(0,H.jsx)(Gv,{...a,ref:t})})})}),[Uv,Wv]=Nv(Ov),Gv=v.forwardRef((e,t)=>{let{__scopeAccordion:n,disabled:r,dir:i,orientation:a=`vertical`,...o}=e,s=gs(v.useRef(null),t),c=jv(n),l=fg(i)===`ltr`,u=J(e.onKeyDown,e=>{if(!kv.includes(e.key))return;let t=e.target,n=c().filter(e=>!e.ref.current?.disabled),r=n.findIndex(e=>e.ref.current===t),i=n.length;if(r===-1)return;e.preventDefault();let o=r,s=i-1,u=()=>{o=r+1,o>s&&(o=0)},d=()=>{o=r-1,o<0&&(o=s)};switch(e.key){case`Home`:o=0;break;case`End`:o=s;break;case`ArrowRight`:a===`horizontal`&&(l?u():d());break;case`ArrowDown`:a===`vertical`&&u();break;case`ArrowLeft`:a===`horizontal`&&(l?d():u());break;case`ArrowUp`:a===`vertical`&&d();break}n[o%i].ref.current?.focus()});return(0,H.jsx)(Uv,{scope:n,disabled:r,direction:i,orientation:a,children:(0,H.jsx)(Av.Slot,{scope:n,children:(0,H.jsx)(hl.div,{...o,"data-orientation":a,ref:s,onKeyDown:r?void 0:u})})})}),Kv=`AccordionItem`,[qv,Jv]=Nv(Kv),Yv=v.forwardRef((e,t)=>{let{__scopeAccordion:n,value:r,...i}=e,a=Wv(Kv,n),o=Rv(Kv,n),s=Fv(n),c=Fl(),l=r&&o.value.includes(r)||!1,u=a.disabled||e.disabled;return(0,H.jsx)(qv,{scope:n,open:l,disabled:u,triggerId:c,children:(0,H.jsx)(Tv,{"data-orientation":a.orientation,"data-state":ny(l),...s,...i,ref:t,disabled:u,open:l,onOpenChange:e=>{e?o.onItemOpen(r):o.onItemClose(r)}})})});Yv.displayName=Kv;var Xv=`AccordionHeader`,Zv=v.forwardRef((e,t)=>{let{__scopeAccordion:n,...r}=e,i=Wv(Ov,n),a=Jv(Xv,n);return(0,H.jsx)(hl.h3,{"data-orientation":i.orientation,"data-state":ny(a.open),"data-disabled":a.disabled?``:void 0,...r,ref:t})});Zv.displayName=Xv;var Qv=`AccordionTrigger`,$v=v.forwardRef((e,t)=>{let{__scopeAccordion:n,...r}=e,i=Wv(Ov,n),a=Jv(Qv,n),o=Bv(Qv,n),s=Fv(n);return(0,H.jsx)(Av.ItemSlot,{scope:n,children:(0,H.jsx)(Ev,{"aria-disabled":a.open&&!o.collapsible||void 0,"data-orientation":i.orientation,id:a.triggerId,...s,...r,ref:t})})});$v.displayName=Qv;var ey=`AccordionContent`,ty=v.forwardRef((e,t)=>{let{__scopeAccordion:n,...r}=e,i=Wv(Ov,n),a=Jv(ey,n),o=Fv(n);return(0,H.jsx)(Dv,{role:`region`,"aria-labelledby":a.triggerId,"data-orientation":i.orientation,...o,...r,ref:t,style:{"--radix-accordion-content-height":`var(--radix-collapsible-content-height)`,"--radix-accordion-content-width":`var(--radix-collapsible-content-width)`,...e.style}})});ty.displayName=ey;function ny(e){return e?`open`:`closed`}var ry=Iv,iy=Yv,ay=Zv,oy=$v,sy=ty,cy=o((e=>{var t=d();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),ly=o(((e,t)=>{t.exports=cy()})),uy=ly();function dy(){return(0,uy.useSyncExternalStore)(fy,()=>!0,()=>!1)}function fy(){return()=>{}}var py=`Checkbox`,[my,hy]=al(py),[gy,_y]=my(py);function vy(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=kf({prop:n,defaultProp:i??!1,onChange:c,caller:py}),[m,h]=v.useState(null),[g,_]=v.useState(null),y=v.useRef(!1),b=m?!!o||!!m.closest(`form`):!0,x={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:y,required:l,defaultChecked:Dy(i)?!1:i,isFormControl:b,bubbleInput:g,setBubbleInput:_};return(0,H.jsx)(gy,{scope:t,...x,children:Ey(d)?d(x):r})}var yy=`CheckboxTrigger`,by=v.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i)=>{let{control:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,isFormControl:p,bubbleInput:m}=_y(yy,e),h=gs(i,u),g=v.useRef(c);return v.useEffect(()=>{let e=a?.form;if(e){let t=()=>d(g.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,H.jsx)(hl.button,{type:`button`,role:`checkbox`,"aria-checked":Dy(c)?`mixed`:c,"aria-required":l,"data-state":Oy(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:h,onKeyDown:J(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:J(n,e=>{d(e=>Dy(e)?!0:!e),m&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});by.displayName=yy;var xy=v.forwardRef((e,t)=>{let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,H.jsx)(vy,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(by,{...d,ref:t,__scopeCheckbox:n}),e&&(0,H.jsx)(Ty,{__scopeCheckbox:n})]})})});xy.displayName=py;var Sy=`CheckboxIndicator`,Cy=v.forwardRef((e,t)=>{let{__scopeCheckbox:n,forceMount:r,...i}=e,a=_y(Sy,n);return(0,H.jsx)(wf,{present:r||Dy(a.checked)||a.checked===!0,children:(0,H.jsx)(hl.span,{"data-state":Oy(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})});Cy.displayName=Sy;var wy=`CheckboxBubbleInput`,Ty=v.forwardRef(({__scopeCheckbox:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:o,required:s,disabled:c,name:l,value:u,form:d,bubbleInput:f,setBubbleInput:p}=_y(wy,e),m=gs(n,p),h=pg(a),g=Zd(r);v.useEffect(()=>{let e=f;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(h!==a&&n){let t=new Event(`click`,{bubbles:r});e.indeterminate=Dy(a),n.call(e,Dy(a)?!1:a),e.dispatchEvent(t)}},[f,h,a,i]);let _=v.useRef(Dy(a)?!1:a);return(0,H.jsx)(hl.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:o??_.current,required:s,disabled:c,name:l,value:u,form:d,...t,tabIndex:-1,ref:m,style:{...t.style,...g,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});Ty.displayName=wy;function Ey(e){return typeof e==`function`}function Dy(e){return e===`indeterminate`}function Oy(e){return Dy(e)?`indeterminate`:e?`checked`:`unchecked`}var ky=`rovingFocusGroup.onEntryFocus`,Ay={bubbles:!1,cancelable:!0},jy=`RovingFocusGroup`,[My,Ny,Py]=ug(jy),[Fy,Iy]=al(jy,[Py]),[Ly,Ry]=Fy(jy),zy=v.forwardRef((e,t)=>(0,H.jsx)(My.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,H.jsx)(My.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,H.jsx)(By,{...e,ref:t})})}));zy.displayName=jy;var By=v.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=v.useRef(null),p=gs(t,f),m=fg(a),[h,g]=kf({prop:o,defaultProp:s??null,onChange:c,caller:jy}),[_,y]=v.useState(!1),b=_l(l),x=Ny(n),S=v.useRef(!1),[C,w]=v.useState(0);return v.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(ky,b),()=>e.removeEventListener(ky,b)},[b]),(0,H.jsx)(Ly,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:v.useCallback(e=>g(e),[g]),onItemShiftTab:v.useCallback(()=>y(!0),[]),onFocusableItemAdd:v.useCallback(()=>w(e=>e+1),[]),onFocusableItemRemove:v.useCallback(()=>w(e=>e-1),[]),children:(0,H.jsx)(hl.div,{tabIndex:_||C===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:J(e.onMouseDown,()=>{S.current=!0}),onFocus:J(e.onFocus,e=>{let t=!S.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(ky,Ay);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=x().filter(e=>e.focusable);Ky([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}S.current=!1}),onBlur:J(e.onBlur,()=>y(!1))})})}),Vy=`RovingFocusGroupItem`,Hy=v.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=Fl(),l=a||c,u=Ry(Vy,n),d=u.currentTabStopId===l,f=Ny(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return v.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,H.jsx)(My.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,H.jsx)(hl.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:J(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:J(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:J(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=Gy(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?qy(n,r+1):n.slice(r+1)}setTimeout(()=>Ky(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});Hy.displayName=Vy;var Uy={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Wy(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function Gy(e,t,n){let r=Wy(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Uy[r]}function Ky(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function qy(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Jy=zy,Yy=Hy,Xy=[`Enter`,` `],Zy=[`ArrowDown`,`PageUp`,`Home`],Qy=[`ArrowUp`,`PageDown`,`End`],$y=[...Zy,...Qy],eb={ltr:[...Xy,`ArrowRight`],rtl:[...Xy,`ArrowLeft`]},tb={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},nb=`Menu`,[rb,ib,ab]=ug(nb),[ob,sb]=al(nb,[ab,ef,Iy]),cb=ef(),lb=Iy(),[ub,db]=ob(nb),[fb,pb]=ob(nb),mb=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=cb(t),[c,l]=v.useState(null),u=v.useRef(!1),d=_l(a),f=fg(i);return v.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,H.jsx)(_f,{...s,children:(0,H.jsx)(ub,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,H.jsx)(fb,{scope:t,onClose:v.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};mb.displayName=nb;var hb=`MenuAnchor`,gb=v.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=cb(n);return(0,H.jsx)(vf,{...i,...r,ref:t})});gb.displayName=hb;var _b=`MenuPortal`,[vb,yb]=ob(_b,{forceMount:void 0}),bb=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=db(_b,t);return(0,H.jsx)(vb,{scope:t,forceMount:n,children:(0,H.jsx)(wf,{present:n||a.open,children:(0,H.jsx)(Sf,{asChild:!0,container:i,children:r})})})};bb.displayName=_b;var xb=`MenuContent`,[Sb,Cb]=ob(xb),wb=v.forwardRef((e,t)=>{let n=yb(xb,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=db(xb,e.__scopeMenu),o=pb(xb,e.__scopeMenu);return(0,H.jsx)(rb.Provider,{scope:e.__scopeMenu,children:(0,H.jsx)(wf,{present:r||a.open,children:(0,H.jsx)(rb.Slot,{scope:e.__scopeMenu,children:o.modal?(0,H.jsx)(Tb,{...i,ref:t}):(0,H.jsx)(Eb,{...i,ref:t})})})})}),Tb=v.forwardRef((e,t)=>{let n=db(xb,e.__scopeMenu),r=v.useRef(null),i=gs(t,r);return v.useEffect(()=>{let e=r.current;if(e)return sh(e)},[]),(0,H.jsx)(Ob,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:J(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Eb=v.forwardRef((e,t)=>{let n=db(xb,e.__scopeMenu);return(0,H.jsx)(Ob,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Db=sl(`MenuContent.ScrollLock`),Ob=v.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=db(xb,n),_=pb(xb,n),y=cb(n),b=lb(n),x=ib(n),[S,C]=v.useState(null),w=v.useRef(null),T=gs(t,w,g.onContentChange),E=v.useRef(0),D=v.useRef(``),O=v.useRef(0),k=v.useRef(null),A=v.useRef(`right`),j=v.useRef(0),M=m?Qm:v.Fragment,N=m?{as:Db,allowPinchZoom:!0}:void 0,P=e=>{let t=D.current+e,n=x().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=fx(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){D.current=t,window.clearTimeout(E.current),t!==``&&(E.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};v.useEffect(()=>()=>window.clearTimeout(E.current),[]),Hp();let F=v.useCallback(e=>A.current===k.current?.side&&mx(e,k.current?.area),[]);return(0,H.jsx)(Sb,{scope:n,searchRef:D,onItemEnter:v.useCallback(e=>{F(e)&&e.preventDefault()},[F]),onItemLeave:v.useCallback(e=>{F(e)||(w.current?.focus(),C(null))},[F]),onTriggerLeave:v.useCallback(e=>{F(e)&&e.preventDefault()},[F]),pointerGraceTimerRef:O,onPointerGraceIntentChange:v.useCallback(e=>{k.current=e},[]),children:(0,H.jsx)(M,{...N,children:(0,H.jsx)(kp,{asChild:!0,trapped:i,onMountAutoFocus:J(a,e=>{e.preventDefault(),w.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,H.jsx)(Tl,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,H.jsx)(Jy,{asChild:!0,...b,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:S,onCurrentTabStopIdChange:C,onEntryFocus:J(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,H.jsx)(yf,{role:`menu`,"aria-orientation":`vertical`,"data-state":sx(g.open),"data-radix-menu-content":``,dir:_.dir,...y,...h,ref:T,style:{outline:`none`,...h.style},onKeyDown:J(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&P(e.key));let i=w.current;if(e.target!==i||!$y.includes(e.key))return;e.preventDefault();let a=x().filter(e=>!e.disabled).map(e=>e.ref.current);Qy.includes(e.key)&&a.reverse(),ux(a)}),onBlur:J(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(E.current),D.current=``)}),onPointerMove:J(e.onPointerMove,hx(e=>{let t=e.target,n=j.current!==e.clientX;e.currentTarget.contains(t)&&n&&(A.current=e.clientX>j.current?`right`:`left`,j.current=e.clientX)}))})})})})})})});wb.displayName=xb;var kb=`MenuGroup`,Ab=v.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,H.jsx)(hl.div,{role:`group`,...r,ref:t})});Ab.displayName=kb;var jb=`MenuLabel`,Mb=v.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,H.jsx)(hl.div,{...r,ref:t})});Mb.displayName=jb;var Nb=`MenuItem`,Pb=`menu.itemSelect`,Fb=v.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=v.useRef(null),o=pb(Nb,e.__scopeMenu),s=Cb(Nb,e.__scopeMenu),c=gs(t,a),l=v.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(Pb,{bubbles:!0,cancelable:!0});e.addEventListener(Pb,e=>r?.(e),{once:!0}),gl(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,H.jsx)(Ib,{...i,ref:c,disabled:n,onClick:J(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:J(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:J(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||Xy.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});Fb.displayName=Nb;var Ib=v.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=Cb(Nb,n),s=lb(n),c=v.useRef(null),l=gs(t,c),[u,d]=v.useState(!1),[f,p]=v.useState(``);return v.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,H.jsx)(rb.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,H.jsx)(Yy,{asChild:!0,...s,focusable:!r,children:(0,H.jsx)(hl.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:J(e.onPointerMove,hx(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:J(e.onPointerLeave,hx(e=>o.onItemLeave(e))),onFocus:J(e.onFocus,()=>d(!0)),onBlur:J(e.onBlur,()=>d(!1))})})})}),Lb=`MenuCheckboxItem`,Rb=v.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,H.jsx)(Kb,{scope:e.__scopeMenu,checked:n,children:(0,H.jsx)(Fb,{role:`menuitemcheckbox`,"aria-checked":cx(n)?`mixed`:n,...i,ref:t,"data-state":lx(n),onSelect:J(i.onSelect,()=>r?.(cx(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Rb.displayName=Lb;var zb=`MenuRadioGroup`,[Bb,Vb]=ob(zb,{value:void 0,onValueChange:()=>{}}),Hb=v.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=_l(r);return(0,H.jsx)(Bb,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,H.jsx)(Ab,{...i,ref:t})})});Hb.displayName=zb;var Ub=`MenuRadioItem`,Wb=v.forwardRef((e,t)=>{let{value:n,...r}=e,i=Vb(Ub,e.__scopeMenu),a=n===i.value;return(0,H.jsx)(Kb,{scope:e.__scopeMenu,checked:a,children:(0,H.jsx)(Fb,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":lx(a),onSelect:J(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Wb.displayName=Ub;var Gb=`MenuItemIndicator`,[Kb,qb]=ob(Gb,{checked:!1}),Jb=v.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=qb(Gb,n);return(0,H.jsx)(wf,{present:r||cx(a.checked)||a.checked===!0,children:(0,H.jsx)(hl.span,{...i,ref:t,"data-state":lx(a.checked)})})});Jb.displayName=Gb;var Yb=`MenuSeparator`,Xb=v.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,H.jsx)(hl.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});Xb.displayName=Yb;var Zb=`MenuArrow`,Qb=v.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=cb(n);return(0,H.jsx)(bf,{...i,...r,ref:t})});Qb.displayName=Zb;var $b=`MenuSub`,[ex,tx]=ob($b),nx=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=db($b,t),o=cb(t),[s,c]=v.useState(null),[l,u]=v.useState(null),d=_l(i);return v.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,H.jsx)(_f,{...o,children:(0,H.jsx)(ub,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,H.jsx)(ex,{scope:t,contentId:Fl(),triggerId:Fl(),trigger:s,onTriggerChange:c,children:n})})})};nx.displayName=$b;var rx=`MenuSubTrigger`,ix=v.forwardRef((e,t)=>{let n=db(rx,e.__scopeMenu),r=pb(rx,e.__scopeMenu),i=tx(rx,e.__scopeMenu),a=Cb(rx,e.__scopeMenu),o=v.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=v.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return v.useEffect(()=>u,[u]),v.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,H.jsx)(gb,{asChild:!0,...l,children:(0,H.jsx)(Ib,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":sx(n.open),...e,ref:hs(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:J(e.onPointerMove,hx(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:J(e.onPointerLeave,hx(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:J(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||eb[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});ix.displayName=rx;var ax=`MenuSubContent`,ox=v.forwardRef((e,t)=>{let n=yb(xb,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=db(xb,e.__scopeMenu),o=pb(xb,e.__scopeMenu),s=tx(ax,e.__scopeMenu),c=v.useRef(null),l=gs(t,c);return(0,H.jsx)(rb.Provider,{scope:e.__scopeMenu,children:(0,H.jsx)(wf,{present:r||a.open,children:(0,H.jsx)(rb.Slot,{scope:e.__scopeMenu,children:(0,H.jsx)(Ob,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:J(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:J(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:J(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=tb[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});ox.displayName=ax;function sx(e){return e?`open`:`closed`}function cx(e){return e===`indeterminate`}function lx(e){return cx(e)?`indeterminate`:e?`checked`:`unchecked`}function ux(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function dx(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function fx(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=dx(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function px(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function mx(e,t){return t?px({x:e.clientX,y:e.clientY},t):!1}function hx(e){return t=>t.pointerType===`mouse`?e(t):void 0}var gx=mb,_x=gb,vx=bb,yx=wb,bx=Ab,xx=Mb,Sx=Fb,Cx=Rb,wx=Hb,Tx=Wb,Ex=Jb,Dx=Xb,Ox=Qb,kx=ix,Ax=ox,jx=`DropdownMenu`,[Mx,Nx]=al(jx,[sb]),Px=sb(),[Fx,Ix]=Mx(jx),Lx=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=Px(t),l=v.useRef(null),[u,d]=kf({prop:i,defaultProp:a??!1,onChange:o,caller:jx});return(0,H.jsx)(Fx,{scope:t,triggerId:Fl(),triggerRef:l,contentId:Fl(),open:u,onOpenChange:d,onOpenToggle:v.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,H.jsx)(gx,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};Lx.displayName=jx;var Rx=`DropdownMenuTrigger`,zx=v.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=Ix(Rx,n),o=Px(n);return(0,H.jsx)(_x,{asChild:!0,...o,children:(0,H.jsx)(hl.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:hs(t,a.triggerRef),onPointerDown:J(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:J(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});zx.displayName=Rx;var Bx=`DropdownMenuPortal`,Vx=e=>{let{__scopeDropdownMenu:t,...n}=e,r=Px(t);return(0,H.jsx)(vx,{...r,...n})};Vx.displayName=Bx;var Hx=`DropdownMenuContent`,Ux=v.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Ix(Hx,n),a=Px(n),o=v.useRef(!1);return(0,H.jsx)(yx,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:J(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:J(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.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)`}})});Ux.displayName=Hx;var Wx=`DropdownMenuGroup`,Gx=v.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Px(n);return(0,H.jsx)(bx,{...i,...r,ref:t})});Gx.displayName=Wx;var Kx=`DropdownMenuLabel`,qx=v.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Px(n);return(0,H.jsx)(xx,{...i,...r,ref:t})});qx.displayName=Kx;var Jx=`DropdownMenuItem`,Yx=v.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Px(n);return(0,H.jsx)(Sx,{...i,...r,ref:t})});Yx.displayName=Jx;var Xx=`DropdownMenuCheckboxItem`,Zx=v.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Px(n);return(0,H.jsx)(Cx,{...i,...r,ref:t})});Zx.displayName=Xx;var Qx=`DropdownMenuRadioGroup`,$x=v.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Px(n);return(0,H.jsx)(wx,{...i,...r,ref:t})});$x.displayName=Qx;var eS=`DropdownMenuRadioItem`,tS=v.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Px(n);return(0,H.jsx)(Tx,{...i,...r,ref:t})});tS.displayName=eS;var nS=`DropdownMenuItemIndicator`,rS=v.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Px(n);return(0,H.jsx)(Ex,{...i,...r,ref:t})});rS.displayName=nS;var iS=`DropdownMenuSeparator`,aS=v.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Px(n);return(0,H.jsx)(Dx,{...i,...r,ref:t})});aS.displayName=iS;var oS=`DropdownMenuArrow`,sS=v.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Px(n);return(0,H.jsx)(Ox,{...i,...r,ref:t})});sS.displayName=oS;var cS=`DropdownMenuSubTrigger`,lS=v.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Px(n);return(0,H.jsx)(kx,{...i,...r,ref:t})});lS.displayName=cS;var uS=`DropdownMenuSubContent`,dS=v.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Px(n);return(0,H.jsx)(Ax,{...i,...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)`}})});dS.displayName=uS;var fS=Lx,pS=zx,mS=Vx,hS=Ux,gS=qx,_S=Yx,vS=Zx,yS=tS,bS=rS,xS=aS,SS=lS,CS=dS,wS=`Popover`,[TS,ES]=al(wS,[ef]),DS=ef(),[OS,kS]=TS(wS),AS=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=DS(t),c=v.useRef(null),[l,u]=v.useState(!1),[d,f]=kf({prop:r,defaultProp:i??!1,onChange:a,caller:wS});return(0,H.jsx)(_f,{...s,children:(0,H.jsx)(OS,{scope:t,contentId:Fl(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:v.useCallback(()=>u(!0),[]),onCustomAnchorRemove:v.useCallback(()=>u(!1),[]),modal:o,children:n})})};AS.displayName=wS;var jS=`PopoverAnchor`,MS=v.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=kS(jS,n),a=DS(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return v.useEffect(()=>(o(),()=>s()),[o,s]),(0,H.jsx)(vf,{...a,...r,ref:t})});MS.displayName=jS;var NS=`PopoverTrigger`,PS=v.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=kS(NS,n),a=DS(n),o=gs(t,i.triggerRef),s=(0,H.jsx)(hl.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":YS(i.open),...r,ref:o,onClick:J(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,H.jsx)(vf,{asChild:!0,...a,children:s})});PS.displayName=NS;var FS=`PopoverPortal`,[IS,LS]=TS(FS,{forceMount:void 0}),RS=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=kS(FS,t);return(0,H.jsx)(IS,{scope:t,forceMount:n,children:(0,H.jsx)(wf,{present:n||a.open,children:(0,H.jsx)(Sf,{asChild:!0,container:i,children:r})})})};RS.displayName=FS;var zS=`PopoverContent`,BS=v.forwardRef((e,t)=>{let n=LS(zS,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=kS(zS,e.__scopePopover);return(0,H.jsx)(wf,{present:r||a.open,children:a.modal?(0,H.jsx)(HS,{...i,ref:t}):(0,H.jsx)(US,{...i,ref:t})})});BS.displayName=zS;var VS=sl(`PopoverContent.RemoveScroll`),HS=v.forwardRef((e,t)=>{let n=kS(zS,e.__scopePopover),r=v.useRef(null),i=gs(t,r),a=v.useRef(!1);return v.useEffect(()=>{let e=r.current;if(e)return sh(e)},[]),(0,H.jsx)(Qm,{as:VS,allowPinchZoom:!0,children:(0,H.jsx)(WS,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:J(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:J(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:J(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),US=v.forwardRef((e,t)=>{let n=kS(zS,e.__scopePopover),r=v.useRef(!1),i=v.useRef(!1);return(0,H.jsx)(WS,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),WS=v.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=kS(zS,n),p=DS(n);return Hp(),(0,H.jsx)(kp,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,H.jsx)(Tl,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,H.jsx)(yf,{"data-state":YS(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),GS=`PopoverClose`,KS=v.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=kS(GS,n);return(0,H.jsx)(hl.button,{type:`button`,...r,ref:t,onClick:J(e.onClick,()=>i.onOpenChange(!1))})});KS.displayName=GS;var qS=`PopoverArrow`,JS=v.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=DS(n);return(0,H.jsx)(bf,{...i,...r,ref:t})});JS.displayName=qS;function YS(e){return e?`open`:`closed`}var XS=AS,ZS=PS,QS=RS,$S=BS,eC=`Separator`,tC=`horizontal`,nC=[`horizontal`,`vertical`],rC=v.forwardRef((e,t)=>{let{decorative:n,orientation:r=tC,...i}=e,a=iC(r)?r:tC,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,H.jsx)(hl.div,{"data-orientation":a,...o,...i,ref:t})});rC.displayName=eC;function iC(e){return nC.includes(e)}var aC=rC,oC=`Switch`,[sC,cC]=al(oC),[lC,uC]=sC(oC),dC=v.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c=`on`,onCheckedChange:l,form:u,...d}=e,[f,p]=v.useState(null),m=gs(t,e=>p(e)),h=v.useRef(!1),g=f?u||!!f.closest(`form`):!0,[_,y]=kf({prop:i,defaultProp:a??!1,onChange:l,caller:oC});return(0,H.jsxs)(lC,{scope:n,checked:_,disabled:s,children:[(0,H.jsx)(hl.button,{type:`button`,role:`switch`,"aria-checked":_,"aria-required":o,"data-state":gC(_),"data-disabled":s?``:void 0,disabled:s,value:c,...d,ref:m,onClick:J(e.onClick,e=>{y(e=>!e),g&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})}),g&&(0,H.jsx)(hC,{control:f,bubbles:!h.current,name:r,value:c,checked:_,required:o,disabled:s,form:u,style:{transform:`translateX(-100%)`}})]})});dC.displayName=oC;var fC=`SwitchThumb`,pC=v.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=uC(fC,n);return(0,H.jsx)(hl.span,{"data-state":gC(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});pC.displayName=fC;var mC=`SwitchBubbleInput`,hC=v.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=v.useRef(null),s=gs(o,a),c=pg(n),l=Zd(t);return v.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(t,`checked`).set;if(c!==n&&i){let t=new Event(`click`,{bubbles:r});i.call(e,n),e.dispatchEvent(t)}},[c,n,r]),(0,H.jsx)(`input`,{type:`checkbox`,"aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...i.style,...l,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});hC.displayName=mC;function gC(e){return e?`checked`:`unchecked`}var _C=dC,vC=pC,yC=`Tabs`,[bC,xC]=al(yC,[Iy]),SC=Iy(),[CC,wC]=bC(yC),TC=v.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=fg(s),[d,f]=kf({prop:r,onChange:i,defaultProp:a??``,caller:yC});return(0,H.jsx)(CC,{scope:n,baseId:Fl(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,H.jsx)(hl.div,{dir:u,"data-orientation":o,...l,ref:t})})});TC.displayName=yC;var EC=`TabsList`,DC=v.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=wC(EC,n),o=SC(n);return(0,H.jsx)(Jy,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,H.jsx)(hl.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});DC.displayName=EC;var OC=`TabsTrigger`,kC=v.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=wC(OC,n),s=SC(n),c=MC(o.baseId,r),l=NC(o.baseId,r),u=r===o.value;return(0,H.jsx)(Yy,{asChild:!0,...s,focusable:!i,active:u,children:(0,H.jsx)(hl.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:J(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:J(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:J(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});kC.displayName=OC;var AC=`TabsContent`,jC=v.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=wC(AC,n),c=MC(s.baseId,r),l=NC(s.baseId,r),u=r===s.value,d=v.useRef(u);return v.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,H.jsx)(wf,{present:i||u,children:({present:n})=>(0,H.jsx)(hl.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});jC.displayName=AC;function MC(e,t){return`${e}-trigger-${t}`}function NC(e,t){return`${e}-content-${t}`}var PC=TC,FC=DC,IC=kC,LC=jC,RC=Ms(`inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 [&>svg]:pointer-events-none [&>svg]:size-3`,{variants:{variant:{default:`bg-primary text-primary-foreground [a&]:hover:bg-primary/90`,secondary:`bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90`,destructive:`bg-destructive text-white focus-visible:ring-destructive/20 [a&]:hover:bg-destructive/90`,outline:`border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,ghost:`[a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,link:`text-primary underline-offset-4 [a&]:hover:underline`}},defaultVariants:{variant:`default`}});function zC({className:e,variant:t=`default`,asChild:n=!1,...r}){return(0,H.jsx)(n?cl:`span`,{"data-slot":`badge`,"data-variant":t,className:K(RC({variant:t}),e),...r})}function BC({className:e,...t}){return(0,H.jsx)(Ao,{role:`status`,"aria-label":`Loading`,className:K(`size-4 animate-spin`,e),...t})}var VC=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`div`,{className:`relative w-full overflow-auto`,children:(0,H.jsx)(`table`,{ref:n,className:K(`w-full caption-bottom text-sm`,e),...t})}));VC.displayName=`Table`;var HC=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`thead`,{ref:n,className:K(`[&_tr]:border-b`,e),...t}));HC.displayName=`TableHeader`;var UC=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`tbody`,{ref:n,className:K(`[&_tr:last-child]:border-0`,e),...t}));UC.displayName=`TableBody`;var WC=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`tr`,{ref:n,className:K(`border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted`,e),...t}));WC.displayName=`TableRow`;var GC=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`th`,{ref:n,className:K(`h-10 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,e),...t}));GC.displayName=`TableHead`;var KC=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`td`,{ref:n,className:K(`p-4 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,e),...t}));KC.displayName=`TableCell`;var qC=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`caption`,{ref:n,className:K(`mt-4 text-sm text-muted-foreground`,e),...t}));qC.displayName=`TableCaption`;function JC(e,t=[]){let n=[];function r(t,r){let i=v.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=v.useMemo(()=>o,Object.values(o));return(0,H.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=v.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>v.createContext(e));return function(n){let r=n?.[e]||t;return v.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,YC(i,...t)]}function YC(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var XC=`Avatar`,[ZC,QC]=JC(XC),[$C,ew]=ZC(XC),tw=v.forwardRef((e,t)=>{let{__scopeAvatar:n,...r}=e,[i,a]=v.useState(`idle`);return(0,H.jsx)($C,{scope:n,imageLoadingStatus:i,onImageLoadingStatusChange:a,children:(0,H.jsx)(ig.span,{...r,ref:t})})});tw.displayName=XC;var nw=`AvatarImage`,rw=v.forwardRef((e,t)=>{let{__scopeAvatar:n,src:r,onLoadingStatusChange:i=()=>{},...a}=e,o=ew(nw,n),s=sw(r,a),c=_l(e=>{i(e),o.onImageLoadingStatusChange(e)});return Ml(()=>{s!==`idle`&&c(s)},[s,c]),s===`loaded`?(0,H.jsx)(ig.img,{...a,ref:t,src:r}):null});rw.displayName=nw;var iw=`AvatarFallback`,aw=v.forwardRef((e,t)=>{let{__scopeAvatar:n,delayMs:r,...i}=e,a=ew(iw,n),[o,s]=v.useState(r===void 0);return v.useEffect(()=>{if(r!==void 0){let e=window.setTimeout(()=>s(!0),r);return()=>window.clearTimeout(e)}},[r]),o&&a.imageLoadingStatus!==`loaded`?(0,H.jsx)(ig.span,{...i,ref:t}):null});aw.displayName=iw;function ow(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?`loaded`:`loading`):`error`:`idle`}function sw(e,{referrerPolicy:t,crossOrigin:n}){let r=dy(),i=v.useRef(null),a=r?(i.current||=new window.Image,i.current):null,[o,s]=v.useState(()=>ow(a,e));return Ml(()=>{s(ow(a,e))},[a,e]),Ml(()=>{let e=e=>()=>{s(e)};if(!a)return;let r=e(`loaded`),i=e(`error`);return a.addEventListener(`load`,r),a.addEventListener(`error`,i),t&&(a.referrerPolicy=t),typeof n==`string`&&(a.crossOrigin=n),()=>{a.removeEventListener(`load`,r),a.removeEventListener(`error`,i)}},[a,n,t]),o}var cw=tw,lw=rw,uw=aw,dw=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(cw,{ref:n,className:K(`relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full`,e),...t}));dw.displayName=cw.displayName;var fw=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(lw,{ref:n,className:K(`aspect-square h-full w-full`,e),...t}));fw.displayName=lw.displayName;var pw=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(uw,{ref:n,className:K(`flex h-full w-full items-center justify-center rounded-full bg-muted text-xs font-medium`,e),...t}));pw.displayName=uw.displayName;function mw(e,t,n){return e&&t?`${e[0]}${t[0]}`.toUpperCase():e?e.slice(0,2).toUpperCase():n?n.slice(0,2).toUpperCase():`?`}var hw=(0,v.forwardRef)(({avatarUrl:e,firstName:t,lastName:n,email:r,className:i,fallbackClassName:a,...o},s)=>(0,H.jsxs)(dw,{ref:s,className:K(`size-8`,i),...o,children:[e&&(0,H.jsx)(fw,{src:e,alt:``,className:`object-cover`}),(0,H.jsx)(pw,{className:K(`text-[11px]`,a),children:mw(t,n,r)})]},e??`fallback`));hw.displayName=`UserAvatar`;function gw({entry:e}){let t=e._author_first_name,n=e._author_last_name,r=t||n?[t,n].filter(Boolean).join(` `):null,i=(0,H.jsx)(hw,{avatarUrl:e._author_avatar_url,firstName:e._author_first_name,lastName:e._author_last_name,className:`size-7`,fallbackClassName:`text-[10px]`});return r?(0,H.jsxs)(Sp,{children:[(0,H.jsx)(Cp,{asChild:!0,children:i}),(0,H.jsx)(wp,{children:r})]}):i}function _w({title:e,dateLabel:t,emptyMessage:n,entries:r,loading:i,timezone:a,navigate:o,collectionTypes:s,entryFieldMap:c,guessDefaultField:l,toEntryLabel:u,getDateValue:d,action:f}){return(0,H.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-border bg-background`,children:(0,H.jsxs)(VC,{className:`w-full text-sm`,children:[(0,H.jsxs)(HC,{className:`border-b border-border font-bold uppercase`,children:[(0,H.jsx)(WC,{className:`hover:bg-transparent`,children:(0,H.jsx)(GC,{colSpan:4,className:`h-auto px-4 py-3`,children:(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:e}),f]})})}),(0,H.jsxs)(WC,{className:`border-t border-border hover:bg-transparent`,children:[(0,H.jsx)(GC,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:`Entry`}),(0,H.jsx)(GC,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:`Collection Type`}),(0,H.jsx)(GC,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:`Author`}),(0,H.jsx)(GC,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:t})]})]}),(0,H.jsx)(UC,{children:i?(0,H.jsx)(WC,{className:`border-b`,children:(0,H.jsx)(KC,{colSpan:4,className:`h-24`,children:(0,H.jsx)(BC,{className:`mx-auto size-5`})})}):r.length===0?(0,H.jsx)(WC,{className:`border-b`,children:(0,H.jsx)(KC,{colSpan:4,className:`h-24 text-center text-muted-foreground`,children:n})}):r.map(e=>(0,H.jsxs)(WC,{className:`border-b last:border-b-0 transition-colors hover:bg-muted/50`,children:[(0,H.jsx)(KC,{className:`px-4 py-3 align-middle`,children:(0,H.jsx)(`button`,{type:`button`,onClick:()=>o(`/content/${e.slug}/${e.id}`),className:`text-left hover:underline`,children:(0,H.jsx)(`div`,{className:`font-medium`,children:u(e[c[e.slug]??l(s.find(t=>t.slug===e.slug)??{slug:e.slug,name:e.contentTypeName,kind:`collection`,isDefault:!1,fields:[]})])})})}),(0,H.jsx)(KC,{className:`px-4 py-3 align-middle`,children:(0,H.jsx)(zC,{variant:`outline`,children:e.contentTypeName})}),(0,H.jsx)(KC,{className:`px-4 py-3 align-middle`,children:(0,H.jsx)(gw,{entry:e})}),(0,H.jsx)(KC,{className:`px-4 py-3 align-middle`,children:d(e)?sv(d(e),a):`—`})]},`${e.slug}-${e.id}`))})]})})}var vw=`plank_dashboard_recent_entry_fields`;function yw(e){for(let t of[`title`,`name`,`entry`])if(e.fields.some(e=>e.name===t))return t;return e.fields.find(e=>[`string`,`text`,`uid`].includes(e.type))?.name??`id`}function bw(e){return e==null||e===``?`Untitled`:typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):JSON.stringify(e)}function xw(){let e=fr(),{timezone:t}=Sa(),{user:n}=_a(),{data:r}=ps(`/cms/admin/content-types`),[i,a]=(0,v.useState)([]),[o,s]=(0,v.useState)([]),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(!1),[f,p]=(0,v.useState)(!1),[m,h]=(0,v.useState)({}),[g,_]=(0,v.useState)(null),y=n?.permissions??[],b=y.includes(`*`)||y.includes(`entries:write`),x=y.includes(`*`)||y.includes(`entries:read`),S=(0,v.useMemo)(()=>(r??[]).filter(e=>e.kind===`collection`),[r]),C=S.length,w=(0,v.useMemo)(()=>(r??[]).filter(e=>e.kind===`single`).length,[r]);(0,v.useEffect)(()=>{try{let e=window.localStorage.getItem(vw);if(!e)return;h(JSON.parse(e))}catch{}},[]),(0,v.useEffect)(()=>{S.length!==0&&h(e=>{let t={...e},n=!1;for(let e of S)t[e.slug]||(t[e.slug]=yw(e),n=!0);return n?t:e})},[S]),(0,v.useEffect)(()=>{window.localStorage.setItem(vw,JSON.stringify(m))},[m]),(0,v.useEffect)(()=>{if(!x||S.length===0)return;let e=new AbortController;async function t(t,n){let r=new URLSearchParams({page:`1`,limit:`100`});n&&r.set(`status`,n);let i=await fetch(`/cms/admin/content-types/${t}/entries?${r}`,{credentials:`include`,signal:e.signal});if(!i.ok)return{total:0,data:[]};let a=await i.json();return{total:a.total??0,data:a.data??[]}}return Promise.all(S.map(async e=>{let[n,r,i]=await Promise.all([t(e.slug),t(e.slug,`draft`),t(e.slug,`scheduled`)]);return{allRes:n,draftsRes:r,scheduledRes:i}})).then(e=>{let t=n?.id,r=0,i=0,a=0,o=0,s=0;for(let{allRes:n,draftsRes:c,scheduledRes:l}of e)r+=n.total,i+=c.total,o+=l.total,t&&(a+=c.data.filter(e=>e.created_by===t).length,s+=l.data.filter(e=>e.created_by===t).length);_({totalEntries:r,totalDrafts:i,myDrafts:a,totalScheduled:o,myScheduled:s})}).catch(()=>{}),()=>e.abort()},[x,S,n?.id]);function T(){!r||r.length===0||e(`/content/${(r.find(e=>e.isDefault)??r[0]).slug}/new`)}return(0,v.useEffect)(()=>{if(!x||S.length===0){a([]);return}let e=new AbortController;return l(!0),Promise.all(S.map(async t=>{let n=await fetch(`/cms/admin/content-types/${t.slug}/entries?page=1&limit=50&sort=published_at&order=desc`,{credentials:`include`,signal:e.signal});if(!n.ok)return[];let r=await n.json(),i=[];for(let e of r.data??[])e.status!==`published`||!e.published_at||i.push({...e,slug:t.slug,contentTypeName:t.name});return i})).then(e=>{a(e.flat().sort((e,t)=>new Date(t.published_at??0).getTime()-new Date(e.published_at??0).getTime()).slice(0,7))}).catch(()=>{a([])}).finally(()=>l(!1)),()=>e.abort()},[x,S]),(0,v.useEffect)(()=>{if(!x||S.length===0||!n?.id){s([]);return}let e=new AbortController;return d(!0),Promise.all(S.map(async t=>{let r=await fetch(`/cms/admin/content-types/${t.slug}/entries?page=1&limit=50&status=draft&sort=updated_at&order=desc`,{credentials:`include`,signal:e.signal});if(!r.ok)return[];let i=await r.json(),a=[];for(let e of i.data??[])e.status!==`draft`||e.created_by!==n.id||a.push({...e,slug:t.slug,contentTypeName:t.name});return a})).then(e=>{s(e.flat().sort((e,t)=>new Date(t.updated_at??0).getTime()-new Date(e.updated_at??0).getTime()).slice(0,7))}).catch(()=>{s([])}).finally(()=>d(!1)),()=>e.abort()},[x,S,n?.id]),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(fs,{children:(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold -mt-2`,children:`Plank Forge`}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(Q_,{open:f,onOpenChange:p,collectionTypes:S,entryFieldMap:m,guessDefaultField:yw,setEntryFieldMap:e=>h(e)}),b&&(0,H.jsxs)(q,{onClick:T,disabled:!r||r.length===0,children:[(0,H.jsx)(Lo,{className:`size-4`}),`New entry`]})]})]})}),(0,H.jsx)(iv,{contentTypes:r,collectionCount:C,singleCount:w,stats:g}),(0,H.jsx)(`section`,{className:`mt-4`,children:(0,H.jsx)(xp,{children:(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsx)(_w,{title:`My drafts`,dateLabel:`Updated`,emptyMessage:`You have no drafts.`,entries:o,loading:u,timezone:t,navigate:e,collectionTypes:S,entryFieldMap:m,guessDefaultField:yw,toEntryLabel:bw,getDateValue:e=>e.updated_at}),(0,H.jsx)(_w,{title:`Recent content`,dateLabel:`Published`,emptyMessage:`No recent entries found.`,entries:i,loading:c,timezone:t,navigate:e,collectionTypes:S,entryFieldMap:m,guessDefaultField:yw,toEntryLabel:bw,getDateValue:e=>e.published_at})]})})})]})}function Sw(e){if(!e||typeof document>`u`)return;let t=document.head||document.getElementsByTagName(`head`)[0],n=document.createElement(`style`);n.type=`text/css`,t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}var Cw=e=>{switch(e){case`success`:return Ew;case`info`:return Ow;case`warning`:return Dw;case`error`:return kw;default:return null}},ww=Array(12).fill(0),Tw=({visible:e,className:t})=>v.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},v.createElement(`div`,{className:`sonner-spinner`},ww.map((e,t)=>v.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),Ew=v.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},v.createElement(`path`,{fillRule:`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,clipRule:`evenodd`})),Dw=v.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`},v.createElement(`path`,{fillRule:`evenodd`,d:`M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z`,clipRule:`evenodd`})),Ow=v.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},v.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z`,clipRule:`evenodd`})),kw=v.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},v.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z`,clipRule:`evenodd`})),Aw=v.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`},v.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),v.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),jw=()=>{let[e,t]=v.useState(document.hidden);return v.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>window.removeEventListener(`visibilitychange`,e)},[]),e},Mw=1,Nw=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{let{message:t,...n}=e,r=typeof e?.id==`number`||e.id?.length>0?e.id:Mw++,i=this.toasts.find(e=>e.id===r),a=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(r)&&this.dismissedToasts.delete(r),i?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:a,title:t}):n):this.addToast({title:t,...n,dismissible:a,id:r}),r},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(t=>t({id:e,dismiss:!0})))):this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=Promise.resolve(e instanceof Function?e():e),i=n!==void 0,a,o=r.then(async e=>{if(a=[`resolve`,e],v.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(Fw(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,a=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description,o=typeof r==`object`&&!v.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(e instanceof Error){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!v.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!v.isValidElement(r)?r:{message:r};this.create({id:n,type:`success`,description:a,...o})}}).catch(async e=>{if(a=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!v.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),t.finally==null||t.finally.call(t)}),s=()=>new Promise((e,t)=>o.then(()=>a[0]===`reject`?t(a[1]):e(a[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=t?.id||Mw++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Pw=(e,t)=>{let n=t?.id||Mw++;return Nw.addToast({title:e,...t,id:n}),n},Fw=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,X=Object.assign(Pw,{success:Nw.success,info:Nw.info,warning:Nw.warning,error:Nw.error,custom:Nw.custom,message:Nw.message,promise:Nw.promise,dismiss:Nw.dismiss,loading:Nw.loading},{getHistory:()=>Nw.toasts,getToasts:()=>Nw.getActiveToasts()});Sw(`[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}`);function Iw(e){return e.label!==void 0}var Lw=3,Rw=`24px`,zw=`16px`,Bw=4e3,Vw=356,Hw=14,Uw=45,Ww=200;function Gw(...e){return e.filter(Boolean).join(` `)}function Kw(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var qw=e=>{let{invert:t,toast:n,unstyled:r,interacting:i,setHeights:a,visibleToasts:o,heights:s,index:c,toasts:l,expanded:u,removeToast:d,defaultRichColors:f,closeButton:p,style:m,cancelButtonStyle:h,actionButtonStyle:g,className:_=``,descriptionClassName:y=``,duration:b,position:x,gap:S,expandByDefault:C,classNames:w,icons:T,closeButtonAriaLabel:E=`Close toast`}=e,[D,O]=v.useState(null),[k,A]=v.useState(null),[j,M]=v.useState(!1),[N,P]=v.useState(!1),[F,I]=v.useState(!1),[L,R]=v.useState(!1),[ee,te]=v.useState(!1),[ne,z]=v.useState(0),[B,re]=v.useState(0),V=v.useRef(n.duration||b||Bw),ie=v.useRef(null),ae=v.useRef(null),oe=c===0,se=c+1<=o,ce=n.type,le=n.dismissible!==!1,ue=n.className||``,de=n.descriptionClassName||``,fe=v.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),pe=v.useMemo(()=>n.closeButton??p,[n.closeButton,p]),me=v.useMemo(()=>n.duration||b||Bw,[n.duration,b]),he=v.useRef(0),ge=v.useRef(0),_e=v.useRef(0),ve=v.useRef(null),[ye,be]=x.split(`-`),xe=v.useMemo(()=>s.reduce((e,t,n)=>n>=fe?e:e+t.height,0),[s,fe]),Se=jw(),Ce=n.invert||t,we=ce===`loading`;ge.current=v.useMemo(()=>fe*S+xe,[fe,xe]),v.useEffect(()=>{V.current=me},[me]),v.useEffect(()=>{M(!0)},[]),v.useEffect(()=>{let e=ae.current;if(e){let t=e.getBoundingClientRect().height;return re(t),a(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>a(e=>e.filter(e=>e.toastId!==n.id))}},[a,n.id]),v.useLayoutEffect(()=>{if(!j)return;let e=ae.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,re(r),a(e=>e.find(e=>e.toastId===n.id)?e.map(e=>e.toastId===n.id?{...e,height:r}:e):[{toastId:n.id,height:r,position:n.position},...e])},[j,n.title,n.description,a,n.id,n.jsx,n.action,n.cancel]);let Te=v.useCallback(()=>{P(!0),z(ge.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{d(n)},Ww)},[n,d,a,ge]);v.useEffect(()=>{if(n.promise&&ce===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return u||i||Se?(()=>{if(_e.current<he.current){let e=new Date().getTime()-he.current;V.current-=e}_e.current=new Date().getTime()})():V.current!==1/0&&(he.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),Te()},V.current)),()=>clearTimeout(e)},[u,i,n,ce,Se,Te]),v.useEffect(()=>{n.delete&&(Te(),n.onDismiss==null||n.onDismiss.call(n,n))},[Te,n.delete]);function Ee(){return T?.loading?v.createElement(`div`,{className:Gw(w?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":ce===`loading`},T.loading):v.createElement(Tw,{className:Gw(w?.loader,n?.classNames?.loader),visible:ce===`loading`})}let De=n.icon||T?.[ce]||Cw(ce);return v.createElement(`li`,{tabIndex:0,ref:ae,className:Gw(_,ue,w?.toast,n?.classNames?.toast,w?.default,w?.[ce],n?.classNames?.[ce]),"data-sonner-toast":``,"data-rich-colors":n.richColors??f,"data-styled":!(n.jsx||n.unstyled||r),"data-mounted":j,"data-promise":!!n.promise,"data-swiped":ee,"data-removed":N,"data-visible":se,"data-y-position":ye,"data-x-position":be,"data-index":c,"data-front":oe,"data-swiping":F,"data-dismissible":le,"data-type":ce,"data-invert":Ce,"data-swipe-out":L,"data-swipe-direction":k,"data-expanded":!!(u||C&&j),"data-testid":n.testId,style:{"--index":c,"--toasts-before":c,"--z-index":l.length-c,"--offset":`${N?ne:ge.current}px`,"--initial-height":C?`auto`:`${B}px`,...m,...n.style},onDragEnd:()=>{I(!1),O(null),ve.current=null},onPointerDown:e=>{e.button!==2&&(we||!le||(ie.current=new Date,z(ge.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(I(!0),ve.current={x:e.clientX,y:e.clientY})))},onPointerUp:()=>{if(L||!le)return;ve.current=null;let e=Number(ae.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(ae.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-ie.current?.getTime(),i=D===`x`?e:t,a=Math.abs(i)/r;if(Math.abs(i)>=Uw||a>.11){z(ge.current),n.onDismiss==null||n.onDismiss.call(n,n),A(D===`x`?e>0?`right`:`left`:t>0?`down`:`up`),Te(),R(!0);return}else{var o,s;(o=ae.current)==null||o.style.setProperty(`--swipe-amount-x`,`0px`),(s=ae.current)==null||s.style.setProperty(`--swipe-amount-y`,`0px`)}te(!1),I(!1),O(null)},onPointerMove:t=>{var n,r;if(!ve.current||!le||window.getSelection()?.toString().length>0)return;let i=t.clientY-ve.current.y,a=t.clientX-ve.current.x,o=e.swipeDirections??Kw(x);!D&&(Math.abs(a)>1||Math.abs(i)>1)&&O(Math.abs(a)>Math.abs(i)?`x`:`y`);let s={x:0,y:0},c=e=>1/(1.5+Math.abs(e)/20);if(D===`y`){if(o.includes(`top`)||o.includes(`bottom`))if(o.includes(`top`)&&i<0||o.includes(`bottom`)&&i>0)s.y=i;else{let e=i*c(i);s.y=Math.abs(e)<Math.abs(i)?e:i}}else if(D===`x`&&(o.includes(`left`)||o.includes(`right`)))if(o.includes(`left`)&&a<0||o.includes(`right`)&&a>0)s.x=a;else{let e=a*c(a);s.x=Math.abs(e)<Math.abs(a)?e:a}(Math.abs(s.x)>0||Math.abs(s.y)>0)&&te(!0),(n=ae.current)==null||n.style.setProperty(`--swipe-amount-x`,`${s.x}px`),(r=ae.current)==null||r.style.setProperty(`--swipe-amount-y`,`${s.y}px`)}},pe&&!n.jsx&&ce!==`loading`?v.createElement(`button`,{"aria-label":E,"data-disabled":we,"data-close-button":!0,onClick:we||!le?()=>{}:()=>{Te(),n.onDismiss==null||n.onDismiss.call(n,n)},className:Gw(w?.closeButton,n?.classNames?.closeButton)},T?.close??Aw):null,(ce||n.icon||n.promise)&&n.icon!==null&&(T?.[ce]!==null||n.icon)?v.createElement(`div`,{"data-icon":``,className:Gw(w?.icon,n?.classNames?.icon)},n.promise||n.type===`loading`&&!n.icon?n.icon||Ee():null,n.type===`loading`?null:De):null,v.createElement(`div`,{"data-content":``,className:Gw(w?.content,n?.classNames?.content)},v.createElement(`div`,{"data-title":``,className:Gw(w?.title,n?.classNames?.title)},n.jsx?n.jsx:typeof n.title==`function`?n.title():n.title),n.description?v.createElement(`div`,{"data-description":``,className:Gw(y,de,w?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),v.isValidElement(n.cancel)?n.cancel:n.cancel&&Iw(n.cancel)?v.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||h,onClick:e=>{Iw(n.cancel)&&le&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),Te())},className:Gw(w?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,v.isValidElement(n.action)?n.action:n.action&&Iw(n.action)?v.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||g,onClick:e=>{Iw(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&Te())},className:Gw(w?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function Jw(){if(typeof window>`u`||typeof document>`u`)return`ltr`;let e=document.documentElement.getAttribute(`dir`);return e===`auto`||!e?window.getComputedStyle(document.documentElement).direction:e}function Yw(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?zw:Rw;function o(e){[`top`,`right`,`bottom`,`left`].forEach(t=>{n[`${i}-${t}`]=typeof e==`number`?`${e}px`:e})}typeof e==`number`||typeof e==`string`?o(e):typeof e==`object`?[`top`,`right`,`bottom`,`left`].forEach(t=>{e[t]===void 0?n[`${i}-${t}`]=a:n[`${i}-${t}`]=typeof e[t]==`number`?`${e[t]}px`:e[t]}):o(a)}),n}var Xw=v.forwardRef(function(e,t){let{id:n,invert:r,position:i=`bottom-right`,hotkey:a=[`altKey`,`KeyT`],expand:o,closeButton:s,className:c,offset:l,mobileOffset:u,theme:d=`light`,richColors:f,duration:p,style:m,visibleToasts:h=Lw,toastOptions:g,dir:_=Jw(),gap:y=Hw,icons:b,containerAriaLabel:x=`Notifications`}=e,[S,C]=v.useState([]),w=v.useMemo(()=>n?S.filter(e=>e.toasterId===n):S.filter(e=>!e.toasterId),[S,n]),T=v.useMemo(()=>Array.from(new Set([i].concat(w.filter(e=>e.position).map(e=>e.position)))),[w,i]),[E,D]=v.useState([]),[O,k]=v.useState(!1),[A,j]=v.useState(!1),[M,P]=v.useState(d===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:d),F=v.useRef(null),I=a.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),L=v.useRef(null),R=v.useRef(!1),ee=v.useCallback(e=>{C(t=>(t.find(t=>t.id===e.id)?.delete||Nw.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return v.useEffect(()=>Nw.subscribe(e=>{if(e.dismiss){requestAnimationFrame(()=>{C(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))});return}setTimeout(()=>{N.flushSync(()=>{C(t=>{let n=t.findIndex(t=>t.id===e.id);return n===-1?[e,...t]:[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]})})})}),[S]),v.useEffect(()=>{if(d!==`system`){P(d);return}if(d===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?P(`dark`):P(`light`)),typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);try{e.addEventListener(`change`,({matches:e})=>{P(e?`dark`:`light`)})}catch{e.addListener(({matches:e})=>{try{P(e?`dark`:`light`)}catch(e){console.error(e)}})}},[d]),v.useEffect(()=>{S.length<=1&&k(!1)},[S]),v.useEffect(()=>{let e=e=>{if(a.every(t=>e[t]||e.code===t)){var t;k(!0),(t=F.current)==null||t.focus()}e.code===`Escape`&&(document.activeElement===F.current||F.current?.contains(document.activeElement))&&k(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a]),v.useEffect(()=>{if(F.current)return()=>{L.current&&(L.current.focus({preventScroll:!0}),L.current=null,R.current=!1)}},[F.current]),v.createElement(`section`,{ref:t,"aria-label":`${x} ${I}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0},T.map((t,n)=>{let[i,a]=t.split(`-`);return w.length?v.createElement(`ol`,{key:t,dir:_===`auto`?Jw():_,tabIndex:-1,ref:F,className:c,"data-sonner-toaster":!0,"data-sonner-theme":M,"data-y-position":i,"data-x-position":a,style:{"--front-toast-height":`${E[0]?.height||0}px`,"--width":`${Vw}px`,"--gap":`${y}px`,...m,...Yw(l,u)},onBlur:e=>{R.current&&!e.currentTarget.contains(e.relatedTarget)&&(R.current=!1,L.current&&=(L.current.focus({preventScroll:!0}),null))},onFocus:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||R.current||(R.current=!0,L.current=e.relatedTarget)},onMouseEnter:()=>k(!0),onMouseMove:()=>k(!0),onMouseLeave:()=>{A||k(!1)},onDragEnd:()=>k(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||j(!0)},onPointerUp:()=>j(!1)},w.filter(e=>!e.position&&n===0||e.position===t).map((n,i)=>v.createElement(qw,{key:n.id,icons:b,index:i,toast:n,defaultRichColors:f,duration:g?.duration??p,className:g?.className,descriptionClassName:g?.descriptionClassName,invert:r,visibleToasts:h,closeButton:g?.closeButton??s,interacting:A,position:t,style:g?.style,unstyled:g?.unstyled,classNames:g?.classNames,cancelButtonStyle:g?.cancelButtonStyle,actionButtonStyle:g?.actionButtonStyle,closeButtonAriaLabel:g?.closeButtonAriaLabel,removeToast:ee,toasts:w.filter(e=>e.position==n.position),heights:E.filter(e=>e.position==n.position),setHeights:D,expandByDefault:o,gap:y,expanded:O,swipeDirections:e.swipeDirections}))):null}))});function Zw(){let[e,t]=(0,v.useState)({data:null,loading:!1,error:null}),n=(0,v.useCallback)(async(e,n,r)=>{t({data:null,loading:!0,error:null});let i={"Content-Type":`application/json`};try{let a=await fetch(e,{method:n,credentials:`include`,headers:i,body:r===void 0?void 0:JSON.stringify(r)});if(!a.ok){let e=await a.text(),t;try{let n=JSON.parse(e);if(n.message)t=n.message;else if(n.error)t=n.error;else if(n.errors){let e=Object.values(n.errors.fieldErrors??{}).flat(),r=[...n.errors.formErrors??[],...e];t=r.length?r.join(` · `):`Something went wrong.`}else t=`Something went wrong.`}catch{t=`Something went wrong.`}throw Error(t)}let o=a.status===204?null:await a.json();return t({data:o,loading:!1,error:null}),o}catch(e){throw t({data:null,loading:!1,error:e instanceof Error?e.message:`Unknown error`}),e}},[]);return{...e,request:n}}var Z=v.forwardRef(({className:e,type:t,...n},r)=>(0,H.jsx)(`input`,{type:t,className:K(`flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm`,e),ref:r,...n}));Z.displayName=`Input`;var Qw=Object.defineProperty,$w=Object.defineProperties,eT=Object.getOwnPropertyDescriptors,tT=Object.getOwnPropertySymbols,nT=Object.prototype.hasOwnProperty,rT=Object.prototype.propertyIsEnumerable,iT=(e,t,n)=>t in e?Qw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,aT=(e,t)=>{for(var n in t||={})nT.call(t,n)&&iT(e,n,t[n]);if(tT)for(var n of tT(t))rT.call(t,n)&&iT(e,n,t[n]);return e},oT=(e,t)=>$w(e,eT(t)),sT=(e,t)=>{var n={};for(var r in e)nT.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&tT)for(var r of tT(e))t.indexOf(r)<0&&rT.call(e,r)&&(n[r]=e[r]);return n};function cT(e){return[setTimeout(e,0),setTimeout(e,10),setTimeout(e,50)]}function lT(e){let t=v.useRef();return v.useEffect(()=>{t.current=e}),t.current}var uT=18,dT=40,fT=`${dT}px`,pT=[`[data-lastpass-icon-root]`,`com-1password-button`,`[data-dashlanecreated]`,`[style$="2147483647 !important;"]`].join(`,`);function mT({containerRef:e,inputRef:t,pushPasswordManagerStrategy:n,isFocused:r}){let[i,a]=v.useState(!1),[o,s]=v.useState(!1),[c,l]=v.useState(!1),u=v.useMemo(()=>n===`none`?!1:(n===`increase-width`||n===`experimental-no-flickering`)&&i&&o,[i,o,n]),d=v.useCallback(()=>{let r=e.current,i=t.current;if(!r||!i||c||n===`none`)return;let o=r,s=o.getBoundingClientRect().left+o.offsetWidth,u=o.getBoundingClientRect().top+o.offsetHeight/2,d=s-uT,f=u;document.querySelectorAll(pT).length===0&&document.elementFromPoint(d,f)===r||(a(!0),l(!0))},[e,t,c,n]);return v.useEffect(()=>{let t=e.current;if(!t||n===`none`)return;function r(){s(window.innerWidth-t.getBoundingClientRect().right>=dT)}r();let i=setInterval(r,1e3);return()=>{clearInterval(i)}},[e,n]),v.useEffect(()=>{let e=r||document.activeElement===t.current;if(n===`none`||!e)return;let i=setTimeout(d,0),a=setTimeout(d,2e3),o=setTimeout(d,5e3),s=setTimeout(()=>{l(!0)},6e3);return()=>{clearTimeout(i),clearTimeout(a),clearTimeout(o),clearTimeout(s)}},[t,r,n,d]),{hasPWMBadge:i,willPushPWMBadge:u,PWM_BADGE_SPACE_WIDTH:fT}}var hT=v.createContext({}),gT=v.forwardRef((e,t)=>{var n=e,{value:r,onChange:i,maxLength:a,textAlign:o=`left`,pattern:s,placeholder:c,inputMode:l=`numeric`,onComplete:u,pushPasswordManagerStrategy:d=`increase-width`,pasteTransformer:f,containerClassName:p,noScriptCSSFallback:m=vT,render:h,children:g}=n,_=sT(n,[`value`,`onChange`,`maxLength`,`textAlign`,`pattern`,`placeholder`,`inputMode`,`onComplete`,`pushPasswordManagerStrategy`,`pasteTransformer`,`containerClassName`,`noScriptCSSFallback`,`render`,`children`]),y;let[b,x]=v.useState(typeof _.defaultValue==`string`?_.defaultValue:``),S=r??b,C=lT(S),w=v.useCallback(e=>{i?.(e),x(e)},[i]),T=v.useMemo(()=>s?typeof s==`string`?new RegExp(s):s:null,[s]),E=v.useRef(null),D=v.useRef(null),O=v.useRef({value:S,onChange:w,isIOS:typeof window<`u`&&((y=window==null?void 0:window.CSS)?.supports)?.call(y,`-webkit-touch-callout`,`none`)}),k=v.useRef({prev:[E.current?.selectionStart,E.current?.selectionEnd,E.current?.selectionDirection]});v.useImperativeHandle(t,()=>E.current,[]),v.useEffect(()=>{let e=E.current,t=D.current;if(!e||!t)return;O.current.value!==e.value&&O.current.onChange(e.value),k.current.prev=[e.selectionStart,e.selectionEnd,e.selectionDirection];function n(){if(document.activeElement!==e){F(null),L(null);return}let t=e.selectionStart,n=e.selectionEnd,r=e.selectionDirection,i=e.maxLength,a=e.value,o=k.current.prev,s=-1,c=-1,l;if(a.length!==0&&t!==null&&n!==null){let e=t===n,r=t===a.length&&a.length<i;if(e&&!r){let e=t;if(e===0)s=0,c=1,l=`forward`;else if(e===i)s=e-1,c=e,l=`backward`;else if(i>1&&a.length>1){let t=0;if(o[0]!==null&&o[1]!==null){l=e<o[1]?`backward`:`forward`;let n=o[0]===o[1]&&o[0]<i;l===`backward`&&!n&&(t=-1)}s=t+e,c=t+e+1}}s!==-1&&c!==-1&&s!==c&&E.current.setSelectionRange(s,c,l)}let u=s===-1?t:s,d=c===-1?n:c,f=l??r;F(u),L(d),k.current.prev=[u,d,f]}if(document.addEventListener(`selectionchange`,n,{capture:!0}),n(),document.activeElement===e&&N(!0),!document.getElementById(`input-otp-style`)){let e=document.createElement(`style`);if(e.id=`input-otp-style`,document.head.appendChild(e),e.sheet){let t=`background: transparent !important; color: transparent !important; border-color: transparent !important; opacity: 0 !important; box-shadow: none !important; -webkit-box-shadow: none !important; -webkit-text-fill-color: transparent !important;`;_T(e.sheet,`[data-input-otp]::selection { background: transparent !important; color: transparent !important; }`),_T(e.sheet,`[data-input-otp]:autofill { ${t} }`),_T(e.sheet,`[data-input-otp]:-webkit-autofill { ${t} }`),_T(e.sheet,`@supports (-webkit-touch-callout: none) { [data-input-otp] { letter-spacing: -.6em !important; font-weight: 100 !important; font-stretch: ultra-condensed; font-optical-sizing: none !important; left: -1px !important; right: 1px !important; } }`),_T(e.sheet,`[data-input-otp] + * { pointer-events: all !important; }`)}}let r=()=>{t&&t.style.setProperty(`--root-height`,`${e.clientHeight}px`)};r();let i=new ResizeObserver(r);return i.observe(e),()=>{document.removeEventListener(`selectionchange`,n,{capture:!0}),i.disconnect()}},[]);let[A,j]=v.useState(!1),[M,N]=v.useState(!1),[P,F]=v.useState(null),[I,L]=v.useState(null);v.useEffect(()=>{cT(()=>{var e;(e=E.current)==null||e.dispatchEvent(new Event(`input`));let t=E.current?.selectionStart,n=E.current?.selectionEnd,r=E.current?.selectionDirection;t!==null&&n!==null&&(F(t),L(n),k.current.prev=[t,n,r])})},[S,M]),v.useEffect(()=>{C!==void 0&&S!==C&&C.length<a&&S.length===a&&u?.(S)},[a,u,C,S]);let R=mT({containerRef:D,inputRef:E,pushPasswordManagerStrategy:d,isFocused:M}),ee=v.useCallback(e=>{let t=e.currentTarget.value.slice(0,a);if(t.length>0&&T&&!T.test(t)){e.preventDefault();return}typeof C==`string`&&t.length<C.length&&document.dispatchEvent(new Event(`selectionchange`)),w(t)},[a,w,C,T]),te=v.useCallback(()=>{var e;if(E.current){let t=Math.min(E.current.value.length,a-1),n=E.current.value.length;(e=E.current)==null||e.setSelectionRange(t,n),F(t),L(n)}N(!0)},[a]),ne=v.useCallback(e=>{let t=E.current;if(!f&&(!O.current.isIOS||!e.clipboardData||!t))return;let n=e.clipboardData.getData(`text/plain`),r=f?f(n):n;e.preventDefault();let i=E.current?.selectionStart,o=E.current?.selectionEnd,s=(i===o?S.slice(0,i)+r+S.slice(i):S.slice(0,i)+r+S.slice(o)).slice(0,a);if(s.length>0&&T&&!T.test(s))return;t.value=s,w(s);let c=Math.min(s.length,a-1),l=s.length;t.setSelectionRange(c,l),F(c),L(l)},[a,w,T,S]),z=v.useMemo(()=>({position:`relative`,cursor:_.disabled?`default`:`text`,userSelect:`none`,WebkitUserSelect:`none`,pointerEvents:`none`}),[_.disabled]),B=v.useMemo(()=>({position:`absolute`,inset:0,width:R.willPushPWMBadge?`calc(100% + ${R.PWM_BADGE_SPACE_WIDTH})`:`100%`,clipPath:R.willPushPWMBadge?`inset(0 ${R.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:`100%`,display:`flex`,textAlign:o,opacity:`1`,color:`transparent`,pointerEvents:`all`,background:`transparent`,caretColor:`transparent`,border:`0 solid transparent`,outline:`0 solid transparent`,boxShadow:`none`,lineHeight:`1`,letterSpacing:`-.5em`,fontSize:`var(--root-height)`,fontFamily:`monospace`,fontVariantNumeric:`tabular-nums`}),[R.PWM_BADGE_SPACE_WIDTH,R.willPushPWMBadge,o]),re=v.useMemo(()=>v.createElement(`input`,oT(aT({autoComplete:_.autoComplete||`one-time-code`},_),{"data-input-otp":!0,"data-input-otp-placeholder-shown":S.length===0||void 0,"data-input-otp-mss":P,"data-input-otp-mse":I,inputMode:l,pattern:T?.source,"aria-placeholder":c,style:B,maxLength:a,value:S,ref:E,onPaste:e=>{var t;ne(e),(t=_.onPaste)==null||t.call(_,e)},onChange:ee,onMouseOver:e=>{var t;j(!0),(t=_.onMouseOver)==null||t.call(_,e)},onMouseLeave:e=>{var t;j(!1),(t=_.onMouseLeave)==null||t.call(_,e)},onFocus:e=>{var t;te(),(t=_.onFocus)==null||t.call(_,e)},onBlur:e=>{var t;N(!1),(t=_.onBlur)==null||t.call(_,e)}})),[ee,te,ne,l,B,a,I,P,_,T?.source,S]),V=v.useMemo(()=>({slots:Array.from({length:a}).map((e,t)=>{let n=M&&P!==null&&I!==null&&(P===I&&t===P||t>=P&&t<I),r=S[t]===void 0?null:S[t];return{char:r,placeholderChar:S[0]===void 0?c?.[t]??null:null,isActive:n,hasFakeCaret:n&&r===null}}),isFocused:M,isHovering:!_.disabled&&A}),[M,A,a,I,P,_.disabled,S]),ie=v.useMemo(()=>h?h(V):v.createElement(hT.Provider,{value:V},g),[g,V,h]);return v.createElement(v.Fragment,null,m!==null&&v.createElement(`noscript`,null,v.createElement(`style`,null,m)),v.createElement(`div`,{ref:D,"data-input-otp-container":!0,style:z,className:p},ie,v.createElement(`div`,{style:{position:`absolute`,inset:0,pointerEvents:`none`}},re)))});gT.displayName=`Input`;function _T(e,t){try{e.insertRule(t)}catch{console.error(`input-otp could not insert CSS rule:`,t)}}var vT=`
57
+ [data-input-otp] {
58
+ --nojs-bg: white !important;
59
+ --nojs-fg: black !important;
60
+
61
+ background-color: var(--nojs-bg) !important;
62
+ color: var(--nojs-fg) !important;
63
+ caret-color: var(--nojs-fg) !important;
64
+ letter-spacing: .25em !important;
65
+ text-align: center !important;
66
+ border: 1px solid var(--nojs-fg) !important;
67
+ border-radius: 4px !important;
68
+ width: 100% !important;
69
+ }
70
+ @media (prefers-color-scheme: dark) {
71
+ [data-input-otp] {
72
+ --nojs-bg: black !important;
73
+ --nojs-fg: white !important;
74
+ }
75
+ }`;function yT({className:e,containerClassName:t,...n}){return(0,H.jsx)(gT,{"data-slot":`input-otp`,containerClassName:K(`flex items-center gap-2 has-disabled:opacity-50`,t),className:K(`disabled:cursor-not-allowed`,e),...n})}function bT({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`input-otp-group`,className:K(`flex items-center`,e),...t})}function xT({index:e,className:t,...n}){let{char:r,hasFakeCaret:i,isActive:a}=v.useContext(hT)?.slots[e]??{};return(0,H.jsxs)(`div`,{"data-slot":`input-otp-slot`,"data-active":a,className:K(`relative flex h-9 w-9 items-center justify-center border-y border-r border-input text-sm shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md aria-invalid:border-destructive data-[active=true]:z-10 data-[active=true]:border-ring data-[active=true]:ring-[3px] data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:border-destructive data-[active=true]:aria-invalid:ring-destructive/20 dark:bg-input/30 dark:data-[active=true]:aria-invalid:ring-destructive/40`,t),...n,children:[r,i&&(0,H.jsx)(`div`,{className:`pointer-events-none absolute inset-0 flex items-center justify-center`,children:(0,H.jsx)(`div`,{className:`h-4 w-px animate-caret-blink bg-foreground duration-1000`})})]})}function ST({...e}){return(0,H.jsx)(`div`,{"data-slot":`input-otp-separator`,role:`separator`,...e,children:(0,H.jsx)(Mo,{})})}function CT(){let{login:e}=_a(),{loading:t,error:n,request:r}=Zw(),{loading:i,request:a}=Zw(),o=fr(),[s,c]=(0,v.useState)(null),[l,u]=(0,v.useState)(!1),[d,f]=(0,v.useState)(!1),[p,m]=(0,v.useState)(``),[h,g]=(0,v.useState)(``),[_,y]=(0,v.useState)(``),[b,x]=(0,v.useState)(``),[S,C]=(0,v.useState)(``),[w,T]=(0,v.useState)(null),[E,D]=(0,v.useState)(null),[O,k]=(0,v.useState)(``),[A,j]=(0,v.useState)(``),[M,N]=(0,v.useState)(!1);(0,v.useEffect)(()=>{Promise.all([fetch(`/cms/auth/setup`).then(e=>e.json()),fetch(`/cms/auth/features`).then(e=>e.json())]).then(([e,t])=>{c(e.needsSetup),u(!!t.passwordRecovery)}).catch(()=>c(!0))},[]);async function P(e){e.preventDefault(),T(null);try{await a(`/cms/auth/password-reset`,`POST`,{email:p}),f(!1),X.success(`If the account exists, a reset link was sent`)}catch{X.error(`Could not request password reset`)}}async function F(t){if(t.preventDefault(),T(null),s&&b!==S){T(`Passwords do not match`);return}try{if(E){let t=await r(`/cms/auth/login/2fa`,`POST`,{challengeToken:E,code:M?A.trim():O});if(!t.user)throw Error(`Invalid 2FA response`);e({...t.user,jobTitle:t.user.jobTitle??null,organization:t.user.organization??null,country:t.user.country??null,twoFactorEnabled:t.user.twoFactorEnabled??!1}),o(`/`);return}s&&await r(`/cms/auth/register`,`POST`,{email:p,firstName:h,lastName:_,password:b});let t=await r(`/cms/auth/login`,`POST`,{email:p,password:b});if(t.requiresTwoFactor&&t.challengeToken){D(t.challengeToken),k(``),j(``),N(!1);return}if(!t.user)throw Error(`Invalid login response`);e({...t.user,jobTitle:t.user.jobTitle??null,organization:t.user.organization??null,country:t.user.country??null,twoFactorEnabled:t.user.twoFactorEnabled??!1}),o(`/`)}catch{T(E?`Invalid verification code.`:s?n??`Could not create account.`:`Invalid email or password.`)}}if(s===null)return null;let I=w;return(0,H.jsxs)(`div`,{className:`grid min-h-svh lg:grid-cols-2`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-4 p-6 md:p-10`,children:[(0,H.jsx)(`div`,{className:`flex items-center`,children:(0,H.jsx)(`img`,{src:`/admin/plank-logo-w.svg`,alt:`Plank CMS`,className:`h-10`})}),(0,H.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,H.jsxs)(`div`,{className:`w-full max-w-xs`,children:[(0,H.jsxs)(`div`,{className:`mb-6 text-center`,children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold`,children:d?`Reset your password`:s?`Create your account`:`Welcome back`}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:d?`Enter your email and we will send a reset link`:s?`Set up your admin account to get started`:`Enter your credentials to access the panel`})]}),(0,H.jsxs)(`form`,{onSubmit:d?P:F,className:`flex flex-col gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`email`,children:`Email`}),(0,H.jsx)(Z,{id:`email`,type:`email`,placeholder:`you@example.com`,value:p,onChange:e=>m(e.target.value),required:!0})]}),d?null:s&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`firstName`,children:`First name`}),(0,H.jsx)(Z,{id:`firstName`,value:h,onChange:e=>g(e.target.value),required:!0})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`lastName`,children:`Last name`}),(0,H.jsx)(Z,{id:`lastName`,value:_,onChange:e=>y(e.target.value),required:!0})]})]}),!d&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`password`,children:`Password`}),(0,H.jsx)(Z,{id:`password`,type:`password`,value:b,onChange:e=>x(e.target.value),required:!0})]}),!d&&E&&(0,H.jsx)(H.Fragment,{children:M?(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`backup-code`,children:`Backup code`}),(0,H.jsx)(Z,{id:`backup-code`,placeholder:`ABCD-EFGH`,value:A,onChange:e=>j(e.target.value.toUpperCase())}),(0,H.jsx)(q,{type:`button`,variant:`ghost`,className:`w-fit px-0 text-xs text-muted-foreground hover:text-foreground`,onClick:()=>{N(!1),j(``)},children:`Use authenticator code instead`})]}):(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{children:`Verification code`}),(0,H.jsxs)(yT,{maxLength:6,value:O,onChange:k,children:[(0,H.jsxs)(bT,{children:[(0,H.jsx)(xT,{index:0}),(0,H.jsx)(xT,{index:1}),(0,H.jsx)(xT,{index:2})]}),(0,H.jsx)(ST,{}),(0,H.jsxs)(bT,{children:[(0,H.jsx)(xT,{index:3}),(0,H.jsx)(xT,{index:4}),(0,H.jsx)(xT,{index:5})]})]}),(0,H.jsx)(q,{type:`button`,variant:`ghost`,className:`w-fit px-0 text-xs text-muted-foreground hover:text-foreground`,onClick:()=>{N(!0),k(``)},children:`Use backup code instead`})]})}),!d&&s&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`confirm`,children:`Confirm password`}),(0,H.jsx)(Z,{id:`confirm`,type:`password`,value:S,onChange:e=>C(e.target.value),required:!0})]}),I&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:I}),(0,H.jsx)(q,{type:`submit`,disabled:t,className:`w-full`,children:t||i?`...`:d?`Send reset link`:E?`Verify code`:s?`Create account`:`Login`}),l&&!s&&!E&&(0,H.jsx)(q,{type:`button`,variant:`ghost`,className:`w-full text-xs text-muted-foreground hover:text-foreground`,onClick:()=>{f(e=>!e),T(null)},children:d?`Back to login`:`Forgot password?`})]})]})})]}),(0,H.jsx)(`div`,{className:`hidden lg:block bg-center bg-cover bg-no-repeat`,style:{backgroundImage:`url(/admin/particles-texture.png)`}})]})}function wT(){let[e]=ta(),t=fr(),{loading:n,error:r,request:i}=Zw(),a=(0,v.useMemo)(()=>e.get(`token`)??``,[e]),[o,s]=(0,v.useState)(``),[c,l]=(0,v.useState)(``),[u,d]=(0,v.useState)(null);async function f(e){if(e.preventDefault(),d(null),o!==c){d(`Passwords do not match`);return}try{await i(`/cms/auth/password-reset/confirm`,`POST`,{token:a,password:o}),X.success(`Password updated`),t(`/login`)}catch{X.error(`Could not update password`)}}return(0,H.jsxs)(`div`,{className:`grid min-h-svh lg:grid-cols-2`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-4 p-6 md:p-10`,children:[(0,H.jsx)(`div`,{className:`flex items-center`,children:(0,H.jsx)(`img`,{src:`/admin/plank-logo-w.svg`,alt:`Plank CMS`,className:`h-10`})}),(0,H.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,H.jsxs)(`div`,{className:`w-full max-w-xs`,children:[(0,H.jsxs)(`div`,{className:`mb-6 text-center`,children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold`,children:`Create new password`}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Enter a new password for your account.`})]}),a?(0,H.jsxs)(`form`,{onSubmit:f,className:`flex flex-col gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`new-password`,children:`New password`}),(0,H.jsx)(Z,{id:`new-password`,type:`password`,value:o,onChange:e=>s(e.target.value),required:!0,minLength:8})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`confirm-password`,children:`Confirm new password`}),(0,H.jsx)(Z,{id:`confirm-password`,type:`password`,value:c,onChange:e=>l(e.target.value),required:!0,minLength:8})]}),(u??r)&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:u??r}),(0,H.jsx)(q,{type:`submit`,disabled:n,className:`w-full`,children:n?`Saving...`:`Update password`})]}):(0,H.jsxs)(`div`,{className:`space-y-4 text-center`,children:[(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:`Invalid password reset link.`}),(0,H.jsx)(q,{asChild:!0,className:`w-full`,children:(0,H.jsx)(qi,{to:`/login`,children:`Back to login`})})]})]})})]}),(0,H.jsx)(`div`,{className:`hidden bg-center bg-cover bg-no-repeat lg:block`,style:{backgroundImage:`url(/admin/particles-texture.png)`}})]})}function TT({...e}){return(0,H.jsx)(`nav`,{"aria-label":`breadcrumb`,"data-slot":`breadcrumb`,...e})}function ET({className:e,...t}){return(0,H.jsx)(`ol`,{"data-slot":`breadcrumb-list`,className:K(`flex flex-wrap items-center gap-1.5 text-sm break-words text-muted-foreground sm:gap-2.5`,e),...t})}function DT({className:e,...t}){return(0,H.jsx)(`li`,{"data-slot":`breadcrumb-item`,className:K(`inline-flex items-center gap-1.5`,e),...t})}function OT({asChild:e,className:t,...n}){return(0,H.jsx)(e?cl:`a`,{"data-slot":`breadcrumb-link`,className:K(`transition-colors hover:text-foreground`,t),...n})}function kT({className:e,...t}){return(0,H.jsx)(`span`,{"data-slot":`breadcrumb-page`,role:`link`,"aria-disabled":`true`,"aria-current":`page`,className:K(`font-normal text-foreground`,e),...t})}function AT({children:e,className:t,...n}){return(0,H.jsx)(`li`,{"data-slot":`breadcrumb-separator`,role:`presentation`,"aria-hidden":`true`,className:K(`[&>svg]:size-3.5`,t),...n,children:e??(0,H.jsx)(Ua,{})})}function jT(e){return{...e}}function MT(e){return e.type.startsWith(`image/`)?new Promise(t=>{let n=new Image,r=URL.createObjectURL(e);n.onload=()=>{URL.revokeObjectURL(r),t({width:n.naturalWidth,height:n.naturalHeight})},n.onerror=()=>{URL.revokeObjectURL(r),t(null)},n.src=r}):Promise.resolve(null)}async function NT(e,t){let n=await MT(e),r=await fetch(`/cms/admin/media/presign`,{method:`POST`,credentials:`include`,headers:jT({"Content-Type":`application/json`}),body:JSON.stringify({filename:e.name,mimeType:e.type,folderId:t?.folderId??null})});if(!r.ok)throw Error(`Upload failed.`);let i=await r.json();if(i.mode===`presigned`){if(!(await fetch(i.uploadUrl,{method:`PUT`,body:e,headers:{"Content-Type":e.type}})).ok)throw Error(`Upload failed.`);let r=await fetch(`/cms/admin/media/confirm`,{method:`POST`,credentials:`include`,headers:jT({"Content-Type":`application/json`}),body:JSON.stringify({key:i.key,filename:e.name,mimeType:e.type,size:e.size,folderId:t?.folderId??null,width:n?.width??null,height:n?.height??null})});if(!r.ok)throw Error(`Upload failed.`);return r.json()}let a=new FormData;a.append(`files`,e,e.name),t?.folderId&&a.append(`folder_id`,t.folderId),n?.width&&a.append(`width`,String(n.width)),n?.height&&a.append(`height`,String(n.height));let o=await fetch(`/cms/admin/media`,{method:`POST`,credentials:`include`,headers:jT(),body:a});if(!o.ok)throw Error(`Upload failed.`);return o.json()}async function PT(e){let t=await fetch(`/cms/admin/users/me/avatar/presign`,{method:`POST`,credentials:`include`,headers:jT({"Content-Type":`application/json`}),body:JSON.stringify({filename:e.name,mimeType:e.type})});if(!t.ok)throw Error(`Upload failed.`);let n=await t.json();if(n.mode===`presigned`){if(!(await fetch(n.uploadUrl,{method:`PUT`,body:e,headers:{"Content-Type":e.type}})).ok)throw Error(`Upload failed.`);let t=await fetch(`/cms/admin/users/me/avatar/confirm`,{method:`POST`,credentials:`include`,headers:jT({"Content-Type":`application/json`}),body:JSON.stringify({key:n.key})});if(!t.ok)throw Error(`Upload failed.`);return(await t.json()).avatarUrl}let r=new FormData;r.append(`file`,e);let i=await fetch(`/cms/admin/users/me/avatar`,{method:`POST`,credentials:`include`,headers:jT(),body:r});if(!i.ok)throw Error(`Upload failed.`);return(await i.json()).avatarUrl}var FT=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(xy,{ref:n,className:K(`peer size-4 shrink-0 rounded-sm border border-input shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=checked]:border-primary`,e),...t,children:(0,H.jsx)(Cy,{className:`flex items-center justify-center text-current`,children:(0,H.jsx)(Ba,{className:`size-3`})})}));FT.displayName=xy.displayName;function IT({className:e,...t}){return(0,H.jsx)(`nav`,{"aria-label":`pagination`,"data-slot":`pagination`,className:K(`mx-auto flex w-full justify-center`,e),...t})}function LT({className:e,...t}){return(0,H.jsx)(`ul`,{"data-slot":`pagination-content`,className:K(`flex flex-row items-center gap-1`,e),...t})}function RT({...e}){return(0,H.jsx)(`li`,{"data-slot":`pagination-item`,...e})}function zT({className:e,isActive:t,size:n=`icon`,...r}){return(0,H.jsx)(`a`,{"aria-current":t?`page`:void 0,"data-slot":`pagination-link`,"data-active":t,className:K(rl({variant:t?`outline`:`ghost`,size:n}),e),...r})}function BT({className:e,...t}){return(0,H.jsxs)(zT,{"aria-label":`Go to previous page`,size:`default`,className:K(`gap-1 px-2.5 sm:pl-2.5`,e),...t,children:[(0,H.jsx)(Ha,{}),(0,H.jsx)(`span`,{className:`hidden sm:block`,children:`Previous`})]})}function VT({className:e,...t}){return(0,H.jsxs)(zT,{"aria-label":`Go to next page`,size:`default`,className:K(`gap-1 px-2.5 sm:pr-2.5`,e),...t,children:[(0,H.jsx)(`span`,{className:`hidden sm:block`,children:`Next`}),(0,H.jsx)(Ua,{})]})}var HT=fS,UT=pS,WT=v.forwardRef(({className:e,inset:t,children:n,...r},i)=>(0,H.jsxs)(SS,{ref:i,className:K(`flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,t&&`pl-8`,e),...r,children:[n,(0,H.jsx)(Ua,{className:`ml-auto`})]}));WT.displayName=SS.displayName;var GT=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(CS,{ref:n,className:K(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground 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}));GT.displayName=CS.displayName;var KT=v.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,H.jsx)(mS,{children:(0,H.jsx)(hS,{ref:r,sideOffset:t,className:K(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground 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),...n})}));KT.displayName=hS.displayName;var qT=v.forwardRef(({className:e,inset:t,...n},r)=>(0,H.jsx)(_S,{ref:r,className:K(`relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,t&&`pl-8`,e),...n}));qT.displayName=_S.displayName;var JT=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(xS,{ref:n,className:K(`-mx-1 my-1 h-px bg-muted`,e),...t}));JT.displayName=xS.displayName;var YT=v.forwardRef(({className:e,inset:t,...n},r)=>(0,H.jsx)(gS,{ref:r,className:K(`px-2 py-1.5 text-sm font-semibold`,t&&`pl-8`,e),...n}));YT.displayName=gS.displayName;var XT=v.forwardRef(({className:e,children:t,checked:n,...r},i)=>(0,H.jsxs)(vS,{ref:i,className:K(`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:[(0,H.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,H.jsx)(bS,{children:(0,H.jsx)(Ba,{className:`h-4 w-4`})})}),t]}));XT.displayName=vS.displayName;var ZT=v.forwardRef(({className:e,children:t,...n},r)=>(0,H.jsxs)(yS,{ref:r,className:K(`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:[(0,H.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,H.jsx)(bS,{children:(0,H.jsx)(Ya,{className:`h-2 w-2 fill-current`})})}),t]}));ZT.displayName=yS.displayName;var QT=({className:e,...t})=>(0,H.jsx)(`span`,{className:K(`ml-auto text-xs tracking-widest opacity-60`,e),...t});QT.displayName=`DropdownMenuShortcut`;function $T(e,t){e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),t())}function eE(e){return e?e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`:`—`}function tE(e){let t=e.split(`/`).pop()??e;return t.replace(/\.[^.]+$/,``).trim()||t.trim()}function nE(e){return!!e?.startsWith(`image/`)}function rE(e){return!!e?.startsWith(`video/`)}function iE(e){return!!e?.startsWith(`audio/`)}function aE(e){return e===`application/pdf`}function oE(e,t){return e.split(`?`)[0].endsWith(`.m3u8`)||t===`application/x-mpegurl`||t===`application/vnd.apple.mpegurl`}async function sE(e){if(e.isFile)return new Promise(t=>{e.file(n=>t([{file:n,relativePath:e.fullPath.replace(/^\//,``)}]))});if(e.isDirectory){let t=e.createReader(),n=[];return await new Promise(e=>{let r=()=>{t.readEntries(async t=>{if(t.length===0){e();return}let i=await Promise.all(t.map(sE));n.push(...i.flat()),r()})};r()}),n}return[]}function cE({folder:e,onOpen:t,onDelete:n,onRename:r,canDelete:i,canRename:a,selected:o,onToggle:s}){return(0,H.jsxs)(`div`,{className:`group relative flex cursor-pointer items-center gap-3 rounded-lg border bg-card px-3 py-2.5 transition-colors hover:bg-muted/50 ${o?`ring-2 ring-primary`:``}`,role:`button`,tabIndex:0,"aria-pressed":o,onClick:()=>{o||t(e)},onKeyDown:n=>{$T(n,()=>{o||t(e)})},children:[(0,H.jsxs)(`div`,{className:`relative flex size-7 shrink-0 items-center justify-center`,children:[(0,H.jsx)(uo,{className:`size-7 text-muted-foreground transition-opacity ${o?`opacity-0`:`group-hover:opacity-0`}`}),(0,H.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center transition-opacity ${o?`opacity-100`:`opacity-0 group-hover:opacity-100`}`,onPointerDown:e=>e.stopPropagation(),children:(0,H.jsx)(FT,{checked:o,onCheckedChange:()=>s(`folder:${e.id}`),"aria-label":`Select folder`})})]}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`p`,{className:`truncate text-sm font-bold`,title:e.name,children:e.name}),(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.item_count,` `,e.item_count===1?`item`:`items`]})]}),!o&&(a||i)&&(0,H.jsxs)(HT,{children:[(0,H.jsx)(UT,{asChild:!0,children:(0,H.jsx)(`button`,{type:`button`,className:`flex size-6 shrink-0 items-center justify-center rounded-md text-muted-foreground opacity-0 transition-opacity hover:bg-muted hover:text-foreground group-hover:opacity-100`,onClick:e=>e.stopPropagation(),children:(0,H.jsx)(eo,{className:`size-4`})})}),(0,H.jsxs)(KT,{align:`end`,onClick:e=>e.stopPropagation(),children:[a&&(0,H.jsxs)(qT,{onSelect:()=>r(e),children:[(0,H.jsx)(Io,{className:`size-4`}),`Rename`]}),i&&(0,H.jsxs)(qT,{onSelect:()=>n(e),className:`text-destructive focus:text-destructive`,children:[(0,H.jsx)(Qo,{className:`size-4`}),`Delete`]})]})]})]})}function lE({item:e,onDelete:t,onPreview:n,canDelete:r,selected:i,onToggle:a}){let o=e.mime_type?.toLowerCase()??null;return(0,H.jsxs)(`div`,{className:`group relative overflow-hidden rounded-lg border bg-card transition-colors ${i?`ring-2 ring-primary`:``}`,children:[(0,H.jsx)(`div`,{className:`flex aspect-square cursor-pointer items-center justify-center bg-muted`,role:`button`,tabIndex:0,"aria-pressed":i,onClick:()=>{i||n(e)},onKeyDown:t=>{$T(t,()=>{i||n(e)})},children:nE(o)?(0,H.jsx)(`img`,{src:e.url,alt:e.alt??e.filename,className:`h-full w-full object-cover`}):rE(o)||oE(e.url,o)?(0,H.jsx)(io,{className:`size-10 text-muted-foreground`}):iE(o)?(0,H.jsx)(ro,{className:`size-10 text-muted-foreground`}):aE(o)?(0,H.jsx)(ao,{className:`size-10 text-muted-foreground`}):(0,H.jsx)(oo,{className:`size-10 text-muted-foreground`})}),(0,H.jsx)(`div`,{className:`absolute left-1.5 top-1.5 transition-opacity ${i?`opacity-100`:`opacity-0 group-hover:opacity-100`}`,children:(0,H.jsx)(FT,{checked:i,onCheckedChange:()=>a(e.id),"aria-label":`Select file`,className:`bg-background/80 backdrop-blur-sm`})}),!i&&r&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>t(e),className:`absolute right-1.5 top-1.5 flex size-6 items-center justify-center rounded-md bg-background/80 text-muted-foreground opacity-0 backdrop-blur-sm transition-opacity hover:text-destructive group-hover:opacity-100`,children:(0,H.jsx)(Qo,{className:`size-3.5`})}),(0,H.jsxs)(`div`,{className:`p-2`,children:[(0,H.jsx)(`p`,{className:`truncate text-xs font-medium`,title:e.filename,children:e.filename}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:eE(e.size)})]})]})}var uE=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`textarea`,{className:K(`flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`,e),ref:n,...t}));uE.displayName=`Textarea`;function dE({url:e}){let t=(0,v.useRef)(null);return(0,v.useEffect)(()=>{let n=t.current;if(!n)return;if(n.canPlayType(`application/vnd.apple.mpegurl`)){n.src=e;return}let r=null;return L(async()=>{let{default:e}=await import(`./hls-0EiSYoTw.js`);return{default:e}},[]).then(({default:t})=>{if(!t.isSupported())return;let i=new t;r=i,i.loadSource(e),i.attachMedia(n)}),()=>{r?.destroy()}},[e]),(0,H.jsx)(`video`,{ref:t,controls:!0,className:`max-h-[70vh] w-full rounded-md bg-zinc-950`})}function fE({item:e}){let t=e.mime_type?.toLowerCase()??null;return nE(t)?(0,H.jsx)(`img`,{src:e.url,alt:e.alt??e.filename,className:`max-h-full max-w-full rounded-md object-contain`}):oE(e.url,t)?(0,H.jsx)(dE,{url:e.url}):rE(t)?(0,H.jsx)(`video`,{src:e.url,controls:!0,preload:`none`,className:`max-h-[70vh] w-full rounded-md bg-zinc-950`}):iE(t)?(0,H.jsxs)(`div`,{className:`flex flex-col items-center gap-4 py-6`,children:[(0,H.jsx)(ro,{className:`size-14 text-muted-foreground`}),(0,H.jsx)(`audio`,{src:e.url,controls:!0,className:`w-full`})]}):aE(t)?(0,H.jsx)(`iframe`,{src:e.url,title:e.filename,className:`h-[70vh] w-full rounded-md border`}):(0,H.jsxs)(`div`,{className:`flex flex-col items-center gap-4 py-8 text-center`,children:[(0,H.jsx)(ao,{className:`size-14 text-muted-foreground`}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.mime_type??`Unknown type`}),(0,H.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,download:e.filename,children:(0,H.jsxs)(q,{variant:`outline`,size:`sm`,children:[(0,H.jsx)($a,{className:`size-4`}),`Download`]})})]})}function pE({preview:e,onOpenChange:t,hasPreviousPreview:n,hasNextPreview:r,stepPreview:i,timezone:a,editFilename:o,onFilenameChange:s,editAlt:c,onAltChange:l,editCaption:u,onCaptionChange:d,editSaving:f,editError:p,canWriteMedia:m,onSave:h}){return(0,H.jsx)(Yh,{open:!!e,onOpenChange:t,children:(0,H.jsxs)($h,{className:`sm:max-w-5xl max-h-[90vh] overflow-hidden p-0`,children:[(0,H.jsx)(eg,{children:(0,H.jsx)(ng,{className:`truncate px-6 pt-6 pr-12`,title:e?.filename,children:e?.filename})}),e&&(0,H.jsxs)(`div`,{className:`grid max-h-[calc(90vh-4rem)] min-h-0 gap-0 lg:grid-cols-[minmax(0,1fr)_320px]`,children:[(0,H.jsxs)(`div`,{className:`relative flex min-h-0 items-center justify-center overflow-hidden bg-muted/30 px-6 py-4`,children:[(0,H.jsx)(`div`,{className:`flex h-full w-full min-h-[280px] items-center justify-center overflow-hidden rounded-xl border bg-background/70 p-4`,children:(0,H.jsx)(fE,{item:e})}),(0,H.jsx)(q,{type:`button`,variant:`secondary`,size:`icon`,className:`absolute left-8 top-1/2 size-10 -translate-y-1/2 rounded-full shadow-sm`,onClick:()=>i(-1),disabled:!n,"aria-label":`Previous file`,children:(0,H.jsx)(Ha,{className:`size-4`})}),(0,H.jsx)(q,{type:`button`,variant:`secondary`,size:`icon`,className:`absolute right-8 top-1/2 size-10 -translate-y-1/2 rounded-full shadow-sm`,onClick:()=>i(1),disabled:!r,"aria-label":`Next file`,children:(0,H.jsx)(Ua,{className:`size-4`})})]}),(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-col border-t lg:border-l lg:border-t-0`,children:[(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 border-b px-6 py-4 text-xs text-muted-foreground`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`mb-1 font-medium text-foreground`,children:`Type`}),(0,H.jsx)(`p`,{className:`break-all`,children:e.mime_type??`—`})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`mb-1 font-medium text-foreground`,children:`Size`}),(0,H.jsx)(`p`,{children:eE(e.size??null)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`mb-1 font-medium text-foreground`,children:`Dimensions`}),(0,H.jsx)(`p`,{children:e.width&&e.height?`${e.width} × ${e.height}`:`—`})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`mb-1 font-medium text-foreground`,children:`Created`}),(0,H.jsx)(`p`,{children:cv(e.created_at,a)})]})]}),(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-6 py-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{className:`text-xs`,children:`Filename`}),(0,H.jsx)(Z,{value:o,onChange:e=>s(e.target.value),placeholder:e.filename,className:`text-sm`,disabled:!m})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{className:`text-xs`,children:`Alt text`}),(0,H.jsx)(Z,{value:c,onChange:e=>l(e.target.value),placeholder:tE(o||e.filename),className:`text-sm`,disabled:!m}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Defaulted from the filename without extension. You can override it.`})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{className:`text-xs`,children:`Subtitle`}),(0,H.jsx)(uE,{value:u,onChange:e=>d(e.target.value),placeholder:`Used as figcaption in the frontend…`,className:`min-h-28 resize-none text-sm`,disabled:!m})]}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3 pt-2`,children:[(0,H.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,download:e.filename,children:(0,H.jsxs)(q,{variant:`outline`,size:`sm`,type:`button`,children:[(0,H.jsx)($a,{className:`size-3.5`}),`Download`]})}),(0,H.jsx)(q,{type:`button`,size:`sm`,onClick:h,disabled:f||!m,children:f?`Saving…`:`Save`})]}),p&&(0,H.jsx)(`p`,{className:`text-xs text-destructive`,children:p})]})]})]})]})})}function mE(){let{timezone:e}=Sa(),t=(0,v.useRef)(null),{user:n}=_a(),r=n?.permissions??[],i=r.includes(`*`)||r.includes(`media:write`),a=r.includes(`*`)||r.includes(`media:delete`),[o,s]=(0,v.useState)([{id:null,name:`Media`}]),c=o[o.length-1].id,[l,u]=(0,v.useState)(1),[d,f]=(0,v.useState)(``),[p,m]=(0,v.useState)(``);(0,v.useEffect)(()=>{let e=setTimeout(()=>{m(d),u(1)},300);return()=>clearTimeout(e)},[d]),(0,v.useEffect)(()=>{u(1),f(``),m(``)},[c]);let{data:h,loading:g,refetch:_}=ps(`/cms/admin/folders?parent_id=${c??``}`),{data:y,loading:b,refetch:x}=ps(`/cms/admin/media?folder_id=${c??``}&page=${l}&limit=48${p?`&search=${encodeURIComponent(p)}`:``}`),S=(0,v.useCallback)(()=>{_(),x()},[_,x]),[C,w]=(0,v.useState)(!1),[T,E]=(0,v.useState)(null),[D,O]=(0,v.useState)(new Set),[k,A]=(0,v.useState)(null),[j,M]=(0,v.useState)(``),[N,P]=(0,v.useState)(``),[F,I]=(0,v.useState)(``),[L,R]=(0,v.useState)(!1),[ee,te]=(0,v.useState)(null),[ne,z]=(0,v.useState)(null),[B,re]=(0,v.useState)(null),[V,ie]=(0,v.useState)(null),[ae,oe]=(0,v.useState)(``),[se,ce]=(0,v.useState)(!1),[le,ue]=(0,v.useState)(``),[de,fe]=(0,v.useState)(!1),[pe,me]=(0,v.useState)(!1),{loading:he,error:ge,request:_e}=Zw(),{loading:ve,error:ye,request:be}=Zw();async function xe(e){if(e.some(({relativePath:e})=>e.endsWith(`.m3u8`))){let t=new FormData;for(let{file:n,relativePath:r}of e)t.append(`files`,n,r);c&&t.append(`folder_id`,c),t.append(`bundle`,`true`);let n=await fetch(`/cms/admin/media`,{method:`POST`,credentials:`include`,body:t});if(!n.ok){let e=await n.text(),t=`Upload failed.`;try{t=JSON.parse(e).error??t}catch{}throw Error(t)}}else await Promise.all(e.map(({file:e})=>NT(e,{folderId:c})))}async function Se(e){if(i&&!(!e||e.length===0)){w(!0),E(null);try{await xe(Array.from(e).map(e=>({file:e,relativePath:e.webkitRelativePath||e.name}))),S(),X.success(`Upload complete`)}catch(e){E(e instanceof Error?e.message:`Upload failed.`),X.error(`Upload failed`)}finally{w(!1),t.current&&(t.current.value=``)}}}async function Ce(e){if(!i)return;e.preventDefault();let t=Array.from(e.dataTransfer.items);if(!t.some(e=>typeof e.webkitGetAsEntry==`function`)){Se(e.dataTransfer.files);return}w(!0),E(null);try{let e=t.map(e=>e.webkitGetAsEntry()).filter(e=>e!==null);await xe((await Promise.all(e.map(sE))).flat()),S(),X.success(`Upload complete`)}catch(e){E(e instanceof Error?e.message:`Upload failed.`),X.error(`Upload failed`)}finally{w(!1)}}function we(e){s(t=>[...t,{id:e.id,name:e.name}]),O(new Set)}function Te(e){s(t=>t.slice(0,e+1)),O(new Set)}async function Ee(){if(i&&le.trim())try{await be(`/cms/admin/folders`,`POST`,{name:le.trim(),parent_id:c}),ce(!1),ue(``),_(),X.success(`Folder created`)}catch{X.error(`Could not create folder`)}}async function De(){if(i&&!(!V||!ae.trim()))try{await be(`/cms/admin/folders/${V.id}`,`PATCH`,{name:ae.trim()}),ie(null),_(),X.success(`Folder renamed`)}catch{X.error(`Could not rename folder`)}}async function Oe(){if(a&&B)try{await _e(`/cms/admin/folders/${B.id}`,`DELETE`),re(null),_(),X.success(`Folder deleted`)}catch{X.error(`Could not delete folder`)}}async function ke(){if(a&&ne)try{await _e(`/cms/admin/media/${ne.id}`,`DELETE`),z(null),x(),X.success(`File deleted`)}catch{X.error(`Could not delete file`)}}function Ae(e){O(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}function je(e){A(e),M(e.filename),P(e.alt??tE(e.filename)),I(e.caption??``),te(null)}function Me(e){if(!k)return;let t=Ie.findIndex(e=>e.id===k.id);if(t===-1)return;let n=Ie[t+e];n&&je(n)}async function Ne(){if(k){R(!0),te(null);try{let e=await fetch(`/cms/admin/media/${k.id}`,{method:`PATCH`,credentials:`include`,headers:{"Content-Type":`application/json`},body:JSON.stringify({filename:j||k.filename,alt:N.trim()||null,caption:F.trim()||null})});if(!e.ok)throw Error(`Save failed.`);je(await e.json()),x(),X.success(`File updated`)}catch(e){te(e instanceof Error?e.message:`Save failed.`),X.error(`Could not update file`)}finally{R(!1)}}}function Pe(e){M(e);let t=tE(j),n=tE(e);(!N.trim()||N===t)&&P(n)}let Fe=h?.folders??[],Ie=y?.items??[],Le=k?Ie.findIndex(e=>e.id===k.id):-1,Re=Le>0,ze=Le!==-1&&Le<Ie.length-1,Be=[...Fe.map(e=>`folder:${e.id}`),...Ie.map(e=>e.id)];(0,v.useEffect)(()=>{if(!k)return;function e(e){e.key===`ArrowLeft`&&Re&&(e.preventDefault(),Me(-1)),e.key===`ArrowRight`&&ze&&(e.preventDefault(),Me(1))}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[k,Re,ze,Ie]);async function Ve(){if(a&&!pe){me(!0);try{await Promise.all([...[...D].filter(e=>e.startsWith(`folder:`)).map(e=>fetch(`/cms/admin/folders/${e.slice(7)}`,{method:`DELETE`,credentials:`include`})),...[...D].filter(e=>!e.startsWith(`folder:`)).map(e=>fetch(`/cms/admin/media/${e}`,{method:`DELETE`,credentials:`include`}))]),X.success(`Files deleted`),fe(!1),O(new Set),S()}catch{X.error(`Could not delete files`)}finally{me(!1)}}}let He=g||b,Ue=Fe.length===0&&Ie.length===0;return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(fs,{children:(0,H.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,H.jsx)(`h1`,{className:`text-2xl font-semibold -mt-2`,children:`Media Library`}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsxs)(q,{variant:`outline`,onClick:()=>{ue(``),ce(!0)},disabled:!i,children:[(0,H.jsx)(lo,{className:`size-4`}),`New folder`]}),(0,H.jsxs)(q,{onClick:()=>t.current?.click(),disabled:C||!i,children:[C?(0,H.jsx)(BC,{className:`size-4`}):(0,H.jsx)(rs,{className:`size-4`}),C?`Uploading…`:`Upload`]})]})]})}),(0,H.jsxs)(`section`,{className:`mt-24`,children:[o.length>1&&(0,H.jsx)(TT,{className:`mb-4`,children:(0,H.jsx)(ET,{children:o.map((e,t)=>(0,H.jsxs)(v.Fragment,{children:[t>0&&(0,H.jsx)(AT,{}),(0,H.jsx)(DT,{children:t===o.length-1?(0,H.jsx)(kT,{children:t===0?(0,H.jsx)(_o,{className:`size-3.5`}):e.name}):(0,H.jsx)(OT,{asChild:!0,children:(0,H.jsx)(`button`,{onClick:()=>Te(t),children:t===0?(0,H.jsx)(_o,{className:`size-3.5`}):e.name})})})]},`${e.id??`root`}:${e.name}`))})}),(0,H.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 rounded-lg border border-border bg-muted/50 p-2`,children:[(0,H.jsxs)(`div`,{className:`relative max-w-72 w-full`,children:[(0,H.jsx)(Uo,{className:`absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground pointer-events-none`}),(0,H.jsx)(Z,{className:`pl-9 h-8 bg-background`,placeholder:`Search media…`,value:d,onChange:e=>f(e.target.value)})]}),!b&&y!=null&&(0,H.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[Ie.length,` / `,y.total,` `,y.total===1?`file`:`files`]}),(0,H.jsx)(`div`,{className:`ml-auto flex h-8 items-center gap-2`,children:D.size>0?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`span`,{className:`text-sm font-medium`,children:[D.size,` selected`]}),(0,H.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>O(new Set),children:`Clear`}),a&&(0,H.jsxs)(q,{variant:`destructive`,size:`sm`,disabled:pe,onClick:()=>fe(!0),children:[(0,H.jsx)(Qo,{className:`size-3.5`}),`Delete`]})]}):!Ue&&!He?(0,H.jsxs)(`button`,{type:`button`,className:`flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors`,onClick:()=>O(new Set(Be)),children:[(0,H.jsx)(FT,{checked:!1,"aria-hidden":!0,className:`pointer-events-none`}),`Select all`]}):null})]}),(0,H.jsx)(`input`,{ref:t,type:`file`,multiple:!0,className:`hidden`,onChange:e=>Se(e.target.files)}),T&&(0,H.jsx)(`p`,{className:`mb-4 text-sm text-destructive`,children:T}),He?(0,H.jsx)(`div`,{className:`flex items-center gap-2 py-16 justify-center text-muted-foreground`,children:(0,H.jsx)(BC,{className:`size-5`})}):Ue?(0,H.jsxs)(`div`,{className:`flex flex-col items-center justify-center rounded-lg border border-dashed py-20 text-center cursor-pointer hover:bg-muted/50 transition-colors`,onClick:()=>i&&t.current?.click(),onDragOver:e=>e.preventDefault(),onDrop:Ce,children:[(0,H.jsx)(rs,{className:`size-8 text-muted-foreground mb-3`}),(0,H.jsx)(`p`,{className:`text-sm font-medium`,children:`Drop files or folders here, or click to upload`}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:`Images, videos, audio, documents and more`})]}):(0,H.jsxs)(`div`,{className:`flex flex-col gap-6`,onDragOver:e=>e.preventDefault(),onDrop:Ce,children:[Fe.length>0&&(0,H.jsx)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4`,children:Fe.map(e=>(0,H.jsx)(cE,{folder:e,onOpen:we,onDelete:re,onRename:e=>{ie(e),oe(e.name)},canDelete:a,canRename:i,selected:D.has(`folder:${e.id}`),onToggle:Ae},e.id))}),Ie.length>0&&(0,H.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6`,children:Ie.map(e=>(0,H.jsx)(lE,{item:e,onDelete:z,onPreview:je,canDelete:a,selected:D.has(e.id),onToggle:Ae},e.id))})]}),(y?.pages??0)>1&&(0,H.jsx)(`div`,{className:`mt-4`,children:(0,H.jsx)(IT,{className:`mx-0 w-auto justify-end`,children:(0,H.jsxs)(LT,{children:[(0,H.jsx)(RT,{children:(0,H.jsx)(BT,{href:`#`,onClick:e=>{e.preventDefault(),l>1&&u(l-1)},"aria-disabled":l===1,className:l===1?`pointer-events-none opacity-50`:``})}),(0,H.jsx)(RT,{children:(0,H.jsx)(VT,{href:`#`,onClick:e=>{e.preventDefault(),l<(y?.pages??1)&&u(l+1)},"aria-disabled":l===(y?.pages??1),className:l===(y?.pages??1)?`pointer-events-none opacity-50`:``})})]})})}),(0,H.jsx)(pE,{preview:k,onOpenChange:e=>{e||(A(null),te(null),I(``))},hasPreviousPreview:Re,hasNextPreview:ze,stepPreview:Me,timezone:e,editFilename:j,onFilenameChange:Pe,editAlt:N,onAltChange:P,editCaption:F,onCaptionChange:I,editSaving:L,editError:ee,canWriteMedia:i,onSave:Ne}),(0,H.jsx)(Yh,{open:se,onOpenChange:e=>{e||ce(!1)},children:(0,H.jsxs)($h,{className:`sm:max-w-sm`,children:[(0,H.jsx)(eg,{children:(0,H.jsx)(ng,{children:`New folder`})}),(0,H.jsx)(Z,{placeholder:`Folder name`,value:le,onChange:e=>ue(e.target.value),onKeyDown:e=>{e.key===`Enter`&&Ee()}}),ye&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:ye}),(0,H.jsxs)(tg,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>ce(!1),children:`Cancel`}),(0,H.jsx)(q,{onClick:Ee,disabled:ve||!le.trim()||!i,children:ve?`Creating…`:`Create`})]})]})}),(0,H.jsx)(Yh,{open:!!V,onOpenChange:e=>{e||ie(null)},children:(0,H.jsxs)($h,{className:`sm:max-w-sm`,children:[(0,H.jsx)(eg,{children:(0,H.jsx)(ng,{children:`Rename folder`})}),(0,H.jsx)(Z,{value:ae,onChange:e=>oe(e.target.value),onKeyDown:e=>{e.key===`Enter`&&De()}}),ye&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:ye}),(0,H.jsxs)(tg,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>ie(null),children:`Cancel`}),(0,H.jsx)(q,{onClick:De,disabled:ve||!ae.trim()||!i,children:ve?`Saving…`:`Save`})]})]})}),(0,H.jsx)(Yh,{open:!!ne,onOpenChange:e=>{e||z(null)},children:(0,H.jsxs)($h,{className:`sm:max-w-sm`,children:[(0,H.jsx)(eg,{children:(0,H.jsx)(ng,{children:`Delete file`})}),(0,H.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Are you sure you want to delete`,` `,(0,H.jsx)(`span`,{className:`font-medium text-foreground`,children:ne?.filename}),`? This action cannot be undone.`]}),ge&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:ge}),(0,H.jsxs)(tg,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>z(null),children:`Cancel`}),(0,H.jsx)(q,{variant:`destructive`,onClick:ke,disabled:he||!a,children:he?`Deleting…`:`Delete`})]})]})}),(0,H.jsx)(Yh,{open:!!B,onOpenChange:e=>{e||re(null)},children:(0,H.jsxs)($h,{className:`sm:max-w-sm`,children:[(0,H.jsx)(eg,{children:(0,H.jsx)(ng,{children:`Delete folder`})}),(0,H.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Are you sure you want to delete`,` `,(0,H.jsx)(`span`,{className:`font-medium text-foreground`,children:B?.name}),`? The folder must be empty.`]}),ge&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:ge}),(0,H.jsxs)(tg,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>re(null),children:`Cancel`}),(0,H.jsx)(q,{variant:`destructive`,onClick:Oe,disabled:he||!a,children:he?`Deleting…`:`Delete`})]})]})}),(0,H.jsx)(Yh,{open:de,onOpenChange:e=>{e||fe(!1)},children:(0,H.jsxs)($h,{className:`sm:max-w-sm`,children:[(0,H.jsx)(eg,{children:(0,H.jsxs)(ng,{children:[`Delete `,D.size,` `,D.size===1?`item`:`items`,`?`]})}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This action cannot be undone. Non-empty folders will be skipped.`}),(0,H.jsxs)(tg,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>fe(!1),children:`Cancel`}),(0,H.jsxs)(q,{variant:`destructive`,onClick:Ve,disabled:pe,children:[pe?(0,H.jsx)(BC,{className:`size-4`}):null,`Delete`]})]})]})})]})]})}function hE({...e}){return(0,H.jsx)(Tv,{"data-slot":`collapsible`,...e})}function gE({...e}){return(0,H.jsx)(Sv,{"data-slot":`collapsible-content`,...e})}function _E(){let{user:e,updateUser:t}=_a(),{loading:n,error:r,request:i}=Zw(),{request:a}=Zw(),o=(0,v.useRef)(null),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(!1),[d,f]=(0,v.useState)(null),[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(e?.firstName??``),[_,y]=(0,v.useState)(e?.lastName??``),[b,x]=(0,v.useState)(e?.jobTitle??``),[S,C]=(0,v.useState)(e?.organization??``),[w,T]=(0,v.useState)(e?.country??``);function E(){p&&(g(e?.firstName??``),y(e?.lastName??``),x(e?.jobTitle??``),C(e?.organization??``),T(e?.country??``)),m(!p)}async function D(e){let n=e.target.files?.[0];if(n){c(!0),f(null);try{t({avatarUrl:await PT(n)}),X.success(`Avatar updated`)}catch(e){f(e instanceof Error?e.message:`Upload failed.`),X.error(`Could not update avatar`)}finally{c(!1),o.current&&(o.current.value=``)}}}async function O(){u(!0),f(null);try{await a(`/cms/admin/users/me/avatar`,`DELETE`),t({avatarUrl:null}),X.success(`Avatar removed`)}catch(e){f(e instanceof Error?e.message:`Delete failed.`),X.error(`Could not remove avatar`)}finally{u(!1)}}async function k(e){e.preventDefault();try{let e=await i(`/cms/admin/users/me`,`PATCH`,{firstName:h,lastName:_,jobTitle:b,organization:S,country:w});t({firstName:e.first_name,lastName:e.last_name,jobTitle:e.job_title,organization:e.organization,country:e.country}),m(!1),X.success(`Profile saved`)}catch{X.error(`Could not save profile`)}}return(0,H.jsx)(hE,{open:p,onOpenChange:m,children:(0,H.jsxs)($_,{children:[(0,H.jsxs)(ev,{children:[(0,H.jsx)(tv,{className:`uppercase`,children:`Account`}),(0,H.jsx)(nv,{children:(0,H.jsx)(q,{variant:`ghost`,size:`icon`,onClick:E,children:p?(0,H.jsx)(cs,{className:`size-4`}):(0,H.jsx)(Io,{className:`size-4`})})})]}),(0,H.jsxs)(rv,{children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-4 -mt-4`,children:[(0,H.jsxs)(`div`,{className:`group relative shrink-0`,children:[(0,H.jsxs)(`button`,{type:`button`,className:`block`,onClick:()=>o.current?.click(),disabled:s||l,title:`Change avatar`,children:[(0,H.jsx)(hw,{avatarUrl:e?.avatarUrl,firstName:e?.firstName,lastName:e?.lastName,email:e?.email,className:`size-20`,fallbackClassName:`text-xl`}),(0,H.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center rounded-full bg-black/40 opacity-0 transition-opacity group-hover:opacity-100`,children:s||l?(0,H.jsx)(`div`,{className:`size-4 animate-spin rounded-full border-2 border-white border-t-transparent`}):(0,H.jsx)(za,{className:`size-5 text-white`})})]}),e?.avatarUrl&&!s&&!l&&(0,H.jsx)(`button`,{type:`button`,onClick:O,title:`Remove avatar`,className:`absolute -top-1 -right-1 flex size-5 items-center justify-center rounded-full bg-destructive text-destructive-foreground opacity-0 transition-opacity group-hover:opacity-100`,children:(0,H.jsx)(Qo,{className:`size-3`})})]}),(0,H.jsx)(`input`,{ref:o,type:`file`,accept:`image/*`,className:`hidden`,onChange:D}),(0,H.jsxs)(`div`,{children:[d&&(0,H.jsx)(`p`,{className:`text-xs text-destructive mb-1`,children:d}),(0,H.jsx)(`p`,{className:`font-bold text-xl`,children:e?.firstName||e?.lastName?`${e.firstName??``} ${e.lastName??``}`.trim():e?.email}),(e?.jobTitle||e?.organization)&&(0,H.jsx)(`p`,{className:`text-sm`,children:[e.jobTitle,e.organization].filter(Boolean).join(` · `)}),(0,H.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:e?.email}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2 mt-2`,children:[(0,H.jsx)(zC,{className:`capitalize`,children:e?.role}),e?.country&&(0,H.jsx)(zC,{variant:`outline`,children:e.country})]})]})]}),(0,H.jsx)(gE,{children:(0,H.jsxs)(`form`,{onSubmit:k,className:`space-y-4 mt-8`,children:[(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`firstName`,children:`First name`}),(0,H.jsx)(Z,{id:`firstName`,value:h,onChange:e=>g(e.target.value)})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`lastName`,children:`Last name`}),(0,H.jsx)(Z,{id:`lastName`,value:_,onChange:e=>y(e.target.value)})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`jobTitle`,children:`Job title`}),(0,H.jsx)(Z,{id:`jobTitle`,value:b,onChange:e=>x(e.target.value)})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`organization`,children:`Organization`}),(0,H.jsx)(Z,{id:`organization`,value:S,onChange:e=>C(e.target.value)})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`country`,children:`Country`}),(0,H.jsx)(Z,{id:`country`,value:w,onChange:e=>T(e.target.value)})]})]}),r&&(0,H.jsx)(`p`,{className:`text-destructive text-sm`,children:r}),(0,H.jsx)(q,{type:`submit`,disabled:n,children:n?`Saving…`:`Save changes`})]})})]})]})})}function vE({className:e,...t}){return(0,H.jsx)(PC,{"data-slot":`tabs`,className:K(`flex flex-col gap-2`,e),...t})}function yE({className:e,...t}){return(0,H.jsx)(FC,{"data-slot":`tabs-list`,className:K(`inline-flex h-9 items-center justify-start rounded-lg bg-muted p-1 text-muted-foreground w-full`,e),...t})}function bE({className:e,...t}){return(0,H.jsx)(IC,{"data-slot":`tabs-trigger`,className:K(`inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow`,e),...t})}function xE({className:e,...t}){return(0,H.jsx)(LC,{"data-slot":`tabs-content`,className:K(`flex-1 outline-none`,e),...t})}var SE=Object.defineProperty,CE=Object.getOwnPropertySymbols,wE=Object.prototype.hasOwnProperty,TE=Object.prototype.propertyIsEnumerable,EE=(e,t,n)=>t in e?SE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,DE=(e,t)=>{for(var n in t||={})wE.call(t,n)&&EE(e,n,t[n]);if(CE)for(var n of CE(t))TE.call(t,n)&&EE(e,n,t[n]);return e},OE=(e,t)=>{var n={};for(var r in e)wE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&CE)for(var r of CE(e))t.indexOf(r)<0&&TE.call(e,r)&&(n[r]=e[r]);return n},kE;(e=>{let t=class t{constructor(e,n,r,a){if(this.version=e,this.errorCorrectionLevel=n,this.modules=[],this.isFunction=[],e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version value out of range`);if(a<-1||a>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let o=[];for(let e=0;e<this.size;e++)o.push(!1);for(let e=0;e<this.size;e++)this.modules.push(o.slice()),this.isFunction.push(o.slice());this.drawFunctionPatterns();let s=this.addEccAndInterleave(r);if(this.drawCodewords(s),a==-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(a=t,e=n),this.applyMask(t)}}i(0<=a&&a<=7),this.mask=a,this.applyMask(a),this.drawFormatBits(a),this.isFunction=[]}static encodeText(n,r){let i=e.QrSegment.makeSegments(n);return t.encodeSegments(i,r)}static encodeBinary(n,r){let i=e.QrSegment.makeBytes(n);return t.encodeSegments([i],r)}static encodeSegments(e,r,a=1,s=40,c=-1,l=!0){if(!(t.MIN_VERSION<=a&&a<=s&&s<=t.MAX_VERSION)||c<-1||c>7)throw RangeError(`Invalid value`);let u,d;for(u=a;;u++){let n=t.getNumDataCodewords(u,r)*8,i=o.getTotalBits(e,u);if(i<=n){d=i;break}if(u>=s)throw RangeError(`Data too long`)}for(let e of[t.Ecc.MEDIUM,t.Ecc.QUARTILE,t.Ecc.HIGH])l&&d<=t.getNumDataCodewords(u,e)*8&&(r=e);let f=[];for(let t of e){n(t.mode.modeBits,4,f),n(t.numChars,t.mode.numCharCountBits(u),f);for(let e of t.getData())f.push(e)}i(f.length==d);let p=t.getNumDataCodewords(u,r)*8;i(f.length<=p),n(0,Math.min(4,p-f.length),f),n(0,(8-f.length%8)%8,f),i(f.length%8==0);for(let e=236;f.length<p;e^=253)n(e,8,f);let m=[];for(;m.length*8<f.length;)m.push(0);return f.forEach((e,t)=>m[t>>>3]|=e<<7-(t&7)),new t(u,r,m,c)}getModule(e,t){return 0<=e&&e<this.size&&0<=t&&t<this.size&&this.modules[t][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0),this.setFunctionModule(e,6,e%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n==0&&r==0||n==0&&r==t-1||n==t-1&&r==0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.errorCorrectionLevel.formatBits<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let a=(t<<10|n)^21522;i(a>>>15==0);for(let e=0;e<=5;e++)this.setFunctionModule(8,e,r(a,e));this.setFunctionModule(8,7,r(a,6)),this.setFunctionModule(8,8,r(a,7)),this.setFunctionModule(7,8,r(a,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,r(a,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,r(a,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,r(a,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;i(t>>>18==0);for(let e=0;e<18;e++){let n=r(t,e),i=this.size-11+e%3,a=Math.floor(e/3);this.setFunctionModule(i,a,n),this.setFunctionModule(a,i,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;0<=a&&a<this.size&&0<=o&&o<this.size&&this.setFunctionModule(a,o,i!=2&&i!=4)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!=1)}setFunctionModule(e,t,n){this.modules[t][e]=n,this.isFunction[t][e]=!0}addEccAndInterleave(e){let n=this.version,r=this.errorCorrectionLevel;if(e.length!=t.getNumDataCodewords(n,r))throw RangeError(`Invalid argument`);let a=t.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][n],o=t.ECC_CODEWORDS_PER_BLOCK[r.ordinal][n],s=Math.floor(t.getNumRawDataModules(n)/8),c=a-s%a,l=Math.floor(s/a),u=[],d=t.reedSolomonComputeDivisor(o);for(let n=0,r=0;n<a;n++){let i=e.slice(r,r+l-o+(n<c?0:1));r+=i.length;let a=t.reedSolomonComputeRemainder(i,d);n<c&&i.push(0),u.push(i.concat(a))}let f=[];for(let e=0;e<u[0].length;e++)u.forEach((t,n)=>{(e!=l-o||n>=c)&&f.push(t[e])});return i(f.length==s),f}drawCodewords(e){if(e.length!=Math.floor(t.getNumRawDataModules(this.version)/8))throw RangeError(`Invalid argument`);let n=0;for(let t=this.size-1;t>=1;t-=2){t==6&&(t=5);for(let i=0;i<this.size;i++)for(let a=0;a<2;a++){let o=t-a,s=t+1&2?i:this.size-1-i;!this.isFunction[s][o]&&n<e.length*8&&(this.modules[s][o]=r(e[n>>>3],7-(n&7)),n++)}}i(n==e.length*8)}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.isFunction[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[n][o]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[n][o],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[o][n]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[o][n],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size-1;n++)for(let r=0;r<this.size-1;r++){let i=this.modules[n][r];i==this.modules[n][r+1]&&i==this.modules[n+1][r]&&i==this.modules[n+1][r+1]&&(e+=t.PENALTY_N2)}let n=0;for(let e of this.modules)n=e.reduce((e,t)=>e+ +!!t,n);let r=this.size*this.size,a=Math.ceil(Math.abs(n*20-r*10)/r)-1;return i(0<=a&&a<=9),e+=a*t.PENALTY_N4,i(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(this.version==1)return[];{let e=Math.floor(this.version/7)+2,t=this.version==32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}static getNumRawDataModules(e){if(e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version number out of range`);let n=(16*e+128)*e+64;if(e>=2){let t=Math.floor(e/7)+2;n-=(25*t-10)*t-55,e>=7&&(n-=36)}return i(208<=n&&n<=29648),n}static getNumDataCodewords(e,n){return Math.floor(t.getNumRawDataModules(e)/8)-t.ECC_CODEWORDS_PER_BLOCK[n.ordinal][e]*t.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let n=[];for(let t=0;t<e-1;t++)n.push(0);n.push(1);let r=1;for(let i=0;i<e;i++){for(let e=0;e<n.length;e++)n[e]=t.reedSolomonMultiply(n[e],r),e+1<n.length&&(n[e]^=n[e+1]);r=t.reedSolomonMultiply(r,2)}return n}static reedSolomonComputeRemainder(e,n){let r=n.map(e=>0);for(let i of e){let e=i^r.shift();r.push(0),n.forEach((n,i)=>r[i]^=t.reedSolomonMultiply(n,e))}return r}static reedSolomonMultiply(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return i(n>>>8==0),n}finderPenaltyCountPatterns(e){let t=e[1];i(t<=this.size*3);let n=t>0&&e[2]==t&&e[3]==t*3&&e[4]==t&&e[5]==t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]==0&&(e+=this.size),t.pop(),t.unshift(e)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function r(e,t){return(e>>>t&1)!=0}function i(e){if(!e)throw Error(`Assertion error`)}let a=class e{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}static makeBytes(t){let r=[];for(let e of t)n(e,8,r);return new e(e.Mode.BYTE,t.length,r)}static makeNumeric(t){if(!e.isNumeric(t))throw RangeError(`String contains non-numeric characters`);let r=[];for(let e=0;e<t.length;){let i=Math.min(t.length-e,3);n(parseInt(t.substring(e,e+i),10),i*3+1,r),e+=i}return new e(e.Mode.NUMERIC,t.length,r)}static makeAlphanumeric(t){if(!e.isAlphanumeric(t))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let r=[],i;for(i=0;i+2<=t.length;i+=2){let a=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i))*45;a+=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i+1)),n(a,11,r)}return i<t.length&&n(e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i)),6,r),new e(e.Mode.ALPHANUMERIC,t.length,r)}static makeSegments(t){return t==``?[]:e.isNumeric(t)?[e.makeNumeric(t)]:e.isAlphanumeric(t)?[e.makeAlphanumeric(t)]:[e.makeBytes(e.toUtf8ByteArray(t))]}static makeEci(t){let r=[];if(t<0)throw RangeError(`ECI assignment value out of range`);if(t<128)n(t,8,r);else if(t<16384)n(2,2,r),n(t,14,r);else if(t<1e6)n(6,3,r),n(t,21,r);else throw RangeError(`ECI assignment value out of range`);return new e(e.Mode.ECI,0,r)}static isNumeric(t){return e.NUMERIC_REGEX.test(t)}static isAlphanumeric(t){return e.ALPHANUMERIC_REGEX.test(t)}getData(){return this.bitData.slice()}static getTotalBits(e,t){let n=0;for(let r of e){let e=r.mode.numCharCountBits(t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}static toUtf8ByteArray(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)==`%`?(t.push(parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}};a.NUMERIC_REGEX=/^[0-9]*$/,a.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,a.ALPHANUMERIC_CHARSET=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`;let o=a;e.QrSegment=a})(kE||={}),(e=>{(e=>{let t=class{constructor(e,t){this.ordinal=e,this.formatBits=t}};t.LOW=new t(0,1),t.MEDIUM=new t(1,0),t.QUARTILE=new t(2,3),t.HIGH=new t(3,2),e.Ecc=t})(e.QrCode||={})})(kE||={}),(e=>{(e=>{let t=class{constructor(e,t){this.modeBits=e,this.numBitsCharCount=t}numCharCountBits(e){return this.numBitsCharCount[Math.floor((e+7)/17)]}};t.NUMERIC=new t(1,[10,12,14]),t.ALPHANUMERIC=new t(2,[9,11,13]),t.BYTE=new t(4,[8,16,16]),t.KANJI=new t(8,[8,10,12]),t.ECI=new t(7,[0,0,0]),e.Mode=t})(e.QrSegment||={})})(kE||={});var AE=kE,jE={L:AE.QrCode.Ecc.LOW,M:AE.QrCode.Ecc.MEDIUM,Q:AE.QrCode.Ecc.QUARTILE,H:AE.QrCode.Ecc.HIGH},ME=128,NE=`L`,PE=`#FFFFFF`,FE=`#000000`,IE=!1,LE=1,RE=4,zE=0,BE=.1;function VE(e,t=0){let n=[];return e.forEach(function(e,r){let i=null;e.forEach(function(a,o){if(!a&&i!==null){n.push(`M${i+t} ${r+t}h${o-i}v1H${i+t}z`),i=null;return}if(o===e.length-1){if(!a)return;i===null?n.push(`M${o+t},${r+t} h1v1H${o+t}z`):n.push(`M${i+t},${r+t} h${o+1-i}v1H${i+t}z`);return}a&&i===null&&(i=o)})}),n.join(``)}function HE(e,t){return e.slice().map((e,n)=>n<t.y||n>=t.y+t.h?e:e.map((e,n)=>n<t.x||n>=t.x+t.w?e:!1))}function UE(e,t,n,r){if(r==null)return null;let i=e.length+n*2,a=Math.floor(t*BE),o=i/t,s=(r.width||a)*o,c=(r.height||a)*o,l=r.x==null?e.length/2-s/2:r.x*o,u=r.y==null?e.length/2-c/2:r.y*o,d=r.opacity==null?1:r.opacity,f=null;if(r.excavate){let e=Math.floor(l),t=Math.floor(u);f={x:e,y:t,w:Math.ceil(s+l-e),h:Math.ceil(c+u-t)}}let p=r.crossOrigin;return{x:l,y:u,h:c,w:s,excavation:f,opacity:d,crossOrigin:p}}function WE(e,t){return t==null?e?RE:zE:Math.max(Math.floor(t),0)}function GE({value:e,level:t,minVersion:n,includeMargin:r,marginSize:i,imageSettings:a,size:o,boostLevel:s}){let c=v.useMemo(()=>{let r=(Array.isArray(e)?e:[e]).reduce((e,t)=>(e.push(...AE.QrSegment.makeSegments(t)),e),[]);return AE.QrCode.encodeSegments(r,jE[t],n,void 0,void 0,s)},[e,t,n,s]),{cells:l,margin:u,numCells:d,calculatedImageSettings:f}=v.useMemo(()=>{let e=c.getModules(),t=WE(r,i);return{cells:e,margin:t,numCells:e.length+t*2,calculatedImageSettings:UE(e,o,t,a)}},[c,o,a,r,i]);return{qrcode:c,margin:u,cells:l,numCells:d,calculatedImageSettings:f}}var KE=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),qE=v.forwardRef(function(e,t){let n=e,{value:r,size:i=ME,level:a=NE,bgColor:o=PE,fgColor:s=FE,includeMargin:c=IE,minVersion:l=LE,boostLevel:u,marginSize:d,imageSettings:f}=n,p=OE(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`marginSize`,`imageSettings`]),{style:m}=p,h=OE(p,[`style`]),g=f?.src,_=v.useRef(null),y=v.useRef(null),b=v.useCallback(e=>{_.current=e,typeof t==`function`?t(e):t&&(t.current=e)},[t]),[x,S]=v.useState(!1),{margin:C,cells:w,numCells:T,calculatedImageSettings:E}=GE({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:d,imageSettings:f,size:i});v.useEffect(()=>{if(_.current!=null){let e=_.current,t=e.getContext(`2d`);if(!t)return;let n=w,r=y.current,a=E!=null&&r!==null&&r.complete&&r.naturalHeight!==0&&r.naturalWidth!==0;a&&E.excavation!=null&&(n=HE(w,E.excavation));let c=window.devicePixelRatio||1;e.height=e.width=i*c;let l=i/T*c;t.scale(l,l),t.fillStyle=o,t.fillRect(0,0,T,T),t.fillStyle=s,KE?t.fill(new Path2D(VE(n,C))):w.forEach(function(e,n){e.forEach(function(e,r){e&&t.fillRect(r+C,n+C,1,1)})}),E&&(t.globalAlpha=E.opacity),a&&t.drawImage(r,E.x+C,E.y+C,E.w,E.h)}}),v.useEffect(()=>{S(!1)},[g]);let D=DE({height:i,width:i},m),O=null;return g!=null&&(O=v.createElement(`img`,{src:g,key:g,style:{display:`none`},onLoad:()=>{S(!0)},ref:y,crossOrigin:E?.crossOrigin})),v.createElement(v.Fragment,null,v.createElement(`canvas`,DE({style:D,height:i,width:i,ref:b,role:`img`},h)),O)});qE.displayName=`QRCodeCanvas`;var JE=v.forwardRef(function(e,t){let n=e,{value:r,size:i=ME,level:a=NE,bgColor:o=PE,fgColor:s=FE,includeMargin:c=IE,minVersion:l=LE,boostLevel:u,title:d,marginSize:f,imageSettings:p}=n,m=OE(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`title`,`marginSize`,`imageSettings`]),{margin:h,cells:g,numCells:_,calculatedImageSettings:y}=GE({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:f,imageSettings:p,size:i}),b=g,x=null;p!=null&&y!=null&&(y.excavation!=null&&(b=HE(g,y.excavation)),x=v.createElement(`image`,{href:p.src,height:y.h,width:y.w,x:y.x+h,y:y.y+h,preserveAspectRatio:`none`,opacity:y.opacity,crossOrigin:y.crossOrigin}));let S=VE(b,h);return v.createElement(`svg`,DE({height:i,width:i,viewBox:`0 0 ${_} ${_}`,ref:t,role:`img`},m),!!d&&v.createElement(`title`,null,d),v.createElement(`path`,{fill:o,d:`M0,0 h${_}v${_}H0z`,shapeRendering:`crispEdges`}),v.createElement(`path`,{fill:s,d:S,shapeRendering:`crispEdges`}),x)});JE.displayName=`QRCodeSVG`;function YE(){let{user:e,updateUser:t,logout:n}=_a(),{loading:r,error:i,request:a}=Zw(),{loading:o,error:s,request:c}=Zw(),{loading:l,request:u}=Zw(),{data:d}=ps(`/cms/auth/features`),[f,p]=(0,v.useState)(``),[m,h]=(0,v.useState)(``),[g,_]=(0,v.useState)(``),[y,b]=(0,v.useState)(``),[x,S]=(0,v.useState)(null),[C,w]=(0,v.useState)(!1),[T,E]=(0,v.useState)(null),[D,O]=(0,v.useState)(``),[k,A]=(0,v.useState)(``),[j,M]=(0,v.useState)(!1),[N,P]=(0,v.useState)([]),[F,I]=(0,v.useState)(!1);(0,v.useEffect)(()=>{typeof e?.twoFactorEnabled==`boolean`&&w(e.twoFactorEnabled)},[e?.twoFactorEnabled]);function L(){p(``),h(``),_(``),b(``),S(null),E(null),O(``)}function R(){E(null),O(``),A(``),M(!1),I(!1)}async function ee(e){if(e.preventDefault(),S(null),g!==y){S(`New passwords do not match`);return}try{await a(`/cms/admin/users/me/password`,`PATCH`,{currentPassword:m,newPassword:g}),L(),X.success(`Password updated`)}catch{X.error(`Could not update password`)}}async function te(){E(await c(`/cms/admin/users/me/2fa/setup`,`POST`))}async function ne(){try{let e=await c(`/cms/admin/users/me/2fa/verify`,`POST`,{code:D});w(!0),t({twoFactorEnabled:!0}),E(null),O(``),M(!0),P(e.backupCodes??[]),X.success(`Two-factor authentication enabled`)}catch{X.error(`Could not enable 2FA`)}}async function z(){try{await c(`/cms/admin/users/me/2fa/disable`,`POST`,{code:D,password:k}),w(!1),t({twoFactorEnabled:!1}),O(``),A(``),P([]),I(!1),X.success(`Two-factor authentication disabled`)}catch{X.error(`Could not disable 2FA`)}}async function B(){if(e?.email)try{await u(`/cms/auth/password-reset`,`POST`,{email:e.email}),X.success(`Password reset link sent`)}catch{X.error(`Could not request password reset`)}}return(0,H.jsxs)($_,{children:[(0,H.jsxs)(ev,{children:[(0,H.jsx)(tv,{className:`uppercase`,children:`Security`}),(0,H.jsx)(nv,{})]}),(0,H.jsx)(rv,{className:`space-y-6`,children:(0,H.jsxs)(vE,{value:f,children:[(0,H.jsxs)(yE,{children:[(0,H.jsx)(bE,{value:`password`,onClick:()=>p(e=>e===`password`?``:`password`),children:`Password`}),(0,H.jsx)(bE,{value:`two-factor`,onClick:()=>p(e=>e===`two-factor`?``:`two-factor`),children:`2FA`})]}),(0,H.jsx)(xE,{value:`password`,className:`mt-4`,children:(0,H.jsxs)(`div`,{className:`space-y-4 rounded-md border border-border p-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Update your account password.`}),(0,H.jsx)(q,{variant:`ghost`,size:`icon`,onClick:L,children:(0,H.jsx)(cs,{className:`size-4`})})]}),(0,H.jsxs)(`form`,{onSubmit:ee,className:`space-y-4`,children:[(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`current`,children:`Current password`}),(0,H.jsx)(Z,{id:`current`,type:`password`,value:m,onChange:e=>h(e.target.value),required:!0})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`new`,children:`New password`}),(0,H.jsx)(Z,{id:`new`,type:`password`,value:g,onChange:e=>_(e.target.value),required:!0,minLength:8})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`confirm`,children:`Confirm new password`}),(0,H.jsx)(Z,{id:`confirm`,type:`password`,value:y,onChange:e=>b(e.target.value),required:!0})]}),(x??i)&&(0,H.jsx)(`p`,{className:`text-destructive text-sm`,children:x??i}),(0,H.jsx)(q,{type:`submit`,disabled:r,children:r?`Saving…`:`Update password`})]}),d?.passwordRecovery&&(0,H.jsx)(`div`,{className:`border-t pt-4`,children:(0,H.jsx)(q,{type:`button`,variant:`outline`,onClick:B,disabled:l,children:l?`Sending…`:`Send password reset link`})})]})}),(0,H.jsx)(xE,{value:`two-factor`,className:`mt-4`,children:(0,H.jsxs)(`div`,{className:`space-y-4`,children:[!C&&!T&&(0,H.jsx)(q,{variant:`secondary`,onClick:te,disabled:o,children:`Enable 2FA`}),T&&!C&&(0,H.jsxs)(`div`,{className:`space-y-3 rounded-md border border-border p-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Scan this QR code with your authenticator app and enter the 6-digit code.`}),(0,H.jsx)(q,{variant:`ghost`,size:`icon`,onClick:R,children:(0,H.jsx)(cs,{className:`size-4`})})]}),(0,H.jsx)(`div`,{className:`inline-flex rounded-md bg-white p-2`,children:(0,H.jsx)(JE,{value:T.otpauthUri,size:176})}),(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Manual code: `,T.secret]}),(0,H.jsx)(yT,{maxLength:6,value:D,onChange:O,containerClassName:`w-fit`,className:`w-fit`,children:(0,H.jsxs)(bT,{className:`w-fit`,children:[(0,H.jsx)(xT,{index:0}),(0,H.jsx)(xT,{index:1}),(0,H.jsx)(xT,{index:2}),(0,H.jsx)(xT,{index:3}),(0,H.jsx)(xT,{index:4}),(0,H.jsx)(xT,{index:5})]})}),(0,H.jsx)(q,{onClick:ne,disabled:o||D.length!==6,children:`Confirm and enable 2FA`}),s&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:s})]}),C&&(0,H.jsxs)(`div`,{className:`space-y-3 rounded-md border border-border p-4`,children:[j&&(0,H.jsxs)(`div`,{className:`space-y-3 rounded-md border border-emerald-500/40 bg-emerald-500/10 p-3`,children:[(0,H.jsx)(`p`,{className:`text-sm font-medium text-emerald-300`,children:`2FA is now enabled.`}),(0,H.jsx)(`p`,{className:`text-xs text-emerald-200/90`,children:`For security, re-login is recommended now. This prevents accidental changes and confirms your new security state.`}),(0,H.jsx)(q,{variant:`default`,onClick:()=>{n()},children:`Re-login now`}),N.length>0&&(0,H.jsxs)(`div`,{className:`space-y-2 rounded-md border border-emerald-400/30 bg-background/40 p-3`,children:[(0,H.jsx)(`p`,{className:`text-xs font-medium text-emerald-200`,children:`Save these backup codes now. Each code can be used once if you lose access to your authenticator.`}),(0,H.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:N.map(e=>(0,H.jsx)(`code`,{className:`rounded bg-black/20 px-2 py-1 text-xs text-emerald-100`,children:e},e))}),(0,H.jsx)(q,{variant:`outline`,onClick:async()=>{try{await navigator.clipboard.writeText(N.join(`
76
+ `)),I(!0),setTimeout(()=>I(!1),2e3)}catch{I(!1)}},children:F?`Copied`:`Copy backup codes`})]})]}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Enter a verification code from your authenticator app to disable 2FA.`}),(0,H.jsx)(q,{variant:`ghost`,size:`icon`,onClick:()=>{O(``),A(``)},children:(0,H.jsx)(cs,{className:`size-4`})})]}),(0,H.jsx)(yT,{maxLength:6,value:D,onChange:O,containerClassName:`w-fit`,className:`w-fit`,children:(0,H.jsxs)(bT,{className:`w-fit`,children:[(0,H.jsx)(xT,{index:0}),(0,H.jsx)(xT,{index:1}),(0,H.jsx)(xT,{index:2}),(0,H.jsx)(xT,{index:3}),(0,H.jsx)(xT,{index:4}),(0,H.jsx)(xT,{index:5})]})}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`disable-2fa-password`,children:`Current password`}),(0,H.jsx)(Z,{id:`disable-2fa-password`,type:`password`,value:k,onChange:e=>A(e.target.value),required:!0})]}),(0,H.jsx)(q,{variant:`destructive`,onClick:z,disabled:j||o||D.length!==6||!k,children:`Disable 2FA`}),s&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:s})]})]})})]})})]})}function XE(){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(fs,{children:(0,H.jsx)(`h1`,{className:`text-2xl font-bold -mt-2`,children:`Profile`})}),(0,H.jsx)(`section`,{className:`mt-18`,children:(0,H.jsx)(`div`,{className:`grid grid-cols-2 gap-4 items-start`,children:(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsx)(_E,{}),(0,H.jsx)(YE,{})]})})})]})}function ZE({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`empty`,className:K(`flex min-w-0 flex-1 flex-col items-center justify-center gap-6 rounded-lg border-dashed p-6 text-center text-balance md:p-12`,e),...t})}function QE({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`empty-header`,className:K(`flex max-w-sm flex-col items-center gap-2 text-center`,e),...t})}var $E=Ms(`mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0`,{variants:{variant:{default:`bg-transparent`,icon:`flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-6`}},defaultVariants:{variant:`default`}});function eD({className:e,variant:t=`default`,...n}){return(0,H.jsx)(`div`,{"data-slot":`empty-icon`,"data-variant":t,className:K($E({variant:t,className:e})),...n})}function tD({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`empty-title`,className:K(`text-lg font-medium tracking-tight`,e),...t})}function nD({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`empty-description`,className:K(`text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,e),...t})}function rD({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`empty-content`,className:K(`flex w-full max-w-sm min-w-0 flex-col items-center gap-4 text-sm text-balance`,e),...t})}var iD=`plank:addons-registry-updated`,aD=new Map;function oD(e){return e.installed&&e.enabled&&e.compatible&&e.hasAdminUi}function sD(){window.dispatchEvent(new CustomEvent(iD))}async function cD(e){let t=window.PlankAddonAdminModules?.[e];if(t)return t;let n=aD.get(e);if(n)return n;let r=new Promise((t,n)=>{let r=document.createElement(`script`);r.src=`/cms/admin/addons/${e}/admin-entry.js`,r.async=!0,r.dataset.plankAddonId=e,r.onload=()=>{t(window.PlankAddonAdminModules?.[e]??null)},r.onerror=()=>{r.remove(),aD.delete(e),n(Error(`Could not load admin runtime for ${e}`))},document.head.appendChild(r)});return aD.set(e,r),r}function lD(){let{addonId:e=``}=gr(),{data:t,loading:n}=ps(`/cms/admin/addons/registry`),{data:r,loading:i}=ps(e?`/cms/admin/addons/${e}/admin-module`:null),{data:a,loading:o,refetch:s}=ps(e?`/cms/admin/addons/${e}/settings`:null),{data:c,loading:l}=ps(`/cms/admin/content-types`),{request:u}=Zw(),[d,f]=(0,v.useState)(null),[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(null),_=t?.addons.find(t=>t.id===e)??null,y=(t?.slots.addonsSections??[]).filter(t=>t.addonId===e),b=(t?.slots.dashboardWidgets??[]).filter(t=>t.addonId===e);(0,v.useEffect)(()=>{if(!_||!oD(_)){f(null),g(null),m(!1);return}let e=!0;return m(!0),g(null),cD(_.id).then(t=>{e&&(f(t),t||g(`This add-on did not register an admin runtime.`))}).catch(t=>{e&&(f(null),g(t instanceof Error?t.message:`Could not load add-on admin runtime`))}).finally(()=>{e&&m(!1)}),()=>{e=!1}},[_]);let x=(0,v.useCallback)(async t=>{try{let n=await u(`/cms/admin/addons/${e}/settings`,`PUT`,t);return s(),X.success(`Add-on settings saved`),n}catch(e){throw X.error(e instanceof Error?e.message:`Could not save add-on settings`),e}},[e,s,u]),S=(0,v.useCallback)(async(t,n)=>(await u(`/cms/admin/addons/${e}/actions`,`POST`,{action:t,input:n})).result,[e,u]);if(n)return(0,H.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,H.jsx)(BC,{className:`size-8`})});if(!_)return(0,H.jsx)(`section`,{className:`mt-24`,children:(0,H.jsx)(ZE,{className:`border`,children:(0,H.jsxs)(QE,{children:[(0,H.jsx)(eD,{variant:`icon`,children:(0,H.jsx)(Ro,{})}),(0,H.jsx)(tD,{children:`Add-on not found`}),(0,H.jsx)(nD,{children:`This add-on is not present in the current registry.`})]})})});let C=!!d?.DashboardPage,w=!!d?.AdminPage,T=C?`dashboard`:w?`admin`:`details`;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(fs,{children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold -mt-2`,children:_.name}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:_.packageName})]}),(0,H.jsxs)(`section`,{className:`mt-24 space-y-6`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(zC,{variant:_.enabled?`secondary`:`outline`,children:_.enabled?`Enabled`:`Disabled`}),(0,H.jsx)(zC,{variant:_.compatible?`secondary`:`destructive`,children:_.compatible?`Compatible`:`Incompatible`})]}),(0,H.jsxs)(vE,{defaultValue:T,children:[(0,H.jsxs)(yE,{className:`mb-6`,children:[C&&(0,H.jsx)(bE,{value:`dashboard`,children:`Dashboard`}),w&&(0,H.jsx)(bE,{value:`admin`,children:`Admin`}),(0,H.jsx)(bE,{value:`details`,children:`Details`})]}),C&&(0,H.jsx)(xE,{value:`dashboard`,className:`space-y-4`,children:oD(_)?i||o||l||p?(0,H.jsx)(`div`,{className:`flex h-40 items-center justify-center rounded-lg border bg-background`,children:(0,H.jsx)(BC,{className:`size-6`})}):r&&a&&d?.DashboardPage?(0,H.jsx)(d.DashboardPage,{addon:_,definition:r,settings:a,contentTypes:c??[],runAction:S,saveSettings:x}):(0,H.jsx)(ZE,{className:`border`,children:(0,H.jsxs)(QE,{children:[(0,H.jsx)(eD,{variant:`icon`,children:(0,H.jsx)(Wo,{})}),(0,H.jsx)(tD,{children:`Dashboard runtime unavailable`}),(0,H.jsx)(nD,{children:h??`This add-on does not expose a mountable dashboard runtime yet.`})]})}):(0,H.jsx)(ZE,{className:`border`,children:(0,H.jsxs)(QE,{children:[(0,H.jsx)(eD,{variant:`icon`,children:(0,H.jsx)(Wo,{})}),(0,H.jsx)(tD,{children:`Dashboard unavailable`}),(0,H.jsx)(nD,{children:`Enable the add-on and make sure it exposes an admin entry before mounting its dashboard surface.`})]})})}),w&&(0,H.jsx)(xE,{value:`admin`,className:`space-y-4`,children:oD(_)?i||o||l||p?(0,H.jsx)(`div`,{className:`flex h-40 items-center justify-center rounded-lg border bg-background`,children:(0,H.jsx)(BC,{className:`size-6`})}):r&&a&&d?.AdminPage?(0,H.jsx)(d.AdminPage,{addon:_,definition:r,settings:a,contentTypes:c??[],runAction:S,saveSettings:x}):(0,H.jsx)(ZE,{className:`border`,children:(0,H.jsxs)(QE,{children:[(0,H.jsx)(eD,{variant:`icon`,children:(0,H.jsx)(Wo,{})}),(0,H.jsx)(tD,{children:`Admin runtime unavailable`}),(0,H.jsx)(nD,{children:h??`This add-on does not expose a mountable admin runtime yet.`})]})}):(0,H.jsx)(ZE,{className:`border`,children:(0,H.jsxs)(QE,{children:[(0,H.jsx)(eD,{variant:`icon`,children:(0,H.jsx)(Wo,{})}),(0,H.jsx)(tD,{children:`Admin view unavailable`}),(0,H.jsx)(nD,{children:`Enable the add-on and make sure it exposes an admin entry before mounting its admin surface.`})]})})}),(0,H.jsx)(xE,{value:`details`,children:(0,H.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,H.jsxs)($_,{className:`bg-background`,children:[(0,H.jsx)(ev,{children:(0,H.jsx)(tv,{children:r?.title??`Metadata`})}),(0,H.jsxs)(rv,{className:`space-y-3 text-sm`,children:[r?.description&&(0,H.jsx)(`p`,{className:`text-muted-foreground`,children:r.description}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`text-muted-foreground`,children:`Version`}),(0,H.jsx)(`div`,{className:`font-medium`,children:_.version||`Unknown version`})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`text-muted-foreground`,children:`Settings Namespace`}),(0,H.jsx)(`div`,{className:`font-medium`,children:_.settingsNamespace??`None`})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`text-muted-foreground`,children:`State`}),(0,H.jsxs)(`div`,{className:`font-medium`,children:[_.installed?`Installed`:`Missing`,` · `,_.enabled?`Enabled`:`Disabled`]})]})]})]}),(0,H.jsxs)($_,{className:`bg-background`,children:[(0,H.jsx)(ev,{children:(0,H.jsx)(tv,{children:`Slot Registration`})}),(0,H.jsxs)(rv,{className:`space-y-2`,children:[y.length>0?y.map(e=>(0,H.jsxs)(`div`,{className:`rounded-md border bg-background px-3 py-2 text-sm`,children:[(0,H.jsx)(`div`,{className:`font-medium`,children:`Section`}),(0,H.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.slotId})]},e.slotId)):(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No section slots registered.`}),b.length>0?b.map(e=>(0,H.jsxs)(`div`,{className:`rounded-md border bg-background px-3 py-2 text-sm`,children:[(0,H.jsx)(`div`,{className:`font-medium`,children:`Widget`}),(0,H.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.slotId})]},e.slotId)):(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No widget slots registered.`})]})]})]})})]},T)]})]})}function uD({className:e,...t}){return(0,H.jsx)(_C,{"data-slot":`switch`,className:K(`peer inline-flex h-5 w-9 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:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input`,e),...t,children:(0,H.jsx)(vC,{className:K(`pointer-events-none block size-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0`)})})}function dD({children:e,variant:t}){return(0,H.jsx)(zC,{variant:t,children:e})}function fD(){let{data:e,loading:t,error:n,refetch:r}=ps(`/cms/admin/addons/registry`),{request:i,loading:a}=Zw(),[o,s]=(0,v.useState)(null),c=e?.addons??[],l=(0,v.useMemo)(()=>({total:c.length,enabled:c.filter(e=>e.enabled).length,compatible:c.filter(e=>e.compatible).length,visibleAdmin:c.filter(oD).length}),[c]);async function u(e,t){s(e);try{await i(`/cms/admin/addons/${e}/${t?`disable`:`enable`}`,`POST`),r(),sD(),X.success(t?`Add-on disabled`:`Add-on enabled`)}catch(e){X.error(e instanceof Error?e.message:`Could not update add-on`)}finally{s(null)}}async function d(e){s(e);try{await i(`/cms/admin/addons/${e}`,`DELETE`),r(),sD(),X.success(`Add-on registry entry removed`)}catch(e){X.error(e instanceof Error?e.message:`Could not remove add-on registry entry`)}finally{s(null)}}return t?(0,H.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,H.jsx)(BC,{className:`size-8`})}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(fs,{children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold -mt-2`,children:`Add-ons`}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Registry, activation state and admin surface for official extensions.`})]}),(0,H.jsxs)(`section`,{className:`mt-24 space-y-6`,children:[(0,H.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-4`,children:[(0,H.jsxs)($_,{className:`bg-background`,children:[(0,H.jsxs)(ev,{children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,H.jsx)(tv,{className:`text-base font-bold uppercase`,children:`Detected`}),(0,H.jsx)(Ro,{className:`size-4 text-muted-foreground`})]}),(0,H.jsx)(`div`,{className:`text-3xl font-bold`,children:l.total})]}),(0,H.jsx)(rv,{children:(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Official add-ons detected by the host`})})]}),(0,H.jsxs)($_,{className:`bg-background`,children:[(0,H.jsxs)(ev,{children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,H.jsx)(tv,{className:`text-base font-bold uppercase`,children:`Enabled`}),(0,H.jsx)(Po,{className:`size-4 text-muted-foreground`})]}),(0,H.jsx)(`div`,{className:`text-3xl font-bold`,children:l.enabled})]}),(0,H.jsx)(rv,{children:(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Add-ons currently active in this instance`})})]}),(0,H.jsxs)($_,{className:`bg-background`,children:[(0,H.jsxs)(ev,{children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,H.jsx)(tv,{className:`text-base font-bold uppercase`,children:`Compatible`}),(0,H.jsx)(Ia,{className:`size-4 text-muted-foreground`})]}),(0,H.jsx)(`div`,{className:`text-3xl font-bold`,children:l.compatible})]}),(0,H.jsx)(rv,{children:(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Packages matching the current Plank version`})})]}),(0,H.jsxs)($_,{className:`bg-background`,children:[(0,H.jsxs)(ev,{children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,H.jsx)(tv,{className:`text-base font-bold uppercase`,children:`Admin UI`}),(0,H.jsx)(Wo,{className:`size-4 text-muted-foreground`})]}),(0,H.jsx)(`div`,{className:`text-3xl font-bold`,children:l.visibleAdmin})]}),(0,H.jsx)(rv,{children:(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Add-ons exposing admin surfaces`})})]})]}),c.length===0?(0,H.jsx)(ZE,{className:`border`,children:(0,H.jsxs)(QE,{children:[(0,H.jsx)(eD,{variant:`icon`,children:(0,H.jsx)(Ro,{})}),(0,H.jsx)(tD,{children:`No add-ons detected`}),(0,H.jsx)(nD,{children:"Install an official `@plank-cms/addon-*` package in the host project and restart the server to populate this registry."})]})}):(0,H.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-border bg-background`,children:(0,H.jsxs)(VC,{className:`w-full text-sm`,children:[(0,H.jsxs)(HC,{className:`border-b border-border font-bold uppercase`,children:[(0,H.jsx)(WC,{className:`hover:bg-transparent`,children:(0,H.jsx)(GC,{colSpan:5,className:`h-auto px-4 py-3`,children:(0,H.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:`Registry`})})}),(0,H.jsxs)(WC,{className:`border-t border-border hover:bg-transparent`,children:[(0,H.jsx)(GC,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:`Add-on`}),(0,H.jsx)(GC,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:`Package`}),(0,H.jsx)(GC,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:`Status`}),(0,H.jsx)(GC,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:`Settings`}),(0,H.jsx)(GC,{className:`w-28 px-4 py-3 text-right font-medium text-muted-foreground`,children:`Enabled`})]})]}),(0,H.jsx)(UC,{children:c.map(e=>{let t=a&&o===e.id,n=e.installed&&e.compatible,r=!e.installed||!e.compatible;return(0,H.jsxs)(WC,{children:[(0,H.jsx)(KC,{children:(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsx)(`div`,{className:`font-medium`,children:e.name}),(0,H.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.version||`Unknown version`}),e.description&&(0,H.jsx)(`p`,{className:`max-w-md text-xs text-muted-foreground`,children:e.description})]})}),(0,H.jsx)(KC,{className:`font-mono text-xs`,children:e.packageName}),(0,H.jsx)(KC,{children:(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(dD,{variant:e.installed?`secondary`:`outline`,children:e.installed?`Installed`:`Missing`}),(0,H.jsx)(dD,{variant:e.compatible?`secondary`:`destructive`,children:e.compatible?`Compatible`:`Incompatible`})]})}),(0,H.jsx)(KC,{children:e.settingsNamespace?(0,H.jsx)(zC,{variant:`outline`,children:e.settingsNamespace}):(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`None`})}),(0,H.jsx)(KC,{className:`text-right`,children:(0,H.jsxs)(`div`,{className:`inline-flex items-center gap-3`,children:[t&&(0,H.jsx)(BC,{className:`size-4`}),r?(0,H.jsxs)(q,{size:`sm`,variant:`outline`,className:`gap-2 text-destructive hover:text-destructive`,disabled:t,onClick:()=>d(e.id),children:[(0,H.jsx)(Qo,{className:`size-3.5`}),`Remove`]}):(0,H.jsx)(uD,{checked:e.enabled,disabled:!n||t,onCheckedChange:()=>u(e.id,e.enabled)})]})})]},e.id)})})]})}),n&&(0,H.jsxs)(`p`,{className:`text-sm text-destructive`,children:[`Could not load add-ons registry: `,n]})]})]})}function pD(){let e=fr(),{data:t,loading:n}=ps(`/cms/admin/content-types`);return(0,v.useEffect)(()=>{!t||t.length===0||e(`/content/${(t.find(e=>e.isDefault)??t[0]).slug}`,{replace:!0})},[t,e]),n||t&&t.length>0?null:(0,H.jsxs)(ZE,{className:`border`,children:[(0,H.jsxs)(QE,{children:[(0,H.jsx)(eD,{variant:`icon`,children:(0,H.jsx)(So,{})}),(0,H.jsx)(tD,{children:`No content types yet`}),(0,H.jsx)(nD,{children:`Create a content type in the Builder before managing content.`})]}),(0,H.jsx)(rD,{children:(0,H.jsx)(q,{onClick:()=>e(`/content-types/new`),children:`Go to Builder`})})]})}function mD(e,t){let n=t.toLowerCase().split(`+`),r=n.includes(`mod`),i=n.includes(`shift`),a=n[n.length-1];return(r?e.metaKey||e.ctrlKey:!e.metaKey&&!e.ctrlKey)&&i===e.shiftKey&&!e.altKey&&e.key.toLowerCase()===a}function hD(e,t,n){let r=n?.enabled??!0,{register:i}=(0,v.useContext)(va),a=(0,v.useRef)(t);(0,v.useEffect)(()=>{a.current=t}),(0,v.useEffect)(()=>{if(n?.label)return i(e,n.label)},[e,n?.label,i]),(0,v.useEffect)(()=>{function t(t){mD(t,e)&&(t.preventDefault(),r&&a.current())}return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,r])}var gD=`plank-preview`;function _D(e,t){let n=!1,r=e.replace(/\{(contentType|entryId|slug|status)\}/g,(e,r)=>{let i=t[r];return i==null||i===``?(n=!0,``):encodeURIComponent(i)});return n||/\{[^}]+\}/.test(r)?null:r}function vD(e){return{enabled:String(e?.enabled??`false`).toLowerCase()===`true`,syncUrl:e?.sync_url?.trim()??``,urlTemplate:e?.url_template?.trim()??``,slugField:e?.slug_field?.trim()||`slug`}}function yD(e){return{enabled:String(e?.preview_enabled??`false`).toLowerCase()===`true`,syncUrl:e?.preview_sync_url?.trim()??``,urlTemplate:e?.preview_url_template?.trim()??``,slugField:e?.preview_slug_field?.trim()||`slug`}}function bD(e,t){if(!e.enabled)return null;if(!e.urlTemplate)return`Set a preview URL template in Settings > Overview > Preview.`;if(e.syncUrl)try{new URL(e.syncUrl)}catch{return`Preview sync webhook URL must be an absolute URL.`}if(e.urlTemplate.includes(`{slug}`)&&!t.includes(e.slugField))return`Preview slug field "${e.slugField}" does not exist on this content type.`;let n=_D(e.urlTemplate,{contentType:`sample-content`,entryId:`sample-entry`,slug:`sample-slug`,status:`draft`});if(!n)return`Preview URL template contains unsupported or unresolved placeholders.`;try{return new URL(n),null}catch{return`Preview URL template must resolve to an absolute URL.`}}function xD(e){let{config:t,contentType:n,entry:r,status:i}=e;if(!t.enabled||!t.urlTemplate)return null;let a=r[t.slugField],o=_D(t.urlTemplate,{contentType:n,entryId:r.id?String(r.id):null,slug:typeof a==`string`&&a.trim()?a.trim():null,status:i??(typeof r.status==`string`?r.status:null)});if(!o)return null;try{return new URL(o).toString()}catch{return null}}var SD=365.2425,CD=6048e5,wD=864e5,TD=3600*24;TD*7,TD*SD/12*3;var ED=Symbol.for(`constructDateFrom`);function DD(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&ED in e?e[ED](t):e instanceof Date?new e.constructor(t):new Date(t)}function OD(e,t){return DD(t||e,e)}function kD(e,t,n){let r=OD(e,n?.in);return isNaN(t)?DD(n?.in||e,NaN):(t&&r.setDate(r.getDate()+t),r)}function AD(e,t,n){let r=OD(e,n?.in);if(isNaN(t))return DD(n?.in||e,NaN);if(!t)return r;let i=r.getDate(),a=DD(n?.in||e,r.getTime());return a.setMonth(r.getMonth()+t+1,0),i>=a.getDate()?a:(r.setFullYear(a.getFullYear(),a.getMonth(),i),r)}var jD={};function MD(){return jD}function ND(e,t){let n=MD(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=OD(e,t?.in),a=i.getDay(),o=(a<r?7:0)+a-r;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function PD(e,t){return ND(e,{...t,weekStartsOn:1})}function FD(e,t){let n=OD(e,t?.in),r=n.getFullYear(),i=DD(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);let a=PD(i),o=DD(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);let s=PD(o);return n.getTime()>=a.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function ID(e){let t=OD(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-+n}function LD(e,...t){let n=DD.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function RD(e,t){let n=OD(e,t?.in);return n.setHours(0,0,0,0),n}function zD(e,t,n){let[r,i]=LD(n?.in,e,t),a=RD(r),o=RD(i),s=+a-ID(a),c=+o-ID(o);return Math.round((s-c)/wD)}function BD(e,t){let n=FD(e,t),r=DD(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),PD(r)}function VD(e,t,n){return kD(e,t*7,n)}function HD(e,t,n){return AD(e,t*12,n)}function UD(e,t){let n,r=t?.in;return e.forEach(e=>{!r&&typeof e==`object`&&(r=DD.bind(null,e));let t=OD(e,r);(!n||n<t||isNaN(+t))&&(n=t)}),DD(r,n||NaN)}function WD(e,t){let n,r=t?.in;return e.forEach(e=>{!r&&typeof e==`object`&&(r=DD.bind(null,e));let t=OD(e,r);(!n||n>t||isNaN(+t))&&(n=t)}),DD(r,n||NaN)}function GD(e,t,n){let[r,i]=LD(n?.in,e,t);return+RD(r)==+RD(i)}function KD(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function qD(e){return!(!KD(e)&&typeof e!=`number`||isNaN(+OD(e)))}function JD(e,t,n){let[r,i]=LD(n?.in,e,t),a=r.getFullYear()-i.getFullYear(),o=r.getMonth()-i.getMonth();return a*12+o}function YD(e,t){let n=OD(e,t?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function XD(e,t){let[n,r]=LD(e,t.start,t.end);return{start:n,end:r}}function ZD(e,t){let{start:n,end:r}=XD(t?.in,e),i=+n>+r,a=i?+n:+r,o=i?r:n;o.setHours(0,0,0,0),o.setDate(1);let s=t?.step??1;if(!s)return[];s<0&&(s=-s,i=!i);let c=[];for(;+o<=a;)c.push(DD(n,o)),o.setMonth(o.getMonth()+s);return i?c.reverse():c}function QD(e,t){let n=OD(e,t?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function $D(e,t){let n=OD(e,t?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function eO(e,t){let n=OD(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function tO(e,t){let{start:n,end:r}=XD(t?.in,e),i=+n>+r,a=i?+n:+r,o=i?r:n;o.setHours(0,0,0,0),o.setMonth(0,1);let s=t?.step??1;if(!s)return[];s<0&&(s=-s,i=!i);let c=[];for(;+o<=a;)c.push(DD(n,o)),o.setFullYear(o.getFullYear()+s);return i?c.reverse():c}function nO(e,t){let n=MD(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=OD(e,t?.in),a=i.getDay(),o=(a<r?-7:0)+6-(a-r);return i.setDate(i.getDate()+o),i.setHours(23,59,59,999),i}function rO(e,t){return nO(e,{...t,weekStartsOn:1})}var iO={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`}},aO=(e,t,n)=>{let r,i=iO[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r};function oO(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var sO={date:oO({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:oO({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:oO({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},cO={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},lO=(e,t,n,r)=>cO[e];function uO(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}var dO={ordinalNumber:(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},era:uO({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:uO({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:uO({values:{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`]},defaultWidth:`wide`}),day:uO({values:{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`]},defaultWidth:`wide`}),dayPeriod:uO({values:{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`}},defaultWidth:`wide`,formattingValues:{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`}},defaultFormattingWidth:`wide`})};function fO(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?mO(s,e=>e.test(o)):pO(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}function pO(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function mO(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function hO(e){return(t,n={})=>{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}var gO={code:`en-US`,formatDistance:aO,formatLong:sO,formatRelative:lO,localize:dO,match:{ordinalNumber:hO({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:fO({matchPatterns:{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},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:fO({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:fO({matchPatterns:{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},defaultMatchWidth:`wide`,parsePatterns:{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]},defaultParseWidth:`any`}),day:fO({matchPatterns:{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},defaultMatchWidth:`wide`,parsePatterns:{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]},defaultParseWidth:`any`}),dayPeriod:fO({matchPatterns:{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},defaultMatchWidth:`any`,parsePatterns:{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}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function _O(e,t){let n=OD(e,t?.in);return zD(n,eO(n))+1}function vO(e,t){let n=OD(e,t?.in),r=PD(n)-+BD(n);return Math.round(r/CD)+1}function yO(e,t){let n=OD(e,t?.in),r=n.getFullYear(),i=MD(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=DD(t?.in||e,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);let s=ND(o,t),c=DD(t?.in||e,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);let l=ND(c,t);return+n>=+s?r+1:+n>=+l?r:r-1}function bO(e,t){let n=MD(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=yO(e,t),a=DD(t?.in||e,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),ND(a,t)}function xO(e,t){let n=OD(e,t?.in),r=ND(n,t)-+bO(n,t);return Math.round(r/CD)+1}function SO(e,t){return(e<0?`-`:``)+Math.abs(e).toString().padStart(t,`0`)}var CO={y(e,t){let n=e.getFullYear(),r=n>0?n:1-n;return SO(t===`yy`?r%100:r,t.length)},M(e,t){let n=e.getMonth();return t===`M`?String(n+1):SO(n+1,2)},d(e,t){return SO(e.getDate(),t.length)},a(e,t){let n=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.toUpperCase();case`aaa`:return n;case`aaaaa`:return n[0];default:return n===`am`?`a.m.`:`p.m.`}},h(e,t){return SO(e.getHours()%12||12,t.length)},H(e,t){return SO(e.getHours(),t.length)},m(e,t){return SO(e.getMinutes(),t.length)},s(e,t){return SO(e.getSeconds(),t.length)},S(e,t){let n=t.length,r=e.getMilliseconds();return SO(Math.trunc(r*10**(n-3)),t.length)}},wO={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},TO={G:function(e,t,n){let r=+(e.getFullYear()>0);switch(t){case`G`:case`GG`:case`GGG`:return n.era(r,{width:`abbreviated`});case`GGGGG`:return n.era(r,{width:`narrow`});default:return n.era(r,{width:`wide`})}},y:function(e,t,n){if(t===`yo`){let t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:`year`})}return CO.y(e,t)},Y:function(e,t,n,r){let i=yO(e,r),a=i>0?i:1-i;return t===`YY`?SO(a%100,2):t===`Yo`?n.ordinalNumber(a,{unit:`year`}):SO(a,t.length)},R:function(e,t){return SO(FD(e),t.length)},u:function(e,t){return SO(e.getFullYear(),t.length)},Q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`Q`:return String(r);case`QQ`:return SO(r,2);case`Qo`:return n.ordinalNumber(r,{unit:`quarter`});case`QQQ`:return n.quarter(r,{width:`abbreviated`,context:`formatting`});case`QQQQQ`:return n.quarter(r,{width:`narrow`,context:`formatting`});default:return n.quarter(r,{width:`wide`,context:`formatting`})}},q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`q`:return String(r);case`qq`:return SO(r,2);case`qo`:return n.ordinalNumber(r,{unit:`quarter`});case`qqq`:return n.quarter(r,{width:`abbreviated`,context:`standalone`});case`qqqqq`:return n.quarter(r,{width:`narrow`,context:`standalone`});default:return n.quarter(r,{width:`wide`,context:`standalone`})}},M:function(e,t,n){let r=e.getMonth();switch(t){case`M`:case`MM`:return CO.M(e,t);case`Mo`:return n.ordinalNumber(r+1,{unit:`month`});case`MMM`:return n.month(r,{width:`abbreviated`,context:`formatting`});case`MMMMM`:return n.month(r,{width:`narrow`,context:`formatting`});default:return n.month(r,{width:`wide`,context:`formatting`})}},L:function(e,t,n){let r=e.getMonth();switch(t){case`L`:return String(r+1);case`LL`:return SO(r+1,2);case`Lo`:return n.ordinalNumber(r+1,{unit:`month`});case`LLL`:return n.month(r,{width:`abbreviated`,context:`standalone`});case`LLLLL`:return n.month(r,{width:`narrow`,context:`standalone`});default:return n.month(r,{width:`wide`,context:`standalone`})}},w:function(e,t,n,r){let i=xO(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):SO(i,t.length)},I:function(e,t,n){let r=vO(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):SO(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getDate(),{unit:`date`}):CO.d(e,t)},D:function(e,t,n){let r=_O(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):SO(r,t.length)},E:function(e,t,n){let r=e.getDay();switch(t){case`E`:case`EE`:case`EEE`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`EEEEE`:return n.day(r,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},e:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`e`:return String(a);case`ee`:return SO(a,2);case`eo`:return n.ordinalNumber(a,{unit:`day`});case`eee`:return n.day(i,{width:`abbreviated`,context:`formatting`});case`eeeee`:return n.day(i,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(i,{width:`short`,context:`formatting`});default:return n.day(i,{width:`wide`,context:`formatting`})}},c:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`c`:return String(a);case`cc`:return SO(a,t.length);case`co`:return n.ordinalNumber(a,{unit:`day`});case`ccc`:return n.day(i,{width:`abbreviated`,context:`standalone`});case`ccccc`:return n.day(i,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(i,{width:`short`,context:`standalone`});default:return n.day(i,{width:`wide`,context:`standalone`})}},i:function(e,t,n){let r=e.getDay(),i=r===0?7:r;switch(t){case`i`:return String(i);case`ii`:return SO(i,t.length);case`io`:return n.ordinalNumber(i,{unit:`day`});case`iii`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`iiiii`:return n.day(r,{width:`narrow`,context:`formatting`});case`iiiiii`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},a:function(e,t,n){let r=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`});case`aaa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`aaaaa`:return n.dayPeriod(r,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(r,{width:`wide`,context:`formatting`})}},b:function(e,t,n){let r=e.getHours(),i;switch(i=r===12?wO.noon:r===0?wO.midnight:r/12>=1?`pm`:`am`,t){case`b`:case`bb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`bbb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`bbbbb`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},B:function(e,t,n){let r=e.getHours(),i;switch(i=r>=17?wO.evening:r>=12?wO.afternoon:r>=4?wO.morning:wO.night,t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`BBBBB`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},h:function(e,t,n){if(t===`ho`){let t=e.getHours()%12;return t===0&&(t=12),n.ordinalNumber(t,{unit:`hour`})}return CO.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getHours(),{unit:`hour`}):CO.H(e,t)},K:function(e,t,n){let r=e.getHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):SO(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):SO(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getMinutes(),{unit:`minute`}):CO.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getSeconds(),{unit:`second`}):CO.s(e,t)},S:function(e,t){return CO.S(e,t)},X:function(e,t,n){let r=e.getTimezoneOffset();if(r===0)return`Z`;switch(t){case`X`:return DO(r);case`XXXX`:case`XX`:return OO(r);default:return OO(r,`:`)}},x:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`x`:return DO(r);case`xxxx`:case`xx`:return OO(r);default:return OO(r,`:`)}},O:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+EO(r,`:`);default:return`GMT`+OO(r,`:`)}},z:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+EO(r,`:`);default:return`GMT`+OO(r,`:`)}},t:function(e,t,n){return SO(Math.trunc(e/1e3),t.length)},T:function(e,t,n){return SO(+e,t.length)}};function EO(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Math.trunc(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+SO(a,2)}function DO(e,t){return e%60==0?(e>0?`-`:`+`)+SO(Math.abs(e)/60,2):OO(e,t)}function OO(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=SO(Math.trunc(r/60),2),a=SO(r%60,2);return n+i+t+a}var kO=(e,t)=>{switch(e){case`P`:return t.date({width:`short`});case`PP`:return t.date({width:`medium`});case`PPP`:return t.date({width:`long`});default:return t.date({width:`full`})}},AO=(e,t)=>{switch(e){case`p`:return t.time({width:`short`});case`pp`:return t.time({width:`medium`});case`ppp`:return t.time({width:`long`});default:return t.time({width:`full`})}},jO={p:AO,P:(e,t)=>{let n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return kO(e,t);let a;switch(r){case`P`:a=t.dateTime({width:`short`});break;case`PP`:a=t.dateTime({width:`medium`});break;case`PPP`:a=t.dateTime({width:`long`});break;default:a=t.dateTime({width:`full`});break}return a.replace(`{{date}}`,kO(r,t)).replace(`{{time}}`,AO(i,t))}},MO=/^D+$/,NO=/^Y+$/,PO=[`D`,`DD`,`YY`,`YYYY`];function FO(e){return MO.test(e)}function IO(e){return NO.test(e)}function LO(e,t,n){let r=RO(e,t,n);if(console.warn(r),PO.includes(e))throw RangeError(r)}function RO(e,t,n){let r=e[0]===`Y`?`years`:`days of the month`;return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}var zO=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,BO=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,VO=/^'([^]*?)'?$/,HO=/''/g,UO=/[a-zA-Z]/;function WO(e,t,n){let r=MD(),i=n?.locale??r.locale??gO,a=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=OD(e,n?.in);if(!qD(s))throw RangeError(`Invalid time value`);let c=t.match(BO).map(e=>{let t=e[0];if(t===`p`||t===`P`){let n=jO[t];return n(e,i.formatLong)}return e}).join(``).match(zO).map(e=>{if(e===`''`)return{isToken:!1,value:`'`};let t=e[0];if(t===`'`)return{isToken:!1,value:GO(e)};if(TO[t])return{isToken:!0,value:e};if(t.match(UO))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));let l={firstWeekContainsDate:a,weekStartsOn:o,locale:i};return c.map(r=>{if(!r.isToken)return r.value;let a=r.value;(!n?.useAdditionalWeekYearTokens&&IO(a)||!n?.useAdditionalDayOfYearTokens&&FO(a))&&LO(a,t,String(e));let o=TO[a[0]];return o(s,a,i.localize,l)}).join(``)}function GO(e){let t=e.match(VO);return t?t[1].replace(HO,`'`):e}function KO(e,t){let n=OD(e,t?.in),r=n.getFullYear(),i=n.getMonth(),a=DD(n,0);return a.setFullYear(r,i+1,0),a.setHours(0,0,0,0),a.getDate()}function qO(e,t){return OD(e,t?.in).getMonth()}function JO(e,t){return OD(e,t?.in).getFullYear()}function YO(e,t){return+OD(e)>+OD(t)}function XO(e,t){return+OD(e)<+OD(t)}function ZO(e,t,n){let[r,i]=LD(n?.in,e,t);return r.getFullYear()===i.getFullYear()&&r.getMonth()===i.getMonth()}function QO(e,t,n){let[r,i]=LD(n?.in,e,t);return r.getFullYear()===i.getFullYear()}function $O(e,t,n){let r=OD(e,n?.in),i=r.getFullYear(),a=r.getDate(),o=DD(n?.in||e,0);o.setFullYear(i,t,15),o.setHours(0,0,0,0);let s=KO(o);return r.setMonth(t,Math.min(a,s)),r}function ek(e,t,n){let r=OD(e,n?.in);return isNaN(+r)?DD(n?.in||e,NaN):(r.setFullYear(t),r)}function tk(){var e=[...arguments];return(0,v.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var nk=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function rk(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function ik(e){return`nodeType`in e}function ak(e){return e?rk(e)?e:ik(e)?e.ownerDocument?.defaultView??window:window:window}function ok(e){let{Document:t}=ak(e);return e instanceof t}function sk(e){return rk(e)?!1:e instanceof ak(e).HTMLElement}function ck(e){return e instanceof ak(e).SVGElement}function lk(e){return e?rk(e)?e.document:ik(e)?ok(e)?e:sk(e)||ck(e)?e.ownerDocument:document:document:document}var uk=nk?v.useLayoutEffect:v.useEffect;function dk(e){let t=(0,v.useRef)(e);return uk(()=>{t.current=e}),(0,v.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function fk(){let e=(0,v.useRef)(null);return[(0,v.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,v.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function pk(e,t){t===void 0&&(t=[e]);let n=(0,v.useRef)(e);return uk(()=>{n.current!==e&&(n.current=e)},t),n}function mk(e,t){let n=(0,v.useRef)();return(0,v.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function hk(e){let t=dk(e),n=(0,v.useRef)(null);return[n,(0,v.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function gk(e){let t=(0,v.useRef)();return(0,v.useEffect)(()=>{t.current=e},[e]),t.current}var _k={};function vk(e,t){return(0,v.useMemo)(()=>{if(t)return t;let n=_k[e]==null?0:_k[e]+1;return _k[e]=n,e+`-`+n},[e,t])}function yk(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var bk=yk(1),xk=yk(-1);function Sk(e){return`clientX`in e&&`clientY`in e}function Ck(e){if(!e)return!1;let{KeyboardEvent:t}=ak(e.target);return t&&e instanceof t}function wk(e){if(!e)return!1;let{TouchEvent:t}=ak(e.target);return t&&e instanceof t}function Tk(e){if(wk(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Sk(e)?{x:e.clientX,y:e.clientY}:null}var Ek=Object.freeze({Translate:{toString(e){if(!e)return;let{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;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[Ek.Translate.toString(e),Ek.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),Dk=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function Ok(e){return e.matches(Dk)?e:e.querySelector(Dk)}var kk={display:`none`};function Ak(e){let{id:t,value:n}=e;return v.createElement(`div`,{id:t,style:kk},n)}function jk(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return v.createElement(`div`,{id:t,style:{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`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function Mk(){let[e,t]=(0,v.useState)(``);return{announce:(0,v.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var Nk=(0,v.createContext)(null);function Pk(e){let t=(0,v.useContext)(Nk);(0,v.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function Fk(){let[e]=(0,v.useState)(()=>new Set),t=(0,v.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,v.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var Ik={draggable:`
77
+ To pick up a draggable item, press the space bar.
78
+ While dragging, use the arrow keys to move the item.
79
+ Press space again to drop the item in its new position, or press escape to cancel.
80
+ `},Lk={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 Rk(e){let{announcements:t=Lk,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Ik}=e,{announce:a,announcement:o}=Mk(),s=vk(`DndLiveRegion`),[c,l]=(0,v.useState)(!1);if((0,v.useEffect)(()=>{l(!0)},[]),Pk((0,v.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=v.createElement(v.Fragment,null,v.createElement(Ak,{id:r,value:i.draggable}),v.createElement(jk,{id:s,announcement:o}));return n?(0,N.createPortal)(u,n):u}var zk;(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`})(zk||={});function Bk(){}function Vk(e,t){return(0,v.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function Hk(){var e=[...arguments];return(0,v.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var Uk=Object.freeze({x:0,y:0});function Wk(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function Gk(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Kk(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function qk(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function Jk(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}}var Yk=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=Jk(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=Wk(Jk(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(Gk)};function Xk(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var Zk=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=Xk(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(Kk)};function Qk(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function $k(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Uk}function eA(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var tA=eA(1);function nA(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function rA(e,t,n){let r=nA(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var iA={ignoreTransform:!1};function aA(e,t){t===void 0&&(t=iA);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=ak(e).getComputedStyle(e);t&&(n=rA(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function oA(e){return aA(e,{ignoreTransform:!0})}function sA(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function cA(e,t){return t===void 0&&(t=ak(e).getComputedStyle(e)),t.position===`fixed`}function lA(e,t){t===void 0&&(t=ak(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function uA(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(ok(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!sk(i)||ck(i)||n.includes(i))return n;let a=ak(e).getComputedStyle(i);return i!==e&&lA(i,a)&&n.push(i),cA(i,a)?n:r(i.parentNode)}return e?r(e):n}function dA(e){let[t]=uA(e,1);return t??null}function fA(e){return!nk||!e?null:rk(e)?e:ik(e)?ok(e)||e===lk(e).scrollingElement?window:sk(e)?e:null:null}function pA(e){return rk(e)?e.scrollX:e.scrollLeft}function mA(e){return rk(e)?e.scrollY:e.scrollTop}function hA(e){return{x:pA(e),y:mA(e)}}var gA;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(gA||={});function _A(e){return!nk||!e?!1:e===document.scrollingElement}function vA(e){let t={x:0,y:0},n=_A(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var yA={x:.2,y:.2};function bA(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=yA);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=vA(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=gA.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=gA.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=gA.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=gA.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function xA(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function SA(e){return e.reduce((e,t)=>bk(e,hA(t)),Uk)}function CA(e){return e.reduce((e,t)=>e+pA(t),0)}function wA(e){return e.reduce((e,t)=>e+mA(t),0)}function TA(e,t){if(t===void 0&&(t=aA),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);dA(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var EA=[[`x`,[`left`,`right`],CA],[`y`,[`top`,`bottom`],wA]],DA=class{constructor(e,t){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;let n=uA(t),r=SA(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of EA)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,`rect`,{enumerable:!1})}},OA=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function kA(e){let{EventTarget:t}=ak(e);return e instanceof t?e:lk(e)}function AA(e,t){let 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 jA;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(jA||={});function MA(e){e.preventDefault()}function NA(e){e.stopPropagation()}var PA;(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`})(PA||={});var FA={start:[PA.Space,PA.Enter],cancel:[PA.Esc],end:[PA.Space,PA.Enter,PA.Tab]},IA=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case PA.Right:return{...n,x:n.x+25};case PA.Left:return{...n,x:n.x-25};case PA.Down:return{...n,y:n.y+25};case PA.Up:return{...n,y:n.y-25}}},LA=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new OA(lk(t)),this.windowListeners=new OA(ak(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(jA.Resize,this.handleCancel),this.windowListeners.add(jA.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(jA.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&TA(n),t(Uk)}handleKeyDown(e){if(Ck(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=FA,coordinateGetter:a=IA,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:Uk;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=xk(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=vA(n),p=xA(n),m={x:Math.min(i===PA.Right?p.right-p.width/2:p.right,Math.max(i===PA.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===PA.Down?p.bottom-p.height/2:p.bottom,Math.max(i===PA.Down?p.top:p.top+p.height/2,u.y))},h=i===PA.Right&&!s||i===PA.Left&&!c,g=i===PA.Down&&!l||i===PA.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===PA.Right&&e<=d.x||i===PA.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===PA.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===PA.Down&&e<=d.y||i===PA.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===PA.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,bk(xk(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};LA.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=FA,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function RA(e){return!!(e&&`distance`in e)}function zA(e){return!!(e&&`delay`in e)}var BA=class{constructor(e,t,n){n===void 0&&(n=kA(e.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=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=lk(i),this.documentListeners=new OA(this.document),this.listeners=new OA(n),this.windowListeners=new OA(ak(i)),this.initialCoordinates=Tk(r)??Uk,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(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(jA.Resize,this.handleCancel),this.windowListeners.add(jA.DragStart,MA),this.windowListeners.add(jA.VisibilityChange,this.handleCancel),this.windowListeners.add(jA.ContextMenu,MA),this.documentListeners.add(jA.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(zA(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(RA(t)){this.handlePending(t);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(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(jA.Click,NA,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(jA.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=Tk(e)??Uk,s=xk(n,o);if(!t&&a){if(RA(a)){if(a.tolerance!=null&&AA(s,a.tolerance))return this.handleCancel();if(AA(s,a.distance))return this.handleStart()}if(zA(a)&&AA(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===PA.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},VA={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},HA=class extends BA{constructor(e){let{event:t}=e,n=lk(t.target);super(e,VA,n)}};HA.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var UA={move:{name:`mousemove`},end:{name:`mouseup`}},WA;(function(e){e[e.RightClick=2]=`RightClick`})(WA||={});var GA=class extends BA{constructor(e){super(e,UA,lk(e.event.target))}};GA.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===WA.RightClick?!1:(r?.({event:n}),!0)}}];var KA={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},qA=class extends BA{constructor(e){super(e,KA)}static setup(){return window.addEventListener(KA.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(KA.move.name,e)};function e(){}}};qA.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var JA;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(JA||={});var YA;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(YA||={});function XA(e){let{acceleration:t,activator:n=JA.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=YA.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=QA({delta:d,disabled:!a}),[m,h]=fk(),g=(0,v.useRef)({x:0,y:0}),_=(0,v.useRef)({x:0,y:0}),y=(0,v.useMemo)(()=>{switch(n){case JA.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case JA.DraggableRect:return i}},[n,i,c]),b=(0,v.useRef)(null),x=(0,v.useCallback)(()=>{let e=b.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),S=(0,v.useMemo)(()=>s===YA.TreeOrder?[...l].reverse():l,[s,l]);(0,v.useEffect)(()=>{if(!a||!l.length||!y){h();return}for(let e of S){if(r?.(e)===!1)continue;let n=u[l.indexOf(e)];if(!n)continue;let{direction:i,speed:a}=bA(e,n,y,t,f);for(let e of[`x`,`y`])p[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0){h(),b.current=e,m(x,o),g.current=a,_.current=i;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,x,r,h,a,o,JSON.stringify(y),JSON.stringify(p),m,l,S,u,JSON.stringify(f)])}var ZA={x:{[gA.Backward]:!1,[gA.Forward]:!1},y:{[gA.Backward]:!1,[gA.Forward]:!1}};function QA(e){let{delta:t,disabled:n}=e,r=gk(t);return mk(e=>{if(n||!r||!e)return ZA;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[gA.Backward]:e.x[gA.Backward]||i.x===-1,[gA.Forward]:e.x[gA.Forward]||i.x===1},y:{[gA.Backward]:e.y[gA.Backward]||i.y===-1,[gA.Forward]:e.y[gA.Forward]||i.y===1}}},[n,t,r])}function $A(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return mk(e=>t==null?null:r??e??null,[r,t])}function ej(e,t){return(0,v.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var tj;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(tj||={});var nj;(function(e){e.Optimized=`optimized`})(nj||={});var rj=new Map;function ij(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,v.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,v.useRef)(e),d=g(),f=pk(d),p=(0,v.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,v.useRef)(null),h=mk(t=>{if(d&&!n)return rj;if(!t||t===rj||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new DA(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,v.useEffect)(()=>{u.current=e},[e]),(0,v.useEffect)(()=>{d||p()},[n,d]),(0,v.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,v.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case tj.Always:return!1;case tj.BeforeDragging:return n;default:return!n}}}function aj(e,t){return mk(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function oj(e,t){return aj(e,t)}function sj(e){let{callback:t,disabled:n}=e,r=dk(t),i=(0,v.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,v.useEffect)(()=>()=>i?.disconnect(),[i]),i}function cj(e){let{callback:t,disabled:n}=e,r=dk(t),i=(0,v.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,v.useEffect)(()=>()=>i?.disconnect(),[i]),i}function lj(e){return new DA(aA(e),e)}function uj(e,t,n){t===void 0&&(t=lj);let[r,i]=(0,v.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=sj({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=cj({callback:a});return uk(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function dj(e){return $k(e,aj(e))}var fj=[];function pj(e){let t=(0,v.useRef)(e),n=mk(n=>e?n&&n!==fj&&e&&t.current&&e.parentNode===t.current.parentNode?n:uA(e):fj,[e]);return(0,v.useEffect)(()=>{t.current=e},[e]),n}function mj(e){let[t,n]=(0,v.useState)(null),r=(0,v.useRef)(e),i=(0,v.useCallback)(e=>{let t=fA(e.target);t&&n(e=>e?(e.set(t,hA(t)),new Map(e)):null)},[]);return(0,v.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=fA(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,hA(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{fA(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,v.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>bk(e,t),Uk):SA(e):Uk,[e,t])}function hj(e,t){t===void 0&&(t=[]);let n=(0,v.useRef)(null);return(0,v.useEffect)(()=>{n.current=null},t),(0,v.useEffect)(()=>{let t=e!==Uk;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?xk(e,n.current):Uk}function gj(e){(0,v.useEffect)(()=>{if(!nk)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function _j(e,t){return(0,v.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function vj(e){return(0,v.useMemo)(()=>e?sA(e):null,[e])}var yj=[];function bj(e,t){t===void 0&&(t=aA);let[n]=e,r=vj(n?ak(n):null),[i,a]=(0,v.useState)(yj);function o(){a(()=>e.length?e.map(e=>_A(e)?r:new DA(t(e),e)):yj)}let s=cj({callback:o});return uk(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function xj(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return sk(t)?t:e}function Sj(e){let{measure:t}=e,[n,r]=(0,v.useState)(null),i=cj({callback:(0,v.useCallback)(e=>{for(let{target:n}of e)if(sk(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=hk((0,v.useCallback)(e=>{let n=xj(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,v.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var Cj=[{sensor:HA,options:{}},{sensor:LA,options:{}}],wj={current:{}},Tj={draggable:{measure:oA},droppable:{measure:oA,strategy:tj.WhileDragging,frequency:nj.Optimized},dragOverlay:{measure:aA}},Ej=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},Dj={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Ej,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Bk},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Tj,measureDroppableContainers:Bk,windowRect:null,measuringScheduled:!1},Oj={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:Bk,draggableNodes:new Map,over:null,measureDroppableContainers:Bk},kj=(0,v.createContext)(Oj),Aj=(0,v.createContext)(Dj);function jj(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Ej}}}function Mj(e,t){switch(t.type){case zk.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case zk.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 zk.DragEnd:case zk.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case zk.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new Ej(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case zk.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new Ej(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case zk.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new Ej(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Nj(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,v.useContext)(kj),a=gk(r),o=gk(n?.id);return(0,v.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!Ck(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=Ok(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function Pj(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function Fj(e){return(0,v.useMemo)(()=>({draggable:{...Tj.draggable,...e?.draggable},droppable:{...Tj.droppable,...e?.droppable},dragOverlay:{...Tj.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Ij(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,v.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;uk(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=$k(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=dA(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var Lj=(0,v.createContext)({...Uk,scaleX:1,scaleY:1}),Rj;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(Rj||={});var zj=(0,v.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=Cj,collisionDetection:o=Zk,measuring:s,modifiers:c,...l}=e,[u,d]=(0,v.useReducer)(Mj,void 0,jj),[f,p]=Fk(),[m,h]=(0,v.useState)(Rj.Uninitialized),g=m===Rj.Initialized,{draggable:{active:_,nodes:y,translate:b},droppable:{containers:x}}=u,S=_==null?null:y.get(_),C=(0,v.useRef)({initial:null,translated:null}),w=(0,v.useMemo)(()=>_==null?null:{id:_,data:S?.data??wj,rect:C},[_,S]),T=(0,v.useRef)(null),[E,D]=(0,v.useState)(null),[O,k]=(0,v.useState)(null),A=pk(l,Object.values(l)),j=vk(`DndDescribedBy`,t),M=(0,v.useMemo)(()=>x.getEnabled(),[x]),P=Fj(s),{droppableRects:F,measureDroppableContainers:I,measuringScheduled:L}=ij(M,{dragging:g,dependencies:[b.x,b.y],config:P.droppable}),R=$A(y,_),ee=(0,v.useMemo)(()=>O?Tk(O):null,[O]),te=ke(),ne=oj(R,P.draggable.measure);Ij({activeNode:_==null?null:y.get(_),config:te.layoutShiftCompensation,initialRect:ne,measure:P.draggable.measure});let z=uj(R,P.draggable.measure,ne),B=uj(R?R.parentElement:null),re=(0,v.useRef)({activatorEvent:null,active:null,activeNode:R,collisionRect:null,collisions:null,droppableRects:F,draggableNodes:y,draggingNode:null,draggingNodeRect:null,droppableContainers:x,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),V=x.getNodeFor(re.current.over?.id),ie=Sj({measure:P.dragOverlay.measure}),ae=ie.nodeRef.current??R,oe=g?ie.rect??z:null,se=!!(ie.nodeRef.current&&ie.rect),ce=dj(se?null:z),le=vj(ae?ak(ae):null),ue=pj(g?V??R:null),de=bj(ue),fe=Pj(c,{transform:{x:b.x-ce.x,y:b.y-ce.y,scaleX:1,scaleY:1},activatorEvent:O,active:w,activeNodeRect:z,containerNodeRect:B,draggingNodeRect:oe,over:re.current.over,overlayNodeRect:ie.rect,scrollableAncestors:ue,scrollableAncestorRects:de,windowRect:le}),pe=ee?bk(ee,b):null,me=mj(ue),he=hj(me),ge=hj(me,[z]),_e=bk(fe,he),ve=oe?tA(oe,fe):null,ye=w&&ve?o({active:w,collisionRect:ve,droppableRects:F,droppableContainers:M,pointerCoordinates:pe}):null,be=qk(ye,`id`),[xe,Se]=(0,v.useState)(null),Ce=Qk(se?fe:bk(fe,ge),xe?.rect??null,z),we=(0,v.useRef)(null),Te=(0,v.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(T.current==null)return;let i=y.get(T.current);if(!i)return;let a=e.nativeEvent;we.current=new n({active:T.current,activeNode:i,event:a,options:r,context:re,onAbort(e){if(!y.get(e))return;let{onDragAbort:t}=A.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!y.get(e))return;let{onDragPending:i}=A.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=T.current;if(t==null)return;let n=y.get(t);if(!n)return;let{onDragStart:r}=A.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:C}};(0,N.unstable_batchedUpdates)(()=>{r?.(i),h(Rj.Initializing),d({type:zk.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),D(we.current),k(a)})},onMove(e){d({type:zk.DragMove,coordinates:e})},onEnd:o(zk.DragEnd),onCancel:o(zk.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=re.current,o=null;if(t&&i){let{cancelDrop:s}=A.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===zk.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=zk.DragCancel)}T.current=null,(0,N.unstable_batchedUpdates)(()=>{d({type:e}),h(Rj.Uninitialized),Se(null),D(null),k(null),we.current=null;let t=e===zk.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=A.current[t];e?.(o),f({type:t,event:o})}})}}},[y]),Ee=ej(a,(0,v.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=y.get(r);if(T.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},T.current=r,Te(n,t))},[y,Te]));gj(a),uk(()=>{z&&m===Rj.Initializing&&h(Rj.Initialized)},[z,m]),(0,v.useEffect)(()=>{let{onDragMove:e}=A.current,{active:t,activatorEvent:n,collisions:r,over:i}=re.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:_e.x,y:_e.y},over:i};(0,N.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[_e.x,_e.y]),(0,v.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=re.current;if(!e||T.current==null||!t||!i)return;let{onDragOver:a}=A.current,o=r.get(be),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,N.unstable_batchedUpdates)(()=>{Se(s),a?.(c),f({type:`onDragOver`,event:c})})},[be]),uk(()=>{re.current={activatorEvent:O,active:w,activeNode:R,collisionRect:ve,collisions:ye,droppableRects:F,draggableNodes:y,draggingNode:ae,draggingNodeRect:oe,droppableContainers:x,over:xe,scrollableAncestors:ue,scrollAdjustedTranslate:_e},C.current={initial:oe,translated:ve}},[w,R,ye,ve,y,ae,oe,F,x,xe,ue,_e]),XA({...te,delta:b,draggingRect:ve,pointerCoordinates:pe,scrollableAncestors:ue,scrollableAncestorRects:de});let De=(0,v.useMemo)(()=>({active:w,activeNode:R,activeNodeRect:z,activatorEvent:O,collisions:ye,containerNodeRect:B,dragOverlay:ie,draggableNodes:y,droppableContainers:x,droppableRects:F,over:xe,measureDroppableContainers:I,scrollableAncestors:ue,scrollableAncestorRects:de,measuringConfiguration:P,measuringScheduled:L,windowRect:le}),[w,R,z,O,ye,B,ie,y,x,F,xe,I,ue,de,P,L,le]),Oe=(0,v.useMemo)(()=>({activatorEvent:O,activators:Ee,active:w,activeNodeRect:z,ariaDescribedById:{draggable:j},dispatch:d,draggableNodes:y,over:xe,measureDroppableContainers:I}),[O,Ee,w,z,d,j,y,xe,I]);return v.createElement(Nk.Provider,{value:p},v.createElement(kj.Provider,{value:Oe},v.createElement(Aj.Provider,{value:De},v.createElement(Lj.Provider,{value:Ce},i)),v.createElement(Nj,{disabled:n?.restoreFocus===!1})),v.createElement(Rk,{...n,hiddenTextDescribedById:j}));function ke(){let e=E?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),Bj=(0,v.createContext)(null),Vj=`button`,Hj=`Draggable`;function Uj(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=vk(Hj),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,v.useContext)(kj),{role:p=Vj,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,v.useContext)(g?Lj:Bj),[y,b]=hk(),[x,S]=hk(),C=_j(o,t),w=pk(n);return uk(()=>(d.set(t,{id:t,key:a,node:y,activatorNode:x,data:w}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,v.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===Vj?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:C,node:y,over:f,setNodeRef:b,setActivatorNodeRef:S,transform:_}}function Wj(){return(0,v.useContext)(Aj)}var Gj=`Droppable`,Kj={timeout:25};function qj(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=vk(Gj),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,v.useContext)(kj),u=(0,v.useRef)({disabled:n}),d=(0,v.useRef)(!1),f=(0,v.useRef)(null),p=(0,v.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...Kj,...i},_=pk(h??r),y=cj({callback:(0,v.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[b,x]=hk((0,v.useCallback)((e,t)=>{y&&(t&&(y.unobserve(t),d.current=!1),e&&y.observe(e))},[y])),S=pk(t);return(0,v.useEffect)(()=>{!y||!b.current||(y.disconnect(),d.current=!1,y.observe(b.current))},[b,y]),(0,v.useEffect)(()=>(s({type:zk.RegisterDroppable,element:{id:r,key:a,disabled:n,node:b,rect:f,data:S}}),()=>s({type:zk.UnregisterDroppable,key:a,id:r})),[r]),(0,v.useEffect)(()=>{n!==u.current.disabled&&(s({type:zk.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:b,over:c,setNodeRef:x}}function Jj(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Yj(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function Xj(e){return e!==null&&e>=0}function Zj(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 Qj(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var $j=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=Jj(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},eM={scaleX:1,scaleY:1},tM=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...eM}:null}let s=nM(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...eM}:r<t&&r>=a?{x:0,y:o.height+s,...eM}:{x:0,y:0,...eM}};function nM(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var rM=`Sortable`,iM=v.createContext({activeIndex:-1,containerId:rM,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:$j,disabled:{draggable:!1,droppable:!1}});function aM(e){let{children:t,id:n,items:r,strategy:i=$j,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=Wj(),d=vk(rM,n),f=s.rect!==null,p=(0,v.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,v.useRef)(p),y=!Zj(p,_.current),b=g!==-1&&h===-1||y,x=Qj(a);uk(()=>{y&&m&&u(p)},[y,p,m,u]),(0,v.useEffect)(()=>{_.current=p},[p]);let S=(0,v.useMemo)(()=>({activeIndex:h,containerId:d,disabled:x,disableTransforms:b,items:p,overIndex:g,useDragOverlay:f,sortedRects:Yj(p,c),strategy:i}),[h,d,x.draggable,x.droppable,b,p,g,c,f,i]);return v.createElement(iM.Provider,{value:S},t)}var oM=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return Jj(n,r,i).indexOf(t)},sM=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},cM={duration:200,easing:`ease`},lM=`transform`,uM=Ek.Transition.toString({property:lM,duration:0,easing:`linear`}),dM={roleDescription:`sortable`};function fM(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,v.useState)(null),s=(0,v.useRef)(n);return uk(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=aA(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,v.useEffect)(()=>{a&&o(null)},[a]),a}function pM(e){let{animateLayoutChanges:t=sM,attributes:n,disabled:r,data:i,getNewIndex:a=oM,id:o,strategy:s,resizeObserverConfig:c,transition:l=cM}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:y}=(0,v.useContext)(iM),b=mM(r,p),x=u.indexOf(o),S=(0,v.useMemo)(()=>({sortable:{containerId:d,index:x,items:u},...i}),[d,i,x,u]),C=(0,v.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:w,node:T,isOver:E,setNodeRef:D}=qj({id:o,data:S,disabled:b.droppable,resizeObserverConfig:{updateMeasurementsFor:C,...c}}),{active:O,activatorEvent:k,activeNodeRect:A,attributes:j,setNodeRef:M,listeners:N,isDragging:P,over:F,setActivatorNodeRef:I,transform:L}=Uj({id:o,data:S,attributes:{...dM,...n},disabled:b.draggable}),R=tk(D,M),ee=!!O,te=ee&&!m&&Xj(f)&&Xj(g),ne=!_&&P,z=te?(ne&&te?L:null)??(s??y)({rects:h,activeNodeRect:A,activeIndex:f,overIndex:g,index:x}):null,B=Xj(f)&&Xj(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):x,re=O?.id,V=(0,v.useRef)({activeId:re,items:u,newIndex:B,containerId:d}),ie=u!==V.current.items,ae=t({active:O,containerId:d,isDragging:P,isSorting:ee,id:o,index:x,items:u,newIndex:V.current.newIndex,previousItems:V.current.items,previousContainerId:V.current.containerId,transition:l,wasDragging:V.current.activeId!=null}),oe=fM({disabled:!ae,index:x,node:T,rect:w});return(0,v.useEffect)(()=>{ee&&V.current.newIndex!==B&&(V.current.newIndex=B),d!==V.current.containerId&&(V.current.containerId=d),u!==V.current.items&&(V.current.items=u)},[ee,B,d,u]),(0,v.useEffect)(()=>{if(re===V.current.activeId)return;if(re!=null&&V.current.activeId==null){V.current.activeId=re;return}let e=setTimeout(()=>{V.current.activeId=re},50);return()=>clearTimeout(e)},[re]),{active:O,activeIndex:f,attributes:j,data:S,rect:w,index:x,newIndex:B,items:u,isOver:E,isSorting:ee,isDragging:P,listeners:N,node:T,overIndex:g,over:F,setNodeRef:R,setActivatorNodeRef:I,setDroppableNodeRef:D,setDraggableNodeRef:M,transform:oe??z,transition:se()};function se(){if(oe||ie&&V.current.newIndex===x)return uM;if(!(ne&&!Ck(k)||!l)&&(ee||ae))return Ek.Transition.toString({...l,property:lM})}}function mM(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}PA.Down,PA.Right,PA.Up,PA.Left;function hM({...e}){return(0,H.jsx)(ry,{"data-slot":`accordion`,...e})}function gM({className:e,...t}){return(0,H.jsx)(iy,{"data-slot":`accordion-item`,className:K(`border-b last:border-b-0`,e),...t})}function _M({className:e,children:t,...n}){return(0,H.jsx)(ay,{className:`flex`,children:(0,H.jsxs)(oy,{"data-slot":`accordion-trigger`,className:K(`flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180`,e),...n,children:[t,(0,H.jsx)(Va,{className:`pointer-events-none size-4 shrink-0 translate-y-0.5 text-muted-foreground transition-transform duration-200`})]})})}function vM({className:e,children:t,...n}){return(0,H.jsx)(sy,{"data-slot":`accordion-content`,className:`overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down`,...n,children:(0,H.jsx)(`div`,{className:K(`pt-0 pb-4`,e),children:t})})}function yM(e,t,n=`long`){return new Intl.DateTimeFormat(`en-US`,{hour:`numeric`,timeZone:e,timeZoneName:n}).format(t).split(/\s/g).slice(2).join(` `)}var bM={},xM={};function SM(e,t){try{let n=(bM[e]||=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`longOffset`}).format)(t).split(`GMT`)[1];return n in xM?xM[n]:wM(n,n.split(`:`))}catch{if(e in xM)return xM[e];let t=e?.match(CM);return t?wM(e,t.slice(1)):NaN}}var CM=/([+-]\d\d):?(\d\d)?/;function wM(e,t){let n=+(t[0]||0),r=+(t[1]||0),i=(t[2]||0)/60;return xM[e]=n*60+r>0?n*60+r+i:n*60-r-i}var TM=class e extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]==`string`&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(SM(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]==`number`&&(e.length===1||e.length===2&&typeof e[1]!=`number`)?this.setTime(e[0]):typeof e[0]==`string`?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),kM(this,NaN),DM(this)):this.setTime(Date.now())}static tz(t,...n){return n.length?new e(...n,t):new e(Date.now(),t)}withTimeZone(t){return new e(+this,t)}getTimezoneOffset(){let e=-SM(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),DM(this),+this}[Symbol.for(`constructDateFrom`)](t){return new e(+new Date(t),this.timeZone)}},EM=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!EM.test(e))return;let t=e.replace(EM,`$1UTC`);TM.prototype[t]&&(e.startsWith(`get`)?TM.prototype[e]=function(){return this.internal[t]()}:(TM.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),OM(this),+this},TM.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),DM(this),+this}))});function DM(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-SM(e.timeZone,e)*60))}function OM(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),kM(e)}function kM(e){let t=SM(e.timeZone,e),n=t>0?Math.floor(t):Math.ceil(t),r=new Date(+e);r.setUTCHours(r.getUTCHours()-1);let i=-new Date(+e).getTimezoneOffset(),a=i- -new Date(+r).getTimezoneOffset(),o=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();a&&o&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+a);let s=i-n;s&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+s);let c=new Date(+e);c.setUTCSeconds(0);let l=i>0?c.getSeconds():(c.getSeconds()-60)%60,u=Math.round(-(SM(e.timeZone,e)*60))%60;(u||l)&&(e.internal.setUTCSeconds(e.internal.getUTCSeconds()+u),Date.prototype.setUTCSeconds.call(e,Date.prototype.getUTCSeconds.call(e)+u+l));let d=SM(e.timeZone,e),f=d>0?Math.floor(d):Math.ceil(d),p=-new Date(+e).getTimezoneOffset()-f,m=f!==n,h=p-s;if(m&&h){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+h);let t=SM(e.timeZone,e),n=f-(t>0?Math.floor(t):Math.ceil(t));n&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+n),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+n))}}var AM=class e extends TM{static tz(t,...n){return n.length?new e(...n,t):new e(Date.now(),t)}toISOString(){let[e,t,n]=this.tzComponents(),r=`${e}${t}:${n}`;return this.internal.toISOString().slice(0,-1)+r}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){let[e,t,n,r]=this.internal.toUTCString().split(` `);return`${e?.slice(0,-1)} ${n} ${t} ${r}`}toTimeString(){let e=this.internal.toUTCString().split(` `)[4],[t,n,r]=this.tzComponents();return`${e} GMT${t}${n}${r} (${yM(this.timeZone,this)})`}toLocaleString(e,t){return Date.prototype.toLocaleString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleDateString(e,t){return Date.prototype.toLocaleDateString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleTimeString(e,t){return Date.prototype.toLocaleTimeString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}tzComponents(){let e=this.getTimezoneOffset();return[e>0?`-`:`+`,String(Math.floor(Math.abs(e)/60)).padStart(2,`0`),String(Math.abs(e)%60).padStart(2,`0`)]}withTimeZone(t){return new e(+this,t)}[Symbol.for(`constructDateFrom`)](t){return new e(+new Date(t),this.timeZone)}},jM=5,MM=4;function NM(e,t){let n=t.startOfMonth(e),r=n.getDay()>0?n.getDay():7,i=t.addDays(e,-r+1),a=t.addDays(i,jM*7-1);return t.getMonth(e)===t.getMonth(a)?jM:MM}function PM(e,t){let n=t.startOfMonth(e),r=n.getDay();return r===1?n:r===0?t.addDays(n,-6):t.addDays(n,-1*(r-1))}function FM(e,t){let n=PM(e,t),r=NM(e,t);return t.addDays(n,r*7-1)}var IM={...gO,labels:{labelDayButton:(e,t,n,r)=>{let i;i=r&&typeof r.format==`function`?r.format.bind(r):(e,t)=>WO(e,t,{locale:gO,...n});let a=i(e,`PPPP`);return t.today&&(a=`Today, ${a}`),t.selected&&(a=`${a}, selected`),a},labelMonthDropdown:`Choose the Month`,labelNext:`Go to the Next Month`,labelPrevious:`Go to the Previous Month`,labelWeekNumber:e=>`Week ${e}`,labelYearDropdown:`Choose the Year`,labelGrid:(e,t,n)=>{let r;return r=n&&typeof n.format==`function`?n.format.bind(n):(e,n)=>WO(e,n,{locale:gO,...t}),r(e,`LLLL yyyy`)},labelGridcell:(e,t,n,r)=>{let i;i=r&&typeof r.format==`function`?r.format.bind(r):(e,t)=>WO(e,t,{locale:gO,...n});let a=i(e,`PPPP`);return t?.today&&(a=`Today, ${a}`),a},labelNav:`Navigation bar`,labelWeekNumberHeader:`Week Number`,labelWeekday:(e,t,n)=>{let r;return r=n&&typeof n.format==`function`?n.format.bind(n):(e,n)=>WO(e,n,{locale:gO,...t}),r(e,`cccc`)}}},LM=class e{constructor(e,t){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?AM.tz(this.options.timeZone):new this.Date,this.newDate=(e,t,n)=>this.overrides?.newDate?this.overrides.newDate(e,t,n):this.options.timeZone?new AM(e,t,n,this.options.timeZone):new Date(e,t,n),this.addDays=(e,t)=>this.overrides?.addDays?this.overrides.addDays(e,t):kD(e,t),this.addMonths=(e,t)=>this.overrides?.addMonths?this.overrides.addMonths(e,t):AD(e,t),this.addWeeks=(e,t)=>this.overrides?.addWeeks?this.overrides.addWeeks(e,t):VD(e,t),this.addYears=(e,t)=>this.overrides?.addYears?this.overrides.addYears(e,t):HD(e,t),this.differenceInCalendarDays=(e,t)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(e,t):zD(e,t),this.differenceInCalendarMonths=(e,t)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(e,t):JD(e,t),this.eachMonthOfInterval=e=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(e):ZD(e),this.eachYearOfInterval=e=>{let t=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(e):tO(e),n=new Set(t.map(e=>this.getYear(e)));if(n.size===t.length)return t;let r=[];return n.forEach(e=>{r.push(new Date(e,0,1))}),r},this.endOfBroadcastWeek=e=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(e):FM(e,this),this.endOfISOWeek=e=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(e):rO(e),this.endOfMonth=e=>this.overrides?.endOfMonth?this.overrides.endOfMonth(e):YD(e),this.endOfWeek=(e,t)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(e,t):nO(e,this.options),this.endOfYear=e=>this.overrides?.endOfYear?this.overrides.endOfYear(e):$D(e),this.format=(e,t,n)=>{let r=this.overrides?.format?this.overrides.format(e,t,this.options):WO(e,t,this.options);return this.options.numerals&&this.options.numerals!==`latn`?this.replaceDigits(r):r},this.getISOWeek=e=>this.overrides?.getISOWeek?this.overrides.getISOWeek(e):vO(e),this.getMonth=(e,t)=>this.overrides?.getMonth?this.overrides.getMonth(e,this.options):qO(e,this.options),this.getYear=(e,t)=>this.overrides?.getYear?this.overrides.getYear(e,this.options):JO(e,this.options),this.getWeek=(e,t)=>this.overrides?.getWeek?this.overrides.getWeek(e,this.options):xO(e,this.options),this.isAfter=(e,t)=>this.overrides?.isAfter?this.overrides.isAfter(e,t):YO(e,t),this.isBefore=(e,t)=>this.overrides?.isBefore?this.overrides.isBefore(e,t):XO(e,t),this.isDate=e=>this.overrides?.isDate?this.overrides.isDate(e):KD(e),this.isSameDay=(e,t)=>this.overrides?.isSameDay?this.overrides.isSameDay(e,t):GD(e,t),this.isSameMonth=(e,t)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(e,t):ZO(e,t),this.isSameYear=(e,t)=>this.overrides?.isSameYear?this.overrides.isSameYear(e,t):QO(e,t),this.max=e=>this.overrides?.max?this.overrides.max(e):UD(e),this.min=e=>this.overrides?.min?this.overrides.min(e):WD(e),this.setMonth=(e,t)=>this.overrides?.setMonth?this.overrides.setMonth(e,t):$O(e,t),this.setYear=(e,t)=>this.overrides?.setYear?this.overrides.setYear(e,t):ek(e,t),this.startOfBroadcastWeek=(e,t)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(e,this):PM(e,this),this.startOfDay=e=>this.overrides?.startOfDay?this.overrides.startOfDay(e):RD(e),this.startOfISOWeek=e=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(e):PD(e),this.startOfMonth=e=>this.overrides?.startOfMonth?this.overrides.startOfMonth(e):QD(e),this.startOfWeek=(e,t)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(e,this.options):ND(e,this.options),this.startOfYear=e=>this.overrides?.startOfYear?this.overrides.startOfYear(e):eO(e),this.options={locale:IM,...e},this.overrides=t}getDigitMap(){let{numerals:e=`latn`}=this.options,t=new Intl.NumberFormat(`en-US`,{numberingSystem:e}),n={};for(let e=0;e<10;e++)n[e.toString()]=t.format(e);return n}replaceDigits(e){let t=this.getDigitMap();return e.replace(/\d/g,e=>t[e]||e)}formatNumber(e){return this.replaceDigits(e.toString())}getMonthYearOrder(){let t=this.options.locale?.code;return t&&e.yearFirstLocales.has(t)?`year-first`:`month-first`}formatMonthYear(t){let{locale:n,timeZone:r,numerals:i}=this.options,a=n?.code;if(a&&e.yearFirstLocales.has(a))try{return new Intl.DateTimeFormat(a,{month:`long`,year:`numeric`,timeZone:r,numberingSystem:i}).format(t)}catch{}let o=this.getMonthYearOrder()===`year-first`?`y LLLL`:`LLLL y`;return this.format(t,o)}};LM.yearFirstLocales=new Set([`eu`,`hu`,`ja`,`ja-Hira`,`ja-JP`,`ko`,`ko-KR`,`lt`,`lt-LT`,`lv`,`lv-LV`,`mn`,`mn-MN`,`zh`,`zh-CN`,`zh-HK`,`zh-TW`]);var RM=new LM,zM=class{constructor(e,t,n=RM){this.date=e,this.displayMonth=t,this.outside=!!(t&&!n.isSameMonth(e,t)),this.dateLib=n,this.isoDate=n.format(e,`yyyy-MM-dd`),this.displayMonthId=n.format(t,`yyyy-MM`),this.dateMonthId=n.format(e,`yyyy-MM`)}isEqualTo(e){return this.dateLib.isSameDay(e.date,this.date)&&this.dateLib.isSameMonth(e.displayMonth,this.displayMonth)}},BM=class{constructor(e,t){this.date=e,this.weeks=t}},VM=class{constructor(e,t){this.days=t,this.weekNumber=e}};function HM(e){return v.createElement(`button`,{...e})}function UM(e){return v.createElement(`span`,{...e})}function WM(e){let{size:t=24,orientation:n=`left`,className:r}=e;return v.createElement(`svg`,{className:r,width:t,height:t,viewBox:`0 0 24 24`},n===`up`&&v.createElement(`polygon`,{points:`6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28`}),n===`down`&&v.createElement(`polygon`,{points:`6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72`}),n===`left`&&v.createElement(`polygon`,{points:`16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20`}),n===`right`&&v.createElement(`polygon`,{points:`8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20`}))}function GM(e){let{day:t,modifiers:n,...r}=e;return v.createElement(`td`,{...r})}function KM(e){let{day:t,modifiers:n,...r}=e,i=v.useRef(null);return v.useEffect(()=>{n.focused&&i.current?.focus()},[n.focused]),v.createElement(`button`,{ref:i,...r})}var qM;(function(e){e.Root=`root`,e.Chevron=`chevron`,e.Day=`day`,e.DayButton=`day_button`,e.CaptionLabel=`caption_label`,e.Dropdowns=`dropdowns`,e.Dropdown=`dropdown`,e.DropdownRoot=`dropdown_root`,e.Footer=`footer`,e.MonthGrid=`month_grid`,e.MonthCaption=`month_caption`,e.MonthsDropdown=`months_dropdown`,e.Month=`month`,e.Months=`months`,e.Nav=`nav`,e.NextMonthButton=`button_next`,e.PreviousMonthButton=`button_previous`,e.Week=`week`,e.Weeks=`weeks`,e.Weekday=`weekday`,e.Weekdays=`weekdays`,e.WeekNumber=`week_number`,e.WeekNumberHeader=`week_number_header`,e.YearsDropdown=`years_dropdown`})(qM||={});var JM;(function(e){e.disabled=`disabled`,e.hidden=`hidden`,e.outside=`outside`,e.focused=`focused`,e.today=`today`})(JM||={});var YM;(function(e){e.range_end=`range_end`,e.range_middle=`range_middle`,e.range_start=`range_start`,e.selected=`selected`})(YM||={});var XM;(function(e){e.weeks_before_enter=`weeks_before_enter`,e.weeks_before_exit=`weeks_before_exit`,e.weeks_after_enter=`weeks_after_enter`,e.weeks_after_exit=`weeks_after_exit`,e.caption_after_enter=`caption_after_enter`,e.caption_after_exit=`caption_after_exit`,e.caption_before_enter=`caption_before_enter`,e.caption_before_exit=`caption_before_exit`})(XM||={});function ZM(e){let{options:t,className:n,components:r,classNames:i,...a}=e,o=[i[qM.Dropdown],n].join(` `),s=t?.find(({value:e})=>e===a.value);return v.createElement(`span`,{"data-disabled":a.disabled,className:i[qM.DropdownRoot]},v.createElement(r.Select,{className:o,...a},t?.map(({value:e,label:t,disabled:n})=>v.createElement(r.Option,{key:e,value:e,disabled:n},t))),v.createElement(`span`,{className:i[qM.CaptionLabel],"aria-hidden":!0},s?.label,v.createElement(r.Chevron,{orientation:`down`,size:18,className:i[qM.Chevron]})))}function QM(e){return v.createElement(`div`,{...e})}function $M(e){return v.createElement(`div`,{...e})}function eN(e){let{calendarMonth:t,displayIndex:n,...r}=e;return v.createElement(`div`,{...r},e.children)}function tN(e){let{calendarMonth:t,displayIndex:n,...r}=e;return v.createElement(`div`,{...r})}function nN(e){return v.createElement(`table`,{...e})}function rN(e){return v.createElement(`div`,{...e})}var iN=(0,v.createContext)(void 0);function aN(){let e=(0,v.useContext)(iN);if(e===void 0)throw Error(`useDayPicker() must be used within a custom component.`);return e}function oN(e){let{components:t}=aN();return v.createElement(t.Dropdown,{...e})}function sN(e){let{onPreviousClick:t,onNextClick:n,previousMonth:r,nextMonth:i,...a}=e,{components:o,classNames:s,labels:{labelPrevious:c,labelNext:l}}=aN(),u=(0,v.useCallback)(e=>{i&&n?.(e)},[i,n]),d=(0,v.useCallback)(e=>{r&&t?.(e)},[r,t]);return v.createElement(`nav`,{...a},v.createElement(o.PreviousMonthButton,{type:`button`,className:s[qM.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":c(r),onClick:d},v.createElement(o.Chevron,{disabled:r?void 0:!0,className:s[qM.Chevron],orientation:`left`})),v.createElement(o.NextMonthButton,{type:`button`,className:s[qM.NextMonthButton],tabIndex:i?void 0:-1,"aria-disabled":i?void 0:!0,"aria-label":l(i),onClick:u},v.createElement(o.Chevron,{disabled:i?void 0:!0,orientation:`right`,className:s[qM.Chevron]})))}function cN(e){let{components:t}=aN();return v.createElement(t.Button,{...e})}function lN(e){return v.createElement(`option`,{...e})}function uN(e){let{components:t}=aN();return v.createElement(t.Button,{...e})}function dN(e){let{rootRef:t,...n}=e;return v.createElement(`div`,{...n,ref:t})}function fN(e){return v.createElement(`select`,{...e})}function pN(e){let{week:t,...n}=e;return v.createElement(`tr`,{...n})}function mN(e){return v.createElement(`th`,{...e})}function hN(e){return v.createElement(`thead`,{"aria-hidden":!0},v.createElement(`tr`,{...e}))}function gN(e){let{week:t,...n}=e;return v.createElement(`th`,{...n})}function _N(e){return v.createElement(`th`,{...e})}function vN(e){return v.createElement(`tbody`,{...e})}function yN(e){let{components:t}=aN();return v.createElement(t.Dropdown,{...e})}var bN=s({Button:()=>HM,CaptionLabel:()=>UM,Chevron:()=>WM,Day:()=>GM,DayButton:()=>KM,Dropdown:()=>ZM,DropdownNav:()=>QM,Footer:()=>$M,Month:()=>eN,MonthCaption:()=>tN,MonthGrid:()=>nN,Months:()=>rN,MonthsDropdown:()=>oN,Nav:()=>sN,NextMonthButton:()=>cN,Option:()=>lN,PreviousMonthButton:()=>uN,Root:()=>dN,Select:()=>fN,Week:()=>pN,WeekNumber:()=>gN,WeekNumberHeader:()=>_N,Weekday:()=>mN,Weekdays:()=>hN,Weeks:()=>vN,YearsDropdown:()=>yN});function xN(e,t,n=!1,r=RM){let{from:i,to:a}=e,{differenceInCalendarDays:o,isSameDay:s}=r;return i&&a?(o(a,i)<0&&([i,a]=[a,i]),o(t,i)>=+!!n&&o(a,t)>=+!!n):!n&&a?s(a,t):!n&&i?s(i,t):!1}function SN(e){return!!(e&&typeof e==`object`&&`before`in e&&`after`in e)}function CN(e){return!!(e&&typeof e==`object`&&`from`in e)}function wN(e){return!!(e&&typeof e==`object`&&`after`in e)}function TN(e){return!!(e&&typeof e==`object`&&`before`in e)}function EN(e){return!!(e&&typeof e==`object`&&`dayOfWeek`in e)}function DN(e,t){return Array.isArray(e)&&e.every(t.isDate)}function ON(e,t,n=RM){let r=Array.isArray(t)?t:[t],{isSameDay:i,differenceInCalendarDays:a,isAfter:o}=n;return r.some(t=>{if(typeof t==`boolean`)return t;if(n.isDate(t))return i(e,t);if(DN(t,n))return t.some(t=>i(e,t));if(CN(t))return xN(t,e,!1,n);if(EN(t))return Array.isArray(t.dayOfWeek)?t.dayOfWeek.includes(e.getDay()):t.dayOfWeek===e.getDay();if(SN(t)){let n=a(t.before,e),r=a(t.after,e),i=n>0,s=r<0;return o(t.before,t.after)?s&&i:i||s}return wN(t)?a(e,t.after)>0:TN(t)?a(t.before,e)>0:typeof t==`function`?t(e):!1})}function kN(e,t,n,r,i){let{disabled:a,hidden:o,modifiers:s,showOutsideDays:c,broadcastCalendar:l,today:u=i.today()}=t,{isSameDay:d,isSameMonth:f,startOfMonth:p,isBefore:m,endOfMonth:h,isAfter:g}=i,_=n&&p(n),v=r&&h(r),y={[JM.focused]:[],[JM.outside]:[],[JM.disabled]:[],[JM.hidden]:[],[JM.today]:[]},b={};for(let t of e){let{date:e,displayMonth:n}=t,r=!!(n&&!f(e,n)),p=!!(_&&m(e,_)),h=!!(v&&g(e,v)),x=!!(a&&ON(e,a,i)),S=!!(o&&ON(e,o,i))||p||h||!l&&!c&&r||l&&c===!1&&r,C=d(e,u);r&&y.outside.push(t),x&&y.disabled.push(t),S&&y.hidden.push(t),C&&y.today.push(t),s&&Object.keys(s).forEach(n=>{let r=s?.[n];r&&ON(e,r,i)&&(b[n]?b[n].push(t):b[n]=[t])})}return e=>{let t={[JM.focused]:!1,[JM.disabled]:!1,[JM.hidden]:!1,[JM.outside]:!1,[JM.today]:!1},n={};for(let n in y)t[n]=y[n].some(t=>t===e);for(let t in b)n[t]=b[t].some(t=>t===e);return{...t,...n}}}function AN(e,t,n={}){return Object.entries(e).filter(([,e])=>e===!0).reduce((e,[r])=>(n[r]?e.push(n[r]):t[JM[r]]?e.push(t[JM[r]]):t[YM[r]]&&e.push(t[YM[r]]),e),[t[qM.Day]])}function jN(e){return{...bN,...e}}function MN(e){let t={"data-mode":e.mode??void 0,"data-required":`required`in e?e.required:void 0,"data-multiple-months":e.numberOfMonths&&e.numberOfMonths>1||void 0,"data-week-numbers":e.showWeekNumber||void 0,"data-broadcast-calendar":e.broadcastCalendar||void 0,"data-nav-layout":e.navLayout||void 0};return Object.entries(e).forEach(([e,n])=>{e.startsWith(`data-`)&&(t[e]=n)}),t}function NN(){let e={};for(let t in qM)e[qM[t]]=`rdp-${qM[t]}`;for(let t in JM)e[JM[t]]=`rdp-${JM[t]}`;for(let t in YM)e[YM[t]]=`rdp-${YM[t]}`;for(let t in XM)e[XM[t]]=`rdp-${XM[t]}`;return e}function PN(e,t,n){return(n??new LM(t)).formatMonthYear(e)}var FN=PN;function IN(e,t,n){return(n??new LM(t)).format(e,`d`)}function LN(e,t=RM){return t.format(e,`LLLL`)}function RN(e,t,n){return(n??new LM(t)).format(e,`cccccc`)}function zN(e,t=RM){return e<10?t.formatNumber(`0${e.toLocaleString()}`):t.formatNumber(`${e.toLocaleString()}`)}function BN(){return``}function VN(e,t=RM){return t.format(e,`yyyy`)}var HN=VN,UN=s({formatCaption:()=>PN,formatDay:()=>IN,formatMonthCaption:()=>FN,formatMonthDropdown:()=>LN,formatWeekNumber:()=>zN,formatWeekNumberHeader:()=>BN,formatWeekdayName:()=>RN,formatYearCaption:()=>HN,formatYearDropdown:()=>VN});function WN(e){return e?.formatMonthCaption&&!e.formatCaption&&(e.formatCaption=e.formatMonthCaption),e?.formatYearCaption&&!e.formatYearDropdown&&(e.formatYearDropdown=e.formatYearCaption),{...UN,...e}}function GN(e,t,n,r){let i=(r??new LM(n)).format(e,`PPPP`);return t.today&&(i=`Today, ${i}`),t.selected&&(i=`${i}, selected`),i}var KN=GN;function qN(e,t,n){return(n??new LM(t)).formatMonthYear(e)}var JN=qN;function YN(e,t,n,r){let i=(r??new LM(n)).format(e,`PPPP`);return t?.today&&(i=`Today, ${i}`),i}function XN(e){return`Choose the Month`}function ZN(){return``}var QN=`Go to the Next Month`;function $N(e,t){return QN}function eP(e){return`Go to the Previous Month`}function tP(e,t,n){return(n??new LM(t)).format(e,`cccc`)}function nP(e,t){return`Week ${e}`}function rP(e){return`Week Number`}function iP(e){return`Choose the Year`}var aP=s({labelCaption:()=>JN,labelDay:()=>KN,labelDayButton:()=>GN,labelGrid:()=>qN,labelGridcell:()=>YN,labelMonthDropdown:()=>XN,labelNav:()=>ZN,labelNext:()=>$N,labelPrevious:()=>eP,labelWeekNumber:()=>nP,labelWeekNumberHeader:()=>rP,labelWeekday:()=>tP,labelYearDropdown:()=>iP}),oP=(e,t,n)=>t||(n?typeof n==`function`?n:(...e)=>n:e);function sP(e,t){let n=t.locale?.labels??{};return{...aP,...e??{},labelDayButton:oP(GN,e?.labelDayButton,n.labelDayButton),labelMonthDropdown:oP(XN,e?.labelMonthDropdown,n.labelMonthDropdown),labelNext:oP($N,e?.labelNext,n.labelNext),labelPrevious:oP(eP,e?.labelPrevious,n.labelPrevious),labelWeekNumber:oP(nP,e?.labelWeekNumber,n.labelWeekNumber),labelYearDropdown:oP(iP,e?.labelYearDropdown,n.labelYearDropdown),labelGrid:oP(qN,e?.labelGrid,n.labelGrid),labelGridcell:oP(YN,e?.labelGridcell,n.labelGridcell),labelNav:oP(ZN,e?.labelNav,n.labelNav),labelWeekNumberHeader:oP(rP,e?.labelWeekNumberHeader,n.labelWeekNumberHeader),labelWeekday:oP(tP,e?.labelWeekday,n.labelWeekday)}}function cP(e,t,n,r,i){let{startOfMonth:a,startOfYear:o,endOfYear:s,eachMonthOfInterval:c,getMonth:l}=i;return c({start:o(e),end:s(e)}).map(e=>{let o=r.formatMonthDropdown(e,i);return{value:l(e),label:o,disabled:t&&e<a(t)||n&&e>a(n)||!1}})}function lP(e,t={},n={}){let r={...t?.[qM.Day]};return Object.entries(e).filter(([,e])=>e===!0).forEach(([e])=>{r={...r,...n?.[e]}}),r}function uP(e,t,n,r){let i=r??e.today(),a=n?e.startOfBroadcastWeek(i,e):t?e.startOfISOWeek(i):e.startOfWeek(i),o=[];for(let t=0;t<7;t++){let n=e.addDays(a,t);o.push(n)}return o}function dP(e,t,n,r,i=!1){if(!e||!t)return;let{startOfYear:a,endOfYear:o,eachYearOfInterval:s,getYear:c}=r,l=s({start:a(e),end:o(t)});return i&&l.reverse(),l.map(e=>{let t=n.formatYearDropdown(e,r);return{value:c(e),label:t,disabled:!1}})}function fP(e,t={}){let{weekStartsOn:n,locale:r}=t,i=n??r?.options?.weekStartsOn??0,a=t=>{let n=typeof t==`number`||typeof t==`string`?new Date(t):t;return new AM(n.getFullYear(),n.getMonth(),n.getDate(),12,0,0,e)},o=e=>{let t=a(e);return new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0,0)};return{today:()=>a(AM.tz(e)),newDate:(t,n,r)=>new AM(t,n,r,12,0,0,e),startOfDay:e=>a(e),startOfWeek:(e,t)=>{let n=a(e),r=t?.weekStartsOn??i,o=(n.getDay()-r+7)%7;return n.setDate(n.getDate()-o),n},startOfISOWeek:e=>{let t=a(e),n=(t.getDay()-1+7)%7;return t.setDate(t.getDate()-n),t},startOfMonth:e=>{let t=a(e);return t.setDate(1),t},startOfYear:e=>{let t=a(e);return t.setMonth(0,1),t},endOfWeek:(e,t)=>{let n=a(e),r=(((t?.weekStartsOn??i)+6)%7-n.getDay()+7)%7;return n.setDate(n.getDate()+r),n},endOfISOWeek:e=>{let t=a(e),n=(7-t.getDay())%7;return t.setDate(t.getDate()+n),t},endOfMonth:e=>{let t=a(e);return t.setMonth(t.getMonth()+1,0),t},endOfYear:e=>{let t=a(e);return t.setMonth(11,31),t},eachMonthOfInterval:t=>{let n=a(t.start),r=a(t.end),i=[],o=new AM(n.getFullYear(),n.getMonth(),1,12,0,0,e),s=r.getFullYear()*12+r.getMonth();for(;o.getFullYear()*12+o.getMonth()<=s;)i.push(new AM(o,e)),o.setMonth(o.getMonth()+1,1);return i},addDays:(e,t)=>{let n=a(e);return n.setDate(n.getDate()+t),n},addWeeks:(e,t)=>{let n=a(e);return n.setDate(n.getDate()+t*7),n},addMonths:(e,t)=>{let n=a(e);return n.setMonth(n.getMonth()+t),n},addYears:(e,t)=>{let n=a(e);return n.setFullYear(n.getFullYear()+t),n},eachYearOfInterval:t=>{let n=a(t.start),r=a(t.end),i=[],o=new AM(n.getFullYear(),0,1,12,0,0,e);for(;o.getFullYear()<=r.getFullYear();)i.push(new AM(o,e)),o.setFullYear(o.getFullYear()+1,0,1);return i},getWeek:(e,t)=>xO(o(e),{weekStartsOn:t?.weekStartsOn??i,firstWeekContainsDate:t?.firstWeekContainsDate??r?.options?.firstWeekContainsDate??1}),getISOWeek:e=>vO(o(e)),differenceInCalendarDays:(e,t)=>zD(o(e),o(t)),differenceInCalendarMonths:(e,t)=>JD(o(e),o(t))}}var pP=e=>e instanceof HTMLElement?e:null,mP=e=>[...e.querySelectorAll(`[data-animated-month]`)??[]],hP=e=>pP(e.querySelector(`[data-animated-month]`)),gP=e=>pP(e.querySelector(`[data-animated-caption]`)),_P=e=>pP(e.querySelector(`[data-animated-weeks]`)),vP=e=>pP(e.querySelector(`[data-animated-nav]`)),yP=e=>pP(e.querySelector(`[data-animated-weekdays]`));function bP(e,t,{classNames:n,months:r,focused:i,dateLib:a}){let o=(0,v.useRef)(null),s=(0,v.useRef)(r),c=(0,v.useRef)(!1);(0,v.useLayoutEffect)(()=>{let l=s.current;if(s.current=r,!t||!e.current||!(e.current instanceof HTMLElement)||r.length===0||l.length===0||r.length!==l.length)return;let u=a.isSameMonth(r[0].date,l[0].date),d=a.isAfter(r[0].date,l[0].date),f=d?n[XM.caption_after_enter]:n[XM.caption_before_enter],p=d?n[XM.weeks_after_enter]:n[XM.weeks_before_enter],m=o.current,h=e.current.cloneNode(!0);if(h instanceof HTMLElement?(mP(h).forEach(e=>{if(!(e instanceof HTMLElement))return;let t=hP(e);t&&e.contains(t)&&e.removeChild(t);let n=gP(e);n&&n.classList.remove(f);let r=_P(e);r&&r.classList.remove(p)}),o.current=h):o.current=null,c.current||u||i)return;let g=m instanceof HTMLElement?mP(m):[],_=mP(e.current);if(_?.every(e=>e instanceof HTMLElement)&&g&&g.every(e=>e instanceof HTMLElement)){c.current=!0;let t=[];e.current.style.isolation=`isolate`;let r=vP(e.current);r&&(r.style.zIndex=`1`),_.forEach((i,a)=>{let o=g[a];if(!o)return;i.style.position=`relative`,i.style.overflow=`hidden`;let s=gP(i);s&&s.classList.add(f);let l=_P(i);l&&l.classList.add(p);let u=()=>{c.current=!1,e.current&&(e.current.style.isolation=``),r&&(r.style.zIndex=``),s&&s.classList.remove(f),l&&l.classList.remove(p),i.style.position=``,i.style.overflow=``,i.contains(o)&&i.removeChild(o)};t.push(u),o.style.pointerEvents=`none`,o.style.position=`absolute`,o.style.overflow=`hidden`,o.setAttribute(`aria-hidden`,`true`);let m=yP(o);m&&(m.style.opacity=`0`);let h=gP(o);h&&(h.classList.add(d?n[XM.caption_before_exit]:n[XM.caption_after_exit]),h.addEventListener(`animationend`,u));let _=_P(o);_&&_.classList.add(d?n[XM.weeks_before_exit]:n[XM.weeks_after_exit]),i.insertBefore(o,i.firstChild)})}})}function xP(e,t,n,r){let i=e[0],a=e[e.length-1],{ISOWeek:o,fixedWeeks:s,broadcastCalendar:c}=n??{},{addDays:l,differenceInCalendarDays:u,differenceInCalendarMonths:d,endOfBroadcastWeek:f,endOfISOWeek:p,endOfMonth:m,endOfWeek:h,isAfter:g,startOfBroadcastWeek:_,startOfISOWeek:v,startOfWeek:y}=r,b=c?_(i,r):o?v(i):y(i),x=c?f(a):o?p(m(a)):h(m(a)),S=t&&(c?f(t):o?p(t):h(t)),C=u(S&&g(x,S)?S:x,b),w=d(a,i)+1,T=[];for(let e=0;e<=C;e++){let t=l(b,e);T.push(t)}let E=(c?35:42)*w;if(s&&T.length<E){let e=E-T.length;for(let t=0;t<e;t++){let e=l(T[T.length-1],1);T.push(e)}}return T}function SP(e){let t=[];return e.reduce((e,n)=>{let r=n.weeks.reduce((e,t)=>e.concat(t.days.slice()),t.slice());return e.concat(r.slice())},t.slice())}function CP(e,t,n,r){let{numberOfMonths:i=1}=n,a=[];for(let n=0;n<i;n++){let i=r.addMonths(e,n);if(t&&i>t)break;a.push(i)}return a}function wP(e,t,n,r){let{month:i,defaultMonth:a,today:o=r.today(),numberOfMonths:s=1}=e,c=i||a||o,{differenceInCalendarMonths:l,addMonths:u,startOfMonth:d}=r;return n&&l(n,c)<s-1&&(c=u(n,-1*(s-1))),t&&l(c,t)<0&&(c=t),d(c)}function TP(e,t,n,r){let{addDays:i,endOfBroadcastWeek:a,endOfISOWeek:o,endOfMonth:s,endOfWeek:c,getISOWeek:l,getWeek:u,startOfBroadcastWeek:d,startOfISOWeek:f,startOfWeek:p}=r,m=e.reduce((e,m)=>{let h=n.broadcastCalendar?d(m,r):n.ISOWeek?f(m):p(m),g=n.broadcastCalendar?a(m):n.ISOWeek?o(s(m)):c(s(m)),_=t.filter(e=>e>=h&&e<=g),v=n.broadcastCalendar?35:42;if(n.fixedWeeks&&_.length<v){let e=t.filter(e=>{let t=v-_.length;return e>g&&e<=i(g,t)});_.push(...e)}let y=new BM(m,_.reduce((e,t)=>{let i=n.ISOWeek?l(t):u(t),a=e.find(e=>e.weekNumber===i),o=new zM(t,m,r);return a?a.days.push(o):e.push(new VM(i,[o])),e},[]));return e.push(y),e},[]);return n.reverseMonths?m.reverse():m}function EP(e,t){let{startMonth:n,endMonth:r}=e,{startOfYear:i,startOfDay:a,startOfMonth:o,endOfMonth:s,addYears:c,endOfYear:l,newDate:u,today:d}=t,{fromYear:f,toYear:p,fromMonth:m,toMonth:h}=e;!n&&m&&(n=m),!n&&f&&(n=t.newDate(f,0,1)),!r&&h&&(r=h),!r&&p&&(r=u(p,11,31));let g=e.captionLayout===`dropdown`||e.captionLayout===`dropdown-years`;return n?n=o(n):f?n=u(f,0,1):!n&&g&&(n=i(c(e.today??d(),-100))),r?r=s(r):p?r=u(p,11,31):!r&&g&&(r=l(e.today??d())),[n&&a(n),r&&a(r)]}function DP(e,t,n,r){if(n.disableNavigation)return;let{pagedNavigation:i,numberOfMonths:a=1}=n,{startOfMonth:o,addMonths:s,differenceInCalendarMonths:c}=r,l=i?a:1,u=o(e);if(!t||!(c(t,e)<a))return s(u,l)}function OP(e,t,n,r){if(n.disableNavigation)return;let{pagedNavigation:i,numberOfMonths:a}=n,{startOfMonth:o,addMonths:s,differenceInCalendarMonths:c}=r,l=i?a??1:1,u=o(e);if(!t||!(c(u,t)<=0))return s(u,-l)}function kP(e){return e.reduce((e,t)=>e.concat(t.weeks.slice()),[].slice())}function AP(e,t){let[n,r]=(0,v.useState)(e);return[t===void 0?n:t,r]}function jP(e,t){let[n,r]=EP(e,t),{startOfMonth:i,endOfMonth:a}=t,o=wP(e,n,r,t),[s,c]=AP(o,e.month?o:void 0);(0,v.useEffect)(()=>{c(wP(e,n,r,t))},[e.timeZone]);let{months:l,weeks:u,days:d,previousMonth:f,nextMonth:p}=(0,v.useMemo)(()=>{let i=CP(s,r,{numberOfMonths:e.numberOfMonths},t),o=TP(i,xP(i,e.endMonth?a(e.endMonth):void 0,{ISOWeek:e.ISOWeek,fixedWeeks:e.fixedWeeks,broadcastCalendar:e.broadcastCalendar},t),{broadcastCalendar:e.broadcastCalendar,fixedWeeks:e.fixedWeeks,ISOWeek:e.ISOWeek,reverseMonths:e.reverseMonths},t);return{months:o,weeks:kP(o),days:SP(o),previousMonth:OP(s,n,e,t),nextMonth:DP(s,r,e,t)}},[t,s.getTime(),r?.getTime(),n?.getTime(),e.disableNavigation,e.broadcastCalendar,e.endMonth?.getTime(),e.fixedWeeks,e.ISOWeek,e.numberOfMonths,e.pagedNavigation,e.reverseMonths]),{disableNavigation:m,onMonthChange:h}=e,g=e=>u.some(t=>t.days.some(t=>t.isEqualTo(e))),_=e=>{if(m)return;let t=i(e);n&&t<i(n)&&(t=i(n)),r&&t>i(r)&&(t=i(r)),c(t),h?.(t)};return{months:l,weeks:u,days:d,navStart:n,navEnd:r,previousMonth:f,nextMonth:p,goToMonth:_,goToDay:e=>{g(e)||_(e.date)}}}var MP;(function(e){e[e.Today=0]=`Today`,e[e.Selected=1]=`Selected`,e[e.LastFocused=2]=`LastFocused`,e[e.FocusedModifier=3]=`FocusedModifier`})(MP||={});function NP(e){return!e[JM.disabled]&&!e[JM.hidden]&&!e[JM.outside]}function PP(e,t,n,r){let i,a=-1;for(let o of e){let e=t(o);NP(e)&&(e[JM.focused]&&a<MP.FocusedModifier?(i=o,a=MP.FocusedModifier):r?.isEqualTo(o)&&a<MP.LastFocused?(i=o,a=MP.LastFocused):n(o.date)&&a<MP.Selected?(i=o,a=MP.Selected):e[JM.today]&&a<MP.Today&&(i=o,a=MP.Today))}return i||=e.find(e=>NP(t(e))),i}function FP(e,t,n,r,i,a,o){let{ISOWeek:s,broadcastCalendar:c}=a,{addDays:l,addMonths:u,addWeeks:d,addYears:f,endOfBroadcastWeek:p,endOfISOWeek:m,endOfWeek:h,max:g,min:_,startOfBroadcastWeek:v,startOfISOWeek:y,startOfWeek:b}=o,x={day:l,week:d,month:u,year:f,startOfWeek:e=>c?v(e,o):s?y(e):b(e),endOfWeek:e=>c?p(e):s?m(e):h(e)}[e](n,t===`after`?1:-1);return t===`before`&&r?x=g([r,x]):t===`after`&&i&&(x=_([i,x])),x}function IP(e,t,n,r,i,a,o,s=0){if(s>365)return;let c=FP(e,t,n.date,r,i,a,o),l=!!(a.disabled&&ON(c,a.disabled,o)),u=!!(a.hidden&&ON(c,a.hidden,o)),d=new zM(c,c,o);return!l&&!u?d:IP(e,t,d,r,i,a,o,s+1)}function LP(e,t,n,r,i){let{autoFocus:a}=e,[o,s]=(0,v.useState)(),c=PP(t.days,n,r||(()=>!1),o),[l,u]=(0,v.useState)(a?c:void 0);return{isFocusTarget:e=>!!c?.isEqualTo(e),setFocused:u,focused:l,blur:()=>{s(l),u(void 0)},moveFocus:(n,r)=>{if(!l)return;let a=IP(n,r,l,t.navStart,t.navEnd,e,i);a&&(e.disableNavigation&&!t.days.some(e=>e.isEqualTo(a))||(t.goToDay(a),u(a)))}}}function RP(e,t){let{selected:n,required:r,onSelect:i}=e,[a,o]=AP(n,i?n:void 0),s=i?n:a,{isSameDay:c}=t,l=e=>s?.some(t=>c(t,e))??!1,{min:u,max:d}=e;return{selected:s,select:(e,t,n)=>{let a=[...s??[]];if(l(e)){if(s?.length===u||r&&s?.length===1)return;a=s?.filter(t=>!c(t,e))}else a=s?.length===d?[e]:[...a,e];return i||o(a),i?.(a,e,t,n),a},isSelected:l}}function zP(e,t,n=0,r=0,i=!1,a=RM){let{from:o,to:s}=t||{},{isSameDay:c,isAfter:l,isBefore:u}=a,d;if(!o&&!s)d={from:e,to:n>0?void 0:e};else if(o&&!s)d=c(o,e)?n===0?{from:o,to:e}:i?{from:o,to:void 0}:void 0:u(e,o)?{from:e,to:o}:{from:o,to:e};else if(o&&s)if(c(o,e)&&c(s,e))d=i?{from:o,to:s}:void 0;else if(c(o,e))d={from:o,to:n>0?void 0:e};else if(c(s,e))d={from:e,to:n>0?void 0:e};else if(u(e,o))d={from:e,to:s};else if(l(e,o))d={from:o,to:e};else if(l(e,s))d={from:o,to:e};else throw Error(`Invalid range`);if(d?.from&&d?.to){let t=a.differenceInCalendarDays(d.to,d.from);(r>0&&t>r||n>1&&t<n)&&(d={from:e,to:void 0})}return d}function BP(e,t,n=RM){let r=Array.isArray(t)?t:[t],i=e.from,a=n.differenceInCalendarDays(e.to,e.from),o=Math.min(a,6);for(let e=0;e<=o;e++){if(r.includes(i.getDay()))return!0;i=n.addDays(i,1)}return!1}function VP(e,t,n=RM){return xN(e,t.from,!1,n)||xN(e,t.to,!1,n)||xN(t,e.from,!1,n)||xN(t,e.to,!1,n)}function HP(e,t,n=RM){let r=Array.isArray(t)?t:[t];if(r.filter(e=>typeof e!=`function`).some(t=>typeof t==`boolean`?t:n.isDate(t)?xN(e,t,!1,n):DN(t,n)?t.some(t=>xN(e,t,!1,n)):CN(t)?t.from&&t.to?VP(e,{from:t.from,to:t.to},n):!1:EN(t)?BP(e,t.dayOfWeek,n):SN(t)?n.isAfter(t.before,t.after)?VP(e,{from:n.addDays(t.after,1),to:n.addDays(t.before,-1)},n):ON(e.from,t,n)||ON(e.to,t,n):wN(t)||TN(t)?ON(e.from,t,n)||ON(e.to,t,n):!1))return!0;let i=r.filter(e=>typeof e==`function`);if(i.length){let t=e.from,r=n.differenceInCalendarDays(e.to,e.from);for(let e=0;e<=r;e++){if(i.some(e=>e(t)))return!0;t=n.addDays(t,1)}}return!1}function UP(e,t){let{disabled:n,excludeDisabled:r,resetOnSelect:i,selected:a,required:o,onSelect:s}=e,[c,l]=AP(a,s?a:void 0),u=s?a:c;return{selected:u,select:(a,c,d)=>{let{min:f,max:p}=e,m;if(a){let e=u?.from,n=u?.to,r=!!e&&!!n,s=!!e&&!!n&&t.isSameDay(e,n)&&t.isSameDay(a,e);m=i&&(r||!u?.from)?!o&&s?void 0:{from:a,to:void 0}:zP(a,u,f,p,o,t)}return r&&n&&m?.from&&m.to&&HP({from:m.from,to:m.to},n,t)&&(m.from=a,m.to=void 0),s||l(m),s?.(m,a,c,d),m},isSelected:e=>u&&xN(u,e,!1,t)}}function WP(e,t){let{selected:n,required:r,onSelect:i}=e,[a,o]=AP(n,i?n:void 0),s=i?n:a,{isSameDay:c}=t;return{selected:s,select:(e,t,n)=>{let a=e;return!r&&s&&s&&c(e,s)&&(a=void 0),i||o(a),i?.(a,e,t,n),a},isSelected:e=>s?c(s,e):!1}}function GP(e,t){let n=WP(e,t),r=RP(e,t),i=UP(e,t);switch(e.mode){case`single`:return n;case`multiple`:return r;case`range`:return i;default:return}}function KP(e,t){return e instanceof AM&&e.timeZone===t?e:new AM(e,t)}function qP(e,t,n){if(!n)return KP(e,t);let r=KP(e,t),i=new AM(r.getFullYear(),r.getMonth(),r.getDate(),12,0,0,t);return new Date(i.getTime())}function JP(e,t,n){return typeof e==`boolean`||typeof e==`function`?e:e instanceof Date?qP(e,t,n):Array.isArray(e)?e.map(e=>e instanceof Date?qP(e,t,n):e):CN(e)?{...e,from:e.from?KP(e.from,t):e.from,to:e.to?KP(e.to,t):e.to}:SN(e)?{before:qP(e.before,t,n),after:qP(e.after,t,n)}:wN(e)?{after:qP(e.after,t,n)}:TN(e)?{before:qP(e.before,t,n)}:e}function YP(e,t,n){return e&&(Array.isArray(e)?e.map(e=>JP(e,t,n)):JP(e,t,n))}function XP(e){let t=e,n=t.timeZone;if(n&&(t={...e,timeZone:n},t.today&&=KP(t.today,n),t.month&&=KP(t.month,n),t.defaultMonth&&=KP(t.defaultMonth,n),t.startMonth&&=KP(t.startMonth,n),t.endMonth&&=KP(t.endMonth,n),t.mode===`single`&&t.selected?t.selected=KP(t.selected,n):t.mode===`multiple`&&t.selected?t.selected=t.selected?.map(e=>KP(e,n)):t.mode===`range`&&t.selected&&(t.selected={from:t.selected.from?KP(t.selected.from,n):t.selected.from,to:t.selected.to?KP(t.selected.to,n):t.selected.to}),t.disabled!==void 0&&(t.disabled=YP(t.disabled,n)),t.hidden!==void 0&&(t.hidden=YP(t.hidden,n)),t.modifiers)){let e={};Object.keys(t.modifiers).forEach(r=>{e[r]=YP(t.modifiers?.[r],n)}),t.modifiers=e}let{components:r,formatters:i,labels:a,dateLib:o,locale:s,classNames:c}=(0,v.useMemo)(()=>{let e={...IM,...t.locale},n=t.broadcastCalendar?1:t.weekStartsOn,r=t.noonSafe&&t.timeZone?fP(t.timeZone,{weekStartsOn:n,locale:e}):void 0,i=t.dateLib&&r?{...r,...t.dateLib}:t.dateLib??r,a=new LM({locale:e,weekStartsOn:n,firstWeekContainsDate:t.firstWeekContainsDate,useAdditionalWeekYearTokens:t.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:t.useAdditionalDayOfYearTokens,timeZone:t.timeZone,numerals:t.numerals},i);return{dateLib:a,components:jN(t.components),formatters:WN(t.formatters),labels:sP(t.labels,a.options),locale:e,classNames:{...NN(),...t.classNames}}},[t.locale,t.broadcastCalendar,t.weekStartsOn,t.firstWeekContainsDate,t.useAdditionalWeekYearTokens,t.useAdditionalDayOfYearTokens,t.timeZone,t.numerals,t.dateLib,t.noonSafe,t.components,t.formatters,t.labels,t.classNames]);t.today||(t={...t,today:o.today()});let{captionLayout:l,mode:u,navLayout:d,numberOfMonths:f=1,onDayBlur:p,onDayClick:m,onDayFocus:h,onDayKeyDown:g,onDayMouseEnter:_,onDayMouseLeave:y,onNextClick:b,onPrevClick:x,showWeekNumber:S,styles:C}=t,{formatCaption:w,formatDay:T,formatMonthDropdown:E,formatWeekNumber:D,formatWeekNumberHeader:O,formatWeekdayName:k,formatYearDropdown:A}=i,j=jP(t,o),{days:M,months:N,navStart:P,navEnd:F,previousMonth:I,nextMonth:L,goToMonth:R}=j,ee=kN(M,t,P,F,o),{isSelected:te,select:ne,selected:z}=GP(t,o)??{},{blur:B,focused:re,isFocusTarget:V,moveFocus:ie,setFocused:ae}=LP(t,j,ee,te??(()=>!1),o),{labelDayButton:oe,labelGridcell:se,labelGrid:ce,labelMonthDropdown:le,labelNav:ue,labelPrevious:de,labelNext:fe,labelWeekday:pe,labelWeekNumber:me,labelWeekNumberHeader:he,labelYearDropdown:ge}=a,_e=(0,v.useMemo)(()=>uP(o,t.ISOWeek,t.broadcastCalendar,t.today),[o,t.ISOWeek,t.broadcastCalendar,t.today]),ve=u!==void 0||m!==void 0,ye=(0,v.useCallback)(()=>{I&&(R(I),x?.(I))},[I,R,x]),be=(0,v.useCallback)(()=>{L&&(R(L),b?.(L))},[R,L,b]),xe=(0,v.useCallback)((e,t)=>n=>{n.preventDefault(),n.stopPropagation(),ae(e),!t.disabled&&(ne?.(e.date,t,n),m?.(e.date,t,n))},[ne,m,ae]),Se=(0,v.useCallback)((e,t)=>n=>{ae(e),h?.(e.date,t,n)},[h,ae]),Ce=(0,v.useCallback)((e,t)=>n=>{B(),p?.(e.date,t,n)},[B,p]),we=(0,v.useCallback)((e,n)=>r=>{let i={ArrowLeft:[r.shiftKey?`month`:`day`,t.dir===`rtl`?`after`:`before`],ArrowRight:[r.shiftKey?`month`:`day`,t.dir===`rtl`?`before`:`after`],ArrowDown:[r.shiftKey?`year`:`week`,`after`],ArrowUp:[r.shiftKey?`year`:`week`,`before`],PageUp:[r.shiftKey?`year`:`month`,`before`],PageDown:[r.shiftKey?`year`:`month`,`after`],Home:[`startOfWeek`,`before`],End:[`endOfWeek`,`after`]};if(i[r.key]){r.preventDefault(),r.stopPropagation();let[e,t]=i[r.key];ie(e,t)}g?.(e.date,n,r)},[ie,g,t.dir]),Te=(0,v.useCallback)((e,t)=>n=>{_?.(e.date,t,n)},[_]),Ee=(0,v.useCallback)((e,t)=>n=>{y?.(e.date,t,n)},[y]),De=(0,v.useCallback)(e=>t=>{let n=Number(t.target.value);R(o.setMonth(o.startOfMonth(e),n))},[o,R]),Oe=(0,v.useCallback)(e=>t=>{let n=Number(t.target.value);R(o.setYear(o.startOfMonth(e),n))},[o,R]),{className:ke,style:Ae}=(0,v.useMemo)(()=>({className:[c[qM.Root],t.className].filter(Boolean).join(` `),style:{...C?.[qM.Root],...t.style}}),[c,t.className,t.style,C]),je=MN(t),Me=(0,v.useRef)(null);bP(Me,!!t.animate,{classNames:c,months:N,focused:re,dateLib:o});let Ne={dayPickerProps:t,selected:z,select:ne,isSelected:te,months:N,nextMonth:L,previousMonth:I,goToMonth:R,getModifiers:ee,components:r,classNames:c,styles:C,labels:a,formatters:i};return v.createElement(iN.Provider,{value:Ne},v.createElement(r.Root,{rootRef:t.animate?Me:void 0,className:ke,style:Ae,dir:t.dir,id:t.id,lang:t.lang??s.code,nonce:t.nonce,title:t.title,role:t.role,"aria-label":t[`aria-label`],"aria-labelledby":t[`aria-labelledby`],...je},v.createElement(r.Months,{className:c[qM.Months],style:C?.[qM.Months]},!t.hideNavigation&&!d&&v.createElement(r.Nav,{"data-animated-nav":t.animate?`true`:void 0,className:c[qM.Nav],style:C?.[qM.Nav],"aria-label":ue(),onPreviousClick:ye,onNextClick:be,previousMonth:I,nextMonth:L}),N.map((e,n)=>v.createElement(r.Month,{"data-animated-month":t.animate?`true`:void 0,className:c[qM.Month],style:C?.[qM.Month],key:n,displayIndex:n,calendarMonth:e},d===`around`&&!t.hideNavigation&&n===0&&v.createElement(r.PreviousMonthButton,{type:`button`,className:c[qM.PreviousMonthButton],tabIndex:I?void 0:-1,"aria-disabled":I?void 0:!0,"aria-label":de(I),onClick:ye,"data-animated-button":t.animate?`true`:void 0},v.createElement(r.Chevron,{disabled:I?void 0:!0,className:c[qM.Chevron],orientation:t.dir===`rtl`?`right`:`left`})),v.createElement(r.MonthCaption,{"data-animated-caption":t.animate?`true`:void 0,className:c[qM.MonthCaption],style:C?.[qM.MonthCaption],calendarMonth:e,displayIndex:n},l?.startsWith(`dropdown`)?v.createElement(r.DropdownNav,{className:c[qM.Dropdowns],style:C?.[qM.Dropdowns]},(()=>{let n=l===`dropdown`||l===`dropdown-months`?v.createElement(r.MonthsDropdown,{key:`month`,className:c[qM.MonthsDropdown],"aria-label":le(),classNames:c,components:r,disabled:!!t.disableNavigation,onChange:De(e.date),options:cP(e.date,P,F,i,o),style:C?.[qM.Dropdown],value:o.getMonth(e.date)}):v.createElement(`span`,{key:`month`},E(e.date,o)),a=l===`dropdown`||l===`dropdown-years`?v.createElement(r.YearsDropdown,{key:`year`,className:c[qM.YearsDropdown],"aria-label":ge(o.options),classNames:c,components:r,disabled:!!t.disableNavigation,onChange:Oe(e.date),options:dP(P,F,i,o,!!t.reverseYears),style:C?.[qM.Dropdown],value:o.getYear(e.date)}):v.createElement(`span`,{key:`year`},A(e.date,o));return o.getMonthYearOrder()===`year-first`?[a,n]:[n,a]})(),v.createElement(`span`,{role:`status`,"aria-live":`polite`,style:{border:0,clip:`rect(0 0 0 0)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`,wordWrap:`normal`}},w(e.date,o.options,o))):v.createElement(r.CaptionLabel,{className:c[qM.CaptionLabel],role:`status`,"aria-live":`polite`},w(e.date,o.options,o))),d===`around`&&!t.hideNavigation&&n===f-1&&v.createElement(r.NextMonthButton,{type:`button`,className:c[qM.NextMonthButton],tabIndex:L?void 0:-1,"aria-disabled":L?void 0:!0,"aria-label":fe(L),onClick:be,"data-animated-button":t.animate?`true`:void 0},v.createElement(r.Chevron,{disabled:L?void 0:!0,className:c[qM.Chevron],orientation:t.dir===`rtl`?`left`:`right`})),n===f-1&&d===`after`&&!t.hideNavigation&&v.createElement(r.Nav,{"data-animated-nav":t.animate?`true`:void 0,className:c[qM.Nav],style:C?.[qM.Nav],"aria-label":ue(),onPreviousClick:ye,onNextClick:be,previousMonth:I,nextMonth:L}),v.createElement(r.MonthGrid,{role:`grid`,"aria-multiselectable":u===`multiple`||u===`range`,"aria-label":ce(e.date,o.options,o)||void 0,className:c[qM.MonthGrid],style:C?.[qM.MonthGrid]},!t.hideWeekdays&&v.createElement(r.Weekdays,{"data-animated-weekdays":t.animate?`true`:void 0,className:c[qM.Weekdays],style:C?.[qM.Weekdays]},S&&v.createElement(r.WeekNumberHeader,{"aria-label":he(o.options),className:c[qM.WeekNumberHeader],style:C?.[qM.WeekNumberHeader],scope:`col`},O()),_e.map(e=>v.createElement(r.Weekday,{"aria-label":pe(e,o.options,o),className:c[qM.Weekday],key:String(e),style:C?.[qM.Weekday],scope:`col`},k(e,o.options,o)))),v.createElement(r.Weeks,{"data-animated-weeks":t.animate?`true`:void 0,className:c[qM.Weeks],style:C?.[qM.Weeks]},e.weeks.map(e=>v.createElement(r.Week,{className:c[qM.Week],key:e.weekNumber,style:C?.[qM.Week],week:e},S&&v.createElement(r.WeekNumber,{week:e,style:C?.[qM.WeekNumber],"aria-label":me(e.weekNumber,{locale:s}),className:c[qM.WeekNumber],scope:`row`,role:`rowheader`},D(e.weekNumber,o)),e.days.map(e=>{let{date:n}=e,i=ee(e);if(i[JM.focused]=!i.hidden&&!!re?.isEqualTo(e),i[YM.selected]=te?.(n)||i.selected,CN(z)){let{from:e,to:t}=z;i[YM.range_start]=!!(e&&t&&o.isSameDay(n,e)),i[YM.range_end]=!!(e&&t&&o.isSameDay(n,t)),i[YM.range_middle]=xN(z,n,!0,o)}let a=lP(i,C,t.modifiersStyles),s=AN(i,c,t.modifiersClassNames),l=!ve&&!i.hidden?se(n,i,o.options,o):void 0;return v.createElement(r.Day,{key:`${e.isoDate}_${e.displayMonthId}`,day:e,modifiers:i,className:s.join(` `),style:a,role:`gridcell`,"aria-selected":i.selected||void 0,"aria-label":l,"data-day":e.isoDate,"data-month":e.outside?e.dateMonthId:void 0,"data-selected":i.selected||void 0,"data-disabled":i.disabled||void 0,"data-hidden":i.hidden||void 0,"data-outside":e.outside||void 0,"data-focused":i.focused||void 0,"data-today":i.today||void 0},!i.hidden&&ve?v.createElement(r.DayButton,{className:c[qM.DayButton],style:C?.[qM.DayButton],type:`button`,day:e,modifiers:i,disabled:!i.focused&&i.disabled||void 0,"aria-disabled":i.focused&&i.disabled||void 0,tabIndex:V(e)?0:-1,"aria-label":oe(n,i,o.options,o),onClick:xe(e,i),onBlur:Ce(e,i),onFocus:Se(e,i),onKeyDown:we(e,i),onMouseEnter:Te(e,i),onMouseLeave:Ee(e,i)},T(n,o.options,o)):!i.hidden&&T(e.date,o.options,o))})))))))),t.footer&&v.createElement(r.Footer,{className:c[qM.Footer],style:C?.[qM.Footer],role:`status`,"aria-live":`polite`},t.footer)))}function ZP({className:e,classNames:t,showOutsideDays:n=!0,captionLayout:r=`label`,buttonVariant:i=`ghost`,formatters:a,components:o,...s}){let c=NN();return(0,H.jsx)(XP,{showOutsideDays:n,className:K(`group/calendar bg-background p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent`,String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,e),captionLayout:r,formatters:{formatMonthDropdown:e=>e.toLocaleString(`default`,{month:`short`}),...a},classNames:{root:K(`w-fit`,c.root),months:K(`relative flex flex-col gap-4 md:flex-row`,c.months),month:K(`flex w-full flex-col gap-4`,c.month),nav:K(`absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1`,c.nav),button_previous:K(rl({variant:i}),`size-(--cell-size) p-0 select-none aria-disabled:opacity-50`,c.button_previous),button_next:K(rl({variant:i}),`size-(--cell-size) p-0 select-none aria-disabled:opacity-50`,c.button_next),month_caption:K(`flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)`,c.month_caption),dropdowns:K(`flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium`,c.dropdowns),dropdown_root:K(`relative rounded-md border border-input shadow-xs has-focus:border-ring has-focus:ring-[3px] has-focus:ring-ring/50`,c.dropdown_root),dropdown:K(`absolute inset-0 bg-popover opacity-0`,c.dropdown),caption_label:K(`font-medium select-none`,r===`label`?`text-sm`:`flex h-8 items-center gap-1 rounded-md pr-1 pl-2 text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground`,c.caption_label),table:`w-full border-collapse`,weekdays:K(`flex`,c.weekdays),weekday:K(`flex-1 rounded-md text-[0.8rem] font-normal text-muted-foreground select-none`,c.weekday),week:K(`mt-2 flex w-full`,c.week),week_number_header:K(`w-(--cell-size) select-none`,c.week_number_header),week_number:K(`text-[0.8rem] text-muted-foreground select-none`,c.week_number),day:K(`group/day relative aspect-square h-full w-full p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-r-md`,s.showWeekNumber?`[&:nth-child(2)[data-selected=true]_button]:rounded-l-md`:`[&:first-child[data-selected=true]_button]:rounded-l-md`,c.day),range_start:K(`rounded-l-md bg-accent`,c.range_start),range_middle:K(`rounded-none`,c.range_middle),range_end:K(`rounded-r-md bg-accent`,c.range_end),today:K(`rounded-md bg-accent text-accent-foreground data-[selected=true]:rounded-none`,c.today),outside:K(`text-muted-foreground aria-selected:text-muted-foreground`,c.outside),disabled:K(`text-muted-foreground opacity-50`,c.disabled),hidden:K(`invisible`,c.hidden),...t},components:{Root:({className:e,rootRef:t,...n})=>(0,H.jsx)(`div`,{"data-slot":`calendar`,ref:t,className:K(e),...n}),Chevron:({className:e,orientation:t,...n})=>t===`left`?(0,H.jsx)(Ha,{className:K(`size-4`,e),...n}):t===`right`?(0,H.jsx)(Ua,{className:K(`size-4`,e),...n}):(0,H.jsx)(Va,{className:K(`size-4`,e),...n}),DayButton:QP,WeekNumber:({children:e,...t})=>(0,H.jsx)(`td`,{...t,children:(0,H.jsx)(`div`,{className:`flex size-(--cell-size) items-center justify-center text-center`,children:e})}),...o},...s})}function QP({className:e,day:t,modifiers:n,...r}){let i=NN(),a=v.useRef(null);return v.useEffect(()=>{n.focused&&a.current?.focus()},[n.focused]),(0,H.jsx)(q,{ref:a,variant:`ghost`,size:`icon`,"data-day":t.date.toLocaleDateString(),"data-selected-single":n.selected&&!n.range_start&&!n.range_end&&!n.range_middle,"data-range-start":n.range_start,"data-range-end":n.range_end,"data-range-middle":n.range_middle,className:K(`flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal`,`group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10`,`group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/50`,`data-[range-end=true]:rounded-md data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground`,`data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground`,`data-[range-start=true]:rounded-md data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground`,`data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground`,`dark:hover:text-accent-foreground [&>span]:text-xs [&>span]:opacity-70`,i.day,e),...r})}function $P({...e}){return(0,H.jsx)(XS,{"data-slot":`popover`,...e})}function eF({...e}){return(0,H.jsx)(ZS,{"data-slot":`popover-trigger`,...e})}function tF({className:e,align:t=`center`,sideOffset:n=4,...r}){return(0,H.jsx)(QS,{children:(0,H.jsx)($S,{"data-slot":`popover-content`,align:t,sideOffset:n,className:K(`z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden`,`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`,`data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95`,`data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,e),...r})})}function nF(e){this.content=e}nF.prototype={constructor:nF,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,i=r.find(e),a=r.content.slice();return i==-1?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new nF(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new nF(n)},addToStart:function(e,t){return new nF([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new nF(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(a==-1?i.length:a,0,t,n),new nF(i)},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=nF.from(e),e.size?new nF(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=nF.from(e),e.size?new nF(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=nF.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}},nF.from=function(e){if(e instanceof nF)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new nF(t)};function rF(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){for(let e=0;i.text[e]==a.text[e];e++)n++;return n}if(i.content.size||a.content.size){let e=rF(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function iF(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=0,t=Math.min(o.text.length,s.text.length);for(;e<t&&o.text[o.text.length-e-1]==s.text[s.text.length-e-1];)e++,n--,r--;return{a:n,b:r}}if(o.content.size||s.content.size){let e=iF(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}var Q=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))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(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return rF(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return iF(this,e,t,n)}findIndex(e){if(e==0)return oF(0,e);if(e==this.size)return oF(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?oF(t+1,i):oF(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return new e(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};Q.empty=new Q([],0);var aF={index:0,offset:0};function oF(e,t){return aF.index=e,aF.offset=t,aF}function sF(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 n=0;n<e.length;n++)if(!sF(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!sF(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var cF=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else !n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&sF(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(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].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};cF.none=[];var lF=class extends Error{},uF=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=fF(this.content,t+this.openStart,n);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(dF(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(Q.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};uF.empty=new uF(Q.empty,0,0);function dF(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(dF(a.content,t-i-1,n-i-1)))}function fF(e,t,n,r){let{index:i,offset:a}=e.findIndex(t),o=e.maybeChild(i);if(a==t||o.isText)return r&&!r.canReplace(i,i,n)?null:e.cut(0,t).append(n).append(e.cut(t));let s=fF(o.content,t-a-1,n,o);return s&&e.replaceChild(i,o.copy(s))}function pF(e,t,n){if(n.openStart>e.depth)throw new lF(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new lF(`Inconsistent open depths`);return mF(e,t,n,0)}function mF(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=mF(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return yF(a,xF(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return yF(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=SF(n,e);return yF(a,bF(e,i,o,t,r))}}function hF(e,t){if(!t.type.compatibleContent(e.type))throw new lF(`Cannot join `+t.type.name+` onto `+e.type.name)}function gF(e,t,n){let r=e.node(n);return hF(r,t.node(n)),r}function _F(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 vF(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(_F(e.nodeAfter,r),a++));for(let e=a;e<o;e++)_F(i.child(e),r);t&&t.depth==n&&t.textOffset&&_F(t.nodeBefore,r)}function yF(e,t){return e.type.checkContent(t),e.copy(t)}function bF(e,t,n,r,i){let a=e.depth>i&&gF(e,t,i+1),o=r.depth>i&&gF(n,r,i+1),s=[];return vF(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(hF(a,o),_F(yF(a,bF(e,t,n,r,i+1)),s)):(a&&_F(yF(a,xF(e,t,i+1)),s),vF(t,n,i,s),o&&_F(yF(o,xF(n,r,i+1)),s)),vF(r,null,i,s),new Q(s)}function xF(e,t,n){let r=[];return vF(null,e,n,r),e.depth>n&&_F(yF(gF(e,t,n+1),xF(e,t,n+1)),r),vF(t,null,n,r),new Q(r)}function SF(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(Q.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var CF=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return cF.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new DF(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=EF.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else EF.set(t,r=new wF);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%TF,i}},wF=class{constructor(){this.elts=[],this.i=0}},TF=12,EF=new WeakMap,DF=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}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)}},OF=Object.create(null),kF=class e{constructor(e,t,n,r=cF.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||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(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&sF(this.attrs,t||e.defaultAttrs||OF)&&cF.sameSet(this.marks,n||cF.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return uF.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new uF(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return pF(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return CF.resolveCached(this,e)}resolveNoCache(e){return CF.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}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 e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),jF(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=Q.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=cF.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!cF.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=Q.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};kF.prototype.text=void 0;var AF=class e extends kF{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):jF(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function jF(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var MF=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new NF(t,n);if(r.next==null)return e.empty;let i=PF(r);r.next&&r.err(`Unexpected trailing text`);let a=WF(VF(i));return GF(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return Q.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
81
+ `)}};MF.empty=new MF(!0);var NF=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.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(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+` (in content expression '`+this.string+`')`)}};function PF(e){let t=[];do t.push(FF(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function FF(e){let t=[];do t.push(IF(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function IF(e){let t=BF(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=RF(e,t);else break;return t}function LF(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function RF(e,t){let n=LF(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:LF(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function zF(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function BF(e){if(e.eat(`(`)){let t=PF(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=zF(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function VF(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function HF(e,t){return t-e}function UF(e,t){let n=[];return r(t),n.sort(HF);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function WF(e){let t=Object.create(null);return n(UF(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);UF(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new MF(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(HF);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function GF(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}function KF(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 qF(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(i===void 0){let t=e[r];if(t.hasDefault)i=t.default;else throw RangeError(`No value supplied for attribute `+r)}n[r]=i}return n}function JF(e,t,n,r){for(let r in t)if(!(r in e))throw RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let n in e){let r=e[n];r.validate&&r.validate(t[n])}}function YF(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new QF(e,r,t[r]);return n}var XF=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(` `):[],this.attrs=YF(e,n.attrs),this.defaultAttrs=KF(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e==`text`),this.isText=e==`text`}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==MF.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?`pre`:`normal`)}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:qF(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new kF(this,this.computeAttrs(e),Q.from(t),cF.setFrom(n))}createChecked(e=null,t,n){return t=Q.from(t),this.checkContent(t),new kF(this,this.computeAttrs(e),t,cF.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=Q.from(t),t.size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(Q.empty,!0);return i?new kF(this,e,t.append(i),cF.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){JF(this.attrs,e,`node`,this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||=e.slice(0,n);return t?t.length?t:cF.none:e}static compile(t,n){let r=Object.create(null);t.forEach((t,i)=>r[t]=new e(t,n,i));let i=n.spec.topNode||`doc`;if(!r[i])throw RangeError(`Schema is missing its top node type ('`+i+`')`);if(!r.text)throw RangeError(`Every schema needs a 'text' type`);for(let e in r.text.attrs)throw RangeError(`The text node type should not have attributes`);return r}};function ZF(e,t,n){let r=n.split(`|`);return n=>{let i=n===null?`null`:typeof n;if(r.indexOf(i)<0)throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}var QF=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?ZF(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},$F=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=YF(e,r.attrs),this.excluded=null;let i=KF(this.attrs);this.instance=i?new cF(this,i):null}create(e=null){return!e&&this.instance?this.instance:new cF(this,qF(this.attrs,e))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((t,a)=>r[t]=new e(t,i++,n,a)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){JF(this.attrs,e,`mark`,this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},eI=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=nF.from(e.nodes),t.marks=nF.from(e.marks||{}),this.nodes=XF.compile(this.spec.nodes,this),this.marks=$F.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+` can not be both a node and a mark`);let t=this.nodes[e],r=t.spec.content||``,i=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=MF.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError(`Multiple linebreak nodes defined`);if(!t.isInline||!t.isLeaf)throw RangeError(`Linebreak replacement nodes must be inline leaf nodes`);this.linebreakReplacement=t}t.markSet=i==`_`?null:i?tI(this,i.split(` `)):i==``||!t.inlineContent?[]:null}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=n==null?[t]:n==``?[]:tI(this,n.split(` `))}this.nodeFromJSON=e=>kF.fromJSON(this,e),this.markFromJSON=e=>cF.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||`doc`],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if(typeof e==`string`)e=this.nodeType(e);else if(!(e instanceof XF))throw RangeError(`Invalid node type: `+e);else if(e.schema!=this)throw RangeError(`Node type from different schema used (`+e.name+`)`);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new AF(n,n.defaultAttrs,e,cF.setFrom(t))}mark(e,t){return typeof e==`string`&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError(`Unknown node type: `+e);return t}};function tI(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],a=e.marks[i],o=a;if(a)n.push(a);else for(let t in e.marks){let r=e.marks[t];(i==`_`||r.spec.group&&r.spec.group.split(` `).indexOf(i)>-1)&&n.push(o=r)}if(!o)throw SyntaxError(`Unknown mark type: '`+t[r]+`'`)}return n}function nI(e){return e.tag!=null}function rI(e){return e.style!=null}var iI=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(nI(e))this.tags.push(e);else if(rI(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new pI(this,t,!1);return n.addAll(e,cF.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new pI(this,t,!0);return n.addAll(e,cF.none,t.from,t.to),uF.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(hI(e,n.tag)&&(n.namespace===void 0||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(t===!1)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],a=r.style;if(!(a.indexOf(e)!=0||r.context&&!n.matchesContext(r.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(e===!1)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=e.priority==null?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((e.priority==null?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=gI(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=gI(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}},aI={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},oI={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},sI={ol:!0,ul:!0},cI=1,lI=2,uI=4;function dI(e,t,n){return t==null?e&&e.whitespace==`pre`?cI|lI:n&~uI:(t?cI:0)|(t===`full`?lI:0)}var fI=class{constructor(e,t,n,r,i,a){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=a,this.content=[],this.activeMarks=cF.none,this.match=i||(a&uI?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(Q.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&cI)){let e=this.content[this.content.length-1],t;if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let t=Q.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(Q.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!aI.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},pI=class{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,a=dI(null,t.preserveWhitespace,0)|(n?uI:0);i=r?new fI(r.type,r.attrs,cF.none,!0,t.topMatch||r.type.contentMatch,a):n?new fI(null,null,cF.none,!0,null,a):new fI(e.schema.topNodeType,null,cF.none,!0,null,a),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=r.options&lI?`full`:this.localPreserveWS||(r.options&cI)>0,{schema:a}=this.parser;if(i===`full`||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(!i){if(n=n.replace(/[ \t\r\n\u000c]+/g,` `),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&i.nodeName==`BR`||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}}else if(i===`full`)n=n.replace(/\r\n?/g,`
82
+ `);else if(a.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(a.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(a.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(a.text(e[n]),t,!/\S/.test(e[n]));n=``}else n=n.replace(/\r?\n|\r/g,` `);n&&this.insertNode(a.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,i=this.top;(e.tagName==`PRE`||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),o;sI.hasOwnProperty(a)&&this.parser.normalizeLists&&mI(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));out:if(s?s.ignore:oI.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let n,r=this.needsBlock;if(aI.hasOwnProperty(a))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break out}let o=s&&s.skip?t:this.readStyles(e,t);o&&this.addAll(e,o),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,s,n,s.consuming===!1?o:void 0)}this.localPreserveWS=r}leafFallback(e,t){e.nodeName==`BR`&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
83
+ `),t)}ignoreFallback(e,t){e.nodeName==`BR`&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text(`-`),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],i=n.getPropertyValue(r);if(i)for(let e;;){let n=this.parser.matchStyle(r,i,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),n.consuming===!1)e=n;else break}}return t}addElementByRule(e,t,n,r){let i,a;if(t.node)if(a=this.parser.schema.nodes[t.node],a.isLeaf)this.insertNode(a.create(t.attrs),n,e.nodeName==`BR`)||this.leafFallback(e,n);else{let e=this.enter(a,t.attrs||null,n,t.preserveWhitespace);e&&(i=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let o=this.top;if(a&&a.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;typeof t.contentElement==`string`?r=e.querySelector(t.contentElement):typeof t.contentElement==`function`?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}i&&this.sync(o)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let a=n?e.childNodes[n]:e.firstChild,o=r==null?null:e.childNodes[r];a!=o;a=a.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(a,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,a=0;t>=0;t--){let o=this.nodes[t],s=o.findWrapping(e);if(s&&(!r||r.length>s.length+a)&&(r=s,i=o,!s.length))break;if(o.solid){if(n)break;a+=2}}if(!r)return null;this.sync(i);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&=t.match.matchType(e.type);let n=cF.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):_I(i.type,e.type))&&(n=i.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let i=this.findPlace(e.create(t),n,!1);return i&&=this.enterInner(e,t,n,!0,r),i}enterInner(e,t,n,r=!1,i){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let o=dI(e,i,a.options);a.options&uI&&a.content.length==0&&(o|=uI);let s=cF.none;return n=n.filter(t=>(a.type?a.type.allowsMarkType(t.type):_I(t.type,e))?(s=t.addToSet(s),!1):!0),this.nodes.push(new fI(e,t,s,r,null,o)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));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(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;else this.localPreserveWS&&(this.nodes[t].options|=cI);return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf(`|`)>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split(`/`),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),i=-(n?n.depth+1:0)+ +!r,a=(e,o)=>{for(;e>=0;e--){let s=t[e];if(s==``){if(e==t.length-1||e==0)continue;for(;o>=i;o--)if(a(e-1,o))return!0;return!1}else{let e=o>0||o==0&&r?this.nodes[o].type:n&&o>=i?n.node(o-i).type:null;if(!e||e.name!=s&&!e.isInGroup(s))return!1;o--}}return!0};return a(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}};function mI(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=t.nodeType==1?t.nodeName.toLowerCase():null;e&&sI.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):e==`li`?n=t:e&&(n=null)}}function hI(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function gI(e){let t={};for(let n in e)t[n]=e[n];return t}function _I(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let a=[],o=e=>{a.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:i}=e.edge(n);if(r==t||a.indexOf(i)<0&&o(i))return!0}};if(o(i.contentMatch))return!0}}var vI=class e{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||=bI(t).createDocumentFragment();let r=n,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let n=0,a=0;for(;n<i.length&&a<e.marks.length;){let t=e.marks[a];if(!this.marks[t.type.name]){a++;continue}if(!t.eq(i[n][0])||t.type.spec.spanning===!1)break;n++,a++}for(;n<i.length;)r=i.pop()[1];for(;a<e.marks.length;){let n=e.marks[a++],o=this.serializeMark(n,e.isInline,t);o&&(i.push([n,r]),r.appendChild(o.dom),r=o.contentDOM||o.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){let{dom:n,contentDOM:r}=wI(bI(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw RangeError(`Content hole not allowed in a leaf node spec`);this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&wI(bI(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return wI(e,t,n,r)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(e){let t=yI(e.nodes);return t.text||=e=>e.text,t}static marksFromSchema(e){return yI(e.marks)}};function yI(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function bI(e){return e.document||window.document}var xI=new WeakMap;function SI(e){let t=xI.get(e);return t===void 0&&xI.set(e,t=CI(e)),t}function CI(e){let t=null;function n(e){if(e&&typeof e==`object`)if(Array.isArray(e))if(typeof e[0]==`string`)t||=[],t.push(e);else for(let t=0;t<e.length;t++)n(e[t]);else for(let t in e)n(e[t])}return n(e),t}function wI(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 i=t[0],a;if(typeof i!=`string`)throw RangeError(`Invalid array passed to renderSpec`);if(r&&(a=SI(r))&&a.indexOf(t)>-1)throw RangeError(`Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.`);let o=i.indexOf(` `);o>0&&(n=i.slice(0,o),i=i.slice(o+1));let s,c=n?e.createElementNS(n,i):e.createElement(i),l=t[1],u=1;if(l&&typeof l==`object`&&l.nodeType==null&&!Array.isArray(l)){u=2;for(let e in l)if(l[e]!=null){let t=e.indexOf(` `);t>0?c.setAttributeNS(e.slice(0,t),e.slice(t+1),l[e]):e==`style`&&c.style?c.style.cssText=l[e]:c.setAttribute(e,l[e])}}for(let i=u;i<t.length;i++){let a=t[i];if(a===0){if(i<t.length-1||i>u)throw RangeError(`Content hole must be the only child of its parent node`);return{dom:c,contentDOM:c}}else{let{dom:t,contentDOM:i}=wI(e,a,n,r);if(c.appendChild(t),i){if(s)throw RangeError(`Multiple content holes`);s=i}}}return{dom:c,contentDOM:s}}var TI=65535,EI=2**16;function DI(e,t){return e+t*EI}function OI(e){return e&TI}function kI(e){return(e-(e&TI))/EI}var AI=1,jI=2,MI=4,NI=8,PI=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&NI)>0}get deletedBefore(){return(this.delInfo&(AI|MI))>0}get deletedAfter(){return(this.delInfo&(jI|MI))>0}get deletedAcross(){return(this.delInfo&MI)>0}},FI=class e{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}recover(e){let t=0,n=OI(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[e*3+2]-this.ranges[e*3+1];return this.ranges[n*3]+t+kI(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,a=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let s=this.ranges[o]-(this.inverted?r:0);if(s>e)break;let c=this.ranges[o+i],l=this.ranges[o+a],u=s+c;if(e<=u){let i=c?e==s?-1:e==u?1:t:t,a=s+r+(i<0?0:l);if(n)return a;let d=e==(t<0?s:u)?null:DI(o/3,e-s),f=e==s?jI:e==u?AI:MI;return(t<0?e!=s:e!=u)&&(f|=NI),new PI(a,f,d)}r+=l-c}return n?e+r:new PI(e+r,0,null)}touches(e,t){let n=0,r=OI(t),i=this.inverted?2:1,a=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let o=this.ranges[t]-(this.inverted?n:0);if(o>e)break;let s=this.ranges[t+i];if(e<=o+s&&t==r*3)return!0;n+=this.ranges[t+a]-s}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let a=this.ranges[r],o=a-(this.inverted?i:0),s=a+(this.inverted?0:i),c=this.ranges[r+t],l=this.ranges[r+n];e(o,o+c,s,s+l),i+=l-c}}invert(){return new e(this.ranges,!this.inverted)}toString(){return(this.inverted?`-`:``)+JSON.stringify(this.ranges)}static offset(t){return t==0?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}};FI.empty=new FI([]);var II=class e{constructor(e,t,n=0,r=e?e.length:0){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(t=0,n=this.maps.length){return new e(this._maps,this.mirror,t,n)}appendMap(e,t){this.ownData||=(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],r!=null&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||=[],this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),r!=null&&r>t?n-r-1:void 0)}}invert(){let t=new e;return t.appendMappingInverted(this),t}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let i=this._maps[n].mapResult(e,t);if(i.recover!=null){let t=this.getMirror(n);if(t!=null&&t>n&&t<this.to){n=t,e=this._maps[t].recover(i.recover);continue}}r|=i.delInfo,e=i.pos}return n?e:new PI(e,r,null)}},LI=Object.create(null),RI=class{getMap(){return FI.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError(`Invalid input for Step.fromJSON`);let n=LI[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in LI)throw RangeError(`Duplicate use of step JSON ID `+e);return LI[e]=t,t.prototype.jsonID=e,t}},zI=class e{constructor(e,t){this.doc=e,this.failed=t}static ok(t){return new e(t,null)}static fail(t){return new e(null,t)}static fromReplace(t,n,r,i){try{return e.ok(t.replace(n,r,i))}catch(t){if(t instanceof lF)return e.fail(t.message);throw t}}};function BI(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let a=e.child(i);a.content.size&&(a=a.copy(BI(a.content,t,a))),a.isInline&&(a=t(a,n,i)),r.push(a)}return Q.fromArray(r)}var VI=class e extends RI{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new uF(BI(t.content,(e,t)=>!e.isAtom||!t.type.allowsMarkType(this.mark.type)?e:e.mark(this.mark.addToSet(e.marks)),r),t.openStart,t.openEnd);return zI.fromReplace(e,this.from,this.to,i)}invert(){return new HI(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 e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(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 RangeError(`Invalid input for AddMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};RI.jsonID(`addMark`,VI);var HI=class e extends RI{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new uF(BI(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return zI.fromReplace(e,this.from,this.to,n)}invert(){return new VI(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(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 RangeError(`Invalid input for RemoveMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};RI.jsonID(`removeMark`,HI);var UI=class e extends RI{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return zI.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return zI.fromReplace(e,this.pos,this.pos+1,new uF(Q.from(n),0,+!t.isLeaf))}invert(t){let n=t.nodeAt(this.pos);if(n){let t=this.mark.addToSet(n.marks);if(t.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(t))return new e(this.pos,n.marks[r]);return new e(this.pos,this.mark)}}return new WI(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(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 RangeError(`Invalid input for AddNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};RI.jsonID(`addNodeMark`,UI);var WI=class e extends RI{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return zI.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return zI.fromReplace(e,this.pos,this.pos+1,new uF(Q.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new UI(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(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 RangeError(`Invalid input for RemoveNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};RI.jsonID(`removeNodeMark`,WI);var GI=class e extends RI{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&qI(e,this.from,this.to)?zI.fail(`Structure replace would overwrite content`):zI.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new FI([this.from,this.to-this.from,this.slice.size])}invert(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.to,-1),r=this.from==this.to&&e.MAP_BIAS<0?n:t.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new e(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(t){if(!(t instanceof e)||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?uF.empty:new uF(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(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?uF.empty:new uF(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:`replace`,from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for ReplaceStep.fromJSON`);return new e(n.from,n.to,uF.fromJSON(t,n.slice),!!n.structure)}};GI.MAP_BIAS=1,RI.jsonID(`replace`,GI);var KI=class e extends RI{constructor(e,t,n,r,i,a,o=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=a,this.structure=o}apply(e){if(this.structure&&(qI(e,this.from,this.gapFrom)||qI(e,this.gapTo,this.to)))return zI.fail(`Structure gap-replace would overwrite content`);let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return zI.fail(`Gap is not a flat range`);let n=this.slice.insertAt(this.insert,t.content);return n?zI.fromReplace(e,this.from,this.to,n):zI.fail(`Content does not fit in gap`)}getMap(){return new FI([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 e(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),i=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),a=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||a>r.pos?null:new e(n.pos,r.pos,i,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:`replaceAround`,from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}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 RangeError(`Invalid input for ReplaceAroundStep.fromJSON`);return new e(n.from,n.to,n.gapFrom,n.gapTo,uF.fromJSON(t,n.slice),n.insert,!!n.structure)}};RI.jsonID(`replaceAround`,KI);function qI(e,t,n){let r=e.resolve(t),i=n-t,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let e=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function JI(e,t,n,r){let i=[],a=[],o,s;e.doc.nodesBetween(t,n,(e,c,l)=>{if(!e.isInline)return;let u=e.marks;if(!r.isInSet(u)&&l.type.allowsMarkType(r.type)){let l=Math.max(c,t),d=Math.min(c+e.nodeSize,n),f=r.addToSet(u);for(let e=0;e<u.length;e++)u[e].isInSet(f)||(o&&o.to==l&&o.mark.eq(u[e])?o.to=d:i.push(o=new HI(l,d,u[e])));s&&s.to==l?s.to=d:a.push(s=new VI(l,d,r))}}),i.forEach(t=>e.step(t)),a.forEach(t=>e.step(t))}function YI(e,t,n,r){let i=[],a=0;e.doc.nodesBetween(t,n,(e,o)=>{if(!e.isInline)return;a++;let s=null;if(r instanceof $F){let t=e.marks,n;for(;n=r.isInSet(t);)(s||=[]).push(n),t=n.removeFromSet(t)}else r?r.isInSet(e.marks)&&(s=[r]):s=e.marks;if(s&&s.length){let r=Math.min(o+e.nodeSize,n);for(let e=0;e<s.length;e++){let n=s[e],c;for(let e=0;e<i.length;e++){let t=i[e];t.step==a-1&&n.eq(i[e].style)&&(c=t)}c?(c.to=r,c.step=a):i.push({style:n,from:Math.max(o,t),to:r,step:a})}}}),i.forEach(t=>e.step(new HI(t.from,t.to,t.style)))}function XI(e,t,n,r=n.contentMatch,i=!0){let a=e.doc.nodeAt(t),o=[],s=t+1;for(let t=0;t<a.childCount;t++){let c=a.child(t),l=s+c.nodeSize,u=r.matchType(c.type);if(!u)o.push(new GI(s,l,uF.empty));else{r=u;for(let t=0;t<c.marks.length;t++)n.allowsMarkType(c.marks[t].type)||e.step(new HI(s,l,c.marks[t]));if(i&&c.isText&&n.whitespace!=`pre`){let e,t=/\r?\n|\r/g,r;for(;e=t.exec(c.text);)r||=new uF(Q.from(n.schema.text(` `,n.allowedMarks(c.marks))),0,0),o.push(new GI(s+e.index,s+e.index+e[0].length,r))}}s=l}if(!r.validEnd){let t=r.fillBefore(Q.empty,!0);e.replace(s,s,new uF(t,0,0))}for(let t=o.length-1;t>=0;t--)e.step(o[t])}function ZI(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function QI(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,i=0;;--n){let a=e.$from.node(n),o=e.$from.index(n)+r,s=e.$to.indexAfter(n)-i;if(n<e.depth&&a.canReplace(o,s,t))return n;if(n==0||a.type.spec.isolating||!ZI(a,o,s))break;o&&(r=1),s<a.childCount&&(i=1)}return null}function $I(e,t,n){let{$from:r,$to:i,depth:a}=t,o=r.before(a+1),s=i.after(a+1),c=o,l=s,u=Q.empty,d=0;for(let e=a,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,u=Q.from(r.node(e).copy(u)),d++):c--;let f=Q.empty,p=0;for(let e=a,t=!1;e>n;e--)t||i.after(e+1)<i.end(e)?(t=!0,f=Q.from(i.node(e).copy(f)),p++):l++;e.step(new KI(c,l,o,s,new uF(u.append(f),d,p),u.size-d,!0))}function eL(e,t,n=null,r=e){let i=nL(e,t),a=i&&rL(r,t);return a?i.map(tL).concat({type:t,attrs:n}).concat(a.map(tL)):null}function tL(e){return{type:e,attrs:null}}function nL(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.contentMatchAt(r).findWrapping(t);if(!a)return null;let o=a.length?a[0]:t;return n.canReplaceWith(r,i,o)?a:null}function rL(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.child(r),o=t.contentMatch.findWrapping(a.type);if(!o)return null;let s=(o.length?o[o.length-1]:t).contentMatch;for(let e=r;s&&e<i;e++)s=s.matchType(n.child(e).type);return!s||!s.validEnd?null:o}function iL(e,t,n){let r=Q.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw RangeError(`Wrapper type given to Transform.wrap does not form valid content of its parent wrapper`)}r=Q.from(n[e].type.create(n[e].attrs,r))}let i=t.start,a=t.end;e.step(new KI(i,a,i,a,new uF(r,0,0),n.length,!0))}function aL(e,t,n,r,i){if(!r.isTextblock)throw RangeError(`Type given to setBlockType should be a textblock`);let a=e.steps.length;e.doc.nodesBetween(t,n,(t,n)=>{let o=typeof i==`function`?i(t):i;if(t.isTextblock&&!t.hasMarkup(r,o)&&cL(e.doc,e.mapping.slice(a).map(n),r)){let i=null;if(r.schema.linebreakReplacement){let e=r.whitespace==`pre`,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?i=!1:!e&&t&&(i=!0)}i===!1&&sL(e,t,n,a),XI(e,e.mapping.slice(a).map(n,1),r,void 0,i===null);let s=e.mapping.slice(a),c=s.map(n,1),l=s.map(n+t.nodeSize,1);return e.step(new KI(c,l,c+1,l-1,new uF(Q.from(r.create(o,null,t.marks)),0,0),1,!0)),i===!0&&oL(e,t,n,a),!1}})}function oL(e,t,n,r){t.forEach((i,a)=>{if(i.isText){let o,s=/\r?\n|\r/g;for(;o=s.exec(i.text);){let i=e.mapping.slice(r).map(n+1+a+o.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function sL(e,t,n,r){t.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+a);e.replaceWith(i,i+1,t.type.schema.text(`
84
+ `))}})}function cL(e,t,n){let r=e.resolve(t),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function lL(e,t,n,r,i){let a=e.doc.nodeAt(t);if(!a)throw RangeError(`No node at given position`);n||=a.type;let o=n.create(r,null,i||a.marks);if(a.isLeaf)return e.replaceWith(t,t+a.nodeSize,o);if(!n.validContent(a.content))throw RangeError(`Invalid content for node type `+n.name);e.step(new KI(t,t+a.nodeSize,t+1,t+a.nodeSize-1,new uF(Q.from(o),0,0),1,!0))}function uL(e,t,n=1,r){let i=e.resolve(t),a=i.depth-n,o=r&&r[r.length-1]||i.parent;if(a<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let e=i.depth-1,t=n-2;e>a;e--,t--){let n=i.node(e),a=i.index(e);if(n.type.spec.isolating)return!1;let o=n.content.cutByIndex(a,n.childCount),s=r&&r[t+1];s&&(o=o.replaceChild(0,s.type.create(s.attrs)));let c=r&&r[t]||n;if(!n.canReplace(a+1,n.childCount)||!c.type.validContent(o))return!1}let s=i.indexAfter(a),c=r&&r[0];return i.node(a).canReplaceWith(s,s,c?c.type:i.node(a+1).type)}function dL(e,t,n=1,r){let i=e.doc.resolve(t),a=Q.empty,o=Q.empty;for(let e=i.depth,t=i.depth-n,s=n-1;e>t;e--,s--){a=Q.from(i.node(e).copy(a));let t=r&&r[s];o=Q.from(t?t.type.create(t.attrs,o):i.node(e).copy(o))}e.step(new GI(t,t,new uF(a.append(o),n,n),!0))}function fL(e,t){let n=e.resolve(t),r=n.index();return mL(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function pL(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let i=0;i<t.childCount;i++){let a=t.child(i),o=a.type==r?e.type.schema.nodes.text:a.type;if(n=n.matchType(o),!n||!e.type.allowsMarks(a.marks))return!1}return n.validEnd}function mL(e,t){return!!(e&&t&&!e.isLeaf&&pL(e,t))}function hL(e,t,n=-1){let r=e.resolve(t);for(let e=r.depth;;e--){let i,a,o=r.index(e);if(e==r.depth?(i=r.nodeBefore,a=r.nodeAfter):n>0?(i=r.node(e+1),o++,a=r.node(e).maybeChild(o)):(i=r.node(e).maybeChild(o-1),a=r.node(e+1)),i&&!i.isTextblock&&mL(i,a)&&r.node(e).canReplace(o,o+1))return t;if(e==0)break;t=n<0?r.before(e):r.after(e)}}function gL(e,t,n){let r=null,{linebreakReplacement:i}=e.doc.type.schema,a=e.doc.resolve(t-n),o=a.node().type;if(i&&o.inlineContent){let e=o.whitespace==`pre`,t=!!o.contentMatch.matchType(i);e&&!t?r=!1:!e&&t&&(r=!0)}let s=e.steps.length;if(r===!1){let r=e.doc.resolve(t+n);sL(e,r.node(),r.before(),s)}o.inlineContent&&XI(e,t+n-1,o,a.node().contentMatchAt(a.index()),r==null);let c=e.mapping.slice(s),l=c.map(t-n);if(e.step(new GI(l,c.map(t+n,-1),uF.empty,!0)),r===!0){let t=e.doc.resolve(l);oL(e,t.node(),t.before(),e.steps.length)}return e}function _L(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 e=r.depth-1;e>=0;e--){let t=r.index(e);if(r.node(e).canReplaceWith(t,t,n))return r.before(e+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let e=r.depth-1;e>=0;e--){let t=r.indexAfter(e);if(r.node(e).canReplaceWith(t,t,n))return r.after(e+1);if(t<r.node(e).childCount)return null}return null}function vL(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let i=n.content;for(let e=0;e<n.openStart;e++)i=i.firstChild.content;for(let e=1;e<=(n.openStart==0&&n.size?2:1);e++)for(let t=r.depth;t>=0;t--){let n=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,a=r.index(t)+ +(n>0),o=r.node(t),s=!1;if(e==1)s=o.canReplace(a,a,i);else{let e=o.contentMatchAt(a).findWrapping(i.firstChild.type);s=e&&o.canReplaceWith(a,a,e[0])}if(s)return n==0?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}function yL(e,t,n=t,r=uF.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),a=e.resolve(n);return bL(i,a,r)?new GI(t,n,r):new xL(i,a,r).fit()}function bL(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}var xL=class{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=Q.empty;for(let t=0;t<=e.depth;t++){let n=e.node(t);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=Q.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let i=this.placed,a=n.depth,o=r.depth;for(;a&&o&&i.childCount==1;)i=i.firstChild.content,a--,o--;let s=new uF(i,a,o);return e>-1?new KI(n.pos,e,this.$to.pos,this.$to.end(),s,t):s.size||n.pos!=this.$to.pos?new GI(n.pos,r.pos,s):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=n){e=n;break}t=i.content}for(let t=1;t<=2;t++)for(let n=t==1?e:this.unplaced.openStart;n>=0;n--){let e,r=null;n?(r=wL(this.unplaced.content,n-1).firstChild,e=r.content):e=this.unplaced.content;let i=e.firstChild;for(let e=this.depth;e>=0;e--){let{type:a,match:o}=this.frontier[e],s,c=null;if(t==1&&(i?o.matchType(i.type)||(c=o.fillBefore(Q.from(i),!1)):r&&a.compatibleContent(r.type)))return{sliceDepth:n,frontierDepth:e,parent:r,inject:c};if(t==2&&i&&(s=o.findWrapping(i.type)))return{sliceDepth:n,frontierDepth:e,parent:r,wrap:s};if(r&&o.matchType(r.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=wL(e,t);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new uF(e,t+1,Math.max(n,r.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=wL(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new uF(SL(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new uF(SL(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:r,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let e=0;e<i.length;e++)this.openFrontierNode(i[e]);let a=this.unplaced,o=n?n.content:a.content,s=a.openStart-e,c=0,l=[],{match:u,type:d}=this.frontier[t];if(r){for(let e=0;e<r.childCount;e++)l.push(r.child(e));u=u.matchFragment(r)}let f=o.size+e-(a.content.size-a.openEnd);for(;c<o.childCount;){let e=o.child(c),t=u.matchType(e.type);if(!t)break;c++,(c>1||s==0||e.content.size)&&(u=t,l.push(TL(e.mark(d.allowedMarks(e.marks)),c==1?s:0,c==o.childCount?f:-1)))}let p=c==o.childCount;p||(f=-1),this.placed=CL(this.placed,t,Q.from(l)),this.frontier[t].match=u,p&&f<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=o;e<f;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=p?e==0?uF.empty:new uF(SL(a.content,e-1,1),e-1,f<0?a.openEnd:e-1):new uF(SL(a.content,e,c),a.openStart,a.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!EL(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){scan:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),a=EL(e,t,r,n,i);if(a){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],i=EL(e,n,r,t,!0);if(!i||i.childCount)continue scan}return{depth:t,fit:a,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=CL(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=CL(this.placed,this.depth,Q.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(Q.empty,!0);e.childCount&&(this.placed=CL(this.placed,this.frontier.length,e))}};function SL(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(SL(e.firstChild.content,t-1,n)))}function CL(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(CL(e.lastChild.content,t-1,n)))}function wL(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function TL(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,TL(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 EL(e,t,n,r,i){let a=e.node(t),o=i?e.indexAfter(t):e.index(t);if(o==a.childCount&&!n.compatibleContent(a.type))return null;let s=r.fillBefore(a.content,!0,o);return s&&!DL(n,a.content,o)?s:null}function DL(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}function OL(e){return e.spec.defining||e.spec.definingForContent}function kL(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let i=e.doc.resolve(t),a=e.doc.resolve(n);if(bL(i,a,r))return e.step(new GI(t,n,r));let o=NL(i,a);o[o.length-1]==0&&o.pop();let s=-(i.depth+1);o.unshift(s);for(let e=i.depth,t=i.pos-1;e>0;e--,t--){let n=i.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;o.indexOf(e)>-1?s=e:i.before(e)==t&&o.splice(1,0,-e)}let c=o.indexOf(s),l=[],u=r.openStart;for(let e=r.content,t=0;;t++){let n=e.firstChild;if(l.push(n),t==r.openStart)break;e=n.content}for(let e=u-1;e>=0;e--){let t=l[e],n=OL(t.type);if(n&&!t.sameMarkup(i.node(Math.abs(s)-1)))u=e;else if(n||!t.type.isTextblock)break}for(let t=r.openStart;t>=0;t--){let s=(t+u+1)%(r.openStart+1),d=l[s];if(d)for(let t=0;t<o.length;t++){let l=o[(t+c)%o.length],u=!0;l<0&&(u=!1,l=-l);let f=i.node(l-1),p=i.index(l-1);if(f.canReplaceWith(p,p,d.type,d.marks))return e.replace(i.before(l),u?a.after(l):n,new uF(AL(r.content,0,r.openStart,s),s,r.openEnd))}}let d=e.steps.length;for(let s=o.length-1;s>=0&&(e.replace(t,n,r),!(e.steps.length>d));s--){let e=o[s];e<0||(t=i.before(e),n=a.after(e))}}function AL(e,t,n,r,i){if(t<n){let i=e.firstChild;e=e.replaceChild(0,i.copy(AL(i.content,t+1,n,r,i)))}if(t>r){let t=i.contentMatchAt(0),n=t.fillBefore(e).append(e);e=n.append(t.matchFragment(n).fillBefore(Q.empty,!0))}return e}function jL(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let i=_L(e.doc,t,r.type);i!=null&&(t=n=i)}e.replaceRange(t,n,new uF(Q.from(r),0,0))}function ML(e,t,n){let r=e.doc.resolve(t),i=e.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let a=r.sharedDepth(n),o=!1;for(let e=r.depth;e>a;e--)r.node(e).type.spec.isolating&&(o=!0);for(let e=i.depth;e>a;e--)i.node(e).type.spec.isolating&&(o=!0);if(!o){for(let e=r.depth;e>0&&t==r.start(e);e--)t=r.before(e);for(let e=i.depth;e>0&&n==i.start(e);e--)n=i.before(e);r=e.doc.resolve(t),i=e.doc.resolve(n)}}let a=NL(r,i);for(let t=0;t<a.length;t++){let n=a[t],o=t==a.length-1;if(o&&n==0||r.node(n).type.contentMatch.validEnd)return e.delete(r.start(n),i.end(n));if(n>0&&(o||r.node(n-1).canReplace(r.index(n-1),i.indexAfter(n-1))))return e.delete(r.before(n),i.after(n))}for(let a=1;a<=r.depth&&a<=i.depth;a++)if(t-r.start(a)==r.depth-a&&n>r.end(a)&&i.end(a)-n!=i.depth-a&&r.start(a-1)==i.start(a-1)&&r.node(a-1).canReplace(r.index(a-1),i.index(a-1)))return e.delete(r.before(a),n);e.delete(t,n)}function NL(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let i=r;i>=0;i--){let r=e.start(i);if(r<e.pos-(e.depth-i)||t.end(i)>t.pos+(t.depth-i)||e.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(r==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==r-1)&&n.push(i)}return n}var PL=class e extends RI{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return zI.fail(`No node at attribute step's position`);let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return zI.fromReplace(e,this.pos,this.pos+1,new uF(Q.from(r),0,+!t.isLeaf))}getMap(){return FI.empty}invert(t){return new e(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 e(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 RangeError(`Invalid input for AttrStep.fromJSON`);return new e(n.pos,n.attr,n.value)}};RI.jsonID(`attr`,PL);var FL=class e extends RI{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return zI.ok(n)}getMap(){return FI.empty}invert(t){return new e(this.attr,t.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:`docAttr`,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!=`string`)throw RangeError(`Invalid input for DocAttrStep.fromJSON`);return new e(n.attr,n.value)}};RI.jsonID(`docAttr`,FL);var IL=class extends Error{};IL=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},IL.prototype=Object.create(Error.prototype),IL.prototype.constructor=IL,IL.prototype.name=`TransformError`;var LL=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new II}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new IL(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let n=0;n<this.mapping.maps.length;n++){let r=this.mapping.maps[n];n&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((n,r,i,a)=>{e=Math.min(e,i),t=Math.max(t,a)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=uF.empty){let r=yL(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new uF(Q.from(n),0,0))}delete(e,t){return this.replace(e,t,uF.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return kL(this,e,t,n),this}replaceRangeWith(e,t,n){return jL(this,e,t,n),this}deleteRange(e,t){return ML(this,e,t),this}lift(e,t){return $I(this,e,t),this}join(e,t=1){return gL(this,e,t),this}wrap(e,t){return iL(this,e,t),this}setBlockType(e,t=e,n,r=null){return aL(this,e,t,n,r),this}setNodeMarkup(e,t,n=null,r){return lL(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new PL(e,t,n)),this}setDocAttribute(e,t){return this.step(new FL(e,t)),this}addNodeMark(e,t){return this.step(new UI(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw RangeError(`No node at position `+e);if(t instanceof cF)t.isInSet(n.marks)&&this.step(new WI(e,t));else{let r=n.marks,i,a=[];for(;i=t.isInSet(r);)a.push(new WI(e,i)),r=i.removeFromSet(r);for(let e=a.length-1;e>=0;e--)this.step(a[e])}return this}split(e,t=1,n){return dL(this,e,t,n),this}addMark(e,t,n){return JI(this,e,t,n),this}removeMark(e,t,n){return YI(this,e,t,n),this}clearIncompatible(e,t,n){return XI(this,e,t,n),this}},RL=Object.create(null),zL=class{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new BL(e.min(t),e.max(t))]}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 e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=uF.empty){let n=t.content.lastChild,r=null;for(let e=0;e<t.openEnd;e++)r=n,n=n.lastChild;let i=e.steps.length,a=this.ranges;for(let o=0;o<a.length;o++){let{$from:s,$to:c}=a[o],l=e.mapping.slice(i);e.replaceRange(l.map(s.pos),l.map(c.pos),o?uF.empty:t),o==0&&XL(e,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n),c=s.map(a.pos),l=s.map(o.pos);i?e.deleteRange(c,l):(e.replaceRangeWith(c,l,t),XL(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new UL(e):YL(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let r=e.depth-1;r>=0;r--){let i=t<0?YL(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):YL(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(i)return i}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new qL(e.node(0))}static atStart(e){return YL(e,e,0,0,1)||new qL(e)}static atEnd(e){return YL(e,e,e.content.size,e.childCount,-1)||new qL(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError(`Invalid input for Selection.fromJSON`);let n=RL[t.type];if(!n)throw RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in RL)throw RangeError(`Duplicate use of selection JSON ID `+e);return RL[e]=t,t.prototype.jsonID=e,t}getBookmark(){return UL.between(this.$anchor,this.$head).getBookmark()}};zL.prototype.visible=!0;var BL=class{constructor(e,t){this.$from=e,this.$to=t}},VL=!1;function HL(e){!VL&&!e.parent.inlineContent&&(VL=!0,console.warn(`TextSelection endpoint not pointing into a node with inline content (`+e.parent.type.name+`)`))}var UL=class e extends zL{constructor(e,t=e){HL(e),HL(t),super(e,t)}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 zL.near(r);let i=t.resolve(n.map(this.anchor));return new e(i.parent.inlineContent?i:r,r)}replace(e,t=uF.empty){if(super.replace(e,t),t==uF.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(t){return t instanceof e&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new WL(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 RangeError(`Invalid input for TextSelection.fromJSON`);return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(t,n,r){let i=t.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let e=zL.findFrom(n,r,!0)||zL.findFrom(n,-r,!0);if(e)n=e.$head;else return zL.near(n,r)}return t.parent.inlineContent||(i==0?t=n:(t=(zL.findFrom(t,-r,!0)||zL.findFrom(t,r,!0)).$anchor,t.pos<n.pos!=i<0&&(t=n))),new e(t,n)}};zL.jsonID(`text`,UL);var WL=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){return UL.between(e.resolve(this.anchor),e.resolve(this.head))}},GL=class e extends zL{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(t,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),a=t.resolve(i);return r?zL.near(a):new e(a)}content(){return new uF(Q.from(this.node),0,0)}eq(t){return t instanceof e&&t.anchor==this.anchor}toJSON(){return{type:`node`,anchor:this.anchor}}getBookmark(){return new KL(this.anchor)}static fromJSON(t,n){if(typeof n.anchor!=`number`)throw RangeError(`Invalid input for NodeSelection.fromJSON`);return new e(t.resolve(n.anchor))}static create(t,n){return new e(t.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};GL.prototype.visible=!1,zL.jsonID(`node`,GL);var KL=class e{constructor(e){this.anchor=e}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new WL(r,r):new e(r)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&GL.isSelectable(n)?new GL(t):zL.near(t)}},qL=class e extends zL{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=uF.empty){if(t==uF.empty){e.delete(0,e.doc.content.size);let t=zL.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:`all`}}static fromJSON(t){return new e(t)}map(t){return new e(t)}eq(t){return t instanceof e}getBookmark(){return JL}};zL.jsonID(`all`,qL);var JL={map(){return this},resolve(e){return new qL(e)}};function YL(e,t,n,r,i,a=!1){if(t.inlineContent)return UL.create(e,n);for(let o=r-(i>0?0:1);i>0?o<t.childCount:o>=0;o+=i){let r=t.child(o);if(!r.isAtom){let t=YL(e,r,n+i,i<0?r.childCount:0,i,a);if(t)return t}else if(!a&&GL.isSelectable(r))return GL.create(e,n-(i<0?r.nodeSize:0));n+=r.nodeSize*i}return null}function XL(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof GI||i instanceof KI))return;let a=e.mapping.maps[r],o;a.forEach((e,t,n,r)=>{o??=r}),e.setSelection(zL.near(e.doc.resolve(o),n))}var ZL=1,QL=2,$L=4,eR=class extends LL{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.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(e){if(e.$from.doc!=this.doc)throw RangeError(`Selection passed to setSelection must point at the current document`);return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|ZL)&~QL,this.storedMarks=null,this}get selectionSet(){return(this.updated&ZL)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=QL,this}ensureMarks(e){return cF.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&QL)>0}addStep(e,t){super.addStep(e,t),this.updated&=~QL,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||cF.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(n??=t,!e)return this.deleteRange(t,n);let i=this.storedMarks;if(!i){let e=this.doc.resolve(t);i=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,i)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(zL.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e==`string`?e:e.key]=t,this}getMeta(e){return this.meta[typeof e==`string`?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=$L,this}get scrolledIntoView(){return(this.updated&$L)>0}};function tR(e,t){return!t||!e?e:e.bind(t)}var nR=class{constructor(e,t,n){this.name=e,this.init=tR(t.init,n),this.apply=tR(t.apply,n)}},rR=[new nR(`doc`,{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new nR(`selection`,{init(e,t){return e.selection||zL.atStart(t.doc)},apply(e){return e.selection}}),new nR(`storedMarks`,{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new nR(`scrollToSelection`,{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})],iR=class{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=rR.slice(),t&&t.forEach(e=>{if(this.pluginsByKey[e.key])throw RangeError(`Adding different instances of a keyed plugin (`+e.key+`)`);this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new nR(e.key,e.spec.state,e))})}},aR=class e{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=t){let t=this.config.plugins[n];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),r=null;for(;;){let i=!1;for(let a=0;a<this.config.plugins.length;a++){let o=this.config.plugins[a];if(o.spec.appendTransaction){let s=r?r[a].n:0,c=r?r[a].state:this,l=s<t.length&&o.spec.appendTransaction.call(o,s?t.slice(s):t,c,n);if(l&&n.filterTransaction(l,a)){if(l.setMeta(`appendedTransaction`,e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<a?{state:n,n:t.length}:{state:this,n:0})}t.push(l),n=n.applyInner(l),i=!0}r&&(r[a]={state:n,n:t.length})}}if(!i)return{state:n,transactions:t}}}applyInner(t){if(!t.before.eq(this.doc))throw RangeError(`Applying a mismatched transaction`);let n=new e(this.config),r=this.config.fields;for(let e=0;e<r.length;e++){let i=r[e];n[i.name]=i.apply(t,this[i.name],this,n)}return n}get tr(){return new eR(this)}static create(t){let n=new iR(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new e(n);for(let e=0;e<n.fields.length;e++)r[n.fields[e].name]=n.fields[e].init(t,r);return r}reconfigure(t){let n=new iR(this.schema,t.plugins),r=n.fields,i=new e(n);for(let e=0;e<r.length;e++){let n=r[e].name;i[n]=this.hasOwnProperty(n)?this[n]:r[e].init(t,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(e=>e.toJSON())),e&&typeof e==`object`)for(let n in e){if(n==`doc`||n==`selection`)throw RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],i=r.spec.state;i&&i.toJSON&&(t[n]=i.toJSON.call(r,this[r.key]))}return t}static fromJSON(t,n,r){if(!n)throw RangeError(`Invalid input for EditorState.fromJSON`);if(!t.schema)throw RangeError(`Required config field 'schema' missing`);let i=new iR(t.schema,t.plugins),a=new e(i);return i.fields.forEach(e=>{if(e.name==`doc`)a.doc=kF.fromJSON(t.schema,n.doc);else if(e.name==`selection`)a.selection=zL.fromJSON(a.doc,n.selection);else if(e.name==`storedMarks`)n.storedMarks&&(a.storedMarks=n.storedMarks.map(t.schema.markFromJSON));else{if(r)for(let i in r){let o=r[i],s=o.spec.state;if(o.key==e.name&&s&&s.fromJSON&&Object.prototype.hasOwnProperty.call(n,i)){a[e.name]=s.fromJSON.call(o,t,n[i],a);return}}a[e.name]=e.init(t,a)}}),a}};function oR(e,t,n){for(let r in e){let i=e[r];i instanceof Function?i=i.bind(t):r==`handleDOMEvents`&&(i=oR(i,t,{})),n[r]=i}return n}var sR=class{constructor(e){this.spec=e,this.props={},e.props&&oR(e.props,this,this.props),this.key=e.key?e.key.key:lR(`plugin`)}getState(e){return e[this.key]}},cR=Object.create(null);function lR(e){return e in cR?e+`$`+ ++cR[e]:(cR[e]=0,e+`$`)}var uR=class{constructor(e=`key`){this.key=lR(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}},dR=(e,t)=>e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function fR(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`backward`,e):n.parentOffset>0)?null:n}var pR=(e,t,n)=>{let r=fR(e,n);if(!r)return!1;let i=yR(r);if(!i){let n=r.blockRange(),i=n&&QI(n);return i==null?!1:(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)}let a=i.nodeBefore;if(LR(e,i,t,-1))return!0;if(r.parent.content.size==0&&(_R(a,`end`)||GL.isSelectable(a)))for(let n=r.depth;;n--){let o=yL(e.doc,r.before(n),r.after(n),uF.empty);if(o&&o.slice.size<o.to-o.from){if(t){let n=e.tr.step(o);n.setSelection(_R(a,`end`)?zL.findFrom(n.doc.resolve(n.mapping.map(i.pos,-1)),-1):GL.create(n.doc,i.pos-a.nodeSize)),t(n.scrollIntoView())}return!0}if(n==1||r.node(n-1).childCount>1)break}return a.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos-a.nodeSize,i.pos).scrollIntoView()),!0):!1},mR=(e,t,n)=>{let r=fR(e,n);if(!r)return!1;let i=yR(r);return i?gR(e,i,t):!1},hR=(e,t,n)=>{let r=bR(e,n);if(!r)return!1;let i=CR(r);return i?gR(e,i,t):!1};function gR(e,t,n){let r=t.nodeBefore,i=t.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let e=r.lastChild;if(!e)return!1;r=e}let a=t.nodeAfter,o=t.pos+1;for(;!a.isTextblock;o++){if(a.type.spec.isolating)return!1;let e=a.firstChild;if(!e)return!1;a=e}let s=yL(e.doc,i,o,uF.empty);if(!s||s.from!=i||s instanceof GI&&s.slice.size>=o-i)return!1;if(n){let t=e.tr.step(s);t.setSelection(UL.create(t.doc,i)),n(t.scrollIntoView())}return!0}function _R(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}var vR=(e,t,n)=>{let{$head:r,empty:i}=e.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock(`backward`,e):r.parentOffset>0)return!1;a=yR(r)}let o=a&&a.nodeBefore;return!o||!GL.isSelectable(o)?!1:(t&&t(e.tr.setSelection(GL.create(e.doc,a.pos-o.nodeSize)).scrollIntoView()),!0)};function yR(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 bR(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`forward`,e):n.parentOffset<n.parent.content.size)?null:n}var xR=(e,t,n)=>{let r=bR(e,n);if(!r)return!1;let i=CR(r);if(!i)return!1;let a=i.nodeAfter;if(LR(e,i,t,1))return!0;if(r.parent.content.size==0&&(_R(a,`start`)||GL.isSelectable(a))){let n=yL(e.doc,r.before(),r.after(),uF.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(_R(a,`start`)?zL.findFrom(r.doc.resolve(r.mapping.map(i.pos)),1):GL.create(r.doc,r.mapping.map(i.pos))),t(r.scrollIntoView())}return!0}}return a.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos,i.pos+a.nodeSize).scrollIntoView()),!0):!1},SR=(e,t,n)=>{let{$head:r,empty:i}=e.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock(`forward`,e):r.parentOffset<r.parent.content.size)return!1;a=CR(r)}let o=a&&a.nodeAfter;return!o||!GL.isSelectable(o)?!1:(t&&t(e.tr.setSelection(GL.create(e.doc,a.pos)).scrollIntoView()),!0)};function CR(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}var wR=(e,t)=>{let n=e.selection,r=n instanceof GL,i;if(r){if(n.node.isTextblock||!fL(e.doc,n.from))return!1;i=n.from}else if(i=hL(e.doc,n.from,-1),i==null)return!1;if(t){let n=e.tr.join(i);r&&n.setSelection(GL.create(n.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(n.scrollIntoView())}return!0},TR=(e,t)=>{let n=e.selection,r;if(n instanceof GL){if(n.node.isTextblock||!fL(e.doc,n.to))return!1;r=n.to}else if(r=hL(e.doc,n.to,1),r==null)return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0},ER=(e,t)=>{let{$from:n,$to:r}=e.selection,i=n.blockRange(r),a=i&&QI(i);return a==null?!1:(t&&t(e.tr.lift(i,a).scrollIntoView()),!0)},DR=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(`
85
+ `).scrollIntoView()),!0)};function OR(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}var kR=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),a=n.indexAfter(-1),o=OR(i.contentMatchAt(a));if(!o||!i.canReplaceWith(a,a,o))return!1;if(t){let r=n.after(),i=e.tr.replaceWith(r,r,o.createAndFill());i.setSelection(zL.near(i.doc.resolve(r),1)),t(i.scrollIntoView())}return!0},AR=(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof qL||r.parent.inlineContent||i.parent.inlineContent)return!1;let a=OR(i.parent.contentMatchAt(i.indexAfter()));if(!a||!a.isTextblock)return!1;if(t){let n=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,o=e.tr.insert(n,a.createAndFill());o.setSelection(UL.create(o.doc,n+1)),t(o.scrollIntoView())}return!0},jR=(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 r=n.before();if(uL(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),i=r&&QI(r);return i==null?!1:(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)};function MR(e){return(t,n)=>{let{$from:r,$to:i}=t.selection;if(t.selection instanceof GL&&t.selection.node.isBlock)return!r.parentOffset||!uL(t.doc,r.pos)?!1:(n&&n(t.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let a=[],o,s,c=!1,l=!1;for(let t=r.depth;;t--)if(r.node(t).isBlock){c=r.end(t)==r.pos+(r.depth-t),l=r.start(t)==r.pos-(r.depth-t),s=OR(r.node(t-1).contentMatchAt(r.indexAfter(t-1)));let n=e&&e(i.parent,c,r);a.unshift(n||(c&&s?{type:s}:null)),o=t;break}else{if(t==1)return!1;a.unshift(null)}let u=t.tr;(t.selection instanceof UL||t.selection instanceof qL)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=uL(u.doc,d,a.length,a);if(f||=(a[0]=s?{type:s}:null,uL(u.doc,d,a.length,a)),!f)return!1;if(u.split(d,a.length,a),!c&&l&&r.node(o).type!=s){let e=u.mapping.map(r.before(o)),t=u.doc.resolve(e);s&&r.node(o-1).canReplaceWith(t.index(),t.index()+1,s)&&u.setNodeMarkup(u.mapping.map(r.before(o)),s)}return n&&n(u.scrollIntoView()),!0}}var NR=MR(),PR=(e,t)=>{let{$from:n,to:r}=e.selection,i,a=n.sharedDepth(r);return a==0?!1:(i=n.before(a),t&&t(e.tr.setSelection(GL.create(e.doc,i))),!0)},FR=(e,t)=>(t&&t(e.tr.setSelection(new qL(e.doc))),!0);function IR(e,t,n){let r=t.nodeBefore,i=t.nodeAfter,a=t.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&t.parent.canReplace(a-1,a)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(a,a+1)||!(i.isTextblock||fL(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function LR(e,t,n,r){let i=t.nodeBefore,a=t.nodeAfter,o,s,c=i.type.spec.isolating||a.type.spec.isolating;if(!c&&IR(e,t,n))return!0;let l=!c&&t.parent.canReplace(t.index(),t.index()+1);if(l&&(o=(s=i.contentMatchAt(i.childCount)).findWrapping(a.type))&&s.matchType(o[0]||a.type).validEnd){if(n){let r=t.pos+a.nodeSize,s=Q.empty;for(let e=o.length-1;e>=0;e--)s=Q.from(o[e].create(null,s));s=Q.from(i.copy(s));let c=e.tr.step(new KI(t.pos-1,r,t.pos,r,new uF(s,1,0),o.length,!0)),l=c.doc.resolve(r+2*o.length);l.nodeAfter&&l.nodeAfter.type==i.type&&fL(c.doc,l.pos)&&c.join(l.pos),n(c.scrollIntoView())}return!0}let u=a.type.spec.isolating||r>0&&c?null:zL.findFrom(t,1),d=u&&u.$from.blockRange(u.$to),f=d&&QI(d);if(f!=null&&f>=t.depth)return n&&n(e.tr.lift(d,f).scrollIntoView()),!0;if(l&&_R(a,`start`,!0)&&_R(i,`end`)){let r=i,o=[];for(;o.push(r),!r.isTextblock;)r=r.lastChild;let s=a,c=1;for(;!s.isTextblock;s=s.firstChild)c++;if(r.canReplace(r.childCount,r.childCount,s.content)){if(n){let r=Q.empty;for(let e=o.length-1;e>=0;e--)r=Q.from(o[e].copy(r));n(e.tr.step(new KI(t.pos-o.length,t.pos+a.nodeSize,t.pos+c,t.pos+a.nodeSize-c,new uF(r,o.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function RR(e){return function(t,n){let r=t.selection,i=e<0?r.$from:r.$to,a=i.depth;for(;i.node(a).isInline;){if(!a)return!1;a--}return i.node(a).isTextblock?(n&&n(t.tr.setSelection(UL.create(t.doc,e<0?i.start(a):i.end(a)))),!0):!1}}var zR=RR(-1),BR=RR(1);function VR(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a),s=o&&eL(o,e,t);return s?(r&&r(n.tr.wrap(o,s).scrollIntoView()),!0):!1}}function HR(e,t=null){return function(n,r){let i=!1;for(let r=0;r<n.selection.ranges.length&&!i;r++){let{$from:{pos:a},$to:{pos:o}}=n.selection.ranges[r];n.doc.nodesBetween(a,o,(r,a)=>{if(i)return!1;if(!(!r.isTextblock||r.hasMarkup(e,t)))if(r.type==e)i=!0;else{let t=n.doc.resolve(a),r=t.index();i=t.parent.canReplaceWith(r,r+1,e)}})}if(!i)return!1;if(r){let i=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:a},$to:{pos:o}}=n.selection.ranges[r];i.setBlockType(a,o,e,t)}r(i.scrollIntoView())}return!0}}function UR(...e){return function(t,n,r){for(let i=0;i<e.length;i++)if(e[i](t,n,r))return!0;return!1}}var WR=UR(dR,pR,vR),GR=UR(dR,xR,SR),KR={Enter:UR(DR,AR,jR,NR),"Mod-Enter":kR,Backspace:WR,"Mod-Backspace":WR,"Shift-Backspace":WR,Delete:GR,"Mod-Delete":GR,"Mod-a":FR},qR={"Ctrl-h":KR.Backspace,"Alt-Backspace":KR[`Mod-Backspace`],"Ctrl-d":KR.Delete,"Ctrl-Alt-Backspace":KR[`Mod-Delete`],"Alt-Delete":KR[`Mod-Delete`],"Alt-d":KR[`Mod-Delete`],"Ctrl-a":zR,"Ctrl-e":BR};for(let e in KR)qR[e]=KR[e];typeof navigator<`u`?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<`u`&&os.platform&&os.platform();function JR(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a);if(!o)return!1;let s=r?n.tr:null;return YR(s,o,e,t)?(r&&r(s.scrollIntoView()),!0):!1}}function YR(e,t,n,r=null){let i=!1,a=t,o=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 e=o.resolve(t.start-2);a=new DF(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new DF(t.$from,o.resolve(t.$to.end(t.depth)),t.depth)),i=!0}let s=eL(a,n,r,t);return s?(e&&XR(e,t,s,i,n),!0):!1}function XR(e,t,n,r,i){let a=Q.empty;for(let e=n.length-1;e>=0;e--)a=Q.from(n[e].type.create(n[e].attrs,a));e.step(new KI(t.start-(r?2:0),t.end,t.start,t.end,new uF(a,0,0),n.length,!0));let o=0;for(let e=0;e<n.length;e++)n[e].type==i&&(o=e+1);let s=n.length-o,c=t.start+n.length-(r?2:0),l=t.parent;for(let n=t.startIndex,r=t.endIndex,i=!0;n<r;n++,i=!1)!i&&uL(e.doc,c,s)&&(e.split(c,s),c+=2*s),c+=l.child(n).nodeSize;return e}function ZR(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,t=>t.childCount>0&&t.firstChild.type==e);return a?n?r.node(a.depth-1).type==e?QR(t,n,e,a):$R(t,n,a):!0:!1}}function QR(e,t,n,r){let i=e.tr,a=r.end,o=r.$to.end(r.depth);a<o&&(i.step(new KI(a-1,o,a,o,new uF(Q.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new DF(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));let s=QI(r);if(s==null)return!1;i.lift(r,s);let c=i.doc.resolve(i.mapping.map(a,-1)-1);return fL(i.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&i.join(c.pos),t(i.scrollIntoView()),!0}function $R(e,t,n){let r=e.tr,i=n.parent;for(let e=n.end,t=n.endIndex-1,a=n.startIndex;t>a;t--)e-=i.child(t).nodeSize,r.delete(e-1,e+1);let a=r.doc.resolve(n.start),o=a.nodeAfter;if(r.mapping.map(n.end)!=n.start+a.nodeAfter.nodeSize)return!1;let s=n.startIndex==0,c=n.endIndex==i.childCount,l=a.node(-1),u=a.index(-1);if(!l.canReplace(u+ +!s,u+1,o.content.append(c?Q.empty:Q.from(i))))return!1;let d=a.pos,f=d+o.nodeSize;return r.step(new KI(d-+!!s,f+ +!!c,d+1,f-1,new uF((s?Q.empty:Q.from(i.copy(Q.empty))).append(c?Q.empty:Q.from(i.copy(Q.empty))),+!s,+!c),+!s)),t(r.scrollIntoView()),!0}function ez(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,t=>t.childCount>0&&t.firstChild.type==e);if(!a)return!1;let o=a.startIndex;if(o==0)return!1;let s=a.parent,c=s.child(o-1);if(c.type!=e)return!1;if(n){let r=c.lastChild&&c.lastChild.type==s.type,i=Q.from(r?e.create():null),o=new uF(Q.from(e.create(null,Q.from(s.type.create(null,i)))),r?3:1,0),l=a.start,u=a.end;n(t.tr.step(new KI(l-(r?3:1),u,l,u,o,1,!0)).scrollIntoView())}return!0}}var tz=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},nz=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t},rz=null,iz=function(e,t,n){let r=rz||=document.createRange();return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},az=function(){rz=null},oz=function(e,t,n,r){return n&&(cz(e,t,n,r,-1)||cz(e,t,n,r,1))},sz=/^(img|br|input|textarea|hr)$/i;function cz(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:lz(e))){let n=e.parentNode;if(!n||n.nodeType!=1||pz(e)||sz.test(e.nodeName)||e.contentEditable==`false`)return!1;t=tz(e)+(i<0?0:1),e=n}else if(e.nodeType==1){let n=e.childNodes[t+(i<0?-1:0)];if(n.nodeType==1&&n.contentEditable==`false`)if(n.pmViewDesc?.ignoreForSelection)t+=i;else return!1;else e=n,t=i<0?lz(e):0}else return!1}}function lz(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function uz(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=lz(e)}else if(e.parentNode&&!pz(e))t=tz(e),e=e.parentNode;else return null}}function dz(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&&!pz(e))t=tz(e)+1,e=e.parentNode;else return null}}function fz(e,t,n){for(let r=t==0,i=t==lz(e);r||i;){if(e==n)return!0;let t=tz(e);if(e=e.parentNode,!e)return!1;r&&=t==0,i&&=t==lz(e)}}function pz(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)}var mz=function(e){return e.focusNode&&oz(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function hz(e,t){let n=document.createEvent(`Event`);return n.initEvent(`keydown`,!0,!0),n.keyCode=e,n.key=n.code=t,n}function gz(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function _z(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(lz(r.offsetNode),r.offset)}}catch{}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(lz(r.startContainer),r.startOffset)}}}var vz=typeof navigator<`u`?navigator:null,yz=typeof document<`u`?document:null,bz=vz&&vz.userAgent||``,xz=/Edge\/(\d+)/.exec(bz),Sz=/MSIE \d/.exec(bz),Cz=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(bz),wz=!!(Sz||Cz||xz),Tz=Sz?document.documentMode:Cz?+Cz[1]:xz?+xz[1]:0,Ez=!wz&&/gecko\/(\d+)/i.test(bz);Ez&&+(/Firefox\/(\d+)/.exec(bz)||[0,0])[1];var Dz=!wz&&/Chrome\/(\d+)/.exec(bz),Oz=!!Dz,kz=Dz?+Dz[1]:0,Az=!wz&&!!vz&&/Apple Computer/.test(vz.vendor),jz=Az&&(/Mobile\/\w+/.test(bz)||!!vz&&vz.maxTouchPoints>2),Mz=jz||(vz?/Mac/.test(vz.platform):!1),Nz=vz?/Win/.test(vz.platform):!1,Pz=/Android \d/.test(bz),Fz=!!yz&&`webkitFontSmoothing`in yz.documentElement.style,Iz=Fz?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Lz(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 Rz(e,t){return typeof e==`number`?e:e[t]}function zz(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 Bz(e,t,n){let r=e.someProp(`scrollThreshold`)||0,i=e.someProp(`scrollMargin`)||5,a=e.dom.ownerDocument;for(let o=n||e.dom;o;){if(o.nodeType!=1){o=nz(o);continue}let e=o,n=e==a.body,s=n?Lz(a):zz(e),c=0,l=0;if(t.top<s.top+Rz(r,`top`)?l=-(s.top-t.top+Rz(i,`top`)):t.bottom>s.bottom-Rz(r,`bottom`)&&(l=t.bottom-t.top>s.bottom-s.top?t.top+Rz(i,`top`)-s.top:t.bottom-s.bottom+Rz(i,`bottom`)),t.left<s.left+Rz(r,`left`)?c=-(s.left-t.left+Rz(i,`left`)):t.right>s.right-Rz(r,`right`)&&(c=t.right-s.right+Rz(i,`right`)),c||l)if(n)a.defaultView.scrollBy(c,l);else{let n=e.scrollLeft,r=e.scrollTop;l&&(e.scrollTop+=l),c&&(e.scrollLeft+=c);let i=e.scrollLeft-n,a=e.scrollTop-r;t={left:t.left-i,top:t.top-a,right:t.right-i,bottom:t.bottom-a}}let u=n?`fixed`:getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(u))break;o=u==`absolute`?o.offsetParent:nz(o)}}function Vz(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),r,i;for(let a=(t.left+t.right)/2,o=n+1;o<Math.min(innerHeight,t.bottom);o+=5){let t=e.root.elementFromPoint(a,o);if(!t||t==e.dom||!e.dom.contains(t))continue;let s=t.getBoundingClientRect();if(s.top>=n-20){r=t,i=s.top;break}}return{refDOM:r,refTop:i,stack:Hz(e.dom)}}function Hz(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=nz(r));return t}function Uz({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;Wz(n,r==0?0:r-t)}function Wz(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:i,left:a}=e[n];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=a&&(r.scrollLeft=a)}}var Gz=null;function Kz(e){if(e.setActive)return e.setActive();if(Gz)return e.focus(Gz);let t=Hz(e);e.focus(Gz==null?{get preventScroll(){return Gz={preventScroll:!0},!0}}:void 0),Gz||(Gz=!1,Wz(t,0))}function qz(e,t){let n,r=2e8,i,a=0,o=t.top,s=t.top,c,l;for(let u=e.firstChild,d=0;u;u=u.nextSibling,d++){let e;if(u.nodeType==1)e=u.getClientRects();else if(u.nodeType==3)e=iz(u).getClientRects();else continue;for(let f=0;f<e.length;f++){let p=e[f];if(p.top<=o&&p.bottom>=s){o=Math.max(p.bottom,o),s=Math.min(p.top,s);let e=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(e<r){n=u,r=e,i=e&&n.nodeType==3?{left:p.right<t.left?p.right:p.left,top:t.top}:t,u.nodeType==1&&e&&(a=d+ +(t.left>=(p.left+p.right)/2));continue}}else p.top>t.top&&!c&&p.left<=t.left&&p.right>=t.left&&(c=u,l={left:Math.max(p.left,Math.min(p.right,t.left)),top:p.top});!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(a=d+1)}}return!n&&c&&(n=c,i=l,r=0),n&&n.nodeType==3?Jz(n,i):!n||r&&n.nodeType==1?{node:e,offset:a}:qz(n,i)}function Jz(e,t){let n=e.nodeValue.length,r=document.createRange(),i;for(let a=0;a<n;a++){r.setEnd(e,a+1),r.setStart(e,a);let n=nB(r,1);if(n.top!=n.bottom&&Yz(t,n)){i={node:e,offset:a+ +(t.left>=(n.left+n.right)/2)};break}}return r.detach(),i||{node:e,offset:0}}function Yz(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function Xz(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function Zz(e,t,n){let{node:r,offset:i}=qz(t,n),a=-1;if(r.nodeType==1&&!r.firstChild){let e=r.getBoundingClientRect();a=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,i,a)}function Qz(e,t,n,r){let i=-1;for(let n=t,a=!1;n!=e.dom;){let t=e.docView.nearestDesc(n,!0),o;if(!t)return null;if(t.dom.nodeType==1&&(t.node.isBlock&&t.parent||!t.contentDOM)&&((o=t.dom.getBoundingClientRect()).width||o.height)&&(t.node.isBlock&&t.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(t.dom.nodeName)&&(!a&&o.left>r.left||o.top>r.top?i=t.posBefore:(!a&&o.right<r.left||o.bottom<r.top)&&(i=t.posAfter),a=!0),!t.contentDOM&&i<0&&!t.node.isText))return(t.node.isBlock?r.top<(o.top+o.bottom)/2:r.left<(o.left+o.right)/2)?t.posBefore:t.posAfter;n=t.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n,-1)}function $z(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),a=i;;){let n=e.childNodes[a];if(n.nodeType==1){let e=n.getClientRects();for(let r=0;r<e.length;r++){let i=e[r];if(Yz(t,i))return $z(n,t,i)}}if((a=(a+1)%r)==i)break}return e}function eB(e,t){let n=e.dom.ownerDocument,r,i=0,a=_z(n,t.left,t.top);a&&({node:r,offset:i}=a);let o=(e.root.elementFromPoint?e.root:n).elementFromPoint(t.left,t.top),s;if(!o||!e.dom.contains(o.nodeType==1?o:o.parentNode)){let n=e.dom.getBoundingClientRect();if(!Yz(t,n)||(o=$z(e.dom,t,n),!o))return null}if(Az)for(let e=o;r&&e;e=nz(e))e.draggable&&(r=void 0);if(o=Xz(o,t),r){if(Ez&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let e=r.childNodes[i],n;e.nodeName==`IMG`&&(n=e.getBoundingClientRect()).right<=t.left&&n.bottom>t.top&&i++}let n;Fz&&i&&r.nodeType==1&&(n=r.childNodes[i-1]).nodeType==1&&n.contentEditable==`false`&&n.getBoundingClientRect().top>=t.top&&i--,r==e.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&t.top>r.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!=`BR`)&&(s=Qz(e,r,i,t))}s??=Zz(e,o,t);let c=e.docView.nearestDesc(o,!0);return{pos:s,inside:c?c.posAtStart-c.border:-1}}function tB(e){return e.top<e.bottom||e.left<e.right}function nB(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(tB(e))return e}return Array.prototype.find.call(n,tB)||e.getBoundingClientRect()}var rB=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function iB(e,t,n){let{node:r,offset:i,atom:a}=e.docView.domFromPos(t,n<0?-1:1),o=Fz||Ez;if(r.nodeType==3)if(o&&(rB.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let e=nB(iz(r,i,i),n);if(Ez&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let t=nB(iz(r,i-1,i-1),-1);if(t.top==e.top){let n=nB(iz(r,i,i+1),-1);if(n.top!=e.top)return aB(n,n.left<t.left)}}return e}else{let e=i,t=i,a=n<0?1:-1;return n<0&&!i?(t++,a=-1):n>=0&&i==r.nodeValue.length?(e--,a=1):n<0?e--:t++,aB(nB(iz(r,e,t),a),a<0)}if(!e.state.doc.resolve(t-(a||0)).parent.inlineContent){if(a==null&&i&&(n<0||i==lz(r))){let e=r.childNodes[i-1];if(e.nodeType==1)return oB(e.getBoundingClientRect(),!1)}if(a==null&&i<lz(r)){let e=r.childNodes[i];if(e.nodeType==1)return oB(e.getBoundingClientRect(),!0)}return oB(r.getBoundingClientRect(),n>=0)}if(a==null&&i&&(n<0||i==lz(r))){let e=r.childNodes[i-1],t=e.nodeType==3?iz(e,lz(e)-+!o):e.nodeType==1&&(e.nodeName!=`BR`||!e.nextSibling)?e:null;if(t)return aB(nB(t,1),!1)}if(a==null&&i<lz(r)){let e=r.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?e.nodeType==3?iz(e,0,+!o):e.nodeType==1?e:null:null;if(t)return aB(nB(t,-1),!0)}return aB(nB(r.nodeType==3?iz(r):r,-n),n>=0)}function aB(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 oB(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 sB(e,t,n){let r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}function cB(e,t,n){let r=t.selection,i=n==`up`?r.$from:r.$to;return sB(e,t,()=>{let{node:t}=e.docView.domFromPos(i.pos,n==`up`?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=iB(e,i.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(e.nodeType==1)t=e.getClientRects();else if(e.nodeType==3)t=iz(e,0,e.nodeValue.length).getClientRects();else continue;for(let e=0;e<t.length;e++){let i=t[e];if(i.bottom>i.top+1&&(n==`up`?r.top-i.top>(i.bottom-r.top)*2:i.bottom-r.bottom>(r.bottom-i.top)*2))return!1}}return!0})}var lB=/[\u0590-\u08ac]/;function uB(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,a=!i,o=i==r.parent.content.size,s=e.domSelection();return s?!lB.test(r.parent.textContent)||!s.modify?n==`left`||n==`backward`?a:o:sB(e,t,()=>{let{focusNode:t,focusOffset:i,anchorNode:a,anchorOffset:o}=e.domSelectionRange(),c=s.caretBidiLevel;s.modify(`move`,n,`character`);let l=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:u,focusOffset:d}=e.domSelectionRange(),f=u&&!l.contains(u.nodeType==1?u:u.parentNode)||t==u&&i==d;try{s.collapse(a,o),t&&(t!=a||i!=o)&&s.extend&&s.extend(t,i)}catch{}return c!=null&&(s.caretBidiLevel=c),f}):r.pos==r.start()||r.pos==r.end()}var dB=null,fB=null,pB=!1;function mB(e,t,n){return dB==t&&fB==n?pB:(dB=t,fB=n,pB=n==`up`||n==`down`?cB(e,t,n):uB(e,t,n))}var hB=0,gB=1,_B=2,vB=3,yB=class{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=hB,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.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(e,t,n){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}else{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}let r;if(e==this.dom&&this.contentDOM)r=t>tz(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(r==null&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return r??n>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),a;if(i&&(!t||i.node))if(n&&(a=i.nodeDOM)&&!(a.nodeType==1?a.contains(e.nodeType==1?e:e.parentNode):a==e))n=!1;else return i}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],i=n+r.size;if(n==e&&i!=n){for(;!r.border&&r.children.length;)for(let e=0;e<r.children.length;e++){let t=r.children[e];if(t.size){r=t;break}}return r}if(e<i)return r.descAt(e-n-r.border);n=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let t=0;n<this.children.length;n++){let i=this.children[n],a=t+i.size;if(a>e||i instanceof EB){r=e-t;break}t=a}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let e;n&&!(e=this.children[n-1]).size&&e instanceof bB&&e.side>=0;n--);if(t<=0){let e,r=!0;for(;e=n?this.children[n-1]:null,!(!e||e.dom.parentNode==this.contentDOM);n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?tz(e.dom)+1:0}}else{let e,r=!0;for(;e=n<this.children.length?this.children[n]:null,!(!e||e.dom.parentNode==this.contentDOM);n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?tz(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let a=n,o=0;;o++){let n=this.children[o],s=a+n.size;if(r==-1&&e<=s){let i=a+n.border;if(e>=i&&t<=s-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,i);e=a;for(let t=o;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=tz(n.dom)+1;break}e-=n.size}r==-1&&(r=0)}if(r>-1&&(s>t||o==this.children.length-1)){t=s;for(let e=o+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){i=tz(n.dom);break}t+=n.size}i==-1&&(i=this.contentDOM.childNodes.length);break}a=s}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(t.nodeType!=1||n==t.childNodes.length)throw RangeError(`No node after pos `+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let i=Math.min(e,t),a=Math.max(e,t);for(let o=0,s=0;o<this.children.length;o++){let c=this.children[o],l=s+c.size;if(i>s&&a<l)return c.setSelection(e-s-c.border,t-s-c.border,n,r);s=l}let o=this.domFromPos(e,e?-1:1),s=t==e?o:this.domFromPos(t,t?-1:1),c=n.root.getSelection(),l=n.domSelectionRange(),u=!1;if((Ez||Az)&&e==t){let{node:e,offset:t}=o;if(e.nodeType==3){if(u=!!(t&&e.nodeValue[t-1]==`
86
+ `),u&&t==e.nodeValue.length)for(let t=e,n;t;t=t.parentNode){if(n=t.nextSibling){n.nodeName==`BR`&&(o=s={node:n.parentNode,offset:tz(n)+1});break}let e=t.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];u=n&&(n.nodeName==`BR`||n.contentEditable==`false`)}}if(Ez&&l.focusNode&&l.focusNode!=s.node&&l.focusNode.nodeType==1){let e=l.focusNode.childNodes[l.focusOffset];e&&e.contentEditable==`false`&&(r=!0)}if(!(r||u&&Az)&&oz(o.node,o.offset,l.anchorNode,l.anchorOffset)&&oz(s.node,s.offset,l.focusNode,l.focusOffset))return;let d=!1;if((c.extend||e==t)&&!(u&&Ez)){c.collapse(o.node,o.offset);try{e!=t&&c.extend(s.node,s.offset),d=!0}catch{}}if(!d){if(e>t){let e=o;o=s,s=e}let n=document.createRange();n.setEnd(s.node,s.offset),n.setStart(o.node,o.offset),c.removeAllRanges(),c.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&e.type!=`selection`}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let i=this.children[r],a=n+i.size;if(n==a?e<=a&&t>=n:e<a&&t>n){let r=n+i.border,o=a-i.border;if(e>=r&&t<=o){this.dirty=e==n||t==a?_B:gB,e==r&&t==o&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=vB:i.markDirty(e-r,t-r);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?_B:vB}n=a}this.dirty=_B}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=e==1?_B:gB;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}},bB=class extends yB{constructor(e,t,n,r){let i,a=t.type.toDOM;if(typeof a==`function`&&(a=a(n,()=>{if(!i)return r;if(i.parent)return i.parent.posBeforeChild(i)})),!t.type.spec.raw){if(a.nodeType!=1){let e=document.createElement(`span`);e.appendChild(a),a=e}a.contentEditable=`false`,a.classList.add(`ProseMirror-widget`)}super(e,[],a,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return this.dirty==hB&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!=`selection`||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}},xB=class extends yB{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e==this.textDOM?this.posAtStart+t:this.posAtStart+(t?this.size:0)}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type===`characterData`&&e.target.nodeValue==e.oldValue}},SB=class e extends yB{constructor(e,t,n,r,i){super(e,[],n,r),this.mark=t,this.spec=i}static create(t,n,r,i){let a=i.nodeViews[n.type.name],o=a&&a(n,i,r);return(!o||!o.dom)&&(o=vI.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new e(t,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&vB||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=vB&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=hB){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=hB}}slice(t,n,r){let i=e.create(this.parent,this.mark,!0,r),a=this.children,o=this.size;n<o&&(a=UB(a,n,o,r)),t>0&&(a=UB(a,0,t,r));for(let e=0;e<a.length;e++)a[e].parent=i;return i.children=a,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}},CB=class e extends yB{constructor(e,t,n,r,i,a,o,s,c){super(e,[],i,a),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=o}static create(t,n,r,i,a,o){let s=a.nodeViews[n.type.name],c,l=s&&s(n,a,()=>{if(!c)return o;if(c.parent)return c.parent.posBeforeChild(c)},r,i),u=l&&l.dom,d=l&&l.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw RangeError(`Text must be rendered as a DOM text node`)}else if(!u){let e=vI.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs);({dom:u,contentDOM:d}=e)}!d&&!n.isText&&u.nodeName!=`BR`&&(u.hasAttribute(`contenteditable`)||(u.contentEditable=`false`),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=PB(u,r,n),l?c=new DB(t,n,r,i,u,d||null,f,l,a,o+1):n.isText?new TB(t,n,r,i,u,f,a):new e(t,n,r,i,u,d||null,f,a,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace==`pre`&&(e.preserveWhitespace=`full`),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>Q.empty)}return e}matchesNode(e,t,n){return this.dirty==hB&&e.eq(this.node)&&FB(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return+!this.node.isLeaf}updateChildren(e,t){let n=this.node.inlineContent,r=t,i=e.composing?this.localCompositionInfo(e,t):null,a=i&&i.pos>-1?i:null,o=i&&i.pos<0,s=new LB(this,a&&a.node,e);BB(this.node,this.innerDeco,(t,i,a)=>{t.spec.marks?s.syncToMarks(t.spec.marks,n,e,i):t.type.side>=0&&!a&&s.syncToMarks(i==this.node.childCount?cF.none:this.node.child(i).marks,n,e,i),s.placeWidget(t,e,r)},(t,a,c,l)=>{s.syncToMarks(t.marks,n,e,l);let u;s.findNodeMatch(t,a,c,l)||o&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(u=s.findIndexWithChild(i.node))>-1&&s.updateNodeAt(t,a,c,u,e)||s.updateNextNode(t,a,c,e,l,r)||s.addNode(t,a,c,e,r),r+=t.nodeSize}),s.syncToMarks([],n,e,0),this.node.isTextblock&&s.addTextblockHacks(),s.destroyRest(),(s.changed||this.dirty==_B)&&(a&&this.protectLocalComposition(e,a),OB(this.contentDOM,this.children,e),jz&&VB(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof UL)||n<t||r>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let e=i.nodeValue,a=HB(this.node.content,e,n-t,r-t);return a<0?null:{node:i,pos:a,text:e}}else return{node:i,pos:-1,text:``}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&=void 0}let a=new xB(this,i,t,r);e.input.compositionNodes.push(a),this.children=UB(this.children,n,n+r.length,e,a)}update(e,t,n,r){return this.dirty==vB||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,n,r),!0)}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=hB}updateOuterDeco(e){if(FB(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,n=this.dom;this.dom=MB(this.dom,this.nodeDOM,jB(this.outerDeco,this.node,t),jB(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute(`draggable`))}get domAtom(){return this.node.isAtom}};function wB(e,t,n,r,i){PB(r,t,e);let a=new CB(void 0,e,t,n,r,r,r,i,0);return a.contentDOM&&a.updateChildren(i,0),a}var TB=class e extends CB{constructor(e,t,n,r,i,a,o){super(e,t,n,r,i,null,a,o,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return this.dirty==vB||this.dirty!=hB&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=hB||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=hB,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return e.type!=`characterData`&&e.type!=`selection`}slice(t,n,r){let i=this.node.cut(t,n),a=document.createTextNode(i.text);return new e(this.parent,i,this.outerDeco,this.innerDeco,a,a,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=vB)}get domAtom(){return!1}isText(e){return this.node.text==e}},EB=class extends yB{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==hB&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName==`IMG`}},DB=class extends CB{constructor(e,t,n,r,i,a,o,s,c,l){super(e,t,n,r,i,a,o,c,l),this.spec=s}update(e,t,n,r){if(this.dirty==vB)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,n);return i&&this.updateInner(e,t,n,r),i}else if(!this.contentDOM&&!e.isLeaf)return!1;else return super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}};function OB(e,t,n){let r=e.firstChild,i=!1;for(let a=0;a<t.length;a++){let o=t[a],s=o.dom;if(s.parentNode==e){for(;s!=r;)r=IB(r),i=!0;r=r.nextSibling}else i=!0,e.insertBefore(s,r);if(o instanceof SB){let t=r?r.previousSibling:e.lastChild;OB(o.contentDOM,o.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=IB(r),i=!0;i&&n.trackWrites==e&&(n.trackWrites=null)}var kB=function(e){e&&(this.nodeName=e)};kB.prototype=Object.create(null);var AB=[new kB];function jB(e,t,n){if(e.length==0)return AB;let r=n?AB[0]:new kB,i=[r];for(let a=0;a<e.length;a++){let o=e[a].type.attrs;if(o){o.nodeName&&i.push(r=new kB(o.nodeName));for(let e in o){let a=o[e];a!=null&&(n&&i.length==1&&i.push(r=new kB(t.isInline?`span`:`div`)),e==`class`?r.class=(r.class?r.class+` `:``)+a:e==`style`?r.style=(r.style?r.style+`;`:``)+a:e!=`nodeName`&&(r[e]=a))}}}return i}function MB(e,t,n,r){if(n==AB&&r==AB)return t;let i=t;for(let t=0;t<r.length;t++){let a=r[t],o=n[t];if(t){let t;o&&o.nodeName==a.nodeName&&i!=e&&(t=i.parentNode)&&t.nodeName.toLowerCase()==a.nodeName?i=t:(t=document.createElement(a.nodeName),t.pmIsDeco=!0,t.appendChild(i),o=AB[0],i=t)}NB(i,o||AB[0],a)}return i}function NB(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):[],i=n.class?n.class.split(` `).filter(Boolean):[];for(let t=0;t<r.length;t++)i.indexOf(r[t])==-1&&e.classList.remove(r[t]);for(let t=0;t<i.length;t++)r.indexOf(i[t])==-1&&e.classList.add(i[t]);e.classList.length==0&&e.removeAttribute(`class`)}if(t.style!=n.style){if(t.style){let n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=n.exec(t.style);)e.style.removeProperty(r[1])}n.style&&(e.style.cssText+=n.style)}}function PB(e,t,n){return MB(e,e,AB,jB(t,n,e.nodeType!=1))}function FB(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 IB(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}var LB=class{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=RB(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n,r){let i=0,a=this.stack.length>>1,o=Math.min(a,e.length);for(;i<o&&(i==a-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<a;)this.destroyRest(),this.top.dirty=hB,this.index=this.stack.pop(),this.top=this.stack.pop(),a--;for(;a<e.length;){this.stack.push(this.top,this.index+1);let i=-1,o=this.top.children.length;r<this.preMatch.index&&(o=Math.min(this.index+3,o));for(let t=this.index;t<o;t++){let n=this.top.children[t];if(n.matchesMark(e[a])&&!this.isLocked(n.dom)){i=t;break}}if(i>-1)i>this.index&&(this.changed=!0,this.destroyBetween(this.index,i)),this.top=this.top.children[this.index];else{let r=SB.create(this.top,e[a],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,a++}}findNodeMatch(e,t,n,r){let i=-1,a;if(r>=this.preMatch.index&&(a=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&a.matchesNode(e,t,n))i=this.top.children.indexOf(a,this.index);else for(let r=this.index,a=Math.min(this.top.children.length,r+5);r<a;r++){let a=this.top.children[r];if(a.matchesNode(e,t,n)&&!this.preMatch.matched.has(a)){i=r;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,n,r,i){let a=this.top.children[r];return a.dirty==vB&&a.dom==a.contentDOM&&(a.dirty=_B),a.update(e,t,n,i)?(this.destroyBetween(this.index,r),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t){for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e}return-1}e=t}}updateNextNode(e,t,n,r,i,a){for(let o=this.index;o<this.top.children.length;o++){let s=this.top.children[o];if(s instanceof CB){let c=this.preMatch.matched.get(s);if(c!=null&&c!=i)return!1;let l=s.dom,u,d=this.isLocked(l)&&!(e.isText&&s.node&&s.node.isText&&s.nodeDOM.nodeValue==e.text&&s.dirty!=vB&&FB(t,s.outerDeco));if(!d&&s.update(e,t,n,r))return this.destroyBetween(this.index,o),s.dom!=l&&(this.changed=!0),this.index++,!0;if(!d&&(u=this.recreateWrapper(s,e,t,n,r,a)))return this.destroyBetween(this.index,o),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=_B,u.updateChildren(r,a+1),u.dirty=hB),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,i,a){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!FB(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let o=CB.create(this.top,t,n,r,i,a);if(o.contentDOM){o.children=e.children,e.children=[];for(let e of o.children)e.parent=o}return e.destroy(),o}addNode(e,t,n,r,i){let a=CB.create(this.top,e,t,n,r,i);a.contentDOM&&a.updateChildren(r,i+1),this.top.children.splice(this.index++,0,a),this.changed=!0}placeWidget(e,t,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let r=new bB(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof SB;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof TB)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Az||Oz)&&e&&e.dom.contentEditable==`false`&&this.addHackNode(`IMG`,t),this.addHackNode(`BR`,this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);e==`IMG`&&(n.className=`ProseMirror-separator`,n.alt=``),e==`BR`&&(n.className=`ProseMirror-trailingBreak`);let r=new EB(this.top,[],n,null);t==this.top?t.children.splice(this.index++,0,r):t.children.push(r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}};function RB(e,t){let n=t,r=n.children.length,i=e.childCount,a=new Map,o=[];outer:for(;i>0;){let s;for(;;)if(r){let e=n.children[r-1];if(e instanceof SB)n=e,r=e.children.length;else{s=e,r--;break}}else if(n==t)break outer;else r=n.parent.children.indexOf(n),n=n.parent;let c=s.node;if(c){if(c!=e.child(i-1))break;--i,a.set(s,i),o.push(s)}}return{index:i,matched:a,matches:o.reverse()}}function zB(e,t){return e.type.side-t.type.side}function BB(e,t,n,r){let i=t.locals(e),a=0;if(i.length==0){for(let n=0;n<e.childCount;n++){let o=e.child(n);r(o,i,t.forChild(a,o),n),a+=o.nodeSize}return}let o=0,s=[],c=null;for(let l=0;;){let u,d;for(;o<i.length&&i[o].to==a;){let e=i[o++];e.widget&&(u?(d||=[u]).push(e):u=e)}if(u)if(d){d.sort(zB);for(let e=0;e<d.length;e++)n(d[e],l,!!c)}else n(u,l,!!c);let f,p;if(c)p=-1,f=c,c=null;else if(l<e.childCount)p=l,f=e.child(l++);else break;for(let e=0;e<s.length;e++)s[e].to<=a&&s.splice(e--,1);for(;o<i.length&&i[o].from<=a&&i[o].to>a;)s.push(i[o++]);let m=a+f.nodeSize;if(f.isText){let e=m;o<i.length&&i[o].from<e&&(e=i[o].from);for(let t=0;t<s.length;t++)s[t].to<e&&(e=s[t].to);e<m&&(c=f.cut(e-a),f=f.cut(0,e-a),m=e,p=-1)}else for(;o<i.length&&i[o].to<m;)o++;let h=f.isInline&&!f.isLeaf?s.filter(e=>!e.inline):s.slice();r(f,h,t.forChild(a,f),p),a=m}}function VB(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 HB(e,t,n,r){for(let i=0,a=0;i<e.childCount&&a<=r;){let o=e.child(i++),s=a;if(a+=o.nodeSize,!o.isText)continue;let c=o.text;for(;i<e.childCount;){let t=e.child(i++);if(a+=t.nodeSize,!t.isText)break;c+=t.text}if(a>=n){if(a>=r&&c.slice(r-t.length-s,r-s)==t)return r-t.length;let e=s<r?c.lastIndexOf(t,r-s-1):-1;if(e>=0&&e+t.length+s>=n)return s+e;if(n==r&&c.length>=r+t.length-s&&c.slice(r-s,r-s+t.length)==t)return r}}return-1}function UB(e,t,n,r,i){let a=[];for(let o=0,s=0;o<e.length;o++){let c=e[o],l=s,u=s+=c.size;l>=n||u<=t?a.push(c):(l<t&&a.push(c.slice(0,t-l,r)),i&&=(a.push(i),void 0),u>n&&a.push(c.slice(n-l,c.size,r)))}return a}function WB(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),a=i&&i.size==0,o=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let s=r.resolve(o),c,l;if(mz(n)){for(c=o;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&GL.isSelectable(e)&&i.parent&&!(e.isInline&&fz(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;l=new GL(o==e?s:r.resolve(e))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=o,i=o;for(let r=0;r<n.rangeCount;r++){let a=n.getRangeAt(r);t=Math.min(t,e.docView.posFromDOM(a.startContainer,a.startOffset,1)),i=Math.max(i,e.docView.posFromDOM(a.endContainer,a.endOffset,-1))}if(t<0)return null;[c,o]=i==e.state.selection.anchor?[i,t]:[t,i],s=r.resolve(o)}else c=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let u=r.resolve(c);if(!l){let n=t==`pointer`||e.state.selection.head<s.pos&&!a?1:-1;l=tV(e,u,s,n)}return l}function GB(e){return e.editable?e.hasFocus():rV(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function KB(e,t=!1){let n=e.state.selection;if($B(e,n),GB(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&Oz){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&oz(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset)){e.input.mouseDown.delayedSelectionSync=!0,e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)QB(e);else{let{anchor:r,head:i}=n,a,o;qB&&!(n instanceof UL)&&(n.$from.parent.inlineContent||(a=JB(e,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=JB(e,n.to))),e.docView.setSelection(r,i,e,t),qB&&(a&&XB(a),o&&XB(o)),n.visible?e.dom.classList.remove(`ProseMirror-hideselection`):(e.dom.classList.add(`ProseMirror-hideselection`),`onselectionchange`in document&&ZB(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}var qB=Az||Oz&&kz<63;function JB(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),i=r<n.childNodes.length?n.childNodes[r]:null,a=r?n.childNodes[r-1]:null;if(Az&&i&&i.contentEditable==`false`)return YB(i);if((!i||i.contentEditable==`false`)&&(!a||a.contentEditable==`false`)){if(i)return YB(i);if(a)return YB(a)}}function YB(e){return e.contentEditable=`true`,Az&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function XB(e){e.contentEditable=`false`,e.wasDraggable&&=(e.draggable=!0,null)}function ZB(e){let t=e.dom.ownerDocument;t.removeEventListener(`selectionchange`,e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;t.addEventListener(`selectionchange`,e.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(t.removeEventListener(`selectionchange`,e.input.hideSelectionGuard),setTimeout(()=>{(!GB(e)||e.state.selection.visible)&&e.dom.classList.remove(`ProseMirror-hideselection`)},20))})}function QB(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r=n.nodeName==`IMG`;r?t.collapse(n.parentNode,tz(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&wz&&Tz<=11&&(n.disabled=!0,n.disabled=!1)}function $B(e,t){if(t instanceof GL){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(eV(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else eV(e)}function eV(e){e.lastSelectedViewDesc&&=(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),void 0)}function tV(e,t,n,r){return e.someProp(`createSelectionBetween`,r=>r(e,t,n))||UL.between(t,n,r)}function nV(e){return e.editable&&!e.hasFocus()?!1:rV(e)}function rV(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 iV(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return oz(t.node,t.offset,n.anchorNode,n.anchorOffset)}function aV(e,t){let{$anchor:n,$head:r}=e.selection,i=t>0?n.max(r):n.min(r),a=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return a&&zL.findFrom(a,t)}function oV(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function sV(e,t,n){let r=e.state.selection;if(r instanceof UL){if(n.indexOf(`s`)>-1){let{$head:n}=r,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let a=e.state.doc.resolve(n.pos+i.nodeSize*(t<0?-1:1));return oV(e,new UL(r.$anchor,a))}else if(!r.empty)return!1;else if(e.endOfTextblock(t>0?`forward`:`backward`)){let n=aV(e.state,t);return n&&n instanceof GL?oV(e,n):!1}else if(!(Mz&&n.indexOf(`m`)>-1)){let n=r.$head,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter,a;if(!i||i.isText)return!1;let o=t<0?n.pos-i.nodeSize:n.pos;return i.isAtom||(a=e.docView.descAt(o))&&!a.contentDOM?GL.isSelectable(i)?oV(e,new GL(t<0?e.state.doc.resolve(n.pos-i.nodeSize):n)):Fz?oV(e,new UL(e.state.doc.resolve(t<0?o:o+i.nodeSize))):!1:!1}}else if(r instanceof GL&&r.node.isInline)return oV(e,new UL(t>0?r.$to:r.$from));else{let n=aV(e.state,t);return n?oV(e,n):!1}}function cV(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function lV(e,t){let n=e.pmViewDesc;return n&&n.size==0&&(t<0||e.nextSibling||e.nodeName!=`BR`)}function uV(e,t){return t<0?dV(e):fV(e)}function dV(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,a,o=!1;for(Ez&&n.nodeType==1&&r<cV(n)&&lV(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let e=n.childNodes[r-1];if(lV(e,-1))i=n,a=--r;else if(e.nodeType==3)n=e,r=n.nodeValue.length;else break}}else if(pV(n))break;else{let t=n.previousSibling;for(;t&&lV(t,-1);)i=n.parentNode,a=tz(t),t=t.previousSibling;if(t)n=t,r=cV(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}o?gV(e,n,r):i&&gV(e,i,a)}function fV(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i=cV(n),a,o;for(;;)if(r<i){if(n.nodeType!=1)break;let e=n.childNodes[r];if(lV(e,1))a=n,o=++r;else break}else if(pV(n))break;else{let t=n.nextSibling;for(;t&&lV(t,1);)a=t.parentNode,o=tz(t)+1,t=t.nextSibling;if(t)n=t,r=0,i=cV(n);else{if(n=n.parentNode,n==e.dom)break;r=i=0}}a&&gV(e,a,o)}function pV(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function mV(e,t){for(;e&&t==e.childNodes.length&&!pz(e);)t=tz(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 hV(e,t){for(;e&&!t&&!pz(e);)t=tz(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 gV(e,t,n){if(t.nodeType!=3){let e,r;(r=mV(t,n))?(t=r,n=0):(e=hV(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(mz(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:i}=e;setTimeout(()=>{e.state==i&&KB(e)},50)}function _V(e,t){let n=e.state.doc.resolve(t);if(!(Oz||Nz)&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?`ltr`:`rtl`}if(t<n.end()){let n=e.coordsAtPos(t+1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?`ltr`:`rtl`}}return getComputedStyle(e.dom).direction==`rtl`?`rtl`:`ltr`}function vV(e,t,n){let r=e.state.selection;if(r instanceof UL&&!r.empty||n.indexOf(`s`)>-1||Mz&&n.indexOf(`m`)>-1)return!1;let{$from:i,$to:a}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?`up`:`down`)){let n=aV(e.state,t);if(n&&n instanceof GL)return oV(e,n)}if(!i.parent.inlineContent){let n=t<0?i:a,o=r instanceof qL?zL.near(n,t):zL.findFrom(n,t);return o?oV(e,o):!1}return!1}function yV(e,t){if(!(e.state.selection instanceof UL))return!0;let{$head:n,$anchor:r,empty:i}=e.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?`forward`:`backward`))return!0;let a=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(a&&!a.isText){let r=e.state.tr;return t<0?r.delete(n.pos-a.nodeSize,n.pos):r.delete(n.pos,n.pos+a.nodeSize),e.dispatch(r),!0}return!1}function bV(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function xV(e){if(!Az||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 n=t.firstChild;bV(e,n,`true`),setTimeout(()=>bV(e,n,`false`),20)}return!1}function SV(e){let t=``;return e.ctrlKey&&(t+=`c`),e.metaKey&&(t+=`m`),e.altKey&&(t+=`a`),e.shiftKey&&(t+=`s`),t}function CV(e,t){let n=t.keyCode,r=SV(t);if(n==8||Mz&&n==72&&r==`c`)return yV(e,-1)||uV(e,-1);if(n==46&&!t.shiftKey||Mz&&n==68&&r==`c`)return yV(e,1)||uV(e,1);if(n==13||n==27)return!0;if(n==37||Mz&&n==66&&r==`c`){let t=n==37?_V(e,e.state.selection.from)==`ltr`?-1:1:-1;return sV(e,t,r)||uV(e,t)}else if(n==39||Mz&&n==70&&r==`c`){let t=n==39?_V(e,e.state.selection.from)==`ltr`?1:-1:1;return sV(e,t,r)||uV(e,t)}else if(n==38||Mz&&n==80&&r==`c`)return vV(e,-1,r)||uV(e,-1);else if(n==40||Mz&&n==78&&r==`c`)return xV(e)||vV(e,1,r)||uV(e,1);else if(r==(Mz?`m`:`c`)&&(n==66||n==73||n==89||n==90))return!0;return!1}function wV(e,t){e.someProp(`transformCopied`,n=>{t=n(t,e)});let n=[],{content:r,openStart:i,openEnd:a}=t;for(;i>1&&a>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,a--;let e=r.firstChild;n.push(e.type.name,e.attrs==e.type.defaultAttrs?null:e.attrs),r=e.content}let o=e.someProp(`clipboardSerializer`)||vI.fromSchema(e.state.schema),s=FV(),c=s.createElement(`div`);c.appendChild(o.serializeFragment(r,{document:s}));let l=c.firstChild,u,d=0;for(;l&&l.nodeType==1&&(u=NV[l.nodeName.toLowerCase()]);){for(let e=u.length-1;e>=0;e--){let t=s.createElement(u[e]);for(;c.firstChild;)t.appendChild(c.firstChild);c.appendChild(t),d++}l=c.firstChild}return l&&l.nodeType==1&&l.setAttribute(`data-pm-slice`,`${i} ${a}${d?` -${d}`:``} ${JSON.stringify(n)}`),{dom:c,text:e.someProp(`clipboardTextSerializer`,n=>n(t,e))||t.content.textBetween(0,t.content.size,`
87
+
88
+ `),slice:t}}function TV(e,t,n,r,i){let a=i.parent.type.spec.code,o,s;if(!n&&!t)return null;let c=!!t&&(r||a||!n);if(c){if(e.someProp(`transformPastedText`,n=>{t=n(t,a||r,e)}),a)return s=new uF(Q.from(e.state.schema.text(t.replace(/\r\n?/g,`
89
+ `))),0,0),e.someProp(`transformPasted`,t=>{s=t(s,e,!0)}),s;let n=e.someProp(`clipboardTextParser`,n=>n(t,i,r,e));if(n)s=n;else{let n=i.marks(),{schema:r}=e.state,a=vI.fromSchema(r);o=document.createElement(`div`),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=o.appendChild(document.createElement(`p`));e&&t.appendChild(a.serializeNode(r.text(e,n)))})}}else e.someProp(`transformPastedHTML`,t=>{n=t(n,e)}),o=RV(n),Fz&&zV(o);let l=o&&o.querySelector(`[data-pm-slice]`),u=l&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(l.getAttribute(`data-pm-slice`)||``);if(u&&u[3])for(let e=+u[3];e>0;e--){let e=o.firstChild;for(;e&&e.nodeType!=1;)e=e.nextSibling;if(!e)break;o=e}if(s||=(e.someProp(`clipboardParser`)||e.someProp(`domParser`)||iI.fromSchema(e.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||u),context:i,ruleFromNode(e){return e.nodeName==`BR`&&!e.nextSibling&&e.parentNode&&!EV.test(e.parentNode.nodeName)?{ignore:!0}:null}}),u)s=BV(MV(s,+u[1],+u[2]),u[4]);else if(s=uF.maxOpen(DV(s.content,i),!0),s.openStart||s.openEnd){let e=0,t=0;for(let t=s.content.firstChild;e<s.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=s.content.lastChild;t<s.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);s=MV(s,e,t)}return e.someProp(`transformPasted`,t=>{s=t(s,e,c)}),s}var EV=/^(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 DV(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.index(n)),i,a=[];if(e.forEach(e=>{if(!a)return;let t=r.findWrapping(e.type),n;if(!t)return a=null;if(n=a.length&&i.length&&kV(t,i,e,a[a.length-1],0))a[a.length-1]=n;else{a.length&&(a[a.length-1]=AV(a[a.length-1],i.length));let n=OV(e,t);a.push(n),r=r.matchType(n.type),i=t}}),a)return Q.from(a)}return e}function OV(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,Q.from(e));return e}function kV(e,t,n,r,i){if(i<e.length&&i<t.length&&e[i]==t[i]){let a=kV(e,t,n,r.lastChild,i+1);if(a)return r.copy(r.content.replaceChild(r.childCount-1,a));if(r.contentMatchAt(r.childCount).matchType(i==e.length-1?n.type:e[i+1]))return r.copy(r.content.append(Q.from(OV(n,e,i+1))))}}function AV(e,t){if(t==0)return e;let n=e.content.replaceChild(e.childCount-1,AV(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(Q.empty,!0);return e.copy(n.append(r))}function jV(e,t,n,r,i,a){let o=t<0?e.firstChild:e.lastChild,s=o.content;return e.childCount>1&&(a=0),i<r-1&&(s=jV(s,t,n,r,i+1,a)),i>=n&&(s=t<0?o.contentMatchAt(0).fillBefore(s,a<=i).append(s):s.append(o.contentMatchAt(o.childCount).fillBefore(Q.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,o.copy(s))}function MV(e,t,n){return t<e.openStart&&(e=new uF(jV(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new uF(jV(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}var NV={thead:[`table`],tbody:[`table`],tfoot:[`table`],caption:[`table`],colgroup:[`table`],col:[`table`,`colgroup`],tr:[`table`,`tbody`],td:[`table`,`tbody`,`tr`],th:[`table`,`tbody`,`tr`]},PV=null;function FV(){return PV||=document.implementation.createHTMLDocument(`title`)}var IV=null;function LV(e){let t=window.trustedTypes;return t?(IV||=t.defaultPolicy||t.createPolicy(`ProseMirrorClipboard`,{createHTML:e=>e}),IV.createHTML(e)):e}function RV(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=FV().createElement(`div`),r=/<([a-z][^>\s]+)/i.exec(e),i;if((i=r&&NV[r[1].toLowerCase()])&&(e=i.map(e=>`<`+e+`>`).join(``)+e+i.map(e=>`</`+e+`>`).reverse().join(``)),n.innerHTML=LV(e),i)for(let e=0;e<i.length;e++)n=n.querySelector(i[e])||n;return n}function zV(e){let t=e.querySelectorAll(Oz?`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==`\xA0`&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(` `),r)}}function BV(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:i,openStart:a,openEnd:o}=e;for(let e=r.length-2;e>=0;e-=2){let t=n.nodes[r[e]];if(!t||t.hasRequiredAttrs())break;i=Q.from(t.create(r[e+1],i)),a++,o++}return new uF(i,a,o)}var VV={},HV={},UV={touchstart:!0,touchmove:!0},WV=class{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.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}};function GV(e){for(let t in VV){let n=VV[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{XV(e,t)&&!YV(e,t)&&(e.editable||!(t.type in HV))&&n(e,t)},UV[t]?{passive:!0}:void 0)}Az&&e.dom.addEventListener(`input`,()=>null),JV(e)}function KV(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function qV(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 JV(e){e.someProp(`handleDOMEvents`,t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>YV(e,t))})}function YV(e,t){return e.someProp(`handleDOMEvents`,n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function XV(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 ZV(e,t){!YV(e,t)&&VV[t.type]&&(e.editable||!(t.type in HV))&&VV[t.type](e,t)}HV.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!dH(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(Pz&&Oz&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),jz&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp(`handleKeyDown`,t=>t(e,hz(13,`Enter`))),e.input.lastIOSEnter=0)},200)}else e.someProp(`handleKeyDown`,t=>t(e,n))||CV(e,n)?n.preventDefault():KV(e,`key`)},HV.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)},HV.keypress=(e,t)=>{let n=t;if(dH(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||Mz&&n.metaKey)return;if(e.someProp(`handleKeyPress`,t=>t(e,n))){n.preventDefault();return}let r=e.state.selection;if(!(r instanceof UL)||!r.$from.sameParent(r.$to)){let t=String.fromCharCode(n.charCode),i=()=>e.state.tr.insertText(t).scrollIntoView();!/[\r\n]/.test(t)&&!e.someProp(`handleTextInput`,n=>n(e,r.$from.pos,r.$to.pos,t,i))&&e.dispatch(i()),n.preventDefault()}};function QV(e){return{left:e.clientX,top:e.clientY}}function $V(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function eH(e,t,n,r,i){if(r==-1)return!1;let a=e.state.doc.resolve(r);for(let r=a.depth+1;r>0;r--)if(e.someProp(t,t=>r>a.depth?t(e,n,a.nodeAfter,a.before(r),i,!0):t(e,n,a.node(r),a.before(r),i,!1)))return!0;return!1}function tH(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);n==`pointer`&&r.setMeta(`pointer`,!0),e.dispatch(r)}function nH(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&GL.isSelectable(r)?(tH(e,new GL(n),`pointer`),!0):!1}function rH(e,t){if(t==-1)return!1;let n=e.state.selection,r,i;n instanceof GL&&(r=n.node);let a=e.state.doc.resolve(t);for(let e=a.depth+1;e>0;e--){let t=e>a.depth?a.nodeAfter:a.node(e);if(GL.isSelectable(t)){i=r&&n.$from.depth>0&&e>=n.$from.depth&&a.before(n.$from.depth+1)==n.$from.pos?a.before(n.$from.depth):a.before(e);break}}return i==null?!1:(tH(e,GL.create(e.state.doc,i),`pointer`),!0)}function iH(e,t,n,r,i){return eH(e,`handleClickOn`,t,n,r)||e.someProp(`handleClick`,n=>n(e,t,r))||(i?rH(e,n):nH(e,n))}function aH(e,t,n,r){return eH(e,`handleDoubleClickOn`,t,n,r)||e.someProp(`handleDoubleClick`,n=>n(e,t,r))}function oH(e,t,n,r){return eH(e,`handleTripleClickOn`,t,n,r)||e.someProp(`handleTripleClick`,n=>n(e,t,r))||sH(e,n,r)}function sH(e,t,n){if(n.button!=0)return!1;let r=e.state.doc;if(t==-1)return r.inlineContent?(tH(e,UL.create(r,0,r.content.size),`pointer`),!0):!1;let i=r.resolve(t);for(let t=i.depth+1;t>0;t--){let n=t>i.depth?i.nodeAfter:i.node(t),a=i.before(t);if(n.inlineContent)tH(e,UL.create(r,a+1,a+1+n.content.size),`pointer`);else if(GL.isSelectable(n))tH(e,GL.create(r,a),`pointer`);else continue;return!0}}function cH(e){return vH(e)}var lH=Mz?`metaKey`:`ctrlKey`;VV.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=cH(e),i=Date.now(),a=`singleClick`;i-e.input.lastClick.time<500&&$V(n,e.input.lastClick)&&!n[lH]&&e.input.lastClick.button==n.button&&(e.input.lastClick.type==`singleClick`?a=`doubleClick`:e.input.lastClick.type==`doubleClick`&&(a=`tripleClick`)),e.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:a,button:n.button};let o=e.posAtCoords(QV(n));o&&(a==`singleClick`?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new uH(e,o,n,!!r)):(a==`doubleClick`?aH:oH)(e,o.pos,o.inside,n)?n.preventDefault():KV(e,`pointer`))};var uH=class{constructor(e,t,n,r){this.view=e,this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[lH],this.allowDefault=n.shiftKey;let i,a;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),a=t.inside;else{let n=e.state.doc.resolve(t.pos);i=n.parent,a=n.depth?n.before():0}let o=r?null:n.target,s=o?e.docView.nearestDesc(o,!0):null;this.target=s&&s.nodeDOM.nodeType==1?s.nodeDOM:null;let{selection:c}=e.state;n.button==0&&(i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof GL&&c.from<=a&&c.to>a)&&(this.mightDrag={node:i,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Ez&&!this.target.hasAttribute(`contentEditable`))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute(`contentEditable`,`false`)},20),this.view.domObserver.start()),e.root.addEventListener(`mouseup`,this.up=this.up.bind(this)),e.root.addEventListener(`mousemove`,this.move=this.move.bind(this)),KV(e,`pointer`)}done(){this.view.root.removeEventListener(`mouseup`,this.up),this.view.root.removeEventListener(`mousemove`,this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute(`draggable`),this.mightDrag.setUneditable&&this.target.removeAttribute(`contentEditable`),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>KB(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(QV(e))),this.updateAllowDefault(e),this.allowDefault||!t?KV(this.view,`pointer`):iH(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Az&&this.mightDrag&&!this.mightDrag.node.isAtom||Oz&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(tH(this.view,zL.near(this.view.state.doc.resolve(t.pos)),`pointer`),e.preventDefault()):KV(this.view,`pointer`)}move(e){this.updateAllowDefault(e),KV(this.view,`pointer`),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}};VV.touchstart=e=>{e.input.lastTouch=Date.now(),cH(e),KV(e,`pointer`)},VV.touchmove=e=>{e.input.lastTouch=Date.now(),KV(e,`pointer`)},VV.contextmenu=e=>cH(e);function dH(e,t){return e.composing?!0:Az&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}var fH=Pz?5e3:-1;HV.compositionstart=HV.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof UL&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>e.type.spec.inclusive===!1)||Oz&&Nz&&pH(e)))e.markCursor=e.state.storedMarks||n.marks(),vH(e,!0),e.markCursor=null;else if(vH(e,!t.selection.empty),Ez&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&n.nodeType==1&&r!=0;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(t.nodeType==3){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}else n=t,r=-1}}e.input.composing=!0}mH(e,fH)};function pH(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`}HV.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.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,mH(e,20))};function mH(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>vH(e),t))}function hH(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=_H());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function gH(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=uz(t.focusNode,t.focusOffset),r=dz(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let t=r.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!t||!t.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let e=n.pmViewDesc;if(!(!e||!e.isText(n.nodeValue)))return r}}return n||r}function _H(){let e=document.createEvent(`Event`);return e.initEvent(`event`,!0,!0),e.timeStamp}function vH(e,t=!1){if(!(Pz&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),hH(e),t||e.docView&&e.docView.dirty){let n=WB(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 yH(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(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}var bH=wz&&Tz<15||jz&&Iz<604;VV.copy=HV.cut=(e,t)=>{let n=t,r=e.state.selection,i=n.type==`cut`;if(r.empty)return;let a=bH?null:n.clipboardData,{dom:o,text:s}=wV(e,r.content());a?(n.preventDefault(),a.clearData(),a.setData(`text/html`,o.innerHTML),a.setData(`text/plain`,s)):yH(e,o),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta(`uiEvent`,`cut`))};function xH(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function SH(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 i=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?CH(e,r.value,null,i,t):CH(e,r.textContent,r.innerHTML,i,t)},50)}function CH(e,t,n,r,i){let a=TV(e,t,n,r,e.state.selection.$from);if(e.someProp(`handlePaste`,t=>t(e,i,a||uF.empty)))return!0;if(!a)return!1;let o=xH(a),s=o?e.state.tr.replaceSelectionWith(o,r):e.state.tr.replaceSelection(a);return e.dispatch(s.scrollIntoView().setMeta(`paste`,!0).setMeta(`uiEvent`,`paste`)),!0}function wH(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,` `):``}HV.paste=(e,t)=>{let n=t;if(e.composing&&!Pz)return;let r=bH?null:n.clipboardData,i=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&CH(e,wH(r),r.getData(`text/html`),i,n)?n.preventDefault():SH(e,n)};var TH=class{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}},EH=Mz?`altKey`:`ctrlKey`;function DH(e,t){let n;return e.someProp(`dragCopies`,e=>{n||=e(t)}),n==null?!t[EH]:!n}VV.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=e.state.selection,a=i.empty?null:e.posAtCoords(QV(n)),o;if(!(a&&a.pos>=i.from&&a.pos<=(i instanceof GL?i.to-1:i.to))){if(r&&r.mightDrag)o=GL.create(e.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let t=e.docView.nearestDesc(n.target,!0);t&&t.node.type.spec.draggable&&t!=e.docView&&(o=GL.create(e.state.doc,t.posBefore))}}let{dom:s,text:c,slice:l}=wV(e,(o||e.state.selection).content());(!n.dataTransfer.files.length||!Oz||kz>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(bH?`Text`:`text/html`,s.innerHTML),n.dataTransfer.effectAllowed=`copyMove`,bH||n.dataTransfer.setData(`text/plain`,c),e.dragging=new TH(l,DH(e,n),o)},VV.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},HV.dragover=HV.dragenter=(e,t)=>t.preventDefault(),HV.drop=(e,t)=>{try{OH(e,t,e.dragging)}finally{e.dragging=null}};function OH(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(QV(t));if(!r)return;let i=e.state.doc.resolve(r.pos),a=n&&n.slice;a?e.someProp(`transformPasted`,t=>{a=t(a,e,!1)}):a=TV(e,wH(t.dataTransfer),bH?null:t.dataTransfer.getData(`text/html`),!1,i);let o=!!(n&&DH(e,t));if(e.someProp(`handleDrop`,n=>n(e,t,a||uF.empty,o))){t.preventDefault();return}if(!a)return;t.preventDefault();let s=a?vL(e.state.doc,i.pos,a):i.pos;s??=i.pos;let c=e.state.tr;if(o){let{node:e}=n;e?e.replace(c):c.deleteSelection()}let l=c.mapping.map(s),u=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,d=c.doc;if(u?c.replaceRangeWith(l,l,a.content.firstChild):c.replaceRange(l,l,a),c.doc.eq(d))return;let f=c.doc.resolve(l);if(u&&GL.isSelectable(a.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(a.content.firstChild))c.setSelection(new GL(f));else{let t=c.mapping.map(s);c.mapping.maps[c.mapping.maps.length-1].forEach((e,n,r,i)=>t=i),c.setSelection(tV(e,f,c.doc.resolve(t)))}e.focus(),e.dispatch(c.setMeta(`uiEvent`,`drop`))}VV.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())&&KB(e)},20))},VV.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(),!1)},VV.beforeinput=(e,t)=>{if(Oz&&Pz&&t.inputType==`deleteContentBackward`){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t||(e.dom.blur(),e.focus(),e.someProp(`handleKeyDown`,t=>t(e,hz(8,`Backspace`)))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}};for(let e in HV)VV[e]=HV[e];function kH(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}var AH=class e{constructor(e,t){this.toDOM=e,this.spec=t||FH,this.side=this.spec.side||0}map(e,t,n,r){let{pos:i,deleted:a}=e.mapResult(t.from+r,this.side<0?-1:1);return a?null:new NH(i-n,i-n,this)}valid(){return!0}eq(t){return this==t||t instanceof e&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&kH(this.spec,t.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},jH=class e{constructor(e,t){this.attrs=e,this.spec=t||FH}map(e,t,n,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,a=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=a?null:new NH(i,a,this)}valid(e,t){return t.from<t.to}eq(t){return this==t||t instanceof e&&kH(this.attrs,t.attrs)&&kH(this.spec,t.spec)}static is(t){return t.type instanceof e}destroy(){}},MH=class e{constructor(e,t){this.attrs=e,this.spec=t||FH}map(e,t,n,r){let i=e.mapResult(t.from+r,1);if(i.deleted)return null;let a=e.mapResult(t.to+r,-1);return a.deleted||a.pos<=i.pos?null:new NH(i.pos-n,a.pos-n,this)}valid(e,t){let{index:n,offset:r}=e.content.findIndex(t.from),i;return r==t.from&&!(i=e.child(n)).isText&&r+i.nodeSize==t.to}eq(t){return this==t||t instanceof e&&kH(this.attrs,t.attrs)&&kH(this.spec,t.spec)}destroy(){}},NH=class e{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(t,n){return new e(t,n,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(t,n,r){return new e(t,t,new AH(n,r))}static inline(t,n,r,i){return new e(t,n,new jH(r,i))}static node(t,n,r,i){return new e(t,n,new MH(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof jH}get widget(){return this.type instanceof AH}},PH=[],FH={},IH=class e{constructor(e,t){this.local=e.length?e:PH,this.children=t.length?t:PH}static create(e,t){return t.length?WH(t,e,0,FH):LH}find(e,t,n){let r=[];return this.findInner(e??0,t??1e9,r,0,n),r}findInner(e,t,n,r,i){for(let a=0;a<this.local.length;a++){let o=this.local[a];o.from<=t&&o.to>=e&&(!i||i(o.spec))&&n.push(o.copy(o.from+r,o.to+r))}for(let a=0;a<this.children.length;a+=3)if(this.children[a]<t&&this.children[a+1]>e){let o=this.children[a]+1;this.children[a+2].findInner(e-o,t-o,n,r+o,i)}}map(e,t,n){return this==LH||e.maps.length==0?this:this.mapInner(e,t,0,0,n||FH)}mapInner(t,n,r,i,a){let o;for(let e=0;e<this.local.length;e++){let s=this.local[e].map(t,r,i);s&&s.type.valid(n,s)?(o||=[]).push(s):a.onRemove&&a.onRemove(this.local[e].spec)}return this.children.length?zH(this.children,o||[],t,n,r,i,a):o?new e(o.sort(GH),PH):LH}add(t,n){return n.length?this==LH?e.create(t,n):this.addInner(t,n,0):this}addInner(t,n,r){let i,a=0;t.forEach((e,t)=>{let o=t+r,s;if(s=HH(n,e,o)){for(i||=this.children.slice();a<i.length&&i[a]<t;)a+=3;i[a]==t?i[a+2]=i[a+2].addInner(e,s,o+1):i.splice(a,0,t,t+e.nodeSize,WH(s,e,o+1,FH)),a+=3}});let o=BH(a?UH(n):n,-r);for(let e=0;e<o.length;e++)o[e].type.valid(t,o[e])||o.splice(e--,1);return new e(o.length?this.local.concat(o).sort(GH):this.local,i||this.children)}remove(e){return e.length==0||this==LH?this:this.removeInner(e,0)}removeInner(t,n){let r=this.children,i=this.local;for(let e=0;e<r.length;e+=3){let i,a=r[e]+n,o=r[e+1]+n;for(let e=0,n;e<t.length;e++)(n=t[e])&&n.from>a&&n.to<o&&(t[e]=null,(i||=[]).push(n));if(!i)continue;r==this.children&&(r=this.children.slice());let s=r[e+2].removeInner(i,a+1);s==LH?(r.splice(e,3),e-=3):r[e+2]=s}if(i.length){for(let e=0,r;e<t.length;e++)if(r=t[e])for(let e=0;e<i.length;e++)i[e].eq(r,n)&&(i==this.local&&(i=this.local.slice()),i.splice(e--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new e(i,r):LH}forChild(t,n){if(this==LH)return this;if(n.isLeaf)return e.empty;let r,i;for(let e=0;e<this.children.length;e+=3)if(this.children[e]>=t){this.children[e]==t&&(r=this.children[e+2]);break}let a=t+1,o=a+n.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<o&&t.to>a&&t.type instanceof jH){let e=Math.max(a,t.from)-a,n=Math.min(o,t.to)-a;e<n&&(i||=[]).push(t.copy(e,n))}}if(i){let t=new e(i.sort(GH),PH);return r?new RH([t,r]):t}return r||LH}eq(t){if(this==t)return!0;if(!(t instanceof e)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let e=0;e<this.local.length;e++)if(!this.local[e].eq(t.local[e]))return!1;for(let e=0;e<this.children.length;e+=3)if(this.children[e]!=t.children[e]||this.children[e+1]!=t.children[e+1]||!this.children[e+2].eq(t.children[e+2]))return!1;return!0}locals(e){return KH(this.localsInner(e))}localsInner(e){if(this==LH)return PH;if(e.inlineContent||!this.local.some(jH.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof jH||t.push(this.local[e]);return t}forEachSet(e){e(this)}};IH.empty=new IH([],[]),IH.removeOverlap=KH;var LH=IH.empty,RH=class e{constructor(e){this.members=e}map(t,n){let r=this.members.map(e=>e.map(t,n,FH));return e.from(r)}forChild(t,n){if(n.isLeaf)return IH.empty;let r=[];for(let i=0;i<this.members.length;i++){let a=this.members[i].forChild(t,n);a!=LH&&(a instanceof e?r=r.concat(a.members):r.push(a))}return e.from(r)}eq(t){if(!(t instanceof e)||t.members.length!=this.members.length)return!1;for(let e=0;e<this.members.length;e++)if(!this.members[e].eq(t.members[e]))return!1;return!0}locals(e){let t,n=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length)if(!t)t=i;else{n&&=(t=t.slice(),!1);for(let e=0;e<i.length;e++)t.push(i[e])}}return t?KH(n?t:t.sort(GH)):PH}static from(t){switch(t.length){case 0:return LH;case 1:return t[0];default:return new e(t.every(e=>e instanceof IH)?t:t.reduce((e,t)=>e.concat(t instanceof IH?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}};function zH(e,t,n,r,i,a,o){let s=e.slice();for(let e=0,t=a;e<n.maps.length;e++){let r=0;n.maps[e].forEach((e,n,i,a)=>{let o=a-i-(n-e);for(let i=0;i<s.length;i+=3){let a=s[i+1];if(a<0||e>a+t-r)continue;let c=s[i]+t-r;n>=c?s[i+1]=e<=c?-2:-1:e>=t&&o&&(s[i]+=o,s[i+1]+=o)}r+=o}),t=n.maps[e].map(t,-1)}let c=!1;for(let t=0;t<s.length;t+=3)if(s[t+1]<0){if(s[t+1]==-2){c=!0,s[t+1]=-1;continue}let l=n.map(e[t]+a),u=l-i;if(u<0||u>=r.content.size){c=!0;continue}let d=n.map(e[t+1]+a,-1)-i,{index:f,offset:p}=r.content.findIndex(u),m=r.maybeChild(f);if(m&&p==u&&p+m.nodeSize==d){let r=s[t+2].mapInner(n,m,l+1,e[t]+a+1,o);r==LH?(s[t+1]=-2,c=!0):(s[t]=u,s[t+1]=d,s[t+2]=r)}else c=!0}if(c){let c=WH(VH(s,e,t,n,i,a,o),r,0,o);t=c.local;for(let e=0;e<s.length;e+=3)s[e+1]<0&&(s.splice(e,3),e-=3);for(let e=0,t=0;e<c.children.length;e+=3){let n=c.children[e];for(;t<s.length&&s[t]<n;)t+=3;s.splice(t,0,c.children[e],c.children[e+1],c.children[e+2])}}return new IH(t.sort(GH),s)}function BH(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let i=e[r];n.push(new NH(i.from+t,i.to+t,i.type))}return n}function VH(e,t,n,r,i,a,o){function s(e,t){for(let a=0;a<e.local.length;a++){let s=e.local[a].map(r,i,t);s?n.push(s):o.onRemove&&o.onRemove(e.local[a].spec)}for(let n=0;n<e.children.length;n+=3)s(e.children[n+2],e.children[n]+t+1)}for(let n=0;n<e.length;n+=3)e[n+1]==-1&&s(e[n+2],t[n]+a+1);return n}function HH(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,i=null;for(let t=0,a;t<e.length;t++)(a=e[t])&&a.from>n&&a.to<r&&((i||=[]).push(a),e[t]=null);return i}function UH(e){let t=[];for(let n=0;n<e.length;n++)e[n]!=null&&t.push(e[n]);return t}function WH(e,t,n,r){let i=[],a=!1;t.forEach((t,o)=>{let s=HH(e,t,o+n);if(s){a=!0;let e=WH(s,t,n+o+1,r);e!=LH&&i.push(o,o+t.nodeSize,e)}});let o=BH(a?UH(e):e,-n).sort(GH);for(let e=0;e<o.length;e++)o[e].type.valid(t,o[e])||(r.onRemove&&r.onRemove(o[e].spec),o.splice(e--,1));return o.length||i.length?new IH(o,i):LH}function GH(e,t){return e.from-t.from||e.to-t.to}function KH(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let i=n+1;i<t.length;i++){let a=t[i];if(a.from==r.from){a.to!=r.to&&(t==e&&(t=e.slice()),t[i]=a.copy(a.from,r.to),qH(t,i+1,a.copy(r.to,a.to)));continue}else{a.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,a.from),qH(t,i,r.copy(a.from,r.to)));break}}}return t}function qH(e,t,n){for(;t<e.length&&GH(n,e[t])>0;)t++;e.splice(t,0,n)}function JH(e){let t=[];return e.someProp(`decorations`,n=>{let r=n(e.state);r&&r!=LH&&t.push(r)}),e.cursorWrapper&&t.push(IH.create(e.state.doc,[e.cursorWrapper.deco])),RH.from(t)}var YH={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},XH=wz&&Tz<=11,ZH=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}},QH=class{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new ZH,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(t=>{for(let e=0;e<t.length;e++)this.queue.push(t[e]);wz&&Tz<=11&&t.some(e=>e.type==`childList`&&e.removedNodes.length||e.type==`characterData`&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():Az&&e.composing&&t.some(e=>e.type==`childList`&&e.target.nodeName==`TR`)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),XH&&(this.onCharData=e=>{this.queue.push({target:e.target,type:`characterData`,oldValue:e.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,YH)),this.onCharData&&this.view.dom.addEventListener(`DOMCharacterDataModified`,this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);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(nV(this.view)){if(this.suppressingSelectionUpdates)return KB(this.view);if(wz&&Tz<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&oz(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,n;for(let n=e.focusNode;n;n=nz(n))t.add(n);for(let r=e.anchorNode;r;r=nz(r))if(t.has(r)){n=r;break}let r=n&&this.view.docView.nearestDesc(n);if(r&&r.ignoreMutation({type:`selection`,target:n.nodeType==3?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let n=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&nV(e)&&!this.ignoreSelectionChange(n),i=-1,a=-1,o=!1,s=[];if(e.editable)for(let e=0;e<t.length;e++){let n=this.registerMutation(t[e],s);n&&(i=i<0?n.from:Math.min(n.from,i),a=a<0?n.to:Math.max(n.to,a),n.typeOver&&(o=!0))}if(s.some(e=>e.nodeName==`BR`)&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let e of s)if(e.nodeName==`BR`&&e.parentNode){let t=e.nextSibling;for(;t&&t.nodeType==1;){if(t.contentEditable==`false`){e.parentNode.removeChild(e);break}t=t.firstChild}}}else if(Ez&&s.length){let t=s.filter(e=>e.nodeName==`BR`);if(t.length==2){let[e,n]=t;e.parentNode&&e.parentNode.parentNode==n.parentNode?n.remove():e.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of t){let t=r.parentNode;t&&t.nodeName==`LI`&&(!n||iU(e,n)!=t)&&r.remove()}}}let c=null;i<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&mz(n)&&(c=WB(e))&&c.eq(zL.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,KB(e),this.currentSelection.set(n),e.scrollToSelection()):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,a),tU(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,aU(e,s)),this.handleDOMChange(i,a,o,s),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||KB(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if(e.type==`attributes`&&(n==this.view.docView||e.attributeName==`contenteditable`||e.attributeName==`style`&&!e.oldValue&&!e.target.getAttribute(`style`))||!n||n.ignoreMutation(e))return null;if(e.type==`childList`){for(let n=0;n<e.addedNodes.length;n++){let r=e.addedNodes[n];t.push(r),r.nodeType==3&&(this.lastChangedTextNode=r)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,i=e.nextSibling;if(wz&&Tz<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:a}=e.addedNodes[t];(!n||Array.prototype.indexOf.call(e.addedNodes,n)<0)&&(r=n),(!a||Array.prototype.indexOf.call(e.addedNodes,a)<0)&&(i=a)}let a=r&&r.parentNode==e.target?tz(r)+1:0,o=n.localPosFromDOM(e.target,a,-1),s=i&&i.parentNode==e.target?tz(i):e.target.childNodes.length;return{from:o,to:n.localPosFromDOM(e.target,s,1)}}else if(e.type==`attributes`)return{from:n.posAtStart-n.border,to:n.posAtEnd+n.border};else return this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}}},$H=new WeakMap,eU=!1;function tU(e){if(!$H.has(e)&&($H.set(e,null),[`normal`,`nowrap`,`pre-line`].indexOf(getComputedStyle(e.dom).whiteSpace)!==-1)){if(e.requiresGeckoHackNode=Ez,eU)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.`),eU=!0}}function nU(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,a=t.endOffset,o=e.domAtPos(e.state.selection.anchor);return oz(o.node,o.offset,i,a)&&([n,r,i,a]=[i,a,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}}function rU(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return nU(e,n)}let n;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.dom.addEventListener(`beforeinput`,r,!0),document.execCommand(`indent`),e.dom.removeEventListener(`beforeinput`,r,!0),n?nU(e,n):null}function iU(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let t=e.docView.nearestDesc(n,!0);if(t&&t.node.isBlock)return n}return null}function aU(e,t){let{focusNode:n,focusOffset:r}=e.domSelectionRange();for(let i of t)if(i.parentNode?.nodeName==`TR`){let t=i.nextSibling;for(;t&&t.nodeName!=`TD`&&t.nodeName!=`TH`;)t=t.nextSibling;if(t){let a=t;for(;;){let e=a.firstChild;if(!e||e.nodeType!=1||e.contentEditable==`false`||/^(BR|IMG)$/.test(e.nodeName))break;a=e}a.insertBefore(i,a.firstChild),n==i&&e.domSelection().collapse(i,r)}else i.parentNode.removeChild(i)}}function oU(e,t,n){let{node:r,fromOffset:i,toOffset:a,from:o,to:s}=e.docView.parseRange(t,n),c=e.domSelectionRange(),l,u=c.anchorNode;if(u&&e.dom.contains(u.nodeType==1?u:u.parentNode)&&(l=[{node:u,offset:c.anchorOffset}],mz(c)||l.push({node:c.focusNode,offset:c.focusOffset})),Oz&&e.input.lastKeyCode===8)for(let e=a;e>i;e--){let t=r.childNodes[e-1],n=t.pmViewDesc;if(t.nodeName==`BR`&&!n){a=e;break}if(!n||n.size)break}let d=e.state.doc,f=e.someProp(`domParser`)||iI.fromSchema(e.state.schema),p=d.resolve(o),m=null,h=f.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:a,preserveWhitespace:p.parent.type.whitespace==`pre`?`full`:!0,findPositions:l,ruleFromNode:sU,context:p});if(l&&l[0].pos!=null){let e=l[0].pos,t=l[1]&&l[1].pos;t??=e,m={anchor:e+o,head:t+o}}return{doc:h,sel:m,from:o,to:s}}function sU(e){let t=e.pmViewDesc;if(t)return t.parseRule();if(e.nodeName==`BR`&&e.parentNode){if(Az&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement(`div`);return e.appendChild(document.createElement(`li`)),{skip:e}}else if(e.parentNode.lastChild==e||Az&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName==`IMG`&&e.getAttribute(`mark-placeholder`))return{ignore:!0};return null}var cU=/^(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 lU(e,t,n,r,i){let a=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=WB(e,t);if(n&&!e.state.selection.eq(n)){if(Oz&&Pz&&e.input.lastKeyCode===13&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp(`handleKeyDown`,t=>t(e,hz(13,`Enter`))))return;let r=e.state.tr.setSelection(n);t==`pointer`?r.setMeta(`pointer`,!0):t==`key`&&r.scrollIntoView(),a&&r.setMeta(`composition`,a),e.dispatch(r)}return}let o=e.state.doc.resolve(t),s=o.sharedDepth(n);t=o.before(s+1),n=e.state.doc.resolve(n).after(s+1);let c=e.state.selection,l=oU(e,t,n),u=e.state.doc,d=u.slice(l.from,l.to),f,p;e.input.lastKeyCode===8&&Date.now()-100<e.input.lastKeyCodeTime?(f=e.state.selection.to,p=`end`):(f=e.state.selection.from,p=`start`),e.input.lastKeyCode=null;let m=mU(d.content,l.doc.content,l.from,f,p);if(m&&e.input.domChangeCount++,(jz&&e.input.lastIOSEnter>Date.now()-225||Pz)&&i.some(e=>e.nodeType==1&&!cU.test(e.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp(`handleKeyDown`,t=>t(e,hz(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(!m)if(r&&c instanceof UL&&!c.empty&&c.$head.sameParent(c.$anchor)&&!e.composing&&!(l.sel&&l.sel.anchor!=l.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(l.sel){let t=uU(e,e.state.doc,l.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);a&&n.setMeta(`composition`,a),e.dispatch(n)}}return}e.state.selection.from<e.state.selection.to&&m.start==m.endB&&e.state.selection instanceof UL&&(m.start>e.state.selection.from&&m.start<=e.state.selection.from+2&&e.state.selection.from>=l.from?m.start=e.state.selection.from:m.endA<e.state.selection.to&&m.endA>=e.state.selection.to-2&&e.state.selection.to<=l.to&&(m.endB+=e.state.selection.to-m.endA,m.endA=e.state.selection.to)),wz&&Tz<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>l.from&&l.doc.textBetween(m.start-l.from-1,m.start-l.from+1)==` \xA0`&&(m.start--,m.endA--,m.endB--);let h=l.doc.resolveNoCache(m.start-l.from),g=l.doc.resolveNoCache(m.endB-l.from),_=u.resolve(m.start),v=h.sameParent(g)&&h.parent.inlineContent&&_.end()>=m.endA;if((jz&&e.input.lastIOSEnter>Date.now()-225&&(!v||i.some(e=>e.nodeName==`DIV`||e.nodeName==`P`))||!v&&h.pos<l.doc.content.size&&(!h.sameParent(g)||!h.parent.inlineContent)&&h.pos<g.pos&&!/\S/.test(l.doc.textBetween(h.pos,g.pos,``,``)))&&e.someProp(`handleKeyDown`,t=>t(e,hz(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&fU(u,m.start,m.endA,h,g)&&e.someProp(`handleKeyDown`,t=>t(e,hz(8,`Backspace`)))){Pz&&Oz&&e.domObserver.suppressSelectionUpdates();return}Oz&&m.endB==m.start&&(e.input.lastChromeDelete=Date.now()),Pz&&!v&&h.start()!=g.start()&&g.parentOffset==0&&h.depth==g.depth&&l.sel&&l.sel.anchor==l.sel.head&&l.sel.head==m.endA&&(m.endB-=2,g=l.doc.resolveNoCache(m.endB-l.from),setTimeout(()=>{e.someProp(`handleKeyDown`,function(t){return t(e,hz(13,`Enter`))})},20));let y=m.start,b=m.endA,x=t=>{let n=t||e.state.tr.replace(y,b,l.doc.slice(m.start-l.from,m.endB-l.from));if(l.sel){let t=uU(e,n.doc,l.sel);t&&!(Oz&&e.composing&&t.empty&&(m.start!=m.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==y||t.head==n.mapping.map(b)-1)||wz&&t.empty&&t.head==y)&&n.setSelection(t)}return a&&n.setMeta(`composition`,a),n.scrollIntoView()},S;if(v)if(h.pos==g.pos){wz&&Tz<=11&&h.parentOffset==0&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>KB(e),20));let t=x(e.state.tr.delete(y,b)),n=u.resolve(m.start).marksAcross(u.resolve(m.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(m.endA==m.endB&&(S=dU(h.parent.content.cut(h.parentOffset,g.parentOffset),_.parent.content.cut(_.parentOffset,m.endA-_.start())))){let t=x(e.state.tr);S.type==`add`?t.addMark(y,b,S.mark):t.removeMark(y,b,S.mark),e.dispatch(t)}else if(h.parent.child(h.index()).isText&&h.index()==g.index()-+!g.textOffset){let t=h.parent.textBetween(h.parentOffset,g.parentOffset),n=()=>x(e.state.tr.insertText(t,y,b));e.someProp(`handleTextInput`,r=>r(e,y,b,t,n))||e.dispatch(n())}else e.dispatch(x());else e.dispatch(x())}function uU(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:tV(e,t.resolve(n.anchor),t.resolve(n.head))}function dU(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,i=n,a=r,o,s,c;for(let e=0;e<r.length;e++)i=r[e].removeFromSet(i);for(let e=0;e<n.length;e++)a=n[e].removeFromSet(a);if(i.length==1&&a.length==0)s=i[0],o=`add`,c=e=>e.mark(s.addToSet(e.marks));else if(i.length==0&&a.length==1)s=a[0],o=`remove`,c=e=>e.mark(s.removeFromSet(e.marks));else return null;let l=[];for(let e=0;e<t.childCount;e++)l.push(c(t.child(e)));if(Q.from(l).eq(e))return{mark:s,type:o}}function fU(e,t,n,r,i){if(n-t<=i.pos-r.pos||pU(r,!0,!1)<i.pos)return!1;let a=e.resolve(t);if(!r.parent.isTextblock){let e=a.nodeAfter;return e!=null&&n==t+e.nodeSize}if(a.parentOffset<a.parent.content.size||!a.parent.isTextblock)return!1;let o=e.resolve(pU(a,!0,!0));return!o.parent.isTextblock||o.pos>n||pU(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function pU(e,t,n){let r=e.depth,i=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,i++}return i}function mU(e,t,n,r,i){let a=e.findDiffStart(t,n);if(a==null)return null;let{a:o,b:s}=e.findDiffEnd(t,n+e.size,n+t.size);if(i==`end`){let e=Math.max(0,a-Math.min(o,s));r-=o+e-a}if(o<a&&e.size<t.size){let e=r<=a&&r>=o?a-r:0;a-=e,a&&a<t.size&&hU(t.textBetween(a-1,a+1))&&(a+=e?1:-1),s=a+(s-o),o=a}else if(s<a){let t=r<=a&&r>=s?a-r:0;a-=t,a&&a<e.size&&hU(e.textBetween(a-1,a+1))&&(a+=t?1:-1),o=a+(o-s),s=a}return{start:a,endA:o,endB:s}}function hU(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}var gU=class{constructor(e,t){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 WV,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(CU),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement(`div`),e&&(e.appendChild?e.appendChild(this.dom):typeof e==`function`?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=yU(this),vU(this),this.nodeViews=xU(this),this.docView=wB(this.state.doc,_U(this),JH(this),this.dom,this),this.domObserver=new QH(this,(e,t,n,r)=>lU(this,e,t,n,r)),this.domObserver.start(),GV(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&JV(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(CU),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){let n=this.state,r=!1,i=!1;e.storedMarks&&this.composing&&(hH(this),i=!0),this.state=e;let a=n.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=xU(this);SU(e,this.nodeViews)&&(this.nodeViews=e,r=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&JV(this),this.editable=yU(this),vU(this);let o=JH(this),s=_U(this),c=n.plugins!=e.plugins&&!n.doc.eq(e.doc)?`reset`:e.scrollToSelection>n.scrollToSelection?`to selection`:`preserve`,l=r||!this.docView.matchesNode(e.doc,s,o);(l||!e.selection.eq(n.selection))&&(i=!0);let u=c==`preserve`&&i&&this.dom.style.overflowAnchor==null&&Vz(this);if(i){this.domObserver.stop();let t=l&&(wz||Oz)&&!this.composing&&!n.selection.empty&&!e.selection.empty&&bU(n.selection,e.selection);if(l){let n=Oz?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=gH(this)),(r||!this.docView.update(e.doc,s,o,this))&&(this.docView.updateOuterDeco(s),this.docView.destroy(),this.docView=wB(e.doc,s,o,this.dom,this)),n&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(t=!0)}t||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&iV(this))?KB(this,t):($B(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(n),this.dragging?.node&&!n.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,n),c==`reset`?this.dom.scrollTop=0:c==`to selection`?this.scrollToSelection():u&&Uz(u)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))&&!this.someProp(`handleScrollToSelection`,e=>e(this)))if(this.state.selection instanceof GL){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Bz(this,t.getBoundingClientRect(),e)}else Bz(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}}updateDraggedNode(e,t){let n=e.node,r=-1;if(n.from<this.state.doc.content.size&&this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{let e=n.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&e<this.state.doc.content.size&&this.state.doc.nodeAt(e))==n.node&&(r=e)}this.dragging=new TH(e.slice,e.move,r<0?void 0:GL.create(this.state.doc,r))}someProp(e,t){let n=this._props&&this._props[e],r;if(n!=null&&(r=t?t(n):n))return r;for(let n=0;n<this.directPlugins.length;n++){let i=this.directPlugins[n].props[e];if(i!=null&&(r=t?t(i):i))return r}let i=this.state.plugins;if(i)for(let n=0;n<i.length;n++){let a=i[n].props[e];if(a!=null&&(r=t?t(a):a))return r}}hasFocus(){if(wz){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable==`false`)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&Kz(this.dom),KB(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let e=this.dom.parentNode;e;e=e.parentNode)if(e.nodeType==9||e.nodeType==11&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e}return e||document}updateRoot(){this._root=null}posAtCoords(e){return eB(this,e)}coordsAtPos(e,t=1){return iB(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let r=this.docView.posFromDOM(e,t,n);if(r==null)throw RangeError(`DOM position not inside the editor`);return r}endOfTextblock(e,t){return mB(this,t||this.state,e)}pasteHTML(e,t){return CH(this,``,e,!1,t||new ClipboardEvent(`paste`))}pasteText(e,t){return CH(this,e,null,!0,t||new ClipboardEvent(`paste`))}serializeForClipboard(e){return wV(this,e)}destroy(){this.docView&&(qV(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],JH(this),this),this.dom.textContent=``):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,az())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return ZV(this,e)}domSelectionRange(){let e=this.domSelection();return e?Az&&this.root.nodeType===11&&gz(this.dom.ownerDocument)==this.dom&&rU(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};gU.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};function _U(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 e in n)e==`class`?t.class+=` `+n[e]:e==`style`?t.style=(t.style?t.style+`;`:``)+n[e]:!t[e]&&e!=`contenteditable`&&e!=`nodeName`&&(t[e]=String(n[e]))}),t.translate||=`no`,[NH.node(0,e.state.doc.content.size,t)]}function vU(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:NH.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function yU(e){return!e.someProp(`editable`,t=>t(e.state)===!1)}function bU(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 xU(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp(`nodeViews`,n),e.someProp(`markViews`,n),t}function SU(e,t){let n=0,r=0;for(let r in e){if(e[r]!=t[r])return!0;n++}for(let e in t)r++;return n!=r}function CU(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw RangeError(`Plugins passed directly to the view must not have a state component`)}for(var wU={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:`'`},TU={48:`)`,49:`!`,50:`@`,51:`#`,52:`$`,53:`%`,54:`^`,55:`&`,56:`*`,57:`(`,59:`:`,61:`+`,173:`_`,186:`:`,187:`+`,188:`<`,189:`_`,190:`>`,191:`?`,192:`~`,219:`{`,220:`|`,221:`}`,222:`"`},EU=typeof navigator<`u`&&/Mac/.test(navigator.platform),DU=typeof navigator<`u`&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),OU=0;OU<10;OU++)wU[48+OU]=wU[96+OU]=String(OU);for(var OU=1;OU<=24;OU++)wU[OU+111]=`F`+OU;for(var OU=65;OU<=90;OU++)wU[OU]=String.fromCharCode(OU+32),TU[OU]=String.fromCharCode(OU);for(var kU in wU)TU.hasOwnProperty(kU)||(TU[kU]=wU[kU]);function AU(e){var t=!(EU&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||DU&&e.shiftKey&&e.key&&e.key.length==1||e.key==`Unidentified`)&&e.key||(e.shiftKey?TU:wU)[e.keyCode]||e.key||`Unidentified`;return t==`Esc`&&(t=`Escape`),t==`Del`&&(t=`Delete`),t==`Left`&&(t=`ArrowLeft`),t==`Up`&&(t=`ArrowUp`),t==`Right`&&(t=`ArrowRight`),t==`Down`&&(t=`ArrowDown`),t}var jU=typeof navigator<`u`&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),MU=typeof navigator<`u`&&/Win/.test(navigator.platform);function NU(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n==`Space`&&(n=` `);let r,i,a,o;for(let e=0;e<t.length-1;e++){let n=t[e];if(/^(cmd|meta|m)$/i.test(n))o=!0;else if(/^a(lt)?$/i.test(n))r=!0;else if(/^(c|ctrl|control)$/i.test(n))i=!0;else if(/^s(hift)?$/i.test(n))a=!0;else if(/^mod$/i.test(n))jU?o=!0:i=!0;else throw Error(`Unrecognized modifier name: `+n)}return r&&(n=`Alt-`+n),i&&(n=`Ctrl-`+n),o&&(n=`Meta-`+n),a&&(n=`Shift-`+n),n}function PU(e){let t=Object.create(null);for(let n in e)t[NU(n)]=e[n];return t}function FU(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 IU(e){return new sR({props:{handleKeyDown:LU(e)}})}function LU(e){let t=PU(e);return function(e,n){let r=AU(n),i,a=t[FU(r,n)];if(a&&a(e.state,e.dispatch,e))return!0;if(r.length==1&&r!=` `){if(n.shiftKey){let i=t[FU(r,n,!1)];if(i&&i(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(MU&&n.ctrlKey&&n.altKey)&&(i=wU[n.keyCode])&&i!=r){let r=t[FU(i,n)];if(r&&r(e.state,e.dispatch,e))return!0}}return!1}}var RU=Object.defineProperty,zU=(e,t)=>{for(var n in t)RU(e,n,{get:t[n],enumerable:!0})};function BU(e){let{state:t,transaction:n}=e,{selection:r}=n,{doc:i}=n,{storedMarks:a}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return a},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,a=n.storedMarks,n}}}var VU=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:i}=n,a=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{let n=t(...e)(a);return!i.getMeta(`preventDispatch`)&&!this.hasCustomState&&r.dispatch(i),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o=[],s=!!e,c=e||i.tr,l=()=>(!s&&t&&!c.getMeta(`preventDispatch`)&&!this.hasCustomState&&a.dispatch(c),o.every(e=>e===!0)),u={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{let r=this.buildProps(c,t),i=n(...e)(r);return o.push(i),u}])),run:l};return u}createCan(e){let{rawCommands:t,state:n}=this,r=e||n.tr,i=this.buildProps(r,!1);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})])),chain:()=>this.createChain(r,!1)}}buildProps(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o={tr:e,editor:r,view:a,state:BU({state:i,transaction:e}),dispatch:t?()=>void 0:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,(...e)=>t(...e)(o)]))}};return o}},HU={};zU(HU,{blur:()=>UU,clearContent:()=>WU,clearNodes:()=>GU,command:()=>KU,createParagraphNear:()=>qU,cut:()=>JU,deleteCurrentNode:()=>YU,deleteNode:()=>ZU,deleteRange:()=>QU,deleteSelection:()=>$U,enter:()=>eW,exitCode:()=>tW,extendMarkRange:()=>cW,first:()=>lW,focus:()=>gW,forEach:()=>_W,insertContent:()=>vW,insertContentAt:()=>wW,joinBackward:()=>DW,joinDown:()=>EW,joinForward:()=>OW,joinItemBackward:()=>kW,joinItemForward:()=>AW,joinTextblockBackward:()=>jW,joinTextblockForward:()=>MW,joinUp:()=>TW,keyboardShortcut:()=>FW,lift:()=>LW,liftEmptyBlock:()=>RW,liftListItem:()=>zW,newlineInCode:()=>BW,resetAttributes:()=>UW,scrollIntoView:()=>WW,selectAll:()=>GW,selectNodeBackward:()=>KW,selectNodeForward:()=>qW,selectParentNode:()=>JW,selectTextblockEnd:()=>YW,selectTextblockStart:()=>XW,setContent:()=>QW,setMark:()=>XG,setMeta:()=>ZG,setNode:()=>QG,setNodeSelection:()=>$G,setTextDirection:()=>eK,setTextSelection:()=>tK,sinkListItem:()=>nK,splitBlock:()=>iK,splitListItem:()=>aK,toggleList:()=>lK,toggleMark:()=>uK,toggleNode:()=>dK,toggleWrap:()=>fK,undoInputRule:()=>pK,unsetAllMarks:()=>mK,unsetMark:()=>hK,unsetTextDirection:()=>gK,updateAttributes:()=>_K,wrapIn:()=>vK,wrapInList:()=>yK});var UU=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),WU=(e=!0)=>({commands:t})=>t.setContent(``,{emitUpdate:e}),GU=()=>({state:e,tr:t,dispatch:n})=>{let{selection:r}=t,{ranges:i}=r;return n&&i.forEach(({$from:n,$to:r})=>{e.doc.nodesBetween(n.pos,r.pos,(e,n)=>{if(e.type.isText)return;let{doc:r,mapping:i}=t,a=r.resolve(i.map(n)),o=r.resolve(i.map(n+e.nodeSize)),s=a.blockRange(o);if(!s)return;let c=QI(s);if(e.type.isTextblock){let{defaultType:e}=a.parent.contentMatchAt(a.index());t.setNodeMarkup(s.start,e)}(c||c===0)&&t.lift(s,c)})}),!0},KU=e=>t=>e(t),qU=()=>({state:e,dispatch:t})=>AR(e,t),JU=(e,t)=>({editor:n,tr:r})=>{let{state:i}=n,a=i.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);let o=r.mapping.map(t);return r.insert(o,a.content),r.setSelection(new UL(r.doc.resolve(Math.max(o-1,0)))),!0},YU=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;let i=e.selection.$anchor;for(let n=i.depth;n>0;--n)if(i.node(n).type===r.type){if(t){let t=i.before(n),r=i.after(n);e.delete(t,r).scrollIntoView()}return!0}return!1};function XU(e,t){if(typeof e==`string`){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var ZU=e=>({tr:t,state:n,dispatch:r})=>{let i=XU(e,n.schema),a=t.selection.$anchor;for(let e=a.depth;e>0;--e)if(a.node(e).type===i){if(r){let n=a.before(e),r=a.after(e);t.delete(n,r).scrollIntoView()}return!0}return!1},QU=e=>({tr:t,dispatch:n})=>{let{from:r,to:i}=e;return n&&t.delete(r,i),!0},$U=()=>({state:e,dispatch:t})=>dR(e,t),eW=()=>({commands:e})=>e.keyboardShortcut(`Enter`),tW=()=>({state:e,dispatch:t})=>kR(e,t);function nW(e){return Object.prototype.toString.call(e)===`[object RegExp]`}function rW(e,t,n={strict:!0}){let r=Object.keys(t);return r.length?r.every(r=>n.strict?t[r]===e[r]:nW(t[r])?t[r].test(e[r]):t[r]===e[r]):!0}function iW(e,t,n={}){return e.find(e=>e.type===t&&rW(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function aW(e,t,n={}){return!!iW(e,t,n)}function oW(e,t,n){if(!e||!t)return;let r=e.parent.childAfter(e.parentOffset);if((!r.node||!r.node.marks.some(e=>e.type===t))&&(r=e.parent.childBefore(e.parentOffset)),!r.node||!r.node.marks.some(e=>e.type===t))return;if(!n){let e=r.node.marks.find(e=>e.type===t);e&&(n=e.attrs)}if(!iW([...r.node.marks],t,n))return;let i=r.index,a=e.start()+r.offset,o=i+1,s=a+r.node.nodeSize;for(;i>0&&aW([...e.parent.child(i-1).marks],t,n);)--i,a-=e.parent.child(i).nodeSize;for(;o<e.parent.childCount&&aW([...e.parent.child(o).marks],t,n);)s+=e.parent.child(o).nodeSize,o+=1;return{from:a,to:s}}function sW(e,t){if(typeof e==`string`){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}var cW=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=sW(e,r.schema),{doc:o,selection:s}=n,{$from:c,from:l,to:u}=s;if(i){let e=oW(c,a,t);if(e&&e.from<=l&&e.to>=u){let t=UL.create(o,e.from,e.to);n.setSelection(t)}}return!0},lW=e=>t=>{let n=typeof e==`function`?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1};function uW(e){return e instanceof UL}function dW(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function fW(e,t=null){if(!t)return null;let n=zL.atStart(e),r=zL.atEnd(e);if(t===`start`||t===!0)return n;if(t===`end`)return r;let i=n.from,a=r.to;return t===`all`?UL.create(e,dW(0,i,a),dW(e.content.size,i,a)):UL.create(e,dW(t,i,a),dW(t,i,a))}function pW(){return navigator.platform===`Android`||/android/i.test(navigator.userAgent)}function mW(){return[`iPad Simulator`,`iPhone Simulator`,`iPod Simulator`,`iPad`,`iPhone`,`iPod`].includes(navigator.platform)||navigator.userAgent.includes(`Mac`)&&`ontouchend`in document}function hW(){return typeof navigator<`u`?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var gW=(e=null,t={})=>({editor:n,view:r,tr:i,dispatch:a})=>{t={scrollIntoView:!0,...t};let o=()=>{(mW()||pW())&&r.dom.focus(),hW()&&!mW()&&!pW()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),t?.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&e===null||e===!1)return!0}catch{return!1}if(a&&e===null&&!uW(n.state.selection))return o(),!0;let s=fW(i.doc,e)||n.state.selection,c=n.state.selection.eq(s);return a&&(c||i.setSelection(s),c&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},_W=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),vW=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),yW=e=>{let t=e.childNodes;for(let n=t.length-1;n>=0;--n){let r=t[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):r.nodeType===1&&yW(r)}return e};function bW(e){if(typeof window>`u`)throw Error(`[tiptap error]: there is no window object available, so this function cannot be used`);let t=`<body>${e}</body>`,n=new window.DOMParser().parseFromString(t,`text/html`).body;return yW(n)}function xW(e,t,n){if(e instanceof kF||e instanceof Q)return e;n={slice:!0,parseOptions:{},...n};let r=typeof e==`object`&&!!e,i=typeof e==`string`;if(r)try{if(Array.isArray(e)&&e.length>0)return Q.fromArray(e.map(e=>t.nodeFromJSON(e)));let r=t.nodeFromJSON(e);return n.errorOnInvalidContent&&r.check(),r}catch(r){if(n.errorOnInvalidContent)throw Error(`[tiptap error]: Invalid JSON content`,{cause:r});return console.warn(`[tiptap warn]: Invalid content.`,`Passed value:`,e,`Error:`,r),xW(``,t,n)}if(i){if(n.errorOnInvalidContent){let r=!1,i=``,a=new eI({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:`inline*`,group:`block`,parseDOM:[{tag:`*`,getAttrs:e=>(r=!0,i=typeof e==`string`?e:e.outerHTML,null)}]}})});if(n.slice?iI.fromSchema(a).parseSlice(bW(e),n.parseOptions):iI.fromSchema(a).parse(bW(e),n.parseOptions),n.errorOnInvalidContent&&r)throw Error(`[tiptap error]: Invalid HTML content`,{cause:Error(`Invalid element found: ${i}`)})}let r=iI.fromSchema(t);return n.slice?r.parseSlice(bW(e),n.parseOptions).content:r.parse(bW(e),n.parseOptions)}return xW(``,t,n)}function SW(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof GI||i instanceof KI))return;let a=e.mapping.maps[r],o=0;a.forEach((e,t,n,r)=>{o===0&&(o=r)}),e.setSelection(zL.near(e.doc.resolve(o),n))}var CW=e=>!(`type`in e),wW=(e,t,n)=>({tr:r,dispatch:i,editor:a})=>{if(i){n={parseOptions:a.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let i,o=e=>{a.emit(`contentError`,{editor:a,error:e,disableCollaboration:()=>{`collaboration`in a.storage&&typeof a.storage.collaboration==`object`&&a.storage.collaboration&&(a.storage.collaboration.isDisabled=!0)}})},s={preserveWhitespace:`full`,...n.parseOptions};if(!n.errorOnInvalidContent&&!a.options.enableContentCheck&&a.options.emitContentError)try{xW(t,a.schema,{parseOptions:s,errorOnInvalidContent:!0})}catch(e){o(e)}try{i=xW(t,a.schema,{parseOptions:s,errorOnInvalidContent:n.errorOnInvalidContent??a.options.enableContentCheck})}catch(e){return o(e),!1}let{from:c,to:l}=typeof e==`number`?{from:e,to:e}:{from:e.from,to:e.to},u=!0,d=!0;if((CW(i)?i:[i]).forEach(e=>{e.check(),u=u?e.isText&&e.marks.length===0:!1,d=d?e.isBlock:!1}),c===l&&d){let{parent:e}=r.doc.resolve(c);e.isTextblock&&!e.type.spec.code&&!e.childCount&&(--c,l+=1)}let f;if(u){if(Array.isArray(t))f=t.map(e=>e.text||``).join(``);else if(t instanceof Q){let e=``;t.forEach(t=>{t.text&&(e+=t.text)}),f=e}else f=typeof t==`object`&&t&&t.text?t.text:t;r.insertText(f,c,l)}else{f=i;let e=r.doc.resolve(c),t=e.node(),n=e.parentOffset===0,a=t.isText||t.isTextblock,o=t.content.size>0;n&&a&&o&&d&&(c=Math.max(0,c-1)),r.replaceWith(c,l,f)}n.updateSelection&&SW(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta(`applyInputRules`,{from:c,text:f}),n.applyPasteRules&&r.setMeta(`applyPasteRules`,{from:c,text:f})}return!0},TW=()=>({state:e,dispatch:t})=>wR(e,t),EW=()=>({state:e,dispatch:t})=>TR(e,t),DW=()=>({state:e,dispatch:t})=>pR(e,t),OW=()=>({state:e,dispatch:t})=>xR(e,t),kW=()=>({state:e,dispatch:t,tr:n})=>{try{let r=hL(e.doc,e.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},AW=()=>({state:e,dispatch:t,tr:n})=>{try{let r=hL(e.doc,e.selection.$from.pos,1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},jW=()=>({state:e,dispatch:t})=>mR(e,t),MW=()=>({state:e,dispatch:t})=>hR(e,t);function NW(){return typeof navigator<`u`?/Mac/.test(navigator.platform):!1}function PW(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n===`Space`&&(n=` `);let r,i,a,o;for(let e=0;e<t.length-1;e+=1){let n=t[e];if(/^(cmd|meta|m)$/i.test(n))o=!0;else if(/^a(lt)?$/i.test(n))r=!0;else if(/^(c|ctrl|control)$/i.test(n))i=!0;else if(/^s(hift)?$/i.test(n))a=!0;else if(/^mod$/i.test(n))mW()||NW()?o=!0:i=!0;else throw Error(`Unrecognized modifier name: ${n}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),a&&(n=`Shift-${n}`),n}var FW=e=>({editor:t,view:n,tr:r,dispatch:i})=>{let a=PW(e).split(/-(?!$)/),o=a.find(e=>![`Alt`,`Ctrl`,`Meta`,`Shift`].includes(e)),s=new KeyboardEvent(`keydown`,{key:o===`Space`?` `:o,altKey:a.includes(`Alt`),ctrlKey:a.includes(`Ctrl`),metaKey:a.includes(`Meta`),shiftKey:a.includes(`Shift`),bubbles:!0,cancelable:!0});return t.captureTransaction(()=>{n.someProp(`handleKeyDown`,e=>e(n,s))})?.steps.forEach(e=>{let t=e.map(r.mapping);t&&i&&r.maybeStep(t)}),!0};function IW(e,t,n={}){let{from:r,to:i,empty:a}=e.selection,o=t?XU(t,e.schema):null,s=[];e.doc.nodesBetween(r,i,(e,t)=>{if(e.isText)return;let n=Math.max(r,t),a=Math.min(i,t+e.nodeSize);s.push({node:e,from:n,to:a})});let c=i-r,l=s.filter(e=>o?o.name===e.node.type.name:!0).filter(e=>rW(e.node.attrs,n,{strict:!1}));return a?!!l.length:l.reduce((e,t)=>e+t.to-t.from,0)>=c}var LW=(e,t={})=>({state:n,dispatch:r})=>IW(n,XU(e,n.schema),t)?ER(n,r):!1,RW=()=>({state:e,dispatch:t})=>jR(e,t),zW=e=>({state:t,dispatch:n})=>ZR(XU(e,t.schema))(t,n),BW=()=>({state:e,dispatch:t})=>DR(e,t);function VW(e,t){return t.nodes[e]?`node`:t.marks[e]?`mark`:null}function HW(e,t){let n=typeof t==`string`?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}var UW=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=VW(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=XU(e,r.schema)),s===`mark`&&(o=sW(e,r.schema));let c=!1;return n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{a&&a===e.type&&(c=!0,i&&n.setNodeMarkup(r,void 0,HW(e.attrs,t))),o&&e.marks.length&&e.marks.forEach(a=>{o===a.type&&(c=!0,i&&n.addMark(r,r+e.nodeSize,o.create(HW(a.attrs,t))))})})}),c},WW=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),GW=()=>({tr:e,dispatch:t})=>{if(t){let t=new qL(e.doc);e.setSelection(t)}return!0},KW=()=>({state:e,dispatch:t})=>vR(e,t),qW=()=>({state:e,dispatch:t})=>SR(e,t),JW=()=>({state:e,dispatch:t})=>PR(e,t),YW=()=>({state:e,dispatch:t})=>BR(e,t),XW=()=>({state:e,dispatch:t})=>zR(e,t);function ZW(e,t,n={},r={}){return xW(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var QW=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:a,dispatch:o,commands:s})=>{let{doc:c}=a;if(r.preserveWhitespace!==`full`){let s=ZW(e,i.schema,r,{errorOnInvalidContent:t??i.options.enableContentCheck});return o&&a.replaceWith(0,c.content.size,s).setMeta(`preventUpdate`,!n),!0}return o&&a.setMeta(`preventUpdate`,!n),s.insertContentAt({from:0,to:c.content.size},e,{parseOptions:r,errorOnInvalidContent:t??i.options.enableContentCheck})};function $W(e,t){let n=sW(t,e.schema),{from:r,to:i,empty:a}=e.selection,o=[];a?(e.storedMarks&&o.push(...e.storedMarks),o.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,i,e=>{o.push(...e.marks)});let s=o.find(e=>e.type.name===n.name);return s?{...s.attrs}:{}}function eG(e,t){let n=new LL(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function tG(e){for(let t=0;t<e.edgeCount;t+=1){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function nG(e,t,n){let r=[];return e.nodesBetween(t.from,t.to,(e,t)=>{n(e)&&r.push({node:e,pos:t})}),r}function rG(e,t){for(let n=e.depth;n>0;--n){let r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function iG(e){return t=>rG(t.$from,e)}function aG(e,t,n){return e.config[t]===void 0&&e.parent?aG(e.parent,t,n):typeof e.config[t]==`function`?e.config[t].bind({...n,parent:e.parent?aG(e.parent,t,n):null}):e.config[t]}function oG(e){return e.map(e=>{let t=aG(e,`addExtensions`,{name:e.name,options:e.options,storage:e.storage});return t?[e,...oG(t())]:e}).flat(10)}function sG(e,t){let n=vI.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement(`div`);return r.appendChild(n),r.innerHTML}function cG(e){return typeof e==`function`}function lG(e,t=void 0,...n){return cG(e)?t?e.bind(t)(...n):e(...n):e}function uG(e={}){return Object.keys(e).length===0&&e.constructor===Object}function dG(e){return{baseExtensions:e.filter(e=>e.type===`extension`),nodeExtensions:e.filter(e=>e.type===`node`),markExtensions:e.filter(e=>e.type===`mark`)}}function fG(e){let t=[],{nodeExtensions:n,markExtensions:r}=dG(e),i=[...n,...r],a={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(e=>e.name!==`text`).map(e=>e.name),s=r.map(e=>e.name),c=[...o,...s];return e.forEach(e=>{let n=aG(e,`addGlobalAttributes`,{name:e.name,options:e.options,storage:e.storage,extensions:i});n&&n().forEach(e=>{let n;n=Array.isArray(e.types)?e.types:e.types===`*`?c:e.types===`nodes`?o:e.types===`marks`?s:[],n.forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...a,...r}})})})})}),i.forEach(e=>{let n=aG(e,`addAttributes`,{name:e.name,options:e.options,storage:e.storage});if(!n)return;let r=n();Object.entries(r).forEach(([n,r])=>{let i={...a,...r};typeof i?.default==`function`&&(i.default=i.default()),i?.isRequired&&i?.default===void 0&&delete i.default,t.push({type:e.name,name:n,attribute:i})})}),t}function pG(e){let t=[],n=``,r=!1,i=!1,a=0,o=e.length;for(let s=0;s<o;s+=1){let o=e[s];if(o===`'`&&!i){r=!r,n+=o;continue}if(o===`"`&&!r){i=!i,n+=o;continue}if(!r&&!i){if(o===`(`){a+=1,n+=o;continue}if(o===`)`&&a>0){--a,n+=o;continue}if(o===`;`&&a===0){t.push(n),n=``;continue}}n+=o}return n&&t.push(n),t}function mG(e){let t=[],n=pG(e||``),r=n.length;for(let e=0;e<r;e+=1){let r=n[e],i=r.indexOf(`:`);if(i===-1)continue;let a=r.slice(0,i).trim(),o=r.slice(i+1).trim();a&&o&&t.push([a,o])}return t}function hG(...e){return e.filter(e=>!!e).reduce((e,t)=>{let n={...e};return Object.entries(t).forEach(([e,t])=>{if(!n[e]){n[e]=t;return}if(e===`class`){let r=t?String(t).split(` `):[],i=n[e]?n[e].split(` `):[],a=r.filter(e=>!i.includes(e));n[e]=[...i,...a].join(` `)}else if(e===`style`){let r=new Map([...mG(n[e]),...mG(t)]);n[e]=Array.from(r.entries()).map(([e,t])=>`${e}: ${t}`).join(`; `)}else n[e]=t}),n},{})}function gG(e,t){return t.filter(t=>t.type===e.type.name).filter(e=>e.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]}).reduce((e,t)=>hG(e,t),{})}function _G(e){return typeof e==`string`?e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e===`true`?!0:e===`false`?!1:e:e}function vG(e,t){return`style`in e?e:{...e,getAttrs:n=>{let r=e.getAttrs?e.getAttrs(n):e.attrs;if(r===!1)return!1;let i=t.reduce((e,t)=>{let r=t.attribute.parseHTML?t.attribute.parseHTML(n):_G(n.getAttribute(t.name));return r==null?e:{...e,[t.name]:r}},{});return{...r,...i}}}}function yG(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>e===`attrs`&&uG(t)?!1:t!=null))}function bG(e){let t={};return!e?.attribute?.isRequired&&`default`in(e?.attribute||{})&&(t.default=e.attribute.default),e?.attribute?.validate!==void 0&&(t.validate=e.attribute.validate),[e.name,t]}function xG(e,t){let n=fG(e),{nodeExtensions:r,markExtensions:i}=dG(e);return new eI({topNode:r.find(e=>aG(e,`topNode`))?.name,nodes:Object.fromEntries(r.map(r=>{let i=n.filter(e=>e.type===r.name),a={name:r.name,options:r.options,storage:r.storage,editor:t},o=yG({...e.reduce((e,t)=>{let n=aG(t,`extendNodeSchema`,a);return{...e,...n?n(r):{}}},{}),content:lG(aG(r,`content`,a)),marks:lG(aG(r,`marks`,a)),group:lG(aG(r,`group`,a)),inline:lG(aG(r,`inline`,a)),atom:lG(aG(r,`atom`,a)),selectable:lG(aG(r,`selectable`,a)),draggable:lG(aG(r,`draggable`,a)),code:lG(aG(r,`code`,a)),whitespace:lG(aG(r,`whitespace`,a)),linebreakReplacement:lG(aG(r,`linebreakReplacement`,a)),defining:lG(aG(r,`defining`,a)),isolating:lG(aG(r,`isolating`,a)),attrs:Object.fromEntries(i.map(bG))}),s=lG(aG(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>vG(e,i)));let c=aG(r,`renderHTML`,a);c&&(o.toDOM=e=>c({node:e,HTMLAttributes:gG(e,i)}));let l=aG(r,`renderText`,a);return l&&(o.toText=l),[r.name,o]})),marks:Object.fromEntries(i.map(r=>{let i=n.filter(e=>e.type===r.name),a={name:r.name,options:r.options,storage:r.storage,editor:t},o=yG({...e.reduce((e,t)=>{let n=aG(t,`extendMarkSchema`,a);return{...e,...n?n(r):{}}},{}),inclusive:lG(aG(r,`inclusive`,a)),excludes:lG(aG(r,`excludes`,a)),group:lG(aG(r,`group`,a)),spanning:lG(aG(r,`spanning`,a)),code:lG(aG(r,`code`,a)),attrs:Object.fromEntries(i.map(bG))}),s=lG(aG(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>vG(e,i)));let c=aG(r,`renderHTML`,a);return c&&(o.toDOM=e=>c({mark:e,HTMLAttributes:gG(e,i)})),[r.name,o]}))})}function SG(e){let t=e.filter((t,n)=>e.indexOf(t)!==n);return Array.from(new Set(t))}function CG(e){return e.sort((e,t)=>{let n=aG(e,`priority`)||100,r=aG(t,`priority`)||100;return n>r?-1:+(n<r)})}function wG(e){let t=CG(oG(e)),n=SG(t.map(e=>e.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(e=>`'${e}'`).join(`, `)}]. This can lead to issues.`),t}function TG(e,t,n){let{from:r,to:i}=t,{blockSeparator:a=`
90
+
91
+ `,textSerializers:o={}}=n||{},s=``;return e.nodesBetween(r,i,(e,n,c,l)=>{e.isBlock&&n>r&&(s+=a);let u=o?.[e.type.name];if(u)return c&&(s+=u({node:e,pos:n,parent:c,index:l,range:t})),!1;e.isText&&(s+=(e?.text)?.slice(Math.max(r,n)-n,i-n))}),s}function EG(e,t){return TG(e,{from:0,to:e.content.size},t)}function DG(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function OG(e,t){let n=XU(t,e.schema),{from:r,to:i}=e.selection,a=[];e.doc.nodesBetween(r,i,e=>{a.push(e)});let o=a.reverse().find(e=>e.type.name===n.name);return o?{...o.attrs}:{}}function kG(e,t){let n=VW(typeof t==`string`?t:t.name,e.schema);return n===`node`?OG(e,t):n===`mark`?$W(e,t):{}}function AG(e,t=JSON.stringify){let n={};return e.filter(e=>{let r=t(e);return Object.prototype.hasOwnProperty.call(n,r)?!1:n[r]=!0})}function jG(e){let t=AG(e);return t.length===1?t:t.filter((e,n)=>!t.filter((e,t)=>t!==n).some(t=>e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to))}function MG(e){let{mapping:t,steps:n}=e,r=[];return t.maps.forEach((e,i)=>{let a=[];if(e.ranges.length)e.forEach((e,t)=>{a.push({from:e,to:t})});else{let{from:e,to:t}=n[i];if(e===void 0||t===void 0)return;a.push({from:e,to:t})}a.forEach(({from:e,to:n})=>{let a=t.slice(i).map(e,-1),o=t.slice(i).map(n),s=t.invert().map(a,-1),c=t.invert().map(o);r.push({oldRange:{from:s,to:c},newRange:{from:a,to:o}})})}),jG(r)}function NG(e,t,n){let r=[];return e===t?n.resolve(e).marks().forEach(t=>{let i=oW(n.resolve(e),t.type);i&&r.push({mark:t,...i})}):n.nodesBetween(e,t,(e,t)=>{!e||e?.nodeSize===void 0||r.push(...e.marks.map(n=>({from:t,to:t+e.nodeSize,mark:n})))}),r}var PG=(e,t,n,r=20)=>{let i=e.doc.resolve(n),a=r,o=null;for(;a>0&&o===null;){let e=i.node(a);e?.type.name===t?o=e:--a}return[o,a]};function FG(e,t){return t.nodes[e]||t.marks[e]||null}function IG(e,t,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{let r=e.find(e=>e.type===t&&e.name===n);return r?r.attribute.keepOnSplit:!1}))}var LG=(e,t=500)=>{let n=``,r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,i,a)=>{var o;let s=(o=e.type.spec).toText?.call(o,{node:e,pos:t,parent:i,index:a})||e.textContent||`%leaf%`;n+=e.isAtom&&!e.isText?s:s.slice(0,Math.max(0,r-t))}),n};function RG(e,t,n={}){let{empty:r,ranges:i}=e.selection,a=t?sW(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>a?a.name===e.type.name:!0).find(e=>rW(e.attrs,n,{strict:!1}));let o=0,s=[];if(i.forEach(({$from:t,$to:n})=>{let r=t.pos,i=n.pos;e.doc.nodesBetween(r,i,(e,t)=>{if(a&&e.inlineContent&&!e.type.allowsMarkType(a))return!1;if(!e.isText&&!e.marks.length)return;let n=Math.max(r,t),c=Math.min(i,t+e.nodeSize),l=c-n;o+=l,s.push(...e.marks.map(e=>({mark:e,from:n,to:c})))})}),o===0)return!1;let c=s.filter(e=>a?a.name===e.mark.type.name:!0).filter(e=>rW(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),l=s.filter(e=>a?e.mark.type!==a&&e.mark.type.excludes(a):!0).reduce((e,t)=>e+t.to-t.from,0);return(c>0?c+l:c)>=o}function zG(e,t,n={}){if(!t)return IW(e,null,n)||RG(e,null,n);let r=VW(t,e.schema);return r===`node`?IW(e,t,n):r===`mark`?RG(e,t,n):!1}var BG=(e,t)=>{let{$from:n,$to:r,$anchor:i}=e.selection;if(t){let n=iG(e=>e.type.name===t)(e.selection);if(!n)return!1;let r=e.doc.resolve(n.pos+1);return i.pos+1===r.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},VG=e=>{let{$from:t,$to:n}=e.selection;return!(t.parentOffset>0||t.pos!==n.pos)};function HG(e,t){return Array.isArray(t)?t.some(t=>(typeof t==`string`?t:t.name)===e.name):t}function UG(e,t){let{nodeExtensions:n}=dG(t),r=n.find(t=>t.name===e);if(!r)return!1;let i=lG(aG(r,`group`,{name:r.name,options:r.options,storage:r.storage}));return typeof i==`string`?i.split(` `).includes(`list`):!1}function WG(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){if(n){if(e.type.name===`hardBreak`)return!0;if(e.isText)return!/\S/.test(e.text??``)}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(e.content.childCount===0)return!0;if(t){let r=!0;return e.content.forEach(e=>{r!==!1&&(WG(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}function GG(e){return e instanceof GL}var KG=class e{constructor(e){this.position=e}static fromJSON(t){return new e(t.position)}toJSON(){return{position:this.position}}};function qG(e,t){let n=t.mapping.mapResult(e.position);return{position:new KG(n.pos),mapResult:n}}function JG(e){return new KG(e)}function YG(e,t,n){let{selection:r}=t,i=null;if(uW(r)&&(i=r.$cursor),i){let t=e.storedMarks??i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(t)||!t.some(e=>e.type.excludes(n)))}let{ranges:a}=r;return a.some(({$from:t,$to:r})=>{let i=t.depth===0?e.doc.inlineContent&&e.doc.type.allowsMarkType(n):!1;return e.doc.nodesBetween(t.pos,r.pos,(e,t,r)=>{if(i)return!1;if(e.isInline){let t=!r||r.type.allowsMarkType(n),a=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));i=t&&a}return!i}),i})}var XG=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=n,{empty:o,ranges:s}=a,c=sW(e,r.schema);if(i)if(o){let e=$W(r,c);n.addStoredMark(c.create({...e,...t}))}else s.forEach(e=>{let i=e.$from.pos,a=e.$to.pos;r.doc.nodesBetween(i,a,(e,r)=>{let o=Math.max(r,i),s=Math.min(r+e.nodeSize,a);e.marks.find(e=>e.type===c)?e.marks.forEach(e=>{c===e.type&&n.addMark(o,s,c.create({...e.attrs,...t}))}):n.addMark(o,s,c.create(t))})});return YG(r,n,c)},ZG=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),QG=(e,t={})=>({state:n,dispatch:r,chain:i})=>{let a=XU(e,n.schema),o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),a.isTextblock?i().command(({commands:e})=>HR(a,{...o,...t})(n)?!0:e.clearNodes()).command(({state:e})=>HR(a,{...o,...t})(e,r)).run():(console.warn(`[tiptap warn]: Currently "setNode()" only supports text block nodes.`),!1)},$G=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,r=dW(e,0,n.content.size),i=GL.create(n,r);t.setSelection(i)}return!0},eK=(e,t)=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=r,o,s;return typeof t==`number`?(o=t,s=t):t&&`from`in t&&`to`in t?(o=t.from,s=t.to):(o=a.from,s=a.to),i&&n.doc.nodesBetween(o,s,(t,r)=>{t.isText||n.setNodeMarkup(r,void 0,{...t.attrs,dir:e})}),!0},tK=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,{from:r,to:i}=typeof e==`number`?{from:e,to:e}:e,a=UL.atStart(n).from,o=UL.atEnd(n).to,s=dW(r,a,o),c=dW(i,a,o),l=UL.create(n,s,c);t.setSelection(l)}return!0},nK=e=>({state:t,dispatch:n})=>ez(XU(e,t.schema))(t,n);function rK(e,t){let n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){let r=n.filter(e=>t?.includes(e.type.name));e.tr.ensureMarks(r)}}var iK=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:i})=>{let{selection:a,doc:o}=t,{$from:s,$to:c}=a,l=i.extensionManager.attributes,u=IG(l,s.node().type.name,s.node().attrs);if(a instanceof GL&&a.node.isBlock)return!s.parentOffset||!uL(o,s.pos)?!1:(r&&(e&&rK(n,i.extensionManager.splittableMarks),t.split(s.pos).scrollIntoView()),!0);if(!s.parent.isBlock)return!1;let d=c.parentOffset===c.parent.content.size,f=s.depth===0?void 0:tG(s.node(-1).contentMatchAt(s.indexAfter(-1))),p=d&&f?[{type:f,attrs:u}]:void 0,m=uL(t.doc,t.mapping.map(s.pos),1,p);if(!p&&!m&&uL(t.doc,t.mapping.map(s.pos),1,f?[{type:f}]:void 0)&&(m=!0,p=f?[{type:f,attrs:u}]:void 0),r){if(m&&(a instanceof UL&&t.deleteSelection(),t.split(t.mapping.map(s.pos),1,p),f&&!d&&!s.parentOffset&&s.parent.type!==f)){let e=t.mapping.map(s.before()),n=t.doc.resolve(e);s.node(-1).canReplaceWith(n.index(),n.index()+1,f)&&t.setNodeMarkup(t.mapping.map(s.before()),f)}e&&rK(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return m},aK=(e,t={})=>({tr:n,state:r,dispatch:i,editor:a})=>{let o=XU(e,r.schema),{$from:s,$to:c}=r.selection,l=r.selection.node;if(l&&l.isBlock||s.depth<2||!s.sameParent(c))return!1;let u=s.node(-1);if(u.type!==o)return!1;let d=a.extensionManager.attributes;if(s.parent.content.size===0&&s.node(-1).childCount===s.indexAfter(-1)){if(s.depth===2||s.node(-3).type!==o||s.index(-2)!==s.node(-2).childCount-1)return!1;if(i){let e=Q.empty,r=s.index(-1)?1:s.index(-2)?2:3;for(let t=s.depth-r;t>=s.depth-3;--t)e=Q.from(s.node(t).copy(e));let i=s.indexAfter(-1)<s.node(-2).childCount?1:s.indexAfter(-2)<s.node(-3).childCount?2:3,a={...IG(d,s.node().type.name,s.node().attrs),...t},c=o.contentMatch.defaultType?.createAndFill(a)||void 0;e=e.append(Q.from(o.createAndFill(null,c)||void 0));let l=s.before(s.depth-(r-1));n.replace(l,s.after(-i),new uF(e,4-r,0));let u=-1;n.doc.nodesBetween(l,n.doc.content.size,(e,t)=>{if(u>-1)return!1;e.isTextblock&&e.content.size===0&&(u=t+1)}),u>-1&&n.setSelection(UL.near(n.doc.resolve(u))),n.scrollIntoView()}return!0}let f=c.pos===s.end()?u.contentMatchAt(0).defaultType:null,p={...IG(d,u.type.name,u.attrs),...t},m={...IG(d,s.node().type.name,s.node().attrs),...t};n.delete(s.pos,c.pos);let h=f?[{type:o,attrs:p},{type:f,attrs:m}]:[{type:o,attrs:p}];if(!uL(n.doc,s.pos,2))return!1;if(i){let{selection:e,storedMarks:t}=r,{splittableMarks:o}=a.extensionManager,c=t||e.$to.parentOffset&&e.$from.marks();if(n.split(s.pos,2,h).scrollIntoView(),!c||!i)return!0;let l=c.filter(e=>o.includes(e.type.name));n.ensureMarks(l)}return!0},oK=(e,t)=>{let n=iG(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return n.node.type===i?.type&&fL(e.doc,n.pos)&&e.join(n.pos),!0},sK=(e,t)=>{let n=iG(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return n.node.type===i?.type&&fL(e.doc,r)&&e.join(r),!0};function cK(e){let t=e.doc,n=t.firstChild;if(!n)return null;let r=t.resolve(1),i=t.resolve(n.nodeSize-1);return UL.between(r,i)}var lK=(e,t,n,r={})=>({editor:i,tr:a,state:o,dispatch:s,chain:c,commands:l,can:u})=>{let{extensions:d,splittableMarks:f}=i.extensionManager,p=XU(e,o.schema),m=XU(t,o.schema),{selection:h,storedMarks:g}=o,{$from:_,$to:v}=h,y=_.blockRange(v),b=g||h.$to.parentOffset&&h.$from.marks();if(!y)return!1;let x=iG(e=>UG(e.type.name,d))(h),S=h.from===0&&h.to===o.doc.content.size,C=o.doc.content.content,w=C.length===1?C[0]:null,T=S&&w&&UG(w.type.name,d)?{node:w,pos:0,depth:0}:null,E=x??T,D=!!x&&y.depth>=1&&y.depth-x.depth<=1,O=!!T;if((D||O)&&E){if(E.node.type===p)return S&&O?c().command(({tr:e,dispatch:t})=>{let n=cK(e);return n?(e.setSelection(n),t&&t(e),!0):!1}).liftListItem(m).run():l.liftListItem(m);if(UG(E.node.type.name,d)&&p.validContent(E.node.content))return c().command(()=>(a.setNodeMarkup(E.pos,p),!0)).command(()=>oK(a,p)).command(()=>sK(a,p)).run()}return!n||!b||!s?c().command(()=>u().wrapInList(p,r)?!0:l.clearNodes()).wrapInList(p,r).command(()=>oK(a,p)).command(()=>sK(a,p)).run():c().command(()=>{let e=u().wrapInList(p,r),t=b.filter(e=>f.includes(e.type.name));return a.ensureMarks(t),e?!0:l.clearNodes()}).wrapInList(p,r).command(()=>oK(a,p)).command(()=>sK(a,p)).run()},uK=(e,t={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:a=!1}=n,o=sW(e,r.schema);return RG(r,o,t)?i.unsetMark(o,{extendEmptyMarkRange:a}):i.setMark(o,t)},dK=(e,t,n={})=>({state:r,commands:i})=>{let a=XU(e,r.schema),o=XU(t,r.schema),s=IW(r,a,n),c;return r.selection.$anchor.sameParent(r.selection.$head)&&(c=r.selection.$anchor.parent.attrs),s?i.setNode(o,c):i.setNode(a,{...c,...n})},fK=(e,t={})=>({state:n,commands:r})=>{let i=XU(e,n.schema);return IW(n,i,t)?r.lift(i):r.wrapIn(i,t)},pK=()=>({state:e,dispatch:t})=>{let n=e.plugins;for(let r=0;r<n.length;r+=1){let i=n[r],a;if(i.spec.isInputRules&&(a=i.getState(e))){if(t){let t=e.tr,n=a.transform;for(let e=n.steps.length-1;e>=0;--e)t.step(n.steps[e].invert(n.docs[e]));if(a.text){let n=t.doc.resolve(a.from).marks();t.replaceWith(a.from,a.to,e.schema.text(a.text,n))}else t.delete(a.from,a.to)}return!0}}return!1},mK=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,{empty:r,ranges:i}=n;return r||t&&i.forEach(t=>{e.removeMark(t.$from.pos,t.$to.pos)}),!0},hK=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{extendEmptyMarkRange:a=!1}=t,{selection:o}=n,s=sW(e,r.schema),{$from:c,empty:l,ranges:u}=o;if(!i)return!0;if(l&&a){let{from:e,to:t}=o,r=oW(c,s,c.marks().find(e=>e.type===s)?.attrs);r&&(e=r.from,t=r.to),n.removeMark(e,t,s)}else u.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,s)});return n.removeStoredMark(s),!0},gK=e=>({tr:t,state:n,dispatch:r})=>{let{selection:i}=n,a,o;return typeof e==`number`?(a=e,o=e):e&&`from`in e&&`to`in e?(a=e.from,o=e.to):(a=i.from,o=i.to),r&&t.doc.nodesBetween(a,o,(e,n)=>{if(e.isText)return;let r={...e.attrs};delete r.dir,t.setNodeMarkup(n,void 0,r)}),!0},_K=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=VW(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=XU(e,r.schema)),s===`mark`&&(o=sW(e,r.schema));let c=!1;return n.selection.ranges.forEach(e=>{let s=e.$from.pos,l=e.$to.pos,u,d,f,p;n.selection.empty?r.doc.nodesBetween(s,l,(e,t)=>{a&&a===e.type&&(c=!0,f=Math.max(t,s),p=Math.min(t+e.nodeSize,l),u=t,d=e)}):r.doc.nodesBetween(s,l,(e,r)=>{r<s&&a&&a===e.type&&(c=!0,f=Math.max(r,s),p=Math.min(r+e.nodeSize,l),u=r,d=e),r>=s&&r<=l&&(a&&a===e.type&&(c=!0,i&&n.setNodeMarkup(r,void 0,{...e.attrs,...t})),o&&e.marks.length&&e.marks.forEach(a=>{if(o===a.type&&(c=!0,i)){let i=Math.max(r,s),c=Math.min(r+e.nodeSize,l);n.addMark(i,c,o.create({...a.attrs,...t}))}}))}),d&&(u!==void 0&&i&&n.setNodeMarkup(u,void 0,{...d.attrs,...t}),o&&d.marks.length&&d.marks.forEach(e=>{o===e.type&&i&&n.addMark(f,p,o.create({...e.attrs,...t}))}))}),c},vK=(e,t={})=>({state:n,dispatch:r})=>VR(XU(e,n.schema),t)(n,r),yK=(e,t={})=>({state:n,dispatch:r})=>JR(XU(e,n.schema),t)(n,r),bK=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){let n=this.callbacks[e];return n&&n.forEach(e=>e.apply(this,t)),this}off(e,t){let n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(e=>e!==t):delete this.callbacks[e]),this}once(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}},xK=class{constructor(e){this.find=e.find,this.handler=e.handler,this.undoable=e.undoable??!0}},SK=(e,t)=>{if(nW(t))return t.exec(e);let n=t(e);if(!n)return null;let r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn(`[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".`),r.push(n.replaceWith)),r};function CK(e){let{editor:t,from:n,to:r,text:i,rules:a,plugin:o}=e,{view:s}=t;if(s.composing)return!1;let c=s.state.doc.resolve(n);if(c.parent.type.spec.code||(c.nodeBefore||c.nodeAfter)?.marks.find(e=>e.type.spec.code))return!1;let l=!1,u=LG(c)+i;return a.forEach(e=>{if(l)return;let a=SK(u,e.find);if(!a)return;let c=s.state.tr,d=BU({state:s.state,transaction:c}),f={from:n-(a[0].length-i.length),to:r},{commands:p,chain:m,can:h}=new VU({editor:t,state:d});e.handler({state:d,range:f,match:a,commands:p,chain:m,can:h})===null||!c.steps.length||(e.undoable&&c.setMeta(o,{transform:c,from:n,to:r,text:i}),s.dispatch(c),l=!0)}),l}function wK(e){let{editor:t,rules:n}=e,r=new sR({state:{init(){return null},apply(e,i,a){let o=e.getMeta(r);if(o)return o;let s=e.getMeta(`applyInputRules`);return s&&setTimeout(()=>{let{text:e}=s;e=typeof e==`string`?e:sG(Q.from(e),a.schema);let{from:i}=s;CK({editor:t,from:i,to:i+e.length,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:i}},props:{handleTextInput(e,i,a,o){return CK({editor:t,from:i,to:a,text:o,rules:n,plugin:r})},handleDOMEvents:{compositionend:e=>(setTimeout(()=>{let{$cursor:i}=e.state.selection;i&&CK({editor:t,from:i.pos,to:i.pos,text:``,rules:n,plugin:r})}),!1)},handleKeyDown(e,i){if(i.key!==`Enter`)return!1;let{$cursor:a}=e.state.selection;return a?CK({editor:t,from:a.pos,to:a.pos,text:`
92
+ `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function TK(e){return Object.prototype.toString.call(e).slice(8,-1)}function EK(e){return TK(e)===`Object`?e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype:!1}function DK(e,t){let n={...e};return EK(e)&&EK(t)&&Object.keys(t).forEach(r=>{EK(t[r])&&EK(e[r])?n[r]=DK(e[r],t[r]):n[r]=t[r]}),n}var OK=class{constructor(e={}){this.type=`extendable`,this.parent=null,this.child=null,this.name=``,this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...lG(aG(this,`addOptions`,{name:this.name}))||{}}}get storage(){return{...lG(aG(this,`addStorage`,{name:this.name,options:this.options}))||{}}}configure(e={}){let t=this.extend({...this.config,addOptions:()=>DK(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){let t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name=`name`in e?e.name:t.parent.name,t}},kK=class e extends OK{constructor(){super(...arguments),this.type=`mark`}static create(t={}){return new e(typeof t==`function`?t():t)}static handleExit({editor:e,mark:t}){let{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){let i=r.marks();if(!i.find(e=>e?.type.name===t.name))return!1;let a=i.find(e=>e?.type.name===t.name);return a&&n.removeStoredMark(a),n.insertText(` `,r.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}};function AK(e){return typeof e==`number`}var jK=class{constructor(e){this.find=e.find,this.handler=e.handler}},MK=(e,t,n)=>{if(nW(t))return[...e.matchAll(t)];let r=t(e,n);return r?r.map(t=>{let n=[t.text];return n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn(`[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".`),n.push(t.replaceWith)),n}):[]};function NK(e){let{editor:t,state:n,from:r,to:i,rule:a,pasteEvent:o,dropEvent:s}=e,{commands:c,chain:l,can:u}=new VU({editor:t,state:n}),d=[];return n.doc.nodesBetween(r,i,(e,t)=>{if(e.type?.spec?.code||!(e.isText||e.isTextblock||e.isInline))return;let f=e.content?.size??e.nodeSize??0,p=Math.max(r,t),m=Math.min(i,t+f);p>=m||MK(e.isText?e.text||``:e.textBetween(p-t,m-t,void 0,``),a.find,o).forEach(e=>{if(e.index===void 0)return;let t=p+e.index+1,r=t+e[0].length,i={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},f=a.handler({state:n,range:i,match:e,commands:c,chain:l,can:u,pasteEvent:o,dropEvent:s});d.push(f)})}),d.every(e=>e!==null)}var PK=null,FK=e=>{var t;let n=new ClipboardEvent(`paste`,{clipboardData:new DataTransfer});return(t=n.clipboardData)==null||t.setData(`text/html`,e),n};function IK(e){let{editor:t,rules:n}=e,r=null,i=!1,a=!1,o=typeof ClipboardEvent<`u`?new ClipboardEvent(`paste`):null,s;try{s=typeof DragEvent<`u`?new DragEvent(`drop`):null}catch{s=null}let c=({state:e,from:n,to:r,rule:i,pasteEvt:a})=>{let c=e.tr;if(!(!NK({editor:t,state:BU({state:e,transaction:c}),from:Math.max(n-1,0),to:r.b-1,rule:i,pasteEvent:a,dropEvent:s})||!c.steps.length)){try{s=typeof DragEvent<`u`?new DragEvent(`drop`):null}catch{s=null}return o=typeof ClipboardEvent<`u`?new ClipboardEvent(`paste`):null,c}};return n.map(e=>new sR({view(e){let n=n=>{r=e.dom.parentElement?.contains(n.target)?e.dom.parentElement:null,r&&(PK=t)},i=()=>{PK&&=null};return window.addEventListener(`dragstart`,n),window.addEventListener(`dragend`,i),{destroy(){window.removeEventListener(`dragstart`,n),window.removeEventListener(`dragend`,i)}}},props:{handleDOMEvents:{drop:(e,t)=>{if(a=r===e.dom.parentElement,s=t,!a){let e=PK;e?.isEditable&&setTimeout(()=>{let t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})},10)}return!1},paste:(e,t)=>{let n=t.clipboardData?.getData(`text/html`);return o=t,i=!!n?.includes(`data-pm-slice`),!1}}},appendTransaction:(t,n,r)=>{let s=t[0],l=s.getMeta(`uiEvent`)===`paste`&&!i,u=s.getMeta(`uiEvent`)===`drop`&&!a,d=s.getMeta(`applyPasteRules`),f=!!d;if(!l&&!u&&!f)return;if(f){let{text:t}=d;t=typeof t==`string`?t:sG(Q.from(t),r.schema);let{from:n}=d,i=n+t.length,a=FK(t);return c({rule:e,state:r,from:n,to:{b:i},pasteEvt:a})}let p=n.doc.content.findDiffStart(r.doc.content),m=n.doc.content.findDiffEnd(r.doc.content);if(!(!AK(p)||!m||p===m.b))return c({rule:e,state:r,from:p,to:m,pasteEvt:o})}}))}var LK=class{constructor(e,t){this.splittableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=wG(e),this.schema=xG(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{let n=aG(t,`addCommands`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:FG(t.name,this.schema)});return n?{...e,...n()}:e},{})}get plugins(){let{editor:e}=this;return CG([...this.extensions].reverse()).flatMap(t=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:FG(t.name,this.schema)},r=[],i=aG(t,`addKeyboardShortcuts`,n),a={};if(t.type===`mark`&&aG(t,`exitable`,n)&&(a.ArrowRight=()=>kK.handleExit({editor:e,mark:t})),i){let t=Object.fromEntries(Object.entries(i()).map(([t,n])=>[t,()=>n({editor:e})]));a={...a,...t}}let o=IU(a);r.push(o);let s=aG(t,`addInputRules`,n);if(HG(t,e.options.enableInputRules)&&s){let t=s();if(t&&t.length){let n=wK({editor:e,rules:t}),i=Array.isArray(n)?n:[n];r.push(...i)}}let c=aG(t,`addPasteRules`,n);if(HG(t,e.options.enablePasteRules)&&c){let t=c();if(t&&t.length){let n=IK({editor:e,rules:t});r.push(...n)}}let l=aG(t,`addProseMirrorPlugins`,n);if(l){let e=l();r.push(...e)}return r})}get attributes(){return fG(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=dG(this.extensions);return Object.fromEntries(t.filter(e=>!!aG(e,`addNodeView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=aG(t,`addNodeView`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:XU(t.name,this.schema)});if(!r)return[];let i=r();return i?[t.name,(r,a,o,s,c)=>i({node:r,view:a,getPos:o,decorations:s,innerDecorations:c,editor:e,extension:t,HTMLAttributes:gG(r,n)})]:[]}))}dispatchTransaction(e){let{editor:t}=this;return CG([...this.extensions].reverse()).reduceRight((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:FG(n.name,this.schema)},i=aG(n,`dispatchTransaction`,r);return i?t=>{i.call(r,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){let{editor:t}=this;return CG([...this.extensions]).reduce((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:FG(n.name,this.schema)},i=aG(n,`transformPastedHTML`,r);return i?(t,n)=>{let a=e(t,n);return i.call(r,a)}:e},e||(e=>e))}get markViews(){let{editor:e}=this,{markExtensions:t}=dG(this.extensions);return Object.fromEntries(t.filter(e=>!!aG(e,`addMarkView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=aG(t,`addMarkView`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:sW(t.name,this.schema)});return r?[t.name,(i,a,o)=>{let s=gG(i,n);return r()({mark:i,view:a,inline:o,editor:e,extension:t,HTMLAttributes:s,updateAttributes:t=>{yq(i,e,t)}})}]:[]}))}setupExtensions(){let e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(e=>[e.name,e.storage])),e.forEach(e=>{let t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:FG(e.name,this.schema)};e.type===`mark`&&(lG(aG(e,`keepOnSplit`,t))??!0)&&this.splittableMarks.push(e.name);let n=aG(e,`onBeforeCreate`,t),r=aG(e,`onCreate`,t),i=aG(e,`onUpdate`,t),a=aG(e,`onSelectionUpdate`,t),o=aG(e,`onTransaction`,t),s=aG(e,`onFocus`,t),c=aG(e,`onBlur`,t),l=aG(e,`onDestroy`,t);n&&this.editor.on(`beforeCreate`,n),r&&this.editor.on(`create`,r),i&&this.editor.on(`update`,i),a&&this.editor.on(`selectionUpdate`,a),o&&this.editor.on(`transaction`,o),s&&this.editor.on(`focus`,s),c&&this.editor.on(`blur`,c),l&&this.editor.on(`destroy`,l)})}};LK.resolve=wG,LK.sort=CG,LK.flatten=oG,zU({},{ClipboardTextSerializer:()=>zK,Commands:()=>BK,Delete:()=>VK,Drop:()=>HK,Editable:()=>UK,FocusEvents:()=>GK,Keymap:()=>KK,Paste:()=>qK,Tabindex:()=>JK,TextDirection:()=>YK,focusEventsPluginKey:()=>WK});var RK=class e extends OK{constructor(){super(...arguments),this.type=`extension`}static create(t={}){return new e(typeof t==`function`?t():t)}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}},zK=RK.create({name:`clipboardTextSerializer`,addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new sR({key:new uR(`clipboardTextSerializer`),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:i}=t,{ranges:a}=i,o=Math.min(...a.map(e=>e.$from.pos)),s=Math.max(...a.map(e=>e.$to.pos)),c=DG(n);return TG(r,{from:o,to:s},{...this.options.blockSeparator===void 0?{}:{blockSeparator:this.options.blockSeparator},textSerializers:c})}}})]}}),BK=RK.create({name:`commands`,addCommands(){return{...HU}}}),VK=RK.create({name:`delete`,onUpdate({transaction:e,appendedTransactions:t}){let n=()=>{var n;if(((n=this.editor.options.coreExtensionOptions?.delete)?.filterTransaction)?.call(n,e)??e.getMeta(`y-sync$`))return;let r=eG(e.before,[e,...t]);MG(r).forEach(t=>{r.mapping.mapResult(t.oldRange.from).deletedAfter&&r.mapping.mapResult(t.oldRange.to).deletedBefore&&r.before.nodesBetween(t.oldRange.from,t.oldRange.to,(n,i)=>{let a=i+n.nodeSize-2,o=t.oldRange.from<=i&&a<=t.oldRange.to;this.editor.emit(`delete`,{type:`node`,node:n,from:i,to:a,newFrom:r.mapping.map(i),newTo:r.mapping.map(a),deletedRange:t.oldRange,newRange:t.newRange,partial:!o,editor:this.editor,transaction:e,combinedTransform:r})})});let i=r.mapping;r.steps.forEach((t,n)=>{if(t instanceof HI){let a=i.slice(n).map(t.from,-1),o=i.slice(n).map(t.to),s=i.invert().map(a,-1),c=i.invert().map(o),l=a>0?r.doc.nodeAt(a-1)?.marks.some(e=>e.eq(t.mark)):!1,u=r.doc.nodeAt(o)?.marks.some(e=>e.eq(t.mark));this.editor.emit(`delete`,{type:`mark`,mark:t.mark,from:t.from,to:t.to,deletedRange:{from:s,to:c},newRange:{from:a,to:o},partial:!!(u||l),editor:this.editor,transaction:e,combinedTransform:r})}})};this.editor.options.coreExtensionOptions?.delete?.async??!0?setTimeout(n,0):n()}}),HK=RK.create({name:`drop`,addProseMirrorPlugins(){return[new sR({key:new uR(`tiptapDrop`),props:{handleDrop:(e,t,n,r)=>{this.editor.emit(`drop`,{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),UK=RK.create({name:`editable`,addProseMirrorPlugins(){return[new sR({key:new uR(`editable`),props:{editable:()=>this.editor.options.editable}})]}}),WK=new uR(`focusEvents`),GK=RK.create({name:`focusEvents`,addProseMirrorPlugins(){let{editor:e}=this;return[new sR({key:WK,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;let r=e.state.tr.setMeta(`focus`,{event:n}).setMeta(`addToHistory`,!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;let r=e.state.tr.setMeta(`blur`,{event:n}).setMeta(`addToHistory`,!1);return t.dispatch(r),!1}}}})]}}),KK=RK.create({name:`keymap`,addKeyboardShortcuts(){let e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:t})=>{let{selection:n,doc:r}=t,{empty:i,$anchor:a}=n,{pos:o,parent:s}=a,c=a.parent.isTextblock&&o>0?t.doc.resolve(o-1):a,l=c.parent.type.spec.isolating,u=a.pos-a.parentOffset,d=l&&c.parent.childCount===1?u===a.pos:zL.atStart(r).from===o;return!i||!s.type.isTextblock||s.textContent.length||!d||d&&a.parent.type.name===`paragraph`?!1:e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},i={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return mW()||NW()?i:r},addProseMirrorPlugins(){return[new sR({key:new uR(`clearDocument`),appendTransaction:(e,t,n)=>{if(e.some(e=>e.getMeta(`composition`)))return;let r=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc),i=e.some(e=>e.getMeta(`preventClearDocument`));if(!r||i)return;let{empty:a,from:o,to:s}=t.selection,c=zL.atStart(t.doc).from,l=zL.atEnd(t.doc).to;if(a||!(o===c&&s===l)||!WG(n.doc))return;let u=n.tr,d=BU({state:n,transaction:u}),{commands:f}=new VU({editor:this.editor,state:d});if(f.clearNodes(),u.steps.length)return u}})]}}),qK=RK.create({name:`paste`,addProseMirrorPlugins(){return[new sR({key:new uR(`tiptapPaste`),props:{handlePaste:(e,t,n)=>{this.editor.emit(`paste`,{editor:this.editor,event:t,slice:n})}}})]}}),JK=RK.create({name:`tabindex`,addProseMirrorPlugins(){return[new sR({key:new uR(`tabindex`),props:{attributes:()=>this.editor.isEditable?{tabindex:`0`}:{}}})]}}),YK=RK.create({name:`textDirection`,addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:e}=dG(this.extensions);return[{types:e.filter(e=>e.name!==`text`).map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{let t=e.getAttribute(`dir`);return t&&(t===`ltr`||t===`rtl`||t===`auto`)?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new sR({key:new uR(`textDirection`),props:{attributes:()=>{let e=this.options.direction;return e?{dir:e}:{}}}})]}}),XK=class e{constructor(e,t,n=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=r}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){return this.actualDepth??this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,n=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can\u2019t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+ +!this.node.isText}get parent(){if(this.depth===0)return null;let t=this.resolvedPos.start(this.resolvedPos.depth-1);return new e(this.resolvedPos.doc.resolve(t),this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new e(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new e(t,this.editor)}get children(){let t=[];return this.node.content.forEach((n,r)=>{let i=n.isBlock&&!n.isTextblock,a=n.isAtom&&!n.isText,o=n.isInline,s=this.pos+r+ +!a;if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;let c=this.resolvedPos.doc.resolve(s);if(!i&&!o&&c.depth<=this.depth)return;let l=new e(c,this.editor,i,i||o?n:null);i&&(l.actualDepth=this.depth+1),t.push(l)}),t}get firstChild(){return this.children[0]||null}get lastChild(){let e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,r=this.parent;for(;r&&!n;){if(r.node.type.name===e)if(Object.keys(t).length>0){let e=r.node.attrs,n=Object.keys(t);for(let r=0;r<n.length;r+=1){let i=n[r];if(e[i]!==t[i])break}}else n=r;r=r.parent}return n}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},n=!1){let r=[];if(!this.children||this.children.length===0)return r;let i=Object.keys(t);return this.children.forEach(a=>{n&&r.length>0||(a.node.type.name===e&&i.every(e=>t[e]===a.node.attrs[e])&&r.push(a),!(n&&r.length>0)&&(r=r.concat(a.querySelectorAll(e,t,n))))}),r}setAttribute(e){let{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},ZK=`.ProseMirror {
93
+ position: relative;
94
+ }
95
+
96
+ .ProseMirror {
97
+ word-wrap: break-word;
98
+ white-space: pre-wrap;
99
+ white-space: break-spaces;
100
+ -webkit-font-variant-ligatures: none;
101
+ font-variant-ligatures: none;
102
+ font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
103
+ }
104
+
105
+ .ProseMirror [contenteditable="false"] {
106
+ white-space: normal;
107
+ }
108
+
109
+ .ProseMirror [contenteditable="false"] [contenteditable="true"] {
110
+ white-space: pre-wrap;
111
+ }
112
+
113
+ .ProseMirror pre {
114
+ white-space: pre-wrap;
115
+ }
116
+
117
+ img.ProseMirror-separator {
118
+ display: inline !important;
119
+ border: none !important;
120
+ margin: 0 !important;
121
+ width: 0 !important;
122
+ height: 0 !important;
123
+ }
124
+
125
+ .ProseMirror-gapcursor {
126
+ display: none;
127
+ pointer-events: none;
128
+ position: absolute;
129
+ margin: 0;
130
+ }
131
+
132
+ .ProseMirror-gapcursor:after {
133
+ content: "";
134
+ display: block;
135
+ position: absolute;
136
+ top: -2px;
137
+ width: 20px;
138
+ border-top: 1px solid black;
139
+ animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
140
+ }
141
+
142
+ @keyframes ProseMirror-cursor-blink {
143
+ to {
144
+ visibility: hidden;
145
+ }
146
+ }
147
+
148
+ .ProseMirror-hideselection *::selection {
149
+ background: transparent;
150
+ }
151
+
152
+ .ProseMirror-hideselection *::-moz-selection {
153
+ background: transparent;
154
+ }
155
+
156
+ .ProseMirror-hideselection * {
157
+ caret-color: transparent;
158
+ }
159
+
160
+ .ProseMirror-focused .ProseMirror-gapcursor {
161
+ display: block;
162
+ }`;function QK(e,t,n){let r=document.querySelector(`style[data-tiptap-style${n?`-${n}`:``}]`);if(r!==null)return r;let i=document.createElement(`style`);return t&&i.setAttribute(`nonce`,t),i.setAttribute(`data-tiptap-style${n?`-${n}`:``}`,``),i.innerHTML=e,document.getElementsByTagName(`head`)[0].appendChild(i),i}var $K=class extends bK{constructor(e={}){super(),this.css=null,this.className=`tiptap`,this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<`u`?document.createElement(`div`):null,content:``,injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:qG,createMappablePosition:JG},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on(`beforeCreate`,this.options.onBeforeCreate),this.emit(`beforeCreate`,{editor:this}),this.on(`mount`,this.options.onMount),this.on(`unmount`,this.options.onUnmount),this.on(`contentError`,this.options.onContentError),this.on(`create`,this.options.onCreate),this.on(`update`,this.options.onUpdate),this.on(`selectionUpdate`,this.options.onSelectionUpdate),this.on(`transaction`,this.options.onTransaction),this.on(`focus`,this.options.onFocus),this.on(`blur`,this.options.onBlur),this.on(`destroy`,this.options.onDestroy),this.on(`drop`,({event:e,slice:t,moved:n})=>this.options.onDrop(e,t,n)),this.on(`paste`,({event:e,slice:t})=>this.options.onPaste(e,t)),this.on(`delete`,this.options.onDelete);let t=this.createDoc(),n=fW(t,this.options.autofocus);this.editorState=aR.create({doc:t,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if(typeof document>`u`)throw Error(`[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.`);this.createView(e),this.emit(`mount`,{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit(`create`,{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){let e=this.editorView.dom;e?.editor&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove==`function`?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn(`Failed to remove CSS element:`,e)}this.css=null,this.emit(`unmount`,{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<`u`&&(this.css=QK(ZK,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit(`update`,{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if(t===`state`)return this.editorState;if(t in e)return Reflect.get(e,t);throw Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){let n=cG(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;let t=this.state.plugins,n=t;if([].concat(e).forEach(e=>{let t=typeof e==`string`?`${e}$`:e.key;n=n.filter(e=>!e.key.startsWith(t))}),t.length===n.length)return;let r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){let e=[...this.options.enableCoreExtensions?[UK,zK.configure({blockSeparator:this.options.coreExtensionOptions?.clipboardTextSerializer?.blockSeparator}),BK,GK,KK,JK,HK,qK,VK,YK.configure({direction:this.options.textDirection})].filter(e=>typeof this.options.enableCoreExtensions==`object`?this.options.enableCoreExtensions[e.name]!==!1:!0):[],...this.options.extensions].filter(e=>[`extension`,`node`,`mark`].includes(e?.type));this.extensionManager=new LK(e,this)}createCommandManager(){this.commandManager=new VU({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=ZW(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||![`[tiptap error]: Invalid JSON content`,`[tiptap error]: Invalid HTML content`].includes(t.message))throw t;this.emit(`contentError`,{editor:this,error:t,disableCollaboration:()=>{`collaboration`in this.storage&&typeof this.storage.collaboration==`object`&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(e=>e.name!==`collaboration`),this.createExtensionManager()}}),e=ZW(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){let{editorProps:t,enableExtensionDispatchTransaction:n}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,a=t.transformPastedHTML,o=this.extensionManager.transformPastedHTML(a);this.editorView=new gU(e,{...t,attributes:{role:`textbox`,...t?.attributes},dispatchTransaction:i,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});let s=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(s),this.prependClass(),this.injectCSS();let c=this.view.dom;c.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;let t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(e=>this.capturedTransaction?.step(e));return}let{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),i=n.includes(e),a=this.state;if(this.emit(`beforeTransaction`,{editor:this,transaction:e,nextState:t}),!i)return;this.view.updateState(t),this.emit(`transaction`,{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit(`selectionUpdate`,{editor:this,transaction:e});let o=n.findLast(e=>e.getMeta(`focus`)||e.getMeta(`blur`)),s=o?.getMeta(`focus`),c=o?.getMeta(`blur`);s&&this.emit(`focus`,{editor:this,event:s.event,transaction:o}),c&&this.emit(`blur`,{editor:this,event:c.event,transaction:o}),!(e.getMeta(`preventUpdate`)||!n.some(e=>e.docChanged)||a.doc.eq(t.doc))&&this.emit(`update`,{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return kG(this.state,e)}isActive(e,t){let n=typeof e==`string`?e:null,r=typeof e==`string`?t:e;return zG(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return sG(this.state.doc.content,this.schema)}getText(e){let{blockSeparator:t=`
163
+
164
+ `,textSerializers:n={}}=e||{};return EG(this.state.doc,{blockSeparator:t,textSerializers:{...DG(this.schema),...n}})}get isEmpty(){return WG(this.state.doc)}destroy(){this.emit(`destroy`),this.unmount(),this.removeAllListeners()}get isDestroyed(){return this.editorView?.isDestroyed??!0}$node(e,t){return this.$doc?.querySelector(e,t)||null}$nodes(e,t){return this.$doc?.querySelectorAll(e,t)||null}$pos(e){return new XK(this.state.doc.resolve(e),this)}get $doc(){return this.$pos(0)}};function eq(e){return new xK({find:e.find,handler:({state:t,range:n,match:r})=>{let i=lG(e.getAttributes,void 0,r);if(i===!1||i===null)return null;let{tr:a}=t,o=r[r.length-1],s=r[0];if(o){let r=s.search(/\S/),c=n.from+s.indexOf(o),l=c+o.length;if(NG(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>c).length)return null;l<n.to&&a.delete(l,n.to),c>n.from&&a.delete(n.from+r,c);let u=n.from+r+o.length;a.addMark(n.from+r,u,e.type.create(i||{})),a.removeStoredMark(e.type)}},undoable:e.undoable})}function tq(e){return new xK({find:e.find,handler:({state:t,range:n,match:r})=>{let i=lG(e.getAttributes,void 0,r)||{},{tr:a}=t,o=n.from,s=n.to,c=e.type.create(i);if(r[1]){let e=o+r[0].lastIndexOf(r[1]);e>s?e=s:s=e+r[1].length;let t=r[0][r[0].length-1];a.insertText(t,o+r[0].length-1),a.replaceWith(e,s,c)}else if(r[0]){let t=e.type.isInline?o:o-1;a.insert(t,e.type.create(i)).delete(a.mapping.map(o),a.mapping.map(s))}a.scrollIntoView()},undoable:e.undoable})}function nq(e){return new xK({find:e.find,handler:({state:t,range:n,match:r})=>{let i=t.doc.resolve(n.from),a=lG(e.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,a)},undoable:e.undoable})}function rq(e){return new xK({find:e.find,handler:({state:t,range:n,match:r,chain:i})=>{let a=lG(e.getAttributes,void 0,r)||{},o=t.tr.delete(n.from,n.to),s=o.doc.resolve(n.from).blockRange(),c=s&&eL(s,e.type,a);if(!c)return null;if(o.wrap(s,c),e.keepMarks&&e.editor){let{selection:n,storedMarks:r}=t,{splittableMarks:i}=e.editor.extensionManager,a=r||n.$to.parentOffset&&n.$from.marks();if(a){let e=a.filter(e=>i.includes(e.type.name));o.ensureMarks(e)}}if(e.keepAttributes){let t=e.type.name===`bulletList`||e.type.name===`orderedList`?`listItem`:`taskList`;i().updateAttributes(t,a).run()}let l=o.doc.resolve(n.from-1).nodeBefore;l&&l.type===e.type&&fL(o.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,l))&&o.join(n.from-1)},undoable:e.undoable})}var iq=e=>`touches`in e,aq=class{constructor(e){this.directions=[`bottom-left`,`bottom-right`,`top-left`,`top-right`],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:``,wrapper:``,handle:``,resizing:``},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=e=>{if(!this.isResizing||!this.activeHandle)return;let t=e.clientX-this.startX,n=e.clientY-this.startY;this.handleResize(t,n)},this.handleTouchMove=e=>{if(!this.isResizing||!this.activeHandle)return;let t=e.touches[0];if(!t)return;let n=t.clientX-this.startX,r=t.clientY-this.startY;this.handleResize(n,r)},this.handleMouseUp=()=>{if(!this.isResizing)return;let e=this.element.offsetWidth,t=this.element.offsetHeight;this.onCommit(e,t),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState=`false`,this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener(`mousemove`,this.handleMouseMove),document.removeEventListener(`mouseup`,this.handleMouseUp),document.removeEventListener(`keydown`,this.handleKeyDown),document.removeEventListener(`keyup`,this.handleKeyUp)},this.handleKeyDown=e=>{e.key===`Shift`&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=e=>{e.key===`Shift`&&(this.isShiftKeyPressed=!1)},this.node=e.node,this.editor=e.editor,this.element=e.element,this.contentElement=e.contentElement,this.getPos=e.getPos,this.onResize=e.onResize,this.onCommit=e.onCommit,this.onUpdate=e.onUpdate,e.options?.min&&(this.minSize={...this.minSize,...e.options.min}),e.options?.max&&(this.maxSize=e.options.max),e?.options?.directions&&(this.directions=e.options.directions),e.options?.preserveAspectRatio&&(this.preserveAspectRatio=e.options.preserveAspectRatio),e.options?.className&&(this.classNames={container:e.options.className.container||``,wrapper:e.options.className.wrapper||``,handle:e.options.className.handle||``,resizing:e.options.className.resizing||``}),e.options?.createCustomHandle&&(this.createCustomHandle=e.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on(`update`,this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){return this.contentElement??null}handleEditorUpdate(){let e=this.editor.isEditable;e!==this.lastEditableState&&(this.lastEditableState=e,e?e&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(e,t,n){return e.type===this.node.type?(this.node=e,this.onUpdate?this.onUpdate(e,t,n):!0):!1}destroy(){this.isResizing&&(this.container.dataset.resizeState=`false`,this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener(`mousemove`,this.handleMouseMove),document.removeEventListener(`mouseup`,this.handleMouseUp),document.removeEventListener(`keydown`,this.handleKeyDown),document.removeEventListener(`keyup`,this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off(`update`,this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){let e=document.createElement(`div`);return e.dataset.resizeContainer=``,e.dataset.node=this.node.type.name,e.style.display=this.node.type.isInline?`inline-flex`:`flex`,this.classNames.container&&(e.className=this.classNames.container),e.appendChild(this.wrapper),e}createWrapper(){let e=document.createElement(`div`);return e.style.position=`relative`,e.style.display=`block`,e.dataset.resizeWrapper=``,this.classNames.wrapper&&(e.className=this.classNames.wrapper),e.appendChild(this.element),e}createHandle(e){let t=document.createElement(`div`);return t.dataset.resizeHandle=e,t.style.position=`absolute`,this.classNames.handle&&(t.className=this.classNames.handle),t}positionHandle(e,t){let n=t.includes(`top`),r=t.includes(`bottom`),i=t.includes(`left`),a=t.includes(`right`);n&&(e.style.top=`0`),r&&(e.style.bottom=`0`),i&&(e.style.left=`0`),a&&(e.style.right=`0`),(t===`top`||t===`bottom`)&&(e.style.left=`0`,e.style.right=`0`),(t===`left`||t===`right`)&&(e.style.top=`0`,e.style.bottom=`0`)}attachHandles(){this.directions.forEach(e=>{let t;t=this.createCustomHandle?this.createCustomHandle(e):this.createHandle(e),t instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${e}") did not return an HTMLElement. Falling back to default handle.`),t=this.createHandle(e)),this.createCustomHandle||this.positionHandle(t,e),t.addEventListener(`mousedown`,t=>this.handleResizeStart(t,e)),t.addEventListener(`touchstart`,t=>this.handleResizeStart(t,e)),this.handleMap.set(e,t),this.wrapper.appendChild(t)})}removeHandles(){this.handleMap.forEach(e=>e.remove()),this.handleMap.clear()}applyInitialSize(){let e=this.node.attrs.width,t=this.node.attrs.height;e?(this.element.style.width=`${e}px`,this.initialWidth=e):this.initialWidth=this.element.offsetWidth,t?(this.element.style.height=`${t}px`,this.initialHeight=t):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(e,t){e.preventDefault(),e.stopPropagation(),this.isResizing=!0,this.activeHandle=t,iq(e)?(this.startX=e.touches[0].clientX,this.startY=e.touches[0].clientY):(this.startX=e.clientX,this.startY=e.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState=`true`,this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener(`mousemove`,this.handleMouseMove),document.addEventListener(`touchmove`,this.handleTouchMove),document.addEventListener(`mouseup`,this.handleMouseUp),document.addEventListener(`keydown`,this.handleKeyDown),document.addEventListener(`keyup`,this.handleKeyUp)}handleResize(e,t){if(!this.activeHandle)return;let n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:i}=this.calculateNewDimensions(this.activeHandle,e,t),a=this.applyConstraints(r,i,n);this.element.style.width=`${a.width}px`,this.element.style.height=`${a.height}px`,this.onResize&&this.onResize(a.width,a.height)}calculateNewDimensions(e,t,n){let r=this.startWidth,i=this.startHeight,a=e.includes(`right`),o=e.includes(`left`),s=e.includes(`bottom`),c=e.includes(`top`);return a?r=this.startWidth+t:o&&(r=this.startWidth-t),s?i=this.startHeight+n:c&&(i=this.startHeight-n),(e===`right`||e===`left`)&&(r=this.startWidth+(a?t:-t)),(e===`top`||e===`bottom`)&&(i=this.startHeight+(s?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,i,e):{width:r,height:i}}applyConstraints(e,t,n){if(!n){let n=Math.max(this.minSize.width,e),r=Math.max(this.minSize.height,t);return this.maxSize?.width&&(n=Math.min(this.maxSize.width,n)),this.maxSize?.height&&(r=Math.min(this.maxSize.height,r)),{width:n,height:r}}let r=e,i=t;return r<this.minSize.width&&(r=this.minSize.width,i=r/this.aspectRatio),i<this.minSize.height&&(i=this.minSize.height,r=i*this.aspectRatio),this.maxSize?.width&&r>this.maxSize.width&&(r=this.maxSize.width,i=r/this.aspectRatio),this.maxSize?.height&&i>this.maxSize.height&&(i=this.maxSize.height,r=i*this.aspectRatio),{width:r,height:i}}applyAspectRatio(e,t,n){return n===`left`||n===`right`?{width:e,height:e/this.aspectRatio}:n===`top`||n===`bottom`?{width:t*this.aspectRatio,height:t}:{width:e,height:e/this.aspectRatio}}};function oq(e,t){let{selection:n}=e,{$from:r}=n;if(n instanceof GL){let e=r.index();return r.parent.canReplaceWith(e,e+1,t)}let i=r.depth;for(;i>=0;){let e=r.index(i);if(r.node(i).contentMatchAt(e).matchType(t))return!0;--i}return!1}zU({},{createAtomBlockMarkdownSpec:()=>lq,createBlockMarkdownSpec:()=>uq,createInlineMarkdownSpec:()=>pq,parseAttributes:()=>sq,parseIndentedBlocks:()=>mq,renderNestedMarkdownContent:()=>hq,serializeAttributes:()=>cq});function sq(e){if(!e?.trim())return{};let t={},n=[],r=e.replace(/["']([^"']*)["']/g,e=>(n.push(e),`__QUOTED_${n.length-1}__`)),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);i&&(t.class=i.map(e=>e.trim().slice(1)).join(` `));let a=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);a&&(t.id=a[1]),Array.from(r.matchAll(/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g)).forEach(([,e,r])=>{let i=n[parseInt(r.match(/__QUOTED_(\d+)__/)?.[1]||`0`,10)];i&&(t[e]=i.slice(1,-1))});let o=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,``).replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,``).replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,``).trim();return o&&o.split(/\s+/).filter(Boolean).forEach(e=>{e.match(/^[a-zA-Z][\w-]*$/)&&(t[e]=!0)}),t}function cq(e){if(!e||Object.keys(e).length===0)return``;let t=[];return e.class&&String(e.class).split(/\s+/).filter(Boolean).forEach(e=>t.push(`.${e}`)),e.id&&t.push(`#${e.id}`),Object.entries(e).forEach(([e,n])=>{e===`class`||e===`id`||(n===!0?t.push(e):n!==!1&&n!=null&&t.push(`${e}="${String(n)}"`))}),t.join(` `)}function lq(e){let{nodeName:t,name:n,parseAttributes:r=sq,serializeAttributes:i=cq,defaultAttributes:a={},requiredAttributes:o=[],allowedAttributes:s}=e,c=n||t,l=e=>{if(!s)return e;let t={};return s.forEach(n=>{n in e&&(t[n]=e[n])}),t};return{parseMarkdown:(e,n)=>{let r={...a,...e.attributes};return n.createNode(t,r,[])},markdownTokenizer:{name:t,level:`block`,start(e){let t=RegExp(`^:::${c}(?:\\s|$)`,`m`),n=e.match(t)?.index;return n===void 0?-1:n},tokenize(e,n,i){let a=RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),s=e.match(a);if(!s)return;let l=r(s[1]||``);if(!o.find(e=>!(e in l)))return{type:t,raw:s[0],attributes:l}}},renderMarkdown:e=>{let t=i(l(e.attrs||{}));return`:::${c}${t?` {${t}}`:``} :::`}}}function uq(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=sq,serializeAttributes:a=cq,defaultAttributes:o={},content:s=`block`,allowedAttributes:c}=e,l=n||t,u=e=>{if(!c)return e;let t={};return c.forEach(n=>{n in e&&(t[n]=e[n])}),t};return{parseMarkdown:(e,n)=>{let i;if(r){let t=r(e);i=typeof t==`string`?[{type:`text`,text:t}]:t}else i=s===`block`?n.parseChildren(e.tokens||[]):n.parseInline(e.tokens||[]);let a={...o,...e.attributes};return n.createNode(t,a,i)},markdownTokenizer:{name:t,level:`block`,start(e){let t=RegExp(`^:::${l}`,`m`),n=e.match(t)?.index;return n===void 0?-1:n},tokenize(e,n,r){let a=RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),o=e.match(a);if(!o)return;let[c,u=``]=o,d=i(u),f=1,p=c.length,m=``,h=/^:::([\w-]*)(\s.*)?/gm,g=e.slice(p);for(h.lastIndex=0;;){let n=h.exec(g);if(n===null)break;let i=n.index,a=n[1];if(!n[2]?.endsWith(`:::`)){if(a)f+=1;else if(--f,f===0){let a=g.slice(0,i);m=a.trim();let o=e.slice(0,p+i+n[0].length),c=[];if(m)if(s===`block`)for(c=r.blockTokens(a),c.forEach(e=>{e.text&&(!e.tokens||e.tokens.length===0)&&(e.tokens=r.inlineTokens(e.text))});c.length>0;){let e=c[c.length-1];if(e.type===`paragraph`&&(!e.text||e.text.trim()===``))c.pop();else break}else c=r.inlineTokens(m);return{type:t,raw:o,attributes:d,content:m,tokens:c}}}}}},renderMarkdown:(e,t)=>{let n=a(u(e.attrs||{}));return`:::${l}${n?` {${n}}`:``}
165
+
166
+ ${t.renderChildren(e.content||[],`
167
+
168
+ `)}
169
+
170
+ :::`}}}function dq(e){if(!e.trim())return{};let t={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g,r=n.exec(e);for(;r!==null;){let[,i,a,o]=r;t[i]=a||o,r=n.exec(e)}return t}function fq(e){return Object.entries(e).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(` `)}function pq(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=dq,serializeAttributes:a=fq,defaultAttributes:o={},selfClosing:s=!1,allowedAttributes:c}=e,l=n||t,u=e=>{if(!c)return e;let t={};return c.forEach(n=>{let r=typeof n==`string`?n:n.name,i=typeof n==`string`?void 0:n.skipIfDefault;if(r in e){let n=e[r];if(i!==void 0&&n===i)return;t[r]=n}}),t},d=l.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);return{parseMarkdown:(e,n)=>{let i={...o,...e.attributes};if(s)return n.createNode(t,i);let a=r?r(e):e.content||``;return a?n.createNode(t,i,[n.createTextNode(a)]):n.createNode(t,i,[])},markdownTokenizer:{name:t,level:`inline`,start(e){let t=RegExp(s?`\\[${d}\\s*[^\\]]*\\]`:`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),n=e.match(t)?.index;return n===void 0?-1:n},tokenize(e,n,r){let a=RegExp(s?`^\\[${d}\\s*([^\\]]*)\\]`:`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),o=e.match(a);if(!o)return;let c=``,l=``;if(s){let[,e]=o;l=e}else{let[,e,t]=o;l=e,c=t||``}let u=i(l.trim());return{type:t,raw:o[0],content:c.trim(),attributes:u}}},renderMarkdown:e=>{let t=``;r?t=r(e):e.content&&e.content.length>0&&(t=e.content.filter(e=>e.type===`text`).map(e=>e.text).join(``));let n=a(u(e.attrs||{})),i=n?` ${n}`:``;return s?`[${l}${i}]`:`[${l}${i}]${t}[/${l}]`}}}function mq(e,t,n){let r=e.split(`
171
+ `),i=[],a=``,o=0,s=t.baseIndentSize||2;for(;o<r.length;){let e=r[o],c=e.match(t.itemPattern);if(!c){if(i.length>0)break;if(e.trim()===``){o+=1,a=`${a}${e}
172
+ `;continue}else return}let l=t.extractItemData(c),{indentLevel:u,mainContent:d}=l;a=`${a}${e}
173
+ `;let f=[d];for(o+=1;o<r.length;){let e=r[o];if(e.trim()===``){let t=r.slice(o+1).findIndex(e=>e.trim()!==``);if(t===-1)break;if((r[o+1+t].match(/^(\s*)/)?.[1]?.length||0)>u){f.push(e),a=`${a}${e}
174
+ `,o+=1;continue}else break}if((e.match(/^(\s*)/)?.[1]?.length||0)>u)f.push(e),a=`${a}${e}
175
+ `,o+=1;else break}let p,m=f.slice(1);if(m.length>0){let e=m.map(e=>e.slice(u+s)).join(`
176
+ `);e.trim()&&(p=t.customNestedParser?t.customNestedParser(e):n.blockTokens(e))}let h=t.createToken(l,p);i.push(h)}if(i.length!==0)return{items:i,raw:a}}function hq(e,t,n,r){if(!e||!Array.isArray(e.content))return``;let i=typeof n==`function`?n(r):n,[a,...o]=e.content,s=`${i}${t.renderChildren([a])}`;return o&&o.length>0&&o.forEach((e,n)=>{let r=t.renderChild?.call(t,e,n+1)??t.renderChildren([e]);if(r!=null){let n=r.split(`
177
+ `).map(e=>e?t.indent(e):t.indent(``)).join(`
178
+ `);s+=e.type===`paragraph`?`
179
+
180
+ ${n}`:`
181
+ ${n}`}}),s}var gq=new WeakMap;function _q(e,t){let n=gq.get(e);if(!n){let t={callbacks:new Set,rafId:null,handler:()=>{t.rafId!==null&&cancelAnimationFrame(t.rafId),t.rafId=requestAnimationFrame(()=>{t.rafId=null,t.callbacks.forEach(e=>e())})}};gq.set(e,t),e.on(`update`,t.handler),n=t}n.callbacks.add(t)}function vq(e,t){let n=gq.get(e);n&&(n.callbacks.delete(t),n.callbacks.size===0&&(n.rafId!==null&&cancelAnimationFrame(n.rafId),e.off(`update`,n.handler),gq.delete(e)))}function yq(e,t,n={}){let{state:r}=t,{doc:i,tr:a}=r,o=e;i.descendants((t,r)=>{let i=a.mapping.map(r),s=a.mapping.map(r)+t.nodeSize,c=null;if(t.marks.forEach(e=>{if(e!==o)return!1;c=e}),!c)return;let l=!1;if(Object.keys(n).forEach(e=>{n[e]!==c.attrs[e]&&(l=!0)}),l){let t=e.type.create({...e.attrs,...n});a.removeMark(i,s,e.type),a.addMark(i,s,t)}}),a.docChanged&&t.view.dispatch(a)}var bq=class e extends OK{constructor(){super(...arguments),this.type=`node`}static create(t={}){return new e(typeof t==`function`?t():t)}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}},xq=class{constructor(e,t,n){this.isDragging=!1,this.component=e,this.editor=t.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=t.extension,this.node=t.node,this.decorations=t.decorations,this.innerDecorations=t.innerDecorations,this.view=t.view,this.HTMLAttributes=t.HTMLAttributes,this.getPos=t.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(e){var t;let{view:n}=this.editor,r=e.target,i=r.nodeType===3?r.parentElement?.closest(`[data-drag-handle]`):r.closest(`[data-drag-handle]`);if(!this.dom||this.contentDOM?.contains(r)||!i)return;let a=0,o=0;if(this.dom!==i){let t=this.dom.getBoundingClientRect(),n=i.getBoundingClientRect(),r=e.offsetX??e.nativeEvent?.offsetX,s=e.offsetY??e.nativeEvent?.offsetY;a=n.x-t.x+r,o=n.y-t.y+s}let s=this.dom.cloneNode(!0);try{let e=this.dom.getBoundingClientRect();s.style.width=`${Math.round(e.width)}px`,s.style.height=`${Math.round(e.height)}px`,s.style.boxSizing=`border-box`,s.style.pointerEvents=`none`}catch{}let c=null;try{c=document.createElement(`div`),c.style.position=`absolute`,c.style.top=`-9999px`,c.style.left=`-9999px`,c.style.pointerEvents=`none`,c.appendChild(s),document.body.appendChild(c),(t=e.dataTransfer)==null||t.setDragImage(s,a,o)}finally{c&&setTimeout(()=>{try{c?.remove()}catch{}},0)}let l=this.getPos();if(typeof l!=`number`)return;let u=GL.create(n.state.doc,l),d=n.state.tr.setSelection(u);n.dispatch(d)}stopEvent(e){if(!this.dom)return!1;if(typeof this.options.stopEvent==`function`)return this.options.stopEvent({event:e});let t=e.target;if(!(this.dom.contains(t)&&!this.contentDOM?.contains(t)))return!1;let n=e.type.startsWith(`drag`),r=e.type===`dragover`||e.type===`dragenter`,i=e.type===`drop`;if(([`INPUT`,`BUTTON`,`SELECT`,`TEXTAREA`].includes(t.tagName)||t.isContentEditable)&&!i&&!n)return!0;let{isEditable:a}=this.editor,{isDragging:o}=this,s=!!this.node.type.spec.draggable,c=GL.isSelectable(this.node),l=e.type===`copy`,u=e.type===`paste`,d=e.type===`cut`,f=e.type===`mousedown`;if(!s&&c&&n&&e.target===this.dom&&e.preventDefault(),s&&n&&!o&&e.target===this.dom)return e.preventDefault(),!1;if(s&&a&&!o&&f){let e=t.closest(`[data-drag-handle]`);e&&(this.dom===e||this.dom.contains(e))&&(this.isDragging=!0,document.addEventListener(`dragend`,()=>{this.isDragging=!1},{once:!0}),document.addEventListener(`drop`,()=>{this.isDragging=!1},{once:!0}),document.addEventListener(`mouseup`,()=>{this.isDragging=!1},{once:!0}))}return!(o||r||i||l||u||d||f&&c)}ignoreMutation(e){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation==`function`?this.options.ignoreMutation({mutation:e}):this.node.isLeaf||this.node.isAtom?!0:e.type===`selection`||this.dom.contains(e.target)&&e.type===`childList`&&(mW()||pW())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].every(e=>e.isContentEditable)?!1:this.contentDOM===e.target&&e.type===`attributes`?!0:!this.contentDOM.contains(e.target)}updateAttributes(e){this.editor.commands.command(({tr:t})=>{let n=this.getPos();return typeof n==`number`?(t.setNodeMarkup(n,void 0,{...this.node.attrs,...e}),!0):!1})}deleteNode(){let e=this.getPos();if(typeof e!=`number`)return;let t=e+this.node.nodeSize;this.editor.commands.deleteRange({from:e,to:t})}};function Sq(e){return new jK({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:i})=>{let a=lG(e.getAttributes,void 0,r,i);if(a===!1||a===null)return null;let{tr:o}=t,s=r[r.length-1],c=r[0],l=n.to;if(s){let i=c.search(/\S/),u=n.from+c.indexOf(s),d=u+s.length;if(NG(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>u).length)return null;d<n.to&&o.delete(d,n.to),u>n.from&&o.delete(n.from+i,u),l=n.from+i+s.length,o.addMark(n.from+i,l,e.type.create(a||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(e.type)}}})}var{getOwnPropertyNames:Cq,getOwnPropertySymbols:wq}=Object,{hasOwnProperty:Tq}=Object.prototype;function Eq(e,t){return function(n,r,i){return e(n,r,i)&&t(n,r,i)}}function Dq(e){return function(t,n,r){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r);let{cache:i}=r,a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);let s=e(t,n,r);return i.delete(t),i.delete(n),s}}function Oq(e){return e?.[Symbol.toStringTag]}function kq(e){return Cq(e).concat(wq(e))}var Aq=Object.hasOwn||((e,t)=>Tq.call(e,t));function jq(e,t){return e===t||!e&&!t&&e!==e&&t!==t}var Mq=`__v`,Nq=`__o`,Pq=`_owner`,{getOwnPropertyDescriptor:Fq,keys:Iq}=Object;function Lq(e,t){return e.byteLength===t.byteLength&&Xq(new Uint8Array(e),new Uint8Array(t))}function Rq(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function zq(e,t){return e.byteLength===t.byteLength&&Xq(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function Bq(e,t){return jq(e.getTime(),t.getTime())}function Vq(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function Hq(e,t){return e===t}function Uq(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.entries(),o,s,c=0;for(;(o=a.next())&&!o.done;){let r=t.entries(),a=!1,l=0;for(;(s=r.next())&&!s.done;){if(i[l]){l++;continue}let r=o.value,u=s.value;if(n.equals(r[0],u[0],c,l,e,t,n)&&n.equals(r[1],u[1],r[0],u[0],e,t,n)){a=i[l]=!0;break}l++}if(!a)return!1;c++}return!0}var Wq=jq;function Gq(e,t,n){let r=Iq(e),i=r.length;if(Iq(t).length!==i)return!1;for(;i-- >0;)if(!Qq(e,t,n,r[i]))return!1;return!0}function Kq(e,t,n){let r=kq(e),i=r.length;if(kq(t).length!==i)return!1;let a,o,s;for(;i-- >0;)if(a=r[i],!Qq(e,t,n,a)||(o=Fq(e,a),s=Fq(t,a),(o||s)&&(!o||!s||o.configurable!==s.configurable||o.enumerable!==s.enumerable||o.writable!==s.writable)))return!1;return!0}function qq(e,t){return jq(e.valueOf(),t.valueOf())}function Jq(e,t){return e.source===t.source&&e.flags===t.flags}function Yq(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.values(),o,s;for(;(o=a.next())&&!o.done;){let r=t.values(),a=!1,c=0;for(;(s=r.next())&&!s.done;){if(!i[c]&&n.equals(o.value,s.value,o.value,s.value,e,t,n)){a=i[c]=!0;break}c++}if(!a)return!1}return!0}function Xq(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function Zq(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function Qq(e,t,n,r){return(r===Pq||r===Nq||r===Mq)&&(e.$$typeof||t.$$typeof)?!0:Aq(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}var $q=`[object ArrayBuffer]`,eJ=`[object Arguments]`,tJ=`[object Boolean]`,nJ=`[object DataView]`,rJ=`[object Date]`,iJ=`[object Error]`,aJ=`[object Map]`,oJ=`[object Number]`,sJ=`[object Object]`,cJ=`[object RegExp]`,lJ=`[object Set]`,uJ=`[object String]`,dJ={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},fJ=`[object URL]`,pJ=Object.prototype.toString;function mJ({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:s,areObjectsEqual:c,arePrimitiveWrappersEqual:l,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:p,unknownTagComparators:m}){return function(h,g,_){if(h===g)return!0;if(h==null||g==null)return!1;let v=typeof h;if(v!==typeof g)return!1;if(v!==`object`)return v===`number`?s(h,g,_):v===`function`?a(h,g,_):!1;let y=h.constructor;if(y!==g.constructor)return!1;if(y===Object)return c(h,g,_);if(Array.isArray(h))return t(h,g,_);if(y===Date)return r(h,g,_);if(y===RegExp)return u(h,g,_);if(y===Map)return o(h,g,_);if(y===Set)return d(h,g,_);let b=pJ.call(h);if(b===rJ)return r(h,g,_);if(b===cJ)return u(h,g,_);if(b===aJ)return o(h,g,_);if(b===lJ)return d(h,g,_);if(b===sJ)return typeof h.then!=`function`&&typeof g.then!=`function`&&c(h,g,_);if(b===fJ)return p(h,g,_);if(b===iJ)return i(h,g,_);if(b===eJ)return c(h,g,_);if(dJ[b])return f(h,g,_);if(b===$q)return e(h,g,_);if(b===nJ)return n(h,g,_);if(b===tJ||b===oJ||b===uJ)return l(h,g,_);if(m){let e=m[b];if(!e){let t=Oq(h);t&&(e=m[t])}if(e)return e(h,g,_)}return!1}}function hJ({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:Lq,areArraysEqual:n?Kq:Rq,areDataViewsEqual:zq,areDatesEqual:Bq,areErrorsEqual:Vq,areFunctionsEqual:Hq,areMapsEqual:n?Eq(Uq,Kq):Uq,areNumbersEqual:Wq,areObjectsEqual:n?Kq:Gq,arePrimitiveWrappersEqual:qq,areRegExpsEqual:Jq,areSetsEqual:n?Eq(Yq,Kq):Yq,areTypedArraysEqual:n?Eq(Xq,Kq):Xq,areUrlsEqual:Zq,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){let e=Dq(r.areArraysEqual),t=Dq(r.areMapsEqual),n=Dq(r.areObjectsEqual),i=Dq(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:i})}return r}function gJ(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function _J({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(a,o){let{cache:s=e?new WeakMap:void 0,meta:c}=n();return t(a,o,{cache:s,equals:r,meta:c,strict:i})};if(e)return function(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};let a={cache:void 0,equals:r,meta:void 0,strict:i};return function(e,n){return t(e,n,a)}}var vJ=yJ();yJ({strict:!0}),yJ({circular:!0}),yJ({circular:!0,strict:!0}),yJ({createInternalComparator:()=>jq}),yJ({strict:!0,createInternalComparator:()=>jq}),yJ({circular:!0,createInternalComparator:()=>jq}),yJ({circular:!0,createInternalComparator:()=>jq,strict:!0});function yJ(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,a=mJ(hJ(e));return _J({circular:t,comparator:a,createState:r,equals:n?n(a):gJ(a),strict:i})}var bJ=o((e=>{var t=d(),n=ly();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),xJ=o(((e,t)=>{t.exports=bJ()}))(),SJ=(...e)=>t=>{e.forEach(e=>{typeof e==`function`?e(t):e&&(e.current=t)})},CJ=({contentComponent:e})=>{let t=(0,uy.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getServerSnapshot);return(0,H.jsx)(H.Fragment,{children:Object.values(t)})};function wJ(){let e=new Set,t={};return{subscribe(t){return e.add(t),()=>{e.delete(t)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(n,r){t={...t,[n]:N.createPortal(r.reactElement,r.element,n)},e.forEach(e=>e())},removeRenderer(n){let r={...t};delete r[n],t=r,e.forEach(e=>e())}}}var TJ=class extends v.Component{constructor(e){super(e),this.editorContentRef=v.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){let e=this.props.editor;if(e&&!e.isDestroyed&&e.view.dom?.parentNode){if(e.contentComponent)return;let t=this.editorContentRef.current;t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t}),e.contentComponent=wJ(),e.createNodeViews(),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){let e=this.props.editor;if(e){e.isEditorContentInitialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),e.contentComponent=null;try{if(!e.view.dom?.parentNode)return;let t=document.createElement(`div`);t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t})}catch{}}}render(){let{editor:e,innerRef:t,...n}=this.props;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{ref:SJ(t,this.editorContentRef),...n}),e?.contentComponent&&(0,H.jsx)(CJ,{contentComponent:e.contentComponent})]})}},EJ=(0,v.forwardRef)((e,t)=>{let n=v.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return v.createElement(TJ,{key:n,innerRef:t,...e})}),DJ=v.memo(EJ),OJ=typeof window<`u`?v.useLayoutEffect:v.useEffect,kJ=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){let e=()=>{this.transactionNumber+=1,this.subscribers.forEach(e=>e())},t=this.editor;return t.on(`transaction`,e),()=>{t.off(`transaction`,e)}}}};function AJ(e){let[t]=(0,v.useState)(()=>new kJ(e.editor)),n=(0,xJ.useSyncExternalStoreWithSelector)(t.subscribe,t.getSnapshot,t.getServerSnapshot,e.selector,e.equalityFn??vJ);return OJ(()=>t.watch(e.editor),[e.editor,t]),(0,v.useDebugValue)(n),n}var jJ=!1,MJ=typeof window>`u`,NJ=MJ||!!(typeof window<`u`&&window.next),PJ=class e{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId=``,this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(e=>e())}getInitialEditor(){if(this.options.current.immediatelyRender===void 0){if(MJ||NJ){if(jJ)throw Error("Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches.");return null}return this.createEditor()}if(this.options.current.immediatelyRender&&MJ&&jJ)throw Error("Tiptap Error: SSR has been detected, and `immediatelyRender` has been set to `true` this is an unsupported configuration that may result in errors, explicitly set `immediatelyRender` to `false` to avoid hydration mismatches.");return this.options.current.immediatelyRender?this.createEditor():null}createEditor(){return new $K({...this.options.current,onBeforeCreate:(...e)=>{var t;return(t=this.options.current).onBeforeCreate?.call(t,...e)},onBlur:(...e)=>{var t;return(t=this.options.current).onBlur?.call(t,...e)},onCreate:(...e)=>{var t;return(t=this.options.current).onCreate?.call(t,...e)},onDestroy:(...e)=>{var t;return(t=this.options.current).onDestroy?.call(t,...e)},onFocus:(...e)=>{var t;return(t=this.options.current).onFocus?.call(t,...e)},onSelectionUpdate:(...e)=>{var t;return(t=this.options.current).onSelectionUpdate?.call(t,...e)},onTransaction:(...e)=>{var t;return(t=this.options.current).onTransaction?.call(t,...e)},onUpdate:(...e)=>{var t;return(t=this.options.current).onUpdate?.call(t,...e)},onContentError:(...e)=>{var t;return(t=this.options.current).onContentError?.call(t,...e)},onDrop:(...e)=>{var t;return(t=this.options.current).onDrop?.call(t,...e)},onPaste:(...e)=>{var t;return(t=this.options.current).onPaste?.call(t,...e)},onDelete:(...e)=>{var t;return(t=this.options.current).onDelete?.call(t,...e)}})}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(n=>[`onCreate`,`onBeforeCreate`,`onDestroy`,`onUpdate`,`onTransaction`,`onFocus`,`onBlur`,`onSelectionUpdate`,`onContentError`,`onDrop`,`onPaste`].includes(n)?!0:n===`extensions`&&e.extensions&&t.extensions?e.extensions.length===t.extensions.length?e.extensions.every((e,n)=>e===t.extensions?.[n]):!1:e[n]===t[n])}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&t.length===0?e.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((t,n)=>t===e[n]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){let e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){t&&t.setOptions(this.options.current);return}t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function FJ(e={},t=[]){let n=(0,v.useRef)(e);n.current=e;let[r]=(0,v.useState)(()=>new PJ(n)),i=(0,uy.useSyncExternalStore)(r.subscribe,r.getEditor,r.getServerSnapshot);return(0,v.useDebugValue)(i),(0,v.useEffect)(r.onRender(t)),AJ({editor:i,selector:({transactionNumber:t})=>e.shouldRerenderOnTransaction===!1||e.shouldRerenderOnTransaction===void 0?null:e.immediatelyRender&&t===0?0:t+1}),i}var IJ=(0,v.createContext)({editor:null});IJ.Consumer;var LJ=(0,v.createContext)({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),RJ=()=>(0,v.useContext)(LJ),zJ=v.forwardRef((e,t)=>{let{onDragStart:n}=RJ();return(0,H.jsx)(e.as||`div`,{...e,ref:t,"data-node-view-wrapper":``,onDragStart:n,style:{whiteSpace:`normal`,...e.style}})});function BJ(e){return!!(typeof e==`function`&&e.prototype&&e.prototype.isReactComponent)}function VJ(e){return!!(typeof e==`object`&&e.$$typeof&&(e.$$typeof.toString()===`Symbol(react.forward_ref)`||e.$$typeof.description===`react.forward_ref`))}function HJ(e){return!!(typeof e==`object`&&e.$$typeof&&(e.$$typeof.toString()===`Symbol(react.memo)`||e.$$typeof.description===`react.memo`))}function UJ(e){if(BJ(e)||VJ(e))return!0;if(HJ(e)){let t=e.type;if(t)return BJ(t)||VJ(t)}return!1}function WJ(){try{if(v.version)return parseInt(v.version.split(`.`)[0],10)>=19}catch{}return!1}var GJ=class{constructor(e,{editor:t,props:n={},as:r=`div`,className:i=``}){this.ref=null,this.destroyed=!1,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=e,this.editor=t,this.props=n,this.element=document.createElement(r),this.element.classList.add(`react-renderer`),i&&this.element.classList.add(...i.split(` `)),this.editor.isEditorContentInitialized?(0,N.flushSync)(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var e;if(this.destroyed)return;let t=this.component,n=this.props,r=this.editor,i=WJ(),a=UJ(t),o={...n};o.ref&&!(i||a)&&delete o.ref,!o.ref&&(i||a)&&(o.ref=e=>{this.ref=e}),this.reactElement=(0,H.jsx)(t,{...o}),(e=r?.contentComponent)==null||e.setRenderer(this.id,this)}updateProps(e={}){this.destroyed||(this.props={...this.props,...e},this.render())}destroy(){var e;this.destroyed=!0,(e=this.editor?.contentComponent)==null||e.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(e){Object.keys(e).forEach(t=>{this.element.setAttribute(t,e[t])})}};v.createContext({markViewContentRef:()=>{}});var KJ=class extends xq{constructor(e,t,n){if(super(e,t,n),this.selectionRafId=null,this.positionCheckCallback=null,this.cachedExtensionWithSyncedStorage=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?`span`:`div`),this.contentDOMElement.dataset.nodeViewContentReact=``,this.contentDOMElement.dataset.nodeViewWrapper=``,this.contentDOMElement.style.whiteSpace=`inherit`;let e=this.dom.querySelector(`[data-node-view-content]`);if(!e)return;e.appendChild(this.contentDOMElement)}}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){let e=this.editor,t=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(t,{get(n,r,i){return r===`storage`?e.storage[t.name]??{}:Reflect.get(n,r,i)}})}return this.cachedExtensionWithSyncedStorage}mount(){let e={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(e={})=>this.updateAttributes(e),deleteNode:()=>this.deleteNode(),ref:(0,v.createRef)()};if(!this.component.displayName){let e=e=>e.charAt(0).toUpperCase()+e.substring(1);this.component.displayName=e(this.extension.name)}let t={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:e=>{e&&this.contentDOMElement&&e.firstChild!==this.contentDOMElement&&(e.hasAttribute(`data-node-view-wrapper`)&&e.removeAttribute(`data-node-view-wrapper`),e.appendChild(this.contentDOMElement))}},n=this.component,r=(0,v.memo)(e=>(0,H.jsx)(LJ.Provider,{value:t,children:(0,v.createElement)(n,e)}));r.displayName=`ReactNodeView`;let i=this.node.isInline?`span`:`div`;this.options.as&&(i=this.options.as);let{className:a=``}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new GJ(r,{editor:this.editor,props:e,as:i,className:`node-${this.node.type.name} ${a}`.trim()}),this.editor.on(`selectionUpdate`,this.handleSelectionUpdate),this.updateElementAttributes(),this.currentPos=this.getPos(),this.positionCheckCallback=()=>{let e=this.getPos();typeof e!=`number`||e===this.currentPos||(this.currentPos=e,this.renderer.updateProps({getPos:()=>this.getPos()}),typeof this.options.attrs==`function`&&this.updateElementAttributes())},_q(this.editor,this.positionCheckCallback)}get dom(){if(this.renderer.element.firstElementChild&&!this.renderer.element.firstElementChild?.hasAttribute(`data-node-view-wrapper`))throw Error(`Please use the NodeViewWrapper component for your node view.`);return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){this.selectionRafId&&=(cancelAnimationFrame(this.selectionRafId),null),this.selectionRafId=requestAnimationFrame(()=>{this.selectionRafId=null;let{from:e,to:t}=this.editor.state.selection,n=this.currentPos;if(typeof n==`number`)if(e<=n&&t>=n+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}})}update(e,t,n){let r=e=>{this.renderer.updateProps(e),typeof this.options.attrs==`function`&&this.updateElementAttributes()};if(e.type!==this.node.type)return!1;if(typeof this.options.update==`function`){let i=this.node,a=this.decorations,o=this.innerDecorations;return this.node=e,this.decorations=t,this.innerDecorations=n,this.currentPos=this.getPos(),this.options.update({oldNode:i,oldDecorations:a,newNode:e,newDecorations:t,oldInnerDecorations:o,innerDecorations:n,updateProps:()=>r({node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage})})}let i=this.getPos();return e===this.node&&this.decorations===t&&this.innerDecorations===n?i===this.currentPos?!0:(this.currentPos=i,r({node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage,getPos:()=>this.getPos()}),!0):(this.node=e,this.decorations=t,this.innerDecorations=n,this.currentPos=i,r({node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage}),!0)}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add(`ProseMirror-selectednode`)}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove(`ProseMirror-selectednode`)}destroy(){this.renderer.destroy(),this.editor.off(`selectionUpdate`,this.handleSelectionUpdate),this.positionCheckCallback&&=(vq(this.editor,this.positionCheckCallback),null),this.contentDOMElement=null,this.selectionRafId&&=(cancelAnimationFrame(this.selectionRafId),null)}updateElementAttributes(){if(this.options.attrs){let e={};if(typeof this.options.attrs==`function`){let t=this.editor.extensionManager.attributes,n=gG(this.node,t);e=this.options.attrs({node:this.node,HTMLAttributes:n})}else e=this.options.attrs;this.renderer.updateAttributes(e)}}};function qJ(e,t){return n=>n.editor.contentComponent?new KJ(e,n,t):{}}var JJ=(0,v.createContext)({get editor(){throw Error(`useTiptap must be used within a <Tiptap> provider`)}});JJ.displayName=`TiptapContext`;var YJ=()=>(0,v.useContext)(JJ);function XJ({editor:e,instance:t,children:n}){let r=e??t;if(!r)throw Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");let i=(0,v.useMemo)(()=>({editor:r}),[r]),a=(0,v.useMemo)(()=>({editor:r}),[r]);return(0,H.jsx)(IJ.Provider,{value:a,children:(0,H.jsx)(JJ.Provider,{value:i,children:n})})}XJ.displayName=`Tiptap`;function ZJ({...e}){let{editor:t}=YJ();return(0,H.jsx)(DJ,{editor:t,...e})}ZJ.displayName=`Tiptap.Content`,Object.assign(XJ,{Content:ZJ});var QJ=(e,t)=>{if(e===`slot`)return 0;if(e instanceof Function)return e(t);let{children:n,...r}=t??{};if(e===`svg`)throw Error(`SVG elements are not supported in the JSX syntax, use the array syntax instead`);return[e,r,n]},$J=/^\s*>\s$/,eY=bq.create({name:`blockquote`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,group:`block`,defining:!0,parseHTML(){return[{tag:`blockquote`}]},renderHTML({HTMLAttributes:e}){return QJ(`blockquote`,{...hG(this.options.HTMLAttributes,e),children:QJ(`slot`,{})})},parseMarkdown:(e,t)=>{let n=t.parseBlockChildren??t.parseChildren;return t.createNode(`blockquote`,void 0,n(e.tokens||[]))},renderMarkdown:(e,t)=>{if(!e.content)return``;let n=[];return e.content.forEach((e,r)=>{let i=(t.renderChild?.call(t,e,r)??t.renderChildren([e])).split(`
182
+ `).map(e=>e.trim()===``?`>`:`> ${e}`);n.push(i.join(`
183
+ `))}),n.join(`
184
+ >
185
+ `)},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[rq({find:$J,type:this.type})]}}),tY=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,nY=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,rY=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,iY=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,aY=kK.create({name:`bold`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`strong`},{tag:`b`,getAttrs:e=>e.style.fontWeight!==`normal`&&null},{style:`font-weight=400`,clearMark:e=>e.type.name===this.name},{style:`font-weight`,getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return QJ(`strong`,{...hG(this.options.HTMLAttributes,e),children:QJ(`slot`,{})})},markdownTokenName:`strong`,parseMarkdown:(e,t)=>t.applyMark(`bold`,t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:`<strong>`,close:`</strong>`}},renderMarkdown:(e,t)=>`**${t.renderChildren(e)}**`,addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[eq({find:tY,type:this.type}),eq({find:rY,type:this.type})]},addPasteRules(){return[Sq({find:nY,type:this.type}),Sq({find:iY,type:this.type})]}}),oY=/(^|[^`])`([^`]+)`(?!`)$/,sY=/(^|[^`])`([^`]+)`(?!`)/g,cY=kK.create({name:`code`,addOptions(){return{HTMLAttributes:{}}},excludes:`_`,code:!0,exitable:!0,parseHTML(){return[{tag:`code`}]},renderHTML({HTMLAttributes:e}){return[`code`,hG(this.options.HTMLAttributes,e),0]},markdownTokenName:`codespan`,parseMarkdown:(e,t)=>t.applyMark(`code`,[{type:`text`,text:e.text||``}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:``,addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[eq({find:oY,type:this.type})]},addPasteRules(){return[Sq({find:sY,type:this.type})]}}),lY=4,uY=/^```([a-z]+)?[\s\n]$/,dY=/^~~~([a-z]+)?[\s\n]$/,fY=bq.create({name:`codeBlock`,addOptions(){return{languageClassPrefix:`language-`,exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:lY,HTMLAttributes:{}}},content:`text*`,marks:``,group:`block`,code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{let{languageClassPrefix:t}=this.options;return t&&[...e.firstElementChild?.classList||[]].filter(e=>e.startsWith(t)).map(e=>e.replace(t,``))[0]||null},rendered:!1}}},parseHTML(){return[{tag:`pre`,preserveWhitespace:`full`}]},renderHTML({node:e,HTMLAttributes:t}){return[`pre`,hG(this.options.HTMLAttributes,t),[`code`,{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:`code`,parseMarkdown:(e,t)=>e.raw?.startsWith("```")===!1&&e.raw?.startsWith(`~~~`)===!1&&e.codeBlockStyle!==`indented`?[]:t.createNode(`codeBlock`,{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[]),renderMarkdown:(e,t)=>{let n=``,r=e.attrs?.language||``;return n=e.content?[`\`\`\`${r}`,t.renderChildren(e.content),"```"].join(`
186
+ `):`\`\`\`${r}
187
+
188
+ \`\`\``,n},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,`paragraph`,e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:e,$anchor:t}=this.editor.state.selection,n=t.pos===1;return!e||t.parent.type.name!==this.name?!1:n||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??lY,{state:n}=e,{selection:r}=n,{$from:i,empty:a}=r;if(i.parent.type!==this.type)return!1;let o=` `.repeat(t);return a?e.commands.insertContent(o):e.commands.command(({tr:e})=>{let{from:t,to:i}=r,a=n.doc.textBetween(t,i,`
189
+ `,`
190
+ `).split(`
191
+ `).map(e=>o+e).join(`
192
+ `);return e.replaceWith(t,i,n.schema.text(a)),!0})},"Shift-Tab":({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??lY,{state:n}=e,{selection:r}=n,{$from:i,empty:a}=r;return i.parent.type===this.type?a?e.commands.command(({tr:e})=>{let{pos:r}=i,a=i.start(),o=i.end(),s=n.doc.textBetween(a,o,`
193
+ `,`
194
+ `).split(`
195
+ `),c=0,l=0,u=r-a;for(let e=0;e<s.length;e+=1){if(l+s[e].length>=u){c=e;break}l+=s[e].length+1}let d=s[c].match(/^ */)?.[0]||``,f=Math.min(d.length,t);if(f===0)return!0;let p=a;for(let e=0;e<c;e+=1)p+=s[e].length+1;return e.delete(p,p+f),r-p<=f&&e.setSelection(UL.create(e.doc,p)),!0}):e.commands.command(({tr:e})=>{let{from:i,to:a}=r,o=n.doc.textBetween(i,a,`
196
+ `,`
197
+ `).split(`
198
+ `).map(e=>{let n=e.match(/^ */)?.[0]||``,r=Math.min(n.length,t);return e.slice(r)}).join(`
199
+ `);return e.replaceWith(i,a,n.schema.text(o)),!0}):!1},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;let{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;let a=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
200
+
201
+ `);return!a||!o?!1:e.chain().command(({tr:e})=>(e.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;let{state:t}=e,{selection:n,doc:r}=t,{$from:i,empty:a}=n;if(!a||i.parent.type!==this.type||i.parentOffset!==i.parent.nodeSize-2)return!1;let o=i.after();return o===void 0?!1:r.nodeAt(o)?e.commands.command(({tr:e})=>(e.setSelection(zL.near(r.resolve(o))),!0)):e.commands.exitCode()}}},addInputRules(){return[nq({find:uY,type:this.type,getAttributes:e=>({language:e[1]})}),nq({find:dY,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new sR({key:new uR(`codeBlockVSCodeHandler`),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;let n=t.clipboardData.getData(`text/plain`),r=t.clipboardData.getData(`vscode-editor-data`),i=(r?JSON.parse(r):void 0)?.mode;if(!n||!i)return!1;let{tr:a,schema:o}=e.state,s=o.text(n.replace(/\r\n?/g,`
202
+ `));return a.replaceSelectionWith(this.type.create({language:i},s)),a.selection.$from.parent.type!==this.type&&a.setSelection(UL.near(a.doc.resolve(Math.max(0,a.selection.from-2)))),a.setMeta(`paste`,!0),e.dispatch(a),!0}}})]}}),pY=bq.create({name:`doc`,topNode:!0,content:`block+`,renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
203
+
204
+ `):``}),mY=bq.create({name:`hardBreak`,markdownTokenName:`br`,addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:`inline`,selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:`br`}]},renderHTML({HTMLAttributes:e}){return[`br`,hG(this.options.HTMLAttributes,e)]},renderText(){return`
205
+ `},renderMarkdown:()=>`
206
+ `,parseMarkdown:()=>({type:`hardBreak`}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{let{selection:e,storedMarks:i}=n;if(e.$from.parent.type.spec.isolating)return!1;let{keepMarks:a}=this.options,{splittableMarks:o}=r.extensionManager,s=i||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{if(t&&s&&a){let t=s.filter(e=>o.includes(e.type.name));e.ensureMarks(t)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),hY=bq.create({name:`heading`,addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:`inline*`,group:`block`,defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,hG(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode(`heading`,{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{let n=e.attrs?.level?parseInt(e.attrs.level,10):1,r=`#`.repeat(n);return e.content?`${r} ${t.renderChildren(e.content)}`:``},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,`paragraph`,e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>nq({find:RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),gY=bq.create({name:`horizontalRule`,addOptions(){return{HTMLAttributes:{},nextNodeType:`paragraph`}},group:`block`,parseHTML(){return[{tag:`hr`}]},renderHTML({HTMLAttributes:e}){return[`hr`,hG(this.options.HTMLAttributes,e)]},markdownTokenName:`hr`,parseMarkdown:(e,t)=>t.createNode(`horizontalRule`),renderMarkdown:()=>`---`,addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!oq(t,t.schema.nodes[this.name]))return!1;let{selection:n}=t,{$to:r}=n,i=e();return GG(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:e,tr:t,dispatch:n})=>{if(n){let{$to:n}=t.selection,r=n.end();if(n.nodeAfter)n.nodeAfter.isTextblock?t.setSelection(UL.create(t.doc,n.pos+1)):n.nodeAfter.isBlock?t.setSelection(GL.create(t.doc,n.pos)):t.setSelection(UL.create(t.doc,n.pos));else{let i=(e.schema.nodes[this.options.nextNodeType]||n.parent.type.contentMatch.defaultType)?.create();i&&(t.insert(r,i),t.setSelection(UL.create(t.doc,r+1)))}t.scrollIntoView()}return!0}).run()}}},addInputRules(){return[tq({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),_Y=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,vY=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,yY=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,bY=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,xY=kK.create({name:`italic`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`em`},{tag:`i`,getAttrs:e=>e.style.fontStyle!==`normal`&&null},{style:`font-style=normal`,clearMark:e=>e.type.name===this.name},{style:`font-style=italic`}]},renderHTML({HTMLAttributes:e}){return[`em`,hG(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:`em`,parseMarkdown:(e,t)=>t.applyMark(`italic`,t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:`<em>`,close:`</em>`}},renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[eq({find:_Y,type:this.type}),eq({find:yY,type:this.type})]},addPasteRules(){return[Sq({find:vY,type:this.type}),Sq({find:bY,type:this.type})]}}),SY=`aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2`,CY=`ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2`,wY=`numeric`,TY=`ascii`,EY=`alpha`,DY=`asciinumeric`,OY=`alphanumeric`,kY=`domain`,AY=`emoji`,jY=`scheme`,MY=`slashscheme`,NY=`whitespace`;function PY(e,t){return e in t||(t[e]=[]),t[e]}function FY(e,t,n){t[wY]&&(t[DY]=!0,t[OY]=!0),t[TY]&&(t[DY]=!0,t[EY]=!0),t[DY]&&(t[OY]=!0),t[EY]&&(t[OY]=!0),t[OY]&&(t[kY]=!0),t[AY]&&(t[kY]=!0);for(let r in t){let t=PY(r,n);t.indexOf(e)<0&&t.push(e)}}function IY(e,t){let n={};for(let r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}function LY(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}LY.groups={},LY.prototype={accepts(){return!!this.t},go(e){let t=this,n=t.j[e];if(n)return n;for(let n=0;n<t.jr.length;n++){let r=t.jr[n][0],i=t.jr[n][1];if(i&&r.test(e))return i}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let i=0;i<e.length;i++)this.tt(e[i],t,n,r)},tr(e,t,n,r){r||=LY.groups;let i;return t&&t.j?i=t:(i=new LY(t),n&&r&&FY(t,n,r)),this.jr.push([e,i]),i},ts(e,t,n,r){let i=this,a=e.length;if(!a)return i;for(let t=0;t<a-1;t++)i=i.tt(e[t]);return i.tt(e[a-1],t,n,r)},tt(e,t,n,r){r||=LY.groups;let i=this;if(t&&t.j)return i.j[e]=t,t;let a=t,o,s=i.go(e);return s?(o=new LY,Object.assign(o.j,s.j),o.jr.push.apply(o.jr,s.jr),o.jd=s.jd,o.t=s.t):o=new LY,a&&(r&&(o.t&&typeof o.t==`string`?FY(a,Object.assign(IY(o.t,r),n),r):n&&FY(a,n,r)),o.t=a),i.j[e]=o,o}};var RY=(e,t,n,r,i)=>e.ta(t,n,r,i),zY=(e,t,n,r,i)=>e.tr(t,n,r,i),BY=(e,t,n,r,i)=>e.ts(t,n,r,i),$=(e,t,n,r,i)=>e.tt(t,n,r,i),VY=`WORD`,HY=`UWORD`,UY=`ASCIINUMERICAL`,WY=`ALPHANUMERICAL`,GY=`LOCALHOST`,KY=`TLD`,qY=`UTLD`,JY=`SCHEME`,YY=`SLASH_SCHEME`,XY=`NUM`,ZY=`WS`,QY=`NL`,$Y=`OPENBRACE`,eX=`CLOSEBRACE`,tX=`OPENBRACKET`,nX=`CLOSEBRACKET`,rX=`OPENPAREN`,iX=`CLOSEPAREN`,aX=`OPENANGLEBRACKET`,oX=`CLOSEANGLEBRACKET`,sX=`FULLWIDTHLEFTPAREN`,cX=`FULLWIDTHRIGHTPAREN`,lX=`LEFTCORNERBRACKET`,uX=`RIGHTCORNERBRACKET`,dX=`LEFTWHITECORNERBRACKET`,fX=`RIGHTWHITECORNERBRACKET`,pX=`FULLWIDTHLESSTHAN`,mX=`FULLWIDTHGREATERTHAN`,hX=`AMPERSAND`,gX=`APOSTROPHE`,_X=`ASTERISK`,vX=`AT`,yX=`BACKSLASH`,bX=`BACKTICK`,xX=`CARET`,SX=`COLON`,CX=`COMMA`,wX=`DOLLAR`,TX=`DOT`,EX=`EQUALS`,DX=`EXCLAMATION`,OX=`HYPHEN`,kX=`PERCENT`,AX=`PIPE`,jX=`PLUS`,MX=`POUND`,NX=`QUERY`,PX=`QUOTE`,FX=`FULLWIDTHMIDDLEDOT`,IX=`SEMI`,LX=`SLASH`,RX=`TILDE`,zX=`UNDERSCORE`,BX=`EMOJI`,VX=`SYM`,HX=Object.freeze({__proto__:null,ALPHANUMERICAL:WY,AMPERSAND:hX,APOSTROPHE:gX,ASCIINUMERICAL:UY,ASTERISK:_X,AT:vX,BACKSLASH:yX,BACKTICK:bX,CARET:xX,CLOSEANGLEBRACKET:oX,CLOSEBRACE:eX,CLOSEBRACKET:nX,CLOSEPAREN:iX,COLON:SX,COMMA:CX,DOLLAR:wX,DOT:TX,EMOJI:BX,EQUALS:EX,EXCLAMATION:DX,FULLWIDTHGREATERTHAN:mX,FULLWIDTHLEFTPAREN:sX,FULLWIDTHLESSTHAN:pX,FULLWIDTHMIDDLEDOT:FX,FULLWIDTHRIGHTPAREN:cX,HYPHEN:OX,LEFTCORNERBRACKET:lX,LEFTWHITECORNERBRACKET:dX,LOCALHOST:GY,NL:QY,NUM:XY,OPENANGLEBRACKET:aX,OPENBRACE:$Y,OPENBRACKET:tX,OPENPAREN:rX,PERCENT:kX,PIPE:AX,PLUS:jX,POUND:MX,QUERY:NX,QUOTE:PX,RIGHTCORNERBRACKET:uX,RIGHTWHITECORNERBRACKET:fX,SCHEME:JY,SEMI:IX,SLASH:LX,SLASH_SCHEME:YY,SYM:VX,TILDE:RX,TLD:KY,UNDERSCORE:zX,UTLD:qY,UWORD:HY,WORD:VY,WS:ZY}),UX=/[a-z]/,WX=/\p{L}/u,GX=/\p{Emoji}/u,KX=/\d/,qX=/\s/,JX=`\r`,YX=`
207
+ `,XX=`️`,ZX=`‍`,QX=``,$X=null,eZ=null;function tZ(e=[]){let t={};LY.groups=t;let n=new LY;$X??=aZ(SY),eZ??=aZ(CY),$(n,`'`,gX),$(n,`{`,$Y),$(n,`}`,eX),$(n,`[`,tX),$(n,`]`,nX),$(n,`(`,rX),$(n,`)`,iX),$(n,`<`,aX),$(n,`>`,oX),$(n,`(`,sX),$(n,`)`,cX),$(n,`「`,lX),$(n,`」`,uX),$(n,`『`,dX),$(n,`』`,fX),$(n,`<`,pX),$(n,`>`,mX),$(n,`&`,hX),$(n,`*`,_X),$(n,`@`,vX),$(n,"`",bX),$(n,`^`,xX),$(n,`:`,SX),$(n,`,`,CX),$(n,`$`,wX),$(n,`.`,TX),$(n,`=`,EX),$(n,`!`,DX),$(n,`-`,OX),$(n,`%`,kX),$(n,`|`,AX),$(n,`+`,jX),$(n,`#`,MX),$(n,`?`,NX),$(n,`"`,PX),$(n,`/`,LX),$(n,`;`,IX),$(n,`~`,RX),$(n,`_`,zX),$(n,`\\`,yX),$(n,`・`,FX);let r=zY(n,KX,XY,{[wY]:!0});zY(r,KX,r);let i=zY(r,UX,UY,{[DY]:!0}),a=zY(r,WX,WY,{[OY]:!0}),o=zY(n,UX,VY,{[TY]:!0});zY(o,KX,i),zY(o,UX,o),zY(i,KX,i),zY(i,UX,i);let s=zY(n,WX,HY,{[EY]:!0});zY(s,UX),zY(s,KX,a),zY(s,WX,s),zY(a,KX,a),zY(a,UX),zY(a,WX,a);let c=$(n,YX,QY,{[NY]:!0}),l=$(n,JX,ZY,{[NY]:!0}),u=zY(n,qX,ZY,{[NY]:!0});$(n,QX,u),$(l,YX,c),$(l,QX,u),zY(l,qX,u),$(u,JX),$(u,YX),zY(u,qX,u),$(u,QX,u);let d=zY(n,GX,BX,{[AY]:!0});$(d,`#`),zY(d,GX,d),$(d,XX,d);let f=$(d,ZX);$(f,`#`),zY(f,GX,d);let p=[[UX,o],[KX,i]],m=[[UX,null],[WX,s],[KX,a]];for(let e=0;e<$X.length;e++)iZ(n,$X[e],KY,VY,p);for(let e=0;e<eZ.length;e++)iZ(n,eZ[e],qY,HY,m);FY(KY,{tld:!0,ascii:!0},t),FY(qY,{utld:!0,alpha:!0},t),iZ(n,`file`,JY,VY,p),iZ(n,`mailto`,JY,VY,p),iZ(n,`http`,YY,VY,p),iZ(n,`https`,YY,VY,p),iZ(n,`ftp`,YY,VY,p),iZ(n,`ftps`,YY,VY,p),FY(JY,{scheme:!0,ascii:!0},t),FY(YY,{slashscheme:!0,ascii:!0},t),e=e.sort((e,t)=>e[0]>t[0]?1:-1);for(let t=0;t<e.length;t++){let r=e[t][0],i=e[t][1]?{[jY]:!0}:{[MY]:!0};r.indexOf(`-`)>=0?i[kY]=!0:UX.test(r)?KX.test(r)?i[DY]=!0:i[TY]=!0:i[wY]=!0,BY(n,r,r,i)}return BY(n,`localhost`,GY,{ascii:!0}),n.jd=new LY(VX),{start:n,tokens:Object.assign({groups:t},HX)}}function nZ(e,t){let n=rZ(t.replace(/[A-Z]/g,e=>e.toLowerCase())),r=n.length,i=[],a=0,o=0;for(;o<r;){let s=e,c=null,l=0,u=null,d=-1,f=-1;for(;o<r&&(c=s.go(n[o]));)s=c,s.accepts()?(d=0,f=0,u=s):d>=0&&(d+=n[o].length,f++),l+=n[o].length,a+=n[o].length,o++;a-=d,o-=f,l-=d,i.push({t:u.t,v:t.slice(a-l,a),s:a-l,e:a})}return i}function rZ(e){let t=[],n=e.length,r=0;for(;r<n;){let i=e.charCodeAt(r),a,o=i<55296||i>56319||r+1===n||(a=e.charCodeAt(r+1))<56320||a>57343?e[r]:e.slice(r,r+2);t.push(o),r+=o.length}return t}function iZ(e,t,n,r,i){let a,o=t.length;for(let n=0;n<o-1;n++){let o=t[n];e.j[o]?a=e.j[o]:(a=new LY(r),a.jr=i.slice(),e.j[o]=a),e=a}return a=new LY(n),a.jr=i.slice(),e.j[t[o-1]]=a,a}function aZ(e){let t=[],n=[],r=0;for(;r<e.length;){let i=0;for(;`0123456789`.indexOf(e[r+i])>=0;)i++;if(i>0){t.push(n.join(``));for(let t=parseInt(e.substring(r,r+i),10);t>0;t--)n.pop();r+=i}else n.push(e[r]),r++}return t}var oZ={defaultProtocol:`http`,events:null,format:cZ,formatHref:cZ,nl2br:!1,tagName:`a`,target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function sZ(e,t=null){let n=Object.assign({},oZ);e&&(n=Object.assign(n,e instanceof sZ?e.o:e));let r=n.ignoreTags,i=[];for(let e=0;e<r.length;e++)i.push(r[e].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=i}sZ.prototype={o:oZ,ignoreTags:[],defaultRender(e){return e},check(e){return this.get(`validate`,e.toString(),e)},get(e,t,n){let r=t!=null,i=this.o[e];return i&&(typeof i==`object`?(i=n.t in i?i[n.t]:oZ[e],typeof i==`function`&&r&&(i=i(t,n))):typeof i==`function`&&r&&(i=i(t,n.t,n)),i)},getObj(e,t,n){let r=this.o[e];return typeof r==`function`&&t!=null&&(r=r(t,n.t,n)),r},render(e){let t=e.render(this);return(this.get(`render`,null,e)||this.defaultRender)(t,e.t,e)}};function cZ(e){return e}function lZ(e,t){this.t=`token`,this.v=e,this.tk=t}lZ.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){let t=this.toString(),n=e.get(`truncate`,t,this),r=e.get(`format`,t,this);return n&&r.length>n?r.substring(0,n)+`…`:r},toFormattedHref(e){return e.get(`formatHref`,this.toHref(e.get(`defaultProtocol`)),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=oZ.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get(`validate`,this.toString(),this)},render(e){let t=this,n=this.toHref(e.get(`defaultProtocol`)),r=e.get(`formatHref`,n,this),i=e.get(`tagName`,n,t),a=this.toFormattedString(e),o={},s=e.get(`className`,n,t),c=e.get(`target`,n,t),l=e.get(`rel`,n,t),u=e.getObj(`attributes`,n,t),d=e.getObj(`events`,n,t);return o.href=r,s&&(o.class=s),c&&(o.target=c),l&&(o.rel=l),u&&Object.assign(o,u),{tagName:i,attributes:o,content:a,eventListeners:d}}};function uZ(e,t){class n extends lZ{constructor(t,n){super(t,n),this.t=e}}for(let e in t)n.prototype[e]=t[e];return n.t=e,n}var dZ=uZ(`email`,{isLink:!0,toHref(){return`mailto:`+this.toString()}}),fZ=uZ(`text`),pZ=uZ(`nl`),mZ=uZ(`url`,{isLink:!0,toHref(e=oZ.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){let e=this.tk;return e.length>=2&&e[0].t!==GY&&e[1].t===SX}}),hZ=e=>new LY(e);function gZ({groups:e}){let t=e.domain.concat([hX,_X,vX,yX,bX,xX,wX,EX,OX,XY,kX,AX,jX,MX,LX,VX,RX,zX]),n=[gX,SX,CX,TX,DX,kX,NX,PX,IX,aX,oX,$Y,eX,nX,tX,rX,iX,sX,cX,lX,uX,dX,fX,pX,mX],r=[hX,gX,_X,yX,bX,xX,wX,EX,OX,$Y,eX,kX,AX,jX,MX,NX,LX,VX,RX,zX],i=hZ(),a=$(i,RX);RY(a,r,a),RY(a,e.domain,a);let o=hZ(),s=hZ(),c=hZ();RY(i,e.domain,o),RY(i,e.scheme,s),RY(i,e.slashscheme,c),RY(o,r,a),RY(o,e.domain,o);let l=$(o,vX);$(a,vX,l),$(s,vX,l),$(c,vX,l);let u=$(a,TX);RY(u,r,a),RY(u,e.domain,a);let d=hZ();RY(l,e.domain,d),RY(d,e.domain,d);let f=$(d,TX);RY(f,e.domain,d);let p=hZ(dZ);RY(f,e.tld,p),RY(f,e.utld,p),$(l,GY,p);let m=$(d,OX);$(m,OX,m),RY(m,e.domain,d),RY(p,e.domain,d),$(p,TX,f),$(p,OX,m),RY($(p,SX),e.numeric,dZ);let h=$(o,OX),g=$(o,TX);$(h,OX,h),RY(h,e.domain,o),RY(g,r,a),RY(g,e.domain,o);let _=hZ(mZ);RY(g,e.tld,_),RY(g,e.utld,_),RY(_,e.domain,o),RY(_,r,a),$(_,TX,g),$(_,OX,h),$(_,vX,l);let v=$(_,SX),y=hZ(mZ);RY(v,e.numeric,y);let b=hZ(mZ),x=hZ();RY(b,t,b),RY(b,n,x),RY(x,t,b),RY(x,n,x),$(_,LX,b),$(y,LX,b);let S=$(s,SX),C=$($($(c,SX),LX),LX);RY(s,e.domain,o),$(s,TX,g),$(s,OX,h),RY(c,e.domain,o),$(c,TX,g),$(c,OX,h),RY(S,e.domain,b),$(S,LX,b),$(S,NX,b),RY(C,e.domain,b),RY(C,t,b),$(C,LX,b);let w=[[$Y,eX],[tX,nX],[rX,iX],[aX,oX],[sX,cX],[lX,uX],[dX,fX],[pX,mX]];for(let e=0;e<w.length;e++){let[r,i]=w[e],a=$(b,r);$(x,r,a),$(a,i,b);let o=hZ(mZ);RY(a,t,o);let s=hZ();RY(a,n),RY(o,t,o),RY(o,n,s),RY(s,t,o),RY(s,n,s),$(o,i,b),$(s,i,b)}return $(i,GY,_),$(i,QY,pZ),{start:i,tokens:HX}}function _Z(e,t,n){let r=n.length,i=0,a=[],o=[];for(;i<r;){let s=e,c=null,l=null,u=0,d=null,f=-1;for(;i<r&&!(c=s.go(n[i].t));)o.push(n[i++]);for(;i<r&&(l=c||s.go(n[i].t));)c=null,s=l,s.accepts()?(f=0,d=s):f>=0&&f++,i++,u++;if(f<0)i-=u,i<r&&(o.push(n[i]),i++);else{o.length>0&&(a.push(vZ(fZ,t,o)),o=[]),i-=f,u-=f;let e=d.t,r=n.slice(i-u,i);a.push(vZ(e,t,r))}}return o.length>0&&a.push(vZ(fZ,t,o)),a}function vZ(e,t,n){let r=n[0].s,i=n[n.length-1].e;return new e(t.slice(r,i),n)}var yZ=typeof console<`u`&&console&&console.warn||(()=>{}),bZ=`until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`,xZ={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function SZ(){return LY.groups={},xZ.scanner=null,xZ.parser=null,xZ.tokenQueue=[],xZ.pluginQueue=[],xZ.customSchemes=[],xZ.initialized=!1,xZ}function CZ(e,t=!1){if(xZ.initialized&&yZ(`linkifyjs: already initialized - will not register custom scheme "${e}" ${bZ}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw Error(`linkifyjs: incorrect scheme format.
208
+ 1. Must only contain digits, lowercase ASCII letters or "-"
209
+ 2. Cannot start or end with "-"
210
+ 3. "-" cannot repeat`);xZ.customSchemes.push([e,t])}function wZ(){xZ.scanner=tZ(xZ.customSchemes);for(let e=0;e<xZ.tokenQueue.length;e++)xZ.tokenQueue[e][1]({scanner:xZ.scanner});xZ.parser=gZ(xZ.scanner.tokens);for(let e=0;e<xZ.pluginQueue.length;e++)xZ.pluginQueue[e][1]({scanner:xZ.scanner,parser:xZ.parser});return xZ.initialized=!0,xZ}function TZ(e){return xZ.initialized||wZ(),_Z(xZ.parser.start,e,nZ(xZ.scanner.start,e))}TZ.scan=nZ;function EZ(e,t=null,n=null){if(t&&typeof t==`object`){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}let r=new sZ(n),i=TZ(e),a=[];for(let e=0;e<i.length;e++){let n=i[e];n.isLink&&(!t||n.t===t)&&r.check(n)&&a.push(n.toFormattedObject(r))}return a}var DZ=`[\0- \xA0 ᠎ -\u2029  ]`,OZ=new RegExp(DZ),kZ=RegExp(`${DZ}$`),AZ=new RegExp(DZ,`g`);function jZ(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?[`()`,`[]`].includes(e[0].value+e[2].value):!1}function MZ(e){return new sR({key:new uR(`autolink`),appendTransaction:(t,n,r)=>{let i=t.some(e=>e.docChanged)&&!n.doc.eq(r.doc),a=t.some(e=>e.getMeta(`preventAutolink`));if(!i||a)return;let{tr:o}=r;if(MG(eG(n.doc,[...t])).forEach(({newRange:t})=>{let n=nG(r.doc,t,e=>e.isTextblock),i,a;if(n.length>1)i=n[0],a=r.doc.textBetween(i.pos,i.pos+i.node.nodeSize,void 0,` `);else if(n.length){let e=r.doc.textBetween(t.from,t.to,` `,` `);if(!kZ.test(e))return;i=n[0],a=r.doc.textBetween(i.pos,t.to,void 0,` `)}if(i&&a){let t=a.split(OZ).filter(Boolean);if(t.length<=0)return!1;let n=t[t.length-1],s=i.pos+a.lastIndexOf(n);if(!n)return!1;let c=TZ(n).map(t=>t.toObject(e.defaultProtocol));if(!jZ(c))return!1;c.filter(e=>e.isLink).map(e=>({...e,from:s+e.start+1,to:s+e.end+1})).filter(e=>r.schema.marks.code?!r.doc.rangeHasMark(e.from,e.to,r.schema.marks.code):!0).filter(t=>e.validate(t.value)).filter(t=>e.shouldAutoLink(t.value)).forEach(t=>{NG(t.from,t.to,r.doc).some(t=>t.mark.type===e.type)||o.addMark(t.from,t.to,e.type.create({href:t.href}))})}}),o.steps.length)return o}})}function NZ(e){return new sR({key:new uR(`handleClickLink`),props:{handleClick:(t,n,r)=>{if(r.button!==0||!t.editable)return!1;let i=null;if(r.target instanceof HTMLAnchorElement)i=r.target;else{let t=r.target;if(!t)return!1;let n=e.editor.view.dom;i=t.closest(`a`),i&&!n.contains(i)&&(i=null)}if(!i)return!1;let a=!1;if(e.enableClickSelection&&(a=e.editor.commands.extendMarkRange(e.type.name)),e.openOnClick){let n=kG(t.state,e.type.name),r=i.href??n.href,o=i.target??n.target;r&&(window.open(r,o),a=!0)}return a}}})}function PZ(e){return new sR({key:new uR(`handlePasteLink`),props:{handlePaste:(t,n,r)=>{let{shouldAutoLink:i}=e,{state:a}=t,{selection:o}=a,{empty:s}=o;if(s)return!1;let c=``;r.content.forEach(e=>{c+=e.textContent});let l=EZ(c,{defaultProtocol:e.defaultProtocol}).find(e=>e.isLink&&e.value===c);return!c||!l||i!==void 0&&!i(l.value)?!1:e.editor.commands.setMark(e.type,{href:l.href})}}})}function FZ(e,t){let n=[`http`,`https`,`ftp`,`ftps`,`mailto`,`tel`,`callto`,`sms`,`cid`,`xmpp`];return t&&t.forEach(e=>{let t=typeof e==`string`?e:e.scheme;t&&n.push(t)}),!e||e.replace(AZ,``).match(RegExp(`^(?:(?:${n.join(`|`)}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,`i`))}var IZ=kK.create({name:`link`,priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{if(typeof e==`string`){CZ(e);return}CZ(e.scheme,e.optionalSlashes)})},onDestroy(){SZ()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer nofollow`,class:null},isAllowedUri:(e,t)=>!!FZ(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{let t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes(`@`))return!0;let r=(e.includes(`@`)?e.split(`@`).pop():e).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){return{href:{default:null,parseHTML(e){return e.getAttribute(`href`)}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:`a[href]`,getAttrs:e=>{let t=e.getAttribute(`href`);return!t||!this.options.isAllowedUri(t,{defaultValidate:e=>!!FZ(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!FZ(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?[`a`,hG(this.options.HTMLAttributes,e),0]:[`a`,hG(this.options.HTMLAttributes,{...e,href:``}),0]},markdownTokenName:`link`,parseMarkdown:(e,t)=>t.applyMark(`link`,t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{let n=e.attrs?.href??``,r=e.attrs?.title??``,i=t.renderChildren(e);return r?`[${i}](${n} "${r}")`:`[${i}](${n})`},addCommands(){return{setLink:e=>({chain:t})=>{let{href:n}=e;return this.options.isAllowedUri(n,{defaultValidate:e=>!!FZ(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta(`preventAutolink`,!0).run():!1},toggleLink:e=>({chain:t})=>{let{href:n}=e||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:e=>!!FZ(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()}},addPasteRules(){return[Sq({find:e=>{let t=[];if(e){let{protocols:n,defaultProtocol:r}=this.options,i=EZ(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!FZ(e,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(e=>{this.options.shouldAutoLink(e.value)&&t.push({text:e.value,data:{href:e.href},index:e.start})})}return t},type:this.type,getAttributes:e=>({href:e.data?.href})})]},addProseMirrorPlugins(){let e=[],{protocols:t,defaultProtocol:n}=this.options;return this.options.autolink&&e.push(MZ({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!FZ(e,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),e.push(NZ({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick===`whenNotEditable`?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(PZ({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}}),LZ=Object.defineProperty,RZ=(e,t)=>{for(var n in t)LZ(e,n,{get:t[n],enumerable:!0})},zZ=`listItem`,BZ=`textStyle`,VZ=/^\s*([-+*])\s$/,HZ=bq.create({name:`bulletList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul`}]},renderHTML({HTMLAttributes:e}){return[`ul`,hG(this.options.HTMLAttributes,e),0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>e.type!==`list`||e.ordered?[]:{type:`bulletList`,content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
211
+ `):``,markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(zZ,this.editor.getAttributes(BZ)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=rq({find:VZ,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=rq({find:VZ,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(BZ),editor:this.editor})),[e]}}),UZ=bq.create({name:`listItem`,addOptions(){return{HTMLAttributes:{},bulletListTypeName:`bulletList`,orderedListTypeName:`orderedList`}},content:`paragraph block*`,defining:!0,parseHTML(){return[{tag:`li`}]},renderHTML({HTMLAttributes:e}){return[`li`,hG(this.options.HTMLAttributes,e),0]},markdownTokenName:`list_item`,parseMarkdown:(e,t)=>{if(e.type!==`list_item`)return[];let n=t.parseBlockChildren??t.parseChildren,r=[];if(e.tokens&&e.tokens.length>0)if(e.tokens.some(e=>e.type===`paragraph`))r=n(e.tokens);else{let i=e.tokens[0];if(i&&i.type===`text`&&i.tokens&&i.tokens.length>0){if(r=[{type:`paragraph`,content:t.parseInline(i.tokens)}],e.tokens.length>1){let t=n(e.tokens.slice(1));r.push(...t)}}else r=n(e.tokens)}return r.length===0&&(r=[{type:`paragraph`,content:[]}]),{type:`listItem`,content:r}},renderMarkdown:(e,t,n)=>hq(e,t,e=>e.parentType===`bulletList`?`- `:e.parentType===`orderedList`?`${(e.meta?.parentAttrs?.start||1)+e.index}. `:`- `,n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});RZ({},{findListItemPos:()=>WZ,getNextListDepth:()=>GZ,handleBackspace:()=>YZ,handleDelete:()=>QZ,hasListBefore:()=>KZ,hasListItemAfter:()=>$Z,hasListItemBefore:()=>qZ,listItemHasSubList:()=>JZ,nextListIsDeeper:()=>XZ,nextListIsHigher:()=>ZZ});var WZ=(e,t)=>{let{$from:n}=t.selection,r=XU(e,t.schema),i=null,a=n.depth,o=n.pos,s=null;for(;a>0&&s===null;)i=n.node(a),i.type===r?s=a:(--a,--o);return s===null?null:{$pos:t.doc.resolve(o),depth:s}},GZ=(e,t)=>{let n=WZ(e,t);if(!n)return!1;let[,r]=PG(t,e,n.$pos.pos+4);return r},KZ=(e,t,n)=>{let{$anchor:r}=e.selection,i=Math.max(0,r.pos-2),a=e.doc.resolve(i).node();return!(!a||!n.includes(a.type.name))},qZ=(e,t)=>{let{$anchor:n}=t.selection,r=t.doc.resolve(n.pos-2);return!(r.index()===0||r.nodeBefore?.type.name!==e)},JZ=(e,t,n)=>{if(!n)return!1;let r=XU(e,t.schema),i=!1;return n.descendants(e=>{e.type===r&&(i=!0)}),i},YZ=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!IW(e.state,t)&&KZ(e.state,t,n)){let{$anchor:n}=e.state.selection,r=e.state.doc.resolve(n.before()-1),i=[];r.node().descendants((e,n)=>{e.type.name===t&&i.push({node:e,pos:n})});let a=i.at(-1);if(!a)return!1;let o=e.state.doc.resolve(r.start()+a.pos+1);return e.chain().cut({from:n.start()-1,to:n.end()+1},o.end()).joinForward().run()}if(!IW(e.state,t)||!VG(e.state))return!1;let r=WZ(t,e.state);if(!r)return!1;let i=e.state.doc.resolve(r.$pos.pos-2).node(r.depth),a=JZ(t,e.state,i);return qZ(t,e.state)&&!a?e.commands.joinItemBackward():e.chain().liftListItem(t).run()},XZ=(e,t)=>{let n=GZ(e,t),r=WZ(e,t);return!r||!n?!1:n>r.depth},ZZ=(e,t)=>{let n=GZ(e,t),r=WZ(e,t);return!r||!n?!1:n<r.depth},QZ=(e,t)=>{if(!IW(e.state,t)||!BG(e.state,t))return!1;let{selection:n}=e.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:XZ(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():ZZ(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward()},$Z=(e,t)=>{let{$anchor:n}=t.selection,r=t.doc.resolve(n.pos-n.parentOffset-2);return!(r.index()===r.parent.childCount-1||r.nodeAfter?.type.name!==e)},eQ=RK.create({name:`listKeymap`,addOptions(){return{listTypes:[{itemName:`listItem`,wrapperNames:[`bulletList`,`orderedList`]},{itemName:`taskItem`,wrapperNames:[`taskList`]}]}},addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&QZ(e,n)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&QZ(e,n)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&YZ(e,n,r)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&YZ(e,n,r)&&(t=!0)}),t}}}}),tQ=/^(\s*)(\d+)\.\s+(.*)$/,nQ=/^\s/;function rQ(e){let t=e.trimStart();return/^[-+*]\s+/.test(t)||/^\d+\.\s+/.test(t)||/^>\s?/.test(t)||/^```/.test(t)||/^~~~/.test(t)}function iQ(e){let t=[],n=[],r=!1;return e.forEach(e=>{if(r){n.push(e);return}if(e.trim()===``){r=!0,n.push(e);return}if(t.length>0&&rQ(e)){r=!0,n.push(e);return}t.push(e)}),{paragraphLines:t,blockLines:n}}function aQ(e){let t=[],n=0,r=0;for(;n<e.length;){let i=e[n],a=i.match(tQ);if(!a)break;let[,o,s,c]=a,l=o.length,u=[c],d=n+1,f=[i],p=!1;for(;d<e.length;){let t=e[d];if(t.match(tQ))break;if(t.trim()===``)f.push(t),u.push(``),p=!0,d+=1;else if(t.match(nQ))f.push(t),u.push(t.slice(l+2)),d+=1;else{if(p)break;f.push(t),u.push(t),d+=1}}t.push({indent:l,number:parseInt(s,10),content:u.join(`
212
+ `).trim(),contentLines:u,raw:f.join(`
213
+ `)}),r=d,n=d}return[t,r]}function oQ(e,t,n){let r=[],i=0;for(;i<e.length;){let a=e[i];if(a.indent===t){let{paragraphLines:o,blockLines:s}=iQ(a.contentLines),c=o.join(`
214
+ `).trim(),l=[];c&&l.push({type:`paragraph`,raw:c,tokens:n.inlineTokens(c)});let u=s.join(`
215
+ `).trim();if(u){let e=n.blockTokens(u);l.push(...e)}let d=i+1,f=[];for(;d<e.length&&e[d].indent>t;)f.push(e[d]),d+=1;if(f.length>0){let e=oQ(f,Math.min(...f.map(e=>e.indent)),n);l.push({type:`list`,ordered:!0,start:f[0].number,items:e,raw:f.map(e=>e.raw).join(`
216
+ `)})}r.push({type:`list_item`,raw:a.raw,tokens:l}),i=d}else i+=1}return r}function sQ(e,t){return e.map(e=>{if(e.type!==`list_item`)return t.parseChildren([e])[0];let n=[];return e.tokens&&e.tokens.length>0&&e.tokens.forEach(e=>{if(e.type===`paragraph`||e.type===`list`||e.type===`blockquote`||e.type===`code`)n.push(...t.parseChildren([e]));else if(e.type===`text`&&e.tokens){let r=t.parseChildren([e]);n.push({type:`paragraph`,content:r})}else{let r=t.parseChildren([e]);r.length>0&&n.push(...r)}}),{type:`listItem`,content:n}})}var cQ=`listItem`,lQ=`textStyle`,uQ=/^(\d+)\.\s$/,dQ=bq.create({name:`orderedList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:e=>e.hasAttribute(`start`)?parseInt(e.getAttribute(`start`)||``,10):1},type:{default:null,parseHTML:e=>e.getAttribute(`type`)}}},parseHTML(){return[{tag:`ol`}]},renderHTML({HTMLAttributes:e}){let{start:t,...n}=e;return t===1?[`ol`,hG(this.options.HTMLAttributes,n),0]:[`ol`,hG(this.options.HTMLAttributes,e),0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>{if(e.type!==`list`||!e.ordered)return[];let n=e.start||1,r=e.items?sQ(e.items,t):[];return n===1?{type:`orderedList`,content:r}:{type:`orderedList`,attrs:{start:n},content:r}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
217
+ `):``,markdownTokenizer:{name:`orderedList`,level:`block`,start:e=>{let t=e.match(/^(\s*)(\d+)\.\s+/)?.index;return t===void 0?-1:t},tokenize:(e,t,n)=>{let r=e.split(`
218
+ `),[i,a]=aQ(r);if(i.length===0)return;let o=oQ(i,0,n);if(o.length!==0)return{type:`list`,ordered:!0,start:i[0]?.number||1,items:o,raw:r.slice(0,a).join(`
219
+ `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(cQ,this.editor.getAttributes(lQ)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=rq({find:uQ,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=rq({find:uQ,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(lQ)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[e]}}),fQ=/^\s*(\[([( |x])?\])\s$/,pQ=bq.create({name:`taskItem`,addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:`taskList`,a11y:void 0}},content(){return this.options.nested?`paragraph block*`:`paragraph+`},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{let t=e.getAttribute(`data-checked`);return t===``||t===`true`},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return[`li`,hG(this.options.HTMLAttributes,t,{"data-type":this.name}),[`label`,[`input`,{type:`checkbox`,checked:e.attrs.checked?`checked`:null}],[`span`]],[`div`,0]]},parseMarkdown:(e,t)=>{let n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode(`paragraph`,{},t.parseInline(e.tokens))):e.text?n.push(t.createNode(`paragraph`,{},[t.createNode(`text`,{text:e.text})])):n.push(t.createNode(`paragraph`,{},[])),e.nestedTokens&&e.nestedTokens.length>0){let r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode(`taskItem`,{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>hq(e,t,`- [${e.attrs?.checked?`x`:` `}] `),addKeyboardShortcuts(){let e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{let i=document.createElement(`li`),a=document.createElement(`label`),o=document.createElement(`span`),s=document.createElement(`input`),c=document.createElement(`div`),l=e=>{var t;s.ariaLabel=((t=this.options.a11y)?.checkboxLabel)?.call(t,e,s.checked)||`Task item checkbox for ${e.textContent||`empty task item`}`};l(e),a.contentEditable=`false`,s.type=`checkbox`,s.addEventListener(`mousedown`,e=>e.preventDefault()),s.addEventListener(`change`,t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){s.checked=!s.checked;return}let{checked:i}=t.target;r.isEditable&&typeof n==`function`&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{let t=n();if(typeof t!=`number`)return!1;let r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...r?.attrs,checked:i}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,i)||(s.checked=!s.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{i.setAttribute(e,t)}),i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,a.append(s,o),i.append(a,c),Object.entries(t).forEach(([e,t])=>{i.setAttribute(e,t)});let u=new Set(Object.keys(t));return{dom:i,contentDOM:c,update:e=>{if(e.type!==this.type)return!1;i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,l(e);let t=r.extensionManager.attributes,n=gG(e,t),a=new Set(Object.keys(n)),o=this.options.HTMLAttributes;return u.forEach(e=>{a.has(e)||(e in o?i.setAttribute(e,o[e]):i.removeAttribute(e))}),Object.entries(n).forEach(([e,t])=>{t==null?e in o?i.setAttribute(e,o[e]):i.removeAttribute(e):i.setAttribute(e,t)}),u=a,!0}}}},addInputRules(){return[rq({find:fQ,type:this.type,getAttributes:e=>({checked:e[e.length-1]===`x`})})]}}),mQ=bq.create({name:`taskList`,addOptions(){return{itemTypeName:`taskItem`,HTMLAttributes:{}}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return[`ul`,hG(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode(`taskList`,{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
220
+ `):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){let t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;return t===void 0?-1:t},tokenize(e,t,n){let r=e=>{let t=mq(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);return t?[{type:`taskList`,raw:t.raw,items:t.items}]:n.blockTokens(e)},i=mq(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:`taskList`,raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});RK.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(HZ.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(UZ.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(eQ.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(dQ.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(pQ.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(mQ.configure(this.options.taskList)),e}});var hQ=`&nbsp;`,gQ=`\xA0`,_Q=bq.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,hG(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(n.length===1&&n[0].type===`image`)return t.parseChildren([n[0]]);let r=t.parseInline(n);return n.length===1&&n[0].type===`text`&&(n[0].raw===hQ||n[0].text===hQ||n[0].raw===gQ||n[0].text===gQ)&&r.length===1&&r[0].type===`text`&&(r[0].text===hQ||r[0].text===gQ)?t.createNode(`paragraph`,void 0,[]):t.createNode(`paragraph`,void 0,r)},renderMarkdown:(e,t,n)=>{if(!e)return``;let r=Array.isArray(e.content)?e.content:[];if(r.length===0){let e=Array.isArray(n?.previousNode?.content)?n.previousNode.content:[];return n?.previousNode?.type===`paragraph`&&e.length===0?hQ:``}return t.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),vQ=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,yQ=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,bQ=kK.create({name:`strike`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`s`},{tag:`del`},{tag:`strike`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`line-through`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`s`,hG(this.options.HTMLAttributes,e),0]},markdownTokenName:`del`,parseMarkdown:(e,t)=>t.applyMark(`strike`,t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[eq({find:vQ,type:this.type})]},addPasteRules(){return[Sq({find:yQ,type:this.type})]}}),xQ=bq.create({name:`text`,group:`inline`,parseMarkdown:e=>({type:`text`,text:e.text||``}),renderMarkdown:e=>e.text||``}),SQ=kK.create({name:`underline`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`u`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`underline`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`u`,hG(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||`underline`,t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:`underline`,level:`inline`,start(e){return e.indexOf(`++`)},tokenize(e,t,n){let r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;let i=r[2].trim();return{type:`underline`,raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function CQ(e={}){return new sR({view(t){return new wQ(t,e)}})}var wQ=class{constructor(e,t){this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=t.width??1,this.color=t.color===!1?void 0:t.color||`black`,this.class=t.class,this.handlers=[`dragover`,`dragend`,`drop`,`dragleave`].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,r=this.editorView.dom,i=r.getBoundingClientRect(),a=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(t){let t=e.nodeBefore,r=e.nodeAfter;if(t||r){let e=this.editorView.nodeDOM(this.cursorPos-(t?t.nodeSize:0));if(e){let i=e.getBoundingClientRect(),a=t?i.bottom:i.top;t&&r&&(a=(a+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*o;n={left:i.left,right:i.right,top:a-s,bottom:a+s}}}}if(!n){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*a;n={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let s=this.editorView.dom.offsetParent;this.element||(this.element=s.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`,t),this.element.classList.toggle(`prosemirror-dropcursor-inline`,!t);let c,l;if(!s||s==document.body&&getComputedStyle(s).position==`static`)c=-pageXOffset,l=-pageYOffset;else{let e=s.getBoundingClientRect(),t=e.width/s.offsetWidth,n=e.height/s.offsetHeight;c=e.left-s.scrollLeft*t,l=e.top-s.scrollTop*n}this.element.style.left=(n.left-c)/a+`px`,this.element.style.top=(n.top-l)/o+`px`,this.element.style.width=(n.right-n.left)/a+`px`,this.element.style.height=(n.bottom-n.top)/o+`px`}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i=typeof r==`function`?r(this.editorView,t,e):r;if(t&&!i){let e=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let t=vL(this.editorView.state.doc,e,this.editorView.dragging.slice);t!=null&&(e=t)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}},TQ=class e extends zL{constructor(e){super(e,e)}map(t,n){let r=t.resolve(n.map(this.head));return e.valid(r)?new e(r):zL.near(r)}content(){return uF.empty}eq(t){return t instanceof e&&t.head==this.head}toJSON(){return{type:`gapcursor`,pos:this.head}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for GapCursor.fromJSON`);return new e(t.resolve(n.pos))}getBookmark(){return new EQ(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!OQ(e)||!kQ(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,n,r=!1){search:for(;;){if(!r&&e.valid(t))return t;let i=t.pos,a=null;for(let r=t.depth;;r--){let o=t.node(r);if(n>0?t.indexAfter(r)<o.childCount:t.index(r)>0){a=o.child(n>0?t.indexAfter(r):t.index(r)-1);break}else if(r==0)return null;i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}for(;;){let o=n>0?a.firstChild:a.lastChild;if(!o){if(a.isAtom&&!a.isText&&!GL.isSelectable(a)){t=t.doc.resolve(i+a.nodeSize*n),r=!1;continue search}break}a=o,i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}return null}}};TQ.prototype.visible=!1,TQ.findFrom=TQ.findGapCursorFrom,zL.jsonID(`gapcursor`,TQ);var EQ=class e{constructor(e){this.pos=e}map(t){return new e(t.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return TQ.valid(t)?new TQ(t):zL.near(t)}};function DQ(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function OQ(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 e=r.child(n-1);;e=e.lastChild){if(e.childCount==0&&!e.inlineContent||DQ(e.type))return!0;if(e.inlineContent)return!1}}return!0}function kQ(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 e=r.child(n);;e=e.firstChild){if(e.childCount==0&&!e.inlineContent||DQ(e.type))return!0;if(e.inlineContent)return!1}}return!0}function AQ(){return new sR({props:{decorations:FQ,createSelectionBetween(e,t,n){return t.pos==n.pos&&TQ.valid(n)?new TQ(n):null},handleClick:NQ,handleKeyDown:jQ,handleDOMEvents:{beforeinput:PQ}}})}var jQ=LU({ArrowLeft:MQ(`horiz`,-1),ArrowRight:MQ(`horiz`,1),ArrowUp:MQ(`vert`,-1),ArrowDown:MQ(`vert`,1)});function MQ(e,t){let n=e==`vert`?t>0?`down`:`up`:t>0?`right`:`left`;return function(e,r,i){let a=e.selection,o=t>0?a.$to:a.$from,s=a.empty;if(a instanceof UL){if(!i.endOfTextblock(n)||o.depth==0)return!1;s=!1,o=e.doc.resolve(t>0?o.after():o.before())}let c=TQ.findGapCursorFrom(o,t,s);return c?(r&&r(e.tr.setSelection(new TQ(c))),!0):!1}}function NQ(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!TQ.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&GL.isSelectable(e.state.doc.nodeAt(i.inside))?!1:(e.dispatch(e.state.tr.setSelection(new TQ(r))),!0)}function PQ(e,t){if(t.inputType!=`insertCompositionText`||!(e.state.selection instanceof TQ))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 i=Q.empty;for(let e=r.length-1;e>=0;e--)i=Q.from(r[e].createAndFill(null,i));let a=e.state.tr.replace(n.pos,n.pos,new uF(i,0,0));return a.setSelection(UL.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function FQ(e){if(!(e.selection instanceof TQ))return null;let t=document.createElement(`div`);return t.className=`ProseMirror-gapcursor`,IH.create(e.doc,[NH.widget(e.selection.head,t,{key:`gapcursor`})])}var IQ=200,LQ=function(){};LQ.prototype.append=function(e){return e.length?(e=LQ.from(e),!this.length&&e||e.length<IQ&&this.leafAppend(e)||this.length<IQ&&e.leafPrepend(this)||this.appendInner(e)):this},LQ.prototype.prepend=function(e){return e.length?LQ.from(e).append(this):this},LQ.prototype.appendInner=function(e){return new zQ(this,e)},LQ.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?LQ.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},LQ.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},LQ.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},LQ.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},LQ.from=function(e){return e instanceof LQ?e:e&&e.length?new RQ(e):LQ.empty};var RQ=function(e){function t(t){e.call(this),this.values=t}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(e,n){return e==0&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(e(this.values[i],r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(e(this.values[i],r+i)===!1)return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=IQ)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=IQ)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(LQ);LQ.empty=new RQ([]);var zQ=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.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(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var i=this.left.length;if(t<i&&this.left.forEachInner(e,t,Math.min(n,i),r)===!1||n>i&&this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;if(t>i&&this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i)===!1||n<i&&this.left.forEachInvertedInner(e,Math.min(t,i),n,r)===!1)return!1},t.prototype.sliceInner=function(e,t){if(e==0&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(LQ),BQ=500,VQ=class e{constructor(e,t){this.items=e,this.eventCount=t}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 i,a;n&&(i=this.remapping(r,this.items.length),a=i.maps.length);let o=t.tr,s,c,l=[],u=[];return this.items.forEach((t,n)=>{if(!t.step){i||(i=this.remapping(r,n+1),a=i.maps.length),a--,u.push(t);return}if(i){u.push(new UQ(t.map));let e=t.step.map(i.slice(a)),n;e&&o.maybeStep(e).doc&&(n=o.mapping.maps[o.mapping.maps.length-1],l.push(new UQ(n,void 0,void 0,l.length+u.length))),a--,n&&i.appendMap(n,a)}else o.maybeStep(t.step);if(t.selection)return s=i?t.selection.map(i.slice(a)):t.selection,c=new e(this.items.slice(0,r).append(u.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:o,selection:s}}addTransform(t,n,r,i){let a=[],o=this.eventCount,s=this.items,c=!i&&s.length?s.get(s.length-1):null;for(let e=0;e<t.steps.length;e++){let r=t.steps[e].invert(t.docs[e]),l=new UQ(t.mapping.maps[e],r,n),u;(u=c&&c.merge(l))&&(l=u,e?a.pop():s=s.slice(0,s.length-1)),a.push(l),n&&=(o++,void 0),i||(c=l)}let l=o-r.depth;return l>GQ&&(s=HQ(s,l),o-=l),new e(s.append(a),o)}remapping(e,t){let n=new II;return this.items.forEach((t,r)=>{let i=t.mirrorOffset!=null&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}addMaps(t){return this.eventCount==0?this:new e(this.items.append(t.map(e=>new UQ(e))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),a=t.mapping,o=t.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},i);let c=n;this.items.forEach(e=>{let n=a.getMirror(--c);if(n==null)return;o=Math.min(o,n);let i=a.maps[n];if(e.step){let o=t.steps[n].invert(t.docs[n]),l=e.selection&&e.selection.map(a.slice(c+1,n));l&&s++,r.push(new UQ(i,o,l))}else r.push(new UQ(i))},i);let l=[];for(let e=n;e<o;e++)l.push(new UQ(a.maps[e]));let u=new e(this.items.slice(0,i).append(l).append(r),s);return u.emptyItemCount()>BQ&&(u=u.compress(this.items.length-r.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,i=[],a=0;return this.items.forEach((e,o)=>{if(o>=t)i.push(e),e.selection&&a++;else if(e.step){let t=e.step.map(n.slice(r)),o=t&&t.getMap();if(r--,o&&n.appendMap(o,r),t){let s=e.selection&&e.selection.map(n.slice(r));s&&a++;let c=new UQ(o.invert(),t,s),l,u=i.length-1;(l=i.length&&i[u].merge(c))?i[u]=l:i.push(c)}}else e.map&&r--},this.items.length,0),new e(LQ.from(i.reverse()),a)}};VQ.empty=new VQ(LQ.empty,0);function HQ(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&t--==0)return n=r,!1}),e.slice(n)}var UQ=class e{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new e(n.getMap().invert(),n,this.selection)}}},WQ=class{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}},GQ=20;function KQ(e,t,n,r){let i=n.getMeta(e$),a;if(i)return i.historyState;n.getMeta(t$)&&(e=new WQ(e.done,e.undone,null,0,-1));let o=n.getMeta(`appendedTransaction`);if(n.steps.length==0)return e;if(o&&o.getMeta(e$))return o.getMeta(e$).redo?new WQ(e.done.addTransform(n,void 0,r,$Q(t)),e.undone,JQ(n.mapping.maps),e.prevTime,e.prevComposition):new WQ(e.done,e.undone.addTransform(n,void 0,r,$Q(t)),null,e.prevTime,e.prevComposition);if(n.getMeta(`addToHistory`)!==!1&&!(o&&o.getMeta(`addToHistory`)===!1)){let i=n.getMeta(`composition`),a=e.prevTime==0||!o&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!qQ(n,e.prevRanges)),s=o?YQ(e.prevRanges,n.mapping):JQ(n.mapping.maps);return new WQ(e.done.addTransform(n,a?t.selection.getBookmark():void 0,r,$Q(t)),VQ.empty,s,n.time,i??e.prevComposition)}else if(a=n.getMeta(`rebased`))return new WQ(e.done.rebased(n,a),e.undone.rebased(n,a),YQ(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);else return new WQ(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),YQ(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function qQ(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)}),n}function JQ(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((e,n,r,i)=>t.push(r,i));return t}function YQ(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),a=t.map(e[r+1],-1);i<=a&&n.push(i,a)}return n}function XQ(e,t,n){let r=$Q(t),i=e$.get(t).spec.config,a=(n?e.undone:e.done).popEvent(t,r);if(!a)return null;let o=a.selection.resolve(a.transform.doc),s=(n?e.done:e.undone).addTransform(a.transform,t.selection.getBookmark(),i,r),c=new WQ(n?s:a.remaining,n?a.remaining:s,null,0,-1);return a.transform.setSelection(o).setMeta(e$,{redo:n,historyState:c})}var ZQ=!1,QQ=null;function $Q(e){let t=e.plugins;if(QQ!=t){ZQ=!1,QQ=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){ZQ=!0;break}}return ZQ}var e$=new uR(`history`),t$=new uR(`closeHistory`);function n$(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new sR({key:e$,state:{init(){return new WQ(VQ.empty,VQ.empty,null,0,-1)},apply(t,n,r){return KQ(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r=n==`historyUndo`?i$:n==`historyRedo`?a$:null;return!r||!e.editable?!1:(t.preventDefault(),r(e.state,e.dispatch))}}}})}function r$(e,t){return(n,r)=>{let i=e$.getState(n);if(!i||(e?i.undone:i.done).eventCount==0)return!1;if(r){let a=XQ(i,n,e);a&&r(t?a.scrollIntoView():a)}return!0}}var i$=r$(!1,!0),a$=r$(!0,!0);RK.create({name:`characterCount`,addOptions(){return{limit:null,mode:`textSize`,textCounter:e=>e.length,wordCounter:e=>e.split(` `).filter(e=>e!==``).length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{let t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)===`textSize`){let e=t.textBetween(0,t.content.size,void 0,` `);return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size,` `,` `);return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new sR({key:new uR(`characterCount`),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit;if(i==null||i===0){e=!0;return}let a=this.storage.characters({node:r.doc});if(a>i){let t=a-i;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let n=r.tr.deleteRange(0,t);return e=!0,n}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||n===0||n==null)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta(`paste`))return!1;let a=e.selection.$head.pos,o=a-(i-n),s=a;return e.deleteRange(o,s),!(this.storage.characters({node:e.doc})>n)}})]}});var o$=RK.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[CQ(this.options)]}});RK.create({name:`focus`,addOptions(){return{className:`has-focus`,mode:`all`}},addProseMirrorPlugins(){return[new sR({key:new uR(`focus`),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,a=[];if(!n||!r)return IH.create(e,[]);let o=0;this.options.mode===`deepest`&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;o+=1}});let s=0;return e.descendants((e,t)=>{if(e.isText||!(i>=t&&i<=t+e.nodeSize-1))return!1;if(s+=1,this.options.mode===`deepest`&&o-s>0||this.options.mode===`shallowest`&&s>1)return this.options.mode===`deepest`;a.push(NH.node(t,t+e.nodeSize,{class:this.options.className}))}),IH.create(e,a)}}})]}});var s$=RK.create({name:`gapCursor`,addProseMirrorPlugins(){return[AQ()]},extendNodeSchema(e){return{allowGapCursor:lG(aG(e,`allowGapCursor`,{name:e.name,options:e.options,storage:e.storage}))??null}}}),c$=`placeholder`;function l$(e){return e.replace(/\s+/g,`-`).replace(/[^a-zA-Z0-9-]/g,``).replace(/^[0-9-]+/,``).replace(/^-+/,``).toLowerCase()}RK.create({name:`placeholder`,addOptions(){return{emptyEditorClass:`is-editor-empty`,emptyNodeClass:`is-empty`,dataAttribute:c$,placeholder:`Write something …`,showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){let e=this.options.dataAttribute?`data-${l$(this.options.dataAttribute)}`:`data-${c$}`;return[new sR({key:new uR(`placeholder`),props:{decorations:({doc:t,selection:n})=>{let r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=n,a=[];if(!r)return null;let o=this.editor.isEmpty;return t.descendants((t,n)=>{let r=i>=n&&i<=n+t.nodeSize,s=!t.isLeaf&&WG(t);if(!t.type.isTextblock)return this.options.includeChildren;if((r||!this.options.showOnlyCurrent)&&s){let i=[this.options.emptyNodeClass];o&&i.push(this.options.emptyEditorClass);let s=NH.node(n,n+t.nodeSize,{class:i.join(` `),[e]:typeof this.options.placeholder==`function`?this.options.placeholder({editor:this.editor,node:t,pos:n,hasAnchor:r}):this.options.placeholder});a.push(s)}return this.options.includeChildren}),IH.create(t,a)}}})]}}),RK.create({name:`selection`,addOptions(){return{className:`selection`}},addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new sR({key:new uR(`selection`),props:{decorations(n){return n.selection.empty||e.isFocused||!e.isEditable||GG(n.selection)||e.view.dragging?null:IH.create(n.doc,[NH.inline(n.selection.from,n.selection.to,{class:t.className})])}}})]}});function u$({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var d$=RK.create({name:`trailingNode`,addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){let e=new uR(this.name),t=this.options.node||this.editor.schema.topNodeType.contentMatch.defaultType?.name||`paragraph`,n=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(t).includes(e.name));return[new sR({key:e,appendTransaction:(n,r,i)=>{let{doc:a,tr:o,schema:s}=i,c=e.getState(i),l=a.content.size,u=s.nodes[t];if(!n.some(e=>e.getMeta(`skipTrailingNode`))&&c)return o.insert(l,u.create())},state:{init:(e,t)=>{let r=t.tr.doc.lastChild;return!u$({node:r,types:n})},apply:(e,t)=>{if(!e.docChanged||e.getMeta(`__uniqueIDTransaction`))return t;let r=e.doc.lastChild;return!u$({node:r,types:n})}}})]}}),f$=RK.create({name:`undoRedo`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>i$(e,t),redo:()=>({state:e,dispatch:t})=>a$(e,t)}},addProseMirrorPlugins(){return[n$(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),p$=RK.create({name:`starterKit`,addExtensions(){let e=[];return this.options.bold!==!1&&e.push(aY.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(eY.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(HZ.configure(this.options.bulletList)),this.options.code!==!1&&e.push(cY.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(fY.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(pY.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(o$.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(s$.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(mY.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(hY.configure(this.options.heading)),this.options.undoRedo!==!1&&e.push(f$.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&e.push(gY.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(xY.configure(this.options.italic)),this.options.listItem!==!1&&e.push(UZ.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(eQ.configure(this.options?.listKeymap)),this.options.link!==!1&&e.push(IZ.configure(this.options?.link)),this.options.orderedList!==!1&&e.push(dQ.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(_Q.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(bQ.configure(this.options.strike)),this.options.text!==!1&&e.push(xQ.configure(this.options.text)),this.options.underline!==!1&&e.push(SQ.configure(this.options?.underline)),this.options.trailingNode!==!1&&e.push(d$.configure(this.options?.trailingNode)),e}}),m$=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,h$=bq.create({name:`image`,addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?`inline`:`block`},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?`img[src]`:`img[src]:not([src^="data:"])`}]},renderHTML({HTMLAttributes:e}){return[`img`,hG(this.options.HTMLAttributes,e)]},parseMarkdown:(e,t)=>t.createNode(`image`,{src:e.href,title:e.title,alt:e.text}),renderMarkdown:e=>{let t=e.attrs?.src??``,n=e.attrs?.alt??``,r=e.attrs?.title??``;return r?`![${n}](${t} "${r}")`:`![${n}](${t})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>`u`)return null;let{directions:e,minWidth:t,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:i,getPos:a,HTMLAttributes:o,editor:s})=>{let c=document.createElement(`img`);Object.entries(o).forEach(([e,t])=>{if(t!=null)switch(e){case`width`:case`height`:break;default:c.setAttribute(e,t);break}}),c.src=o.src;let l=new aq({element:c,editor:s,node:i,getPos:a,onResize:(e,t)=>{c.style.width=`${e}px`,c.style.height=`${t}px`},onCommit:(e,t)=>{let n=a();n!==void 0&&this.editor.chain().setNodeSelection(n).updateAttributes(this.name,{width:e,height:t}).run()},onUpdate:(e,t,n)=>e.type===i.type,options:{directions:e,min:{width:t,height:n},preserveAspectRatio:r===!0}}),u=l.dom;return u.style.visibility=`hidden`,u.style.pointerEvents=`none`,c.onload=()=>{u.style.visibility=``,u.style.pointerEvents=``},l}},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[tq({find:m$,type:this.type,getAttributes:e=>{let[,,t,n,r]=e;return{src:n,alt:t,title:r}}})]}});function g$({onClick:e,active:t,disabled:n,title:r,children:i}){return(0,H.jsx)(`button`,{type:`button`,title:r,disabled:n,onMouseDown:t=>{t.preventDefault(),e()},className:K(`flex size-7 items-center justify-center rounded transition-colors`,t?`bg-foreground text-background`:`text-muted-foreground hover:bg-accent hover:text-accent-foreground`,n&&`pointer-events-none opacity-40`),children:i})}function _$(){return(0,H.jsx)(`div`,{className:`mx-0.5 h-4 w-px bg-border`})}function v$(e,t){return!e||!t?null:`${e} × ${t}`}function y$(e){try{let t=new URL(e).pathname.split(`/`).filter(Boolean);return t[t.length-1]||`Image`}catch{let t=e.split(`?`)[0].split(`/`).filter(Boolean);return t[t.length-1]||`Image`}}async function b$(e,t){if(!(await fetch(`/cms/admin/media/${e}`,{method:`PATCH`,credentials:`include`,headers:{"Content-Type":`application/json`},body:JSON.stringify({caption:t})})).ok)throw Error(`Could not update media caption.`)}function x$({node:e,deleteNode:t,selected:n,updateAttributes:r,editor:i}){let a=String(e.attrs.src??``),o=typeof e.attrs.mediaId==`string`?e.attrs.mediaId:null,s=typeof e.attrs.filename==`string`?e.attrs.filename:null,c=typeof e.attrs.alt==`string`?e.attrs.alt:null,l=typeof e.attrs.title==`string`?e.attrs.title:null,u=typeof e.attrs.width==`number`?e.attrs.width:null,d=typeof e.attrs.height==`number`?e.attrs.height:null,f=s||y$(a),p=v$(u,d),[m,h]=(0,v.useState)(l??``),[g,_]=(0,v.useState)(null),[y,b]=(0,v.useState)(!1),x=i.isEditable;(0,v.useEffect)(()=>{h(l??``)},[l]);async function S(){let e=m.trim()||null;if(e===(l?.trim()||null)){_(null);return}if(r({title:e}),_(null),o){b(!0);try{await b$(o,e)}catch(e){_(e instanceof Error?e.message:`Could not update media caption.`)}finally{b(!1)}}}return(0,H.jsx)(zJ,{className:K(`my-3`,`rounded-xl border bg-card shadow-xs transition-colors`,n?`border-primary ring-2 ring-primary/20`:`border-border`),contentEditable:!1,"data-drag-handle":!0,children:(0,H.jsxs)(`div`,{className:`flex items-start gap-3 p-3`,children:[(0,H.jsx)(`div`,{className:`size-18 shrink-0 overflow-hidden rounded-lg border bg-muted`,children:(0,H.jsx)(`img`,{src:a,alt:c??f,className:`h-full w-full object-cover`})}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,H.jsx)(`p`,{className:`truncate text-sm font-medium text-foreground`,title:f,children:f}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground`,children:[p&&(0,H.jsx)(`span`,{children:p}),c&&(0,H.jsxs)(`span`,{className:`truncate`,title:c,children:[`Alt: `,c]})]}),(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsx)(uE,{value:m,onChange:e=>h(e.target.value),onBlur:S,placeholder:`Figcaption...`,disabled:!x,className:`min-h-8 resize-none border-0 bg-muted/60 px-2.5 py-1.5 text-xs text-muted-foreground shadow-none focus-visible:ring-1`}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-[11px] text-muted-foreground`,children:[(0,H.jsx)(`span`,{children:o?`Synced with Media Library`:`Local to this entry`}),y&&(0,H.jsx)(`span`,{children:`Saving…`})]}),g&&(0,H.jsx)(`p`,{className:`text-[11px] text-destructive`,children:g})]})]}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>t(),className:`flex size-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive`,"aria-label":`Remove image`,children:(0,H.jsx)(Qo,{className:`size-4`})})]})})}function S$({value:e,onChange:t,placeholder:n,onInsertImage:r}){let[i,a]=(0,v.useState)(!e),o=FJ({extensions:[p$.configure({link:{openOnClick:!1,HTMLAttributes:{class:`text-primary underline`}}}),h$.extend({addAttributes(){return{...this.parent?.(),mediaId:{default:null},filename:{default:null},width:{default:null},height:{default:null}}},addNodeView(){return qJ(x$)}}).configure({inline:!1})],content:(()=>{if(!e)return``;try{return JSON.parse(e)}catch{return e}})(),editorProps:{attributes:{class:`h-128 px-3 py-2.5 focus:outline-none`}},onUpdate({editor:e}){a(e.isEmpty),t(JSON.stringify(e.getJSON()))}});(0,v.useEffect)(()=>{if(!o)return;let t=e?(()=>{try{return JSON.parse(e)}catch{return e}})():``;JSON.stringify(o.getJSON())!==e&&o.commands.setContent(t,{emitUpdate:!1}),a(o.isEmpty)},[e]);async function s(){if(!o||!r)return;let e=await r();if(!e||e.length===0)return;let t=e.map(e=>({type:`image`,attrs:{mediaId:e.id??void 0,src:e.src,filename:e.filename??void 0,alt:e.alt??void 0,title:e.title??void 0,width:e.width??void 0,height:e.height??void 0}}));o.chain().focus().insertContent(t).run()}function c(){if(!o)return;let e=o.getAttributes(`link`).href,t=window.prompt(`URL`,e??`https://`);if(t!==null){if(!t){o.chain().focus().unsetLink().run();return}o.chain().focus().setLink({href:t}).run()}}return o?(0,H.jsxs)(`div`,{className:`overflow-hidden rounded-md border border-input bg-background focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/50`,children:[(0,H.jsxs)(`div`,{className:`sticky top-0 z-10 flex flex-wrap items-center gap-0.5 border-b border-border bg-background px-2 py-1.5`,children:[(0,H.jsx)(g$,{title:`Bold`,active:o.isActive(`bold`),onClick:()=>o.chain().focus().toggleBold().run(),children:(0,H.jsx)(Fa,{className:`size-3.5`})}),(0,H.jsx)(g$,{title:`Italic`,active:o.isActive(`italic`),onClick:()=>o.chain().focus().toggleItalic().run(),children:(0,H.jsx)(bo,{className:`size-3.5`})}),(0,H.jsx)(g$,{title:`Underline`,active:o.isActive(`underline`),onClick:()=>o.chain().focus().toggleUnderline().run(),children:(0,H.jsx)(ts,{className:`size-3.5`})}),(0,H.jsx)(g$,{title:`Strikethrough`,active:o.isActive(`strike`),onClick:()=>o.chain().focus().toggleStrike().run(),children:(0,H.jsx)(Jo,{className:`size-3.5`})}),(0,H.jsx)(_$,{}),(0,H.jsx)(g$,{title:`Heading 1`,active:o.isActive(`heading`,{level:1}),onClick:()=>o.chain().focus().toggleHeading({level:1}).run(),children:(0,H.jsx)(mo,{className:`size-3.5`})}),(0,H.jsx)(g$,{title:`Heading 2`,active:o.isActive(`heading`,{level:2}),onClick:()=>o.chain().focus().toggleHeading({level:2}).run(),children:(0,H.jsx)(ho,{className:`size-3.5`})}),(0,H.jsx)(g$,{title:`Heading 3`,active:o.isActive(`heading`,{level:3}),onClick:()=>o.chain().focus().toggleHeading({level:3}).run(),children:(0,H.jsx)(go,{className:`size-3.5`})}),(0,H.jsx)(_$,{}),(0,H.jsx)(g$,{title:`Bullet list`,active:o.isActive(`bulletList`),onClick:()=>o.chain().focus().toggleBulletList().run(),children:(0,H.jsx)(ko,{className:`size-3.5`})}),(0,H.jsx)(g$,{title:`Ordered list`,active:o.isActive(`orderedList`),onClick:()=>o.chain().focus().toggleOrderedList().run(),children:(0,H.jsx)(Do,{className:`size-3.5`})}),(0,H.jsx)(_$,{}),(0,H.jsx)(g$,{title:`Blockquote`,active:o.isActive(`blockquote`),onClick:()=>o.chain().focus().toggleBlockquote().run(),children:(0,H.jsx)(zo,{className:`size-3.5`})}),(0,H.jsx)(g$,{title:`Inline code`,active:o.isActive(`code`),onClick:()=>o.chain().focus().toggleCode().run(),children:(0,H.jsx)(Xa,{className:`size-3.5`})}),(0,H.jsx)(g$,{title:`Code block`,active:o.isActive(`codeBlock`),onClick:()=>o.chain().focus().toggleCodeBlock().run(),children:(0,H.jsx)(Ko,{className:`size-3.5`})}),(0,H.jsx)(_$,{}),(0,H.jsx)(g$,{title:`Add link`,active:o.isActive(`link`),onClick:c,children:(0,H.jsx)(Eo,{className:`size-3.5`})}),(0,H.jsx)(g$,{title:`Remove link`,disabled:!o.isActive(`link`),onClick:()=>o.chain().focus().unsetLink().run(),children:(0,H.jsx)(ns,{className:`size-3.5`})}),(0,H.jsx)(_$,{}),r&&(0,H.jsx)(g$,{title:`Insert image`,onClick:s,children:(0,H.jsx)(vo,{className:`size-3.5`})}),(0,H.jsx)(g$,{title:`Hard break (Shift + Enter)`,onClick:()=>o.chain().focus().setHardBreak().run(),children:(0,H.jsx)(Xo,{className:`size-3.5`})})]}),(0,H.jsxs)(`div`,{className:`relative overflow-y-auto`,children:[i&&n&&(0,H.jsx)(`p`,{className:`pointer-events-none absolute left-3 top-2.5 text-muted-foreground select-none`,children:n}),(0,H.jsx)(DJ,{editor:o})]})]}):null}var C$=1,w$=.9,T$=.8,E$=.17,D$=.1,O$=.999,k$=.9999,A$=.99,j$=/[\\\/_+.#"@\[\(\{&]/,M$=/[\\\/_+.#"@\[\(\{&]/g,N$=/[\s-]/,P$=/[\s-]/g;function F$(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?C$:A$;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=F$(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=C$:j$.test(e.charAt(l-1))?(d*=T$,p=e.slice(i,l-1).match(M$),p&&i>0&&(d*=O$**+p.length)):N$.test(e.charAt(l-1))?(d*=w$,m=e.slice(i,l-1).match(P$),m&&i>0&&(d*=O$**+m.length)):(d*=E$,i>0&&(d*=O$**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=k$)),(d<D$&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=F$(e,t,n,r,l+1,a+2,o),f*D$>d&&(d=f*D$)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function I$(e){return e.toLowerCase().replace(P$,` `)}function L$(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,F$(e,t,I$(e),I$(t),0,0,{})}var R$=`[cmdk-group=""]`,z$=`[cmdk-group-items=""]`,B$=`[cmdk-group-heading=""]`,V$=`[cmdk-item=""]`,H$=`${V$}:not([aria-disabled="true"])`,U$=`cmdk-item-select`,W$=`data-value`,G$=(e,t,n)=>L$(e,t,n),K$=v.createContext(void 0),q$=()=>v.useContext(K$),J$=v.createContext(void 0),Y$=()=>v.useContext(J$),X$=v.createContext(void 0),Z$=v.forwardRef((e,t)=>{let n=d1(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=d1(()=>new Set),i=d1(()=>new Map),a=d1(()=>new Map),o=d1(()=>new Set),s=l1(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,y=Fl(),b=Fl(),x=Fl(),S=v.useRef(null),C=m1();u1(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,w.emit()}},[u]),u1(()=>{C(6,A)},[]);let w=v.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)k(),D(),C(1,O);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(x);e?e.focus():(i=document.getElementById(y))==null||i.focus()}if(C(7,()=>{n.current.selectedItemId=j()?.id,w.emit()}),r||C(5,A),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}w.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),T=v.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,E(t,r)),C(2,()=>{D(),w.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),C(3,()=>{k(),D(),n.current.value||O(),w.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=j();C(4,()=>{k(),t?.getAttribute(`id`)===e&&O(),w.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:y,inputId:x,labelId:b,listInnerRef:S}),[]);function E(e,t){let r=s.current?.filter??G$;return e?r(e,n.current.search,t):0}function D(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=S.current;M().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(z$);t?t.appendChild(e.parentElement===t?e:e.closest(`${z$} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${z$} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=S.current?.querySelector(`${R$}[${W$}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function O(){let e=M().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(W$);w.setState(`value`,e||void 0)}function k(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=E(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function A(){var e;let t=j();t&&(t.parentElement?.firstChild===t&&((e=t.closest(R$)?.querySelector(B$))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function j(){return S.current?.querySelector(`${V$}[aria-selected="true"]`)}function M(){return Array.from(S.current?.querySelectorAll(H$)||[])}function N(e){let t=M()[e];t&&w.setState(`value`,t.getAttribute(W$))}function P(e){var t;let n=j(),r=M(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&w.setState(`value`,a.getAttribute(W$))}function F(e){let t=j()?.closest(R$),n;for(;t&&!n;)t=e>0?s1(t,R$):c1(t,R$),n=t?.querySelector(H$);n?w.setState(`value`,n.getAttribute(W$)):P(e)}let I=()=>N(M().length-1),L=e=>{e.preventDefault(),e.metaKey?I():e.altKey?F(1):P(1)},R=e=>{e.preventDefault(),e.metaKey?N(0):e.altKey?F(-1):P(-1)};return v.createElement(ig.div,{ref:t,tabIndex:-1,..._,"cmdk-root":``,onKeyDown:e=>{var t;(t=_.onKeyDown)==null||t.call(_,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&L(e);break;case`ArrowDown`:L(e);break;case`p`:case`k`:g&&e.ctrlKey&&R(e);break;case`ArrowUp`:R(e);break;case`Home`:e.preventDefault(),N(0);break;case`End`:e.preventDefault(),I();break;case`Enter`:{e.preventDefault();let t=j();if(t){let e=new Event(U$);t.dispatchEvent(e)}}}}},v.createElement(`label`,{"cmdk-label":``,htmlFor:T.inputId,id:T.labelId,style:_1},c),g1(e,e=>v.createElement(J$.Provider,{value:w},v.createElement(K$.Provider,{value:T},e))))}),Q$=v.forwardRef((e,t)=>{let n=Fl(),r=v.useRef(null),i=v.useContext(X$),a=q$(),o=l1(e),s=o.current?.forceMount??i?.forceMount;u1(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=p1(n,r,[e.value,e.children,r],e.keywords),l=Y$(),u=f1(e=>e.value&&e.value===c.current),d=f1(e=>s||a.filter()===!1?!0:e.search?e.filtered.items.get(n)>0:!0);v.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(U$,f),()=>t.removeEventListener(U$,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:h,onSelect:g,forceMount:_,keywords:y,...b}=e;return v.createElement(ig.div,{ref:hs(r,t),...b,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),$$=v.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=Fl(),s=v.useRef(null),c=v.useRef(null),l=Fl(),u=q$(),d=f1(e=>i||u.filter()===!1?!0:e.search?e.filtered.groups.has(o):!0);u1(()=>u.group(o),[]),p1(o,s,[e.value,e.heading,c]);let f=v.useMemo(()=>({id:o,forceMount:i}),[i]);return v.createElement(ig.div,{ref:hs(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:d?void 0:!0},n&&v.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),g1(e,e=>v.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},v.createElement(X$.Provider,{value:f},e))))}),e1=v.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=v.useRef(null),a=f1(e=>!e.search);return!n&&!a?null:v.createElement(ig.div,{ref:hs(i,t),...r,"cmdk-separator":``,role:`separator`})}),t1=v.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=Y$(),o=f1(e=>e.search),s=f1(e=>e.selectedItemId),c=q$();return v.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),v.createElement(ig.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),n1=v.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=v.useRef(null),o=v.useRef(null),s=f1(e=>e.selectedItemId),c=q$();return v.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),v.createElement(ig.div,{ref:hs(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},g1(e,e=>v.createElement(`div`,{ref:hs(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),r1=v.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return v.createElement(Hh,{open:n,onOpenChange:r},v.createElement(Uh,{container:o},v.createElement(Wh,{"cmdk-overlay":``,className:i}),v.createElement(Gh,{"aria-label":e.label,"cmdk-dialog":``,className:a},v.createElement(Z$,{ref:t,...s}))))}),i1=v.forwardRef((e,t)=>f1(e=>e.filtered.count===0)?v.createElement(ig.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),a1=v.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return v.createElement(ig.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},g1(e,e=>v.createElement(`div`,{"aria-hidden":!0},e)))}),o1=Object.assign(Z$,{List:n1,Item:Q$,Input:t1,Group:$$,Separator:e1,Dialog:r1,Empty:i1,Loading:a1});function s1(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function c1(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function l1(e){let t=v.useRef(e);return u1(()=>{t.current=e}),t}var u1=typeof window>`u`?v.useEffect:v.useLayoutEffect;function d1(e){let t=v.useRef();return t.current===void 0&&(t.current=e()),t}function f1(e){let t=Y$(),n=()=>e(t.snapshot());return v.useSyncExternalStore(t.subscribe,n,n)}function p1(e,t,n,r=[]){let i=v.useRef(),a=q$();return u1(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(W$,s),i.current=s}),i}var m1=()=>{let[e,t]=v.useState(),n=d1(()=>new Map);return u1(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function h1(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function g1({asChild:e,children:t},n){return e&&v.isValidElement(t)?v.cloneElement(h1(t),{ref:t.ref},n(t.props.children)):n(t)}var _1={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},v1=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(o1,{ref:n,className:K(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,e),...t}));v1.displayName=o1.displayName;var y1=v.forwardRef(({className:e,...t},n)=>(0,H.jsxs)(`div`,{className:`flex items-center border-b px-3`,"data-cmdk-input-wrapper":``,children:[(0,H.jsx)(Uo,{className:`mr-2 h-4 w-4 shrink-0 opacity-50`}),(0,H.jsx)(o1.Input,{ref:n,className:K(`flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,e),...t})]}));y1.displayName=o1.Input.displayName;var b1=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(o1.List,{ref:n,className:K(`max-h-[300px] overflow-y-auto overflow-x-hidden`,e),...t}));b1.displayName=o1.List.displayName;var x1=v.forwardRef((e,t)=>(0,H.jsx)(o1.Empty,{ref:t,className:`py-6 text-center text-sm`,...e}));x1.displayName=o1.Empty.displayName;var S1=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(o1.Group,{ref:n,className:K(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,e),...t}));S1.displayName=o1.Group.displayName;var C1=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(o1.Separator,{ref:n,className:K(`-mx-1 h-px bg-border`,e),...t}));C1.displayName=o1.Separator.displayName;var w1=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(o1.Item,{ref:n,className:K(`relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,e),...t}));w1.displayName=o1.Item.displayName;var T1=({className:e,...t})=>(0,H.jsx)(`span`,{className:K(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...t});T1.displayName=`CommandShortcut`;var E1={image:`image/*`,video:`video/*`,audio:`audio/*`,document:`.pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.txt,.csv`};function D1(e){return!e||e.length===0?`*/*`:e.map(e=>E1[e]).join(`,`)}function O1(e){let t=e.replace(/_/g,` `).trim();return t?t.charAt(0).toUpperCase()+t.slice(1):`Value`}function k1(e){return e?e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`:`—`}function A1(e){return e?.startsWith(`image/`)??!1}async function j1(e,t){return NT(e,{folderId:t})}function M1(e,t){if(!t||t.length===0)return!0;let n=e??``;return t.some(e=>e===`image`?n.startsWith(`image/`):e===`video`?n.startsWith(`video/`):e===`audio`?n.startsWith(`audio/`):e===`document`?n.startsWith(`application/`)||n.startsWith(`text/`):!1)}var N1=30;function P1({open:e,onOpenChange:t,allowedTypes:n,selectionMode:r=`single`,onSelect:i}){let[a,o]=(0,v.useState)([{id:null,name:`Media`}]),s=a[a.length-1].id,[c,l]=(0,v.useState)([]),[u,d]=(0,v.useState)([]),[f,p]=(0,v.useState)(1),[m,h]=(0,v.useState)(!1),[g,_]=(0,v.useState)(1),[y,b]=(0,v.useState)(``),[x,S]=(0,v.useState)(``),[C,w]=(0,v.useState)([]);(0,v.useEffect)(()=>{let e=setTimeout(()=>{S(y),_(1)},300);return()=>clearTimeout(e)},[y]),(0,v.useEffect)(()=>{_(1),b(``),S(``)},[s]),(0,v.useEffect)(()=>{if(!e)return;h(!0);let t=s??``,n=x?`&search=${encodeURIComponent(x)}`:``;Promise.all([x?Promise.resolve([]):fetch(`/cms/admin/folders?parent_id=${t}`,{credentials:`include`}).then(e=>e.ok?e.json():{folders:[]}).then(e=>e.folders),fetch(`/cms/admin/media?folder_id=${t}&page=${g}&limit=${N1}${n}`,{credentials:`include`}).then(e=>e.ok?e.json():{items:[],pages:1})]).then(([e,t])=>{l(e),d(t.items),p(t.pages??1)}).catch(()=>{l([]),d([]),p(1)}).finally(()=>h(!1))},[e,s,g,x]),(0,v.useEffect)(()=>{e||(o([{id:null,name:`Media`}]),_(1),b(``),S(``),w([]))},[e]);function T(e){o(t=>[...t,{id:e.id,name:e.name}])}function E(e){o(t=>t.slice(0,e+1))}function D(e){if(r===`single`){i([e]),t(!1);return}w(t=>t.some(t=>t.id===e.id)?t.filter(t=>t.id!==e.id):[...t,e])}function O(e){let t=C.findIndex(t=>t.id===e);return t===-1?null:t+1}let k=u.filter(e=>M1(e.mime_type,n)),A=c.length===0&&k.length===0;return(0,H.jsx)(Yh,{open:e,onOpenChange:t,children:(0,H.jsxs)($h,{className:`max-w-3xl max-h-[90vh] flex flex-col overflow-hidden`,children:[(0,H.jsx)(eg,{children:(0,H.jsx)(ng,{children:`Media Library`})}),(0,H.jsxs)(`div`,{className:`relative shrink-0`,children:[(0,H.jsx)(Uo,{className:`absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground pointer-events-none`}),(0,H.jsx)(Z,{className:`pl-9 h-8`,placeholder:`Search media…`,value:y,onChange:e=>b(e.target.value)})]}),!x&&a.length>1&&(0,H.jsx)(`div`,{className:`flex items-center gap-1 text-sm shrink-0`,children:a.map((e,t)=>(0,H.jsxs)(`span`,{className:`flex items-center gap-1 text-muted-foreground`,children:[t>0&&(0,H.jsx)(`span`,{children:`/`}),t===a.length-1?(0,H.jsx)(`span`,{className:`font-medium text-foreground`,children:t===0?(0,H.jsx)(_o,{className:`size-3.5`}):e.name}):(0,H.jsx)(`button`,{onClick:()=>E(t),className:`hover:text-foreground transition-colors`,children:t===0?(0,H.jsx)(_o,{className:`size-3.5`}):e.name})]},`${e.id??`root`}:${e.name}`))}),m?(0,H.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-16`,children:(0,H.jsx)(BC,{className:`size-5`})}):A?(0,H.jsx)(`p`,{className:`flex-1 py-16 text-center text-sm text-muted-foreground`,children:x?`No matching files.`:u.length===0&&c.length===0?`No media found.`:`No matching files in this folder.`}):(0,H.jsxs)(`div`,{className:`flex flex-col gap-4 flex-1 min-h-0 overflow-y-auto pr-1`,children:[c.length>0&&(0,H.jsx)(`div`,{className:`grid grid-cols-1 gap-1.5 sm:grid-cols-2`,children:c.map(e=>(0,H.jsxs)(`button`,{type:`button`,onClick:()=>T(e),className:`flex items-center gap-2.5 rounded-md border bg-card px-2.5 py-2 text-left transition-colors hover:bg-muted/50 hover:border-primary`,children:[(0,H.jsx)(uo,{className:`size-7 shrink-0 text-muted-foreground`}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`p`,{className:`truncate text-xs font-bold leading-tight`,title:e.name,children:e.name}),(0,H.jsxs)(`p`,{className:`text-[10px] text-muted-foreground`,children:[e.item_count,` `,e.item_count===1?`item`:`items`]})]})]},e.id))}),k.length>0&&(0,H.jsx)(`div`,{className:`grid grid-cols-3 gap-2 sm:grid-cols-4 md:grid-cols-5`,children:k.map(e=>(0,H.jsxs)(`button`,{type:`button`,onClick:()=>D(e),className:K(`group relative overflow-hidden rounded-md border bg-card text-left transition-colors hover:border-primary`,O(e.id)!=null&&`border-primary ring-2 ring-primary/20`),children:[(0,H.jsx)(`div`,{className:`aspect-square bg-muted`,children:A1(e.mime_type)?(0,H.jsx)(`img`,{src:e.url,alt:e.filename,className:`h-full w-full object-cover`}):(0,H.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,H.jsx)(oo,{className:`size-6 text-muted-foreground`})})}),(0,H.jsxs)(`div`,{className:`p-1.5`,children:[(0,H.jsx)(`p`,{className:`truncate text-[11px] font-medium leading-tight`,title:e.filename,children:e.filename}),(0,H.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:k1(e.size)})]}),(0,H.jsx)(`div`,{className:K(`absolute inset-0 rounded-md ring-2 ring-primary ring-offset-1 transition-opacity pointer-events-none`,O(e.id)==null?`opacity-0 group-hover:opacity-100`:`opacity-100`)}),r===`multiple`&&O(e.id)!=null&&(0,H.jsx)(`div`,{className:`absolute right-1.5 top-1.5 flex size-6 items-center justify-center rounded-full bg-primary text-[11px] font-semibold text-primary-foreground shadow-sm`,children:O(e.id)})]},e.id))})]}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-t pt-2 shrink-0`,children:[(0,H.jsx)(`div`,{className:`flex items-center gap-2`,children:r===`multiple`&&C.length>0&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[C.length,` selected`]}),(0,H.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,className:`h-8 px-2 text-xs`,onClick:()=>w([]),children:`Clear`})]})}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[f>1&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`button`,{type:`button`,onClick:()=>_(e=>Math.max(1,e-1)),disabled:g===1,className:`text-sm text-muted-foreground hover:text-foreground disabled:opacity-40 disabled:pointer-events-none transition-colors`,children:`Previous`}),(0,H.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[g,` / `,f]}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>_(e=>Math.min(f,e+1)),disabled:g===f,className:`text-sm text-muted-foreground hover:text-foreground disabled:opacity-40 disabled:pointer-events-none transition-colors`,children:`Next`})]}),r===`multiple`&&(0,H.jsx)(q,{type:`button`,size:`sm`,disabled:C.length===0,onClick:()=>{i(C),t(!1)},children:`Insert selected`})]})]})]})})}function F1({value:e,onChange:t,allowedTypes:n,disabled:r=!1}){let i=(0,v.useRef)(null),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(null),[l,u]=(0,v.useState)(null),[d,f]=(0,v.useState)(!1),p=typeof e==`string`&&e.startsWith(`http`);(0,v.useEffect)(()=>{if(!e){u(null);return}if(p){u(e);return}fetch(`/cms/admin/media/${e}/url`,{credentials:`include`}).then(e=>e.ok?e.json():null).then(e=>u(e?.url??null)).catch(()=>u(null))},[e,p]);async function m(e){o(!0),c(null);try{let n=await j1(e);u(n.url),t(n.id)}catch(e){c(e instanceof Error?e.message:`Upload failed.`),X.error(`Upload failed`)}finally{o(!1),i.current&&(i.current.value=``)}}let h=l&&/\.(jpe?g|png|gif|webp|avif|svg)(\?|$)/i.test(l);return e?(0,H.jsxs)(`div`,{className:`relative w-full rounded-md border bg-muted/30 overflow-hidden`,children:[l?h?(0,H.jsx)(`img`,{src:l,alt:`Media`,className:`max-h-72 w-full object-contain`}):(0,H.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2`,children:[(0,H.jsx)(vo,{className:`size-4 text-muted-foreground shrink-0`}),(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground truncate`,children:l})]}):(0,H.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-muted-foreground`,children:[(0,H.jsx)(vo,{className:`size-4 shrink-0`}),(0,H.jsx)(`span`,{className:`text-xs`,children:`Loading…`})]}),(0,H.jsx)(q,{type:`button`,size:`icon`,variant:`secondary`,className:`absolute top-1.5 right-1.5 size-6`,onClick:()=>{t(null),u(null)},disabled:r,children:(0,H.jsx)(cs,{className:`size-3.5`})})]}):(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`input`,{ref:i,type:`file`,accept:D1(n),className:`hidden`,onChange:e=>{let t=e.target.files?.[0];t&&m(t)}}),(0,H.jsxs)(`div`,{onDragOver:e=>e.preventDefault(),onDrop:e=>{if(r)return;e.preventDefault();let t=e.dataTransfer.files[0];t&&m(t)},className:`flex w-full gap-2 rounded-md border border-dashed p-3`,children:[(0,H.jsxs)(`button`,{type:`button`,disabled:a||r,onClick:()=>i.current?.click(),className:`flex flex-1 items-center justify-center gap-2 rounded-md py-2 text-sm text-muted-foreground transition-colors hover:bg-muted/50 disabled:opacity-50`,children:[(0,H.jsx)(rs,{className:`size-4`}),a?`Uploading…`:`Upload`]}),(0,H.jsx)(`div`,{className:`w-px bg-border`}),(0,H.jsxs)(`button`,{type:`button`,disabled:a||r,onClick:()=>f(!0),className:`flex flex-1 items-center justify-center gap-2 rounded-md py-2 text-sm text-muted-foreground transition-colors hover:bg-muted/50 disabled:opacity-50`,children:[(0,H.jsx)(co,{className:`size-4`}),`Library`]})]}),s&&(0,H.jsx)(`p`,{className:`mt-1 text-xs text-destructive`,children:s}),(0,H.jsx)(P1,{open:d,onOpenChange:f,allowedTypes:n,selectionMode:`single`,onSelect:e=>{let n=e[0];n&&(u(n.url),t(n.id))}})]})}function I1({id:e,previewUrl:t,filename:n,onRemove:r,disabled:i=!1}){let{attributes:a,listeners:o,setNodeRef:s,transform:c,transition:l,isDragging:u}=pM({id:e});return(0,H.jsxs)(`div`,{ref:s,style:{transform:Ek.Transform.toString(c),transition:l,opacity:u?.4:1},className:`relative aspect-square overflow-hidden rounded-md border bg-muted`,children:[t?(0,H.jsx)(`img`,{src:t,alt:n,className:`h-full w-full object-cover`}):(0,H.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,H.jsx)(vo,{className:`size-5 text-muted-foreground`})}),n&&(0,H.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 bg-background/75 backdrop-blur-sm px-1.5 py-1 pointer-events-none`,children:(0,H.jsx)(`p`,{className:`truncate text-[10px] leading-none text-foreground`,children:n})}),(0,H.jsx)(`button`,{type:`button`,onClick:r,disabled:i,className:`absolute right-1 top-1 flex size-5 items-center justify-center rounded-full bg-background/80 text-foreground shadow-sm hover:bg-background`,children:(0,H.jsx)(cs,{className:`size-3`})}),!i&&(0,H.jsx)(`button`,{type:`button`,className:`absolute bottom-6 left-1 flex size-5 cursor-grab items-center justify-center rounded-full bg-background/80 text-foreground shadow-sm active:cursor-grabbing`,...o,...a,children:(0,H.jsx)(fo,{className:`size-3`})})]})}function L1({value:e,onChange:t,disabled:n=!1}){let r=Array.isArray(e)?e:[],[,i]=(0,v.useState)(0),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(null),[l,u]=(0,v.useState)(!1),d=(0,v.useRef)(null),f=(0,v.useRef)({}),p=(0,v.useRef)({}),m=r.join(`,`),h=Hk(Vk(HA,{activationConstraint:{distance:5}}));(0,v.useEffect)(()=>{let e=r.filter(e=>!e.startsWith(`http`)&&!(e in f.current));e.length!==0&&Promise.all(e.map(e=>fetch(`/cms/admin/media/${e}/url`,{credentials:`include`}).then(e=>e.ok?e.json():null).then(t=>t?[e,t.url]:null).catch(()=>null))).then(e=>{let t=!1;for(let n of e)n&&(f.current[n[0]]=n[1],t=!0);t&&i(e=>e+1)})},[m]),(0,v.useEffect)(()=>{let e=r.filter(e=>!e.startsWith(`http`)&&!(e in p.current));e.length!==0&&fetch(`/cms/admin/media`,{credentials:`include`}).then(e=>e.ok?e.json():{items:[]}).then(t=>{let n=!1;for(let r of t.items)e.includes(r.id)&&(p.current[r.id]=r.filename,n=!0);n&&i(e=>e+1)}).catch(()=>{})},[m]);function g(e){return e.startsWith(`http`)?e:f.current[e]??null}function _(e){return p.current[e]??``}function y(e){if(n)return;let{active:i,over:a}=e;!a||i.id===a.id||t(Jj(r,r.indexOf(i.id),r.indexOf(a.id)))}async function b(e){if(e.length===0)return;o(!0),c(null);let n=r;try{for(let r of e){let e=await j1(r);f.current[e.id]=e.url,p.current[e.id]=r.name,i(e=>e+1),n=[...n,e.id],t(n)}}catch(e){c(e instanceof Error?e.message:`Upload failed.`),X.error(`Upload failed`)}finally{o(!1),d.current&&(d.current.value=``)}}return(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(`input`,{ref:d,type:`file`,accept:`image/*`,multiple:!0,className:`hidden`,onChange:e=>{b(Array.from(e.target.files??[]))}}),r.length>0&&(0,H.jsx)(zj,{sensors:h,collisionDetection:Yk,onDragEnd:y,children:(0,H.jsx)(aM,{items:r,strategy:$j,children:(0,H.jsx)(`div`,{className:`grid grid-cols-3 gap-2 sm:grid-cols-4`,children:r.map(e=>(0,H.jsx)(I1,{id:e,previewUrl:g(e),filename:_(e),onRemove:()=>t(r.filter(t=>t!==e)),disabled:n},e))})})}),(0,H.jsxs)(`div`,{className:`flex w-full gap-2 rounded-md border border-dashed p-3`,children:[(0,H.jsxs)(`button`,{type:`button`,disabled:a||n,onClick:()=>d.current?.click(),className:`flex flex-1 items-center justify-center gap-2 rounded-md py-2 text-sm text-muted-foreground transition-colors hover:bg-muted/50 disabled:opacity-50`,children:[(0,H.jsx)(rs,{className:`size-4`}),a?`Uploading…`:`Upload`]}),(0,H.jsx)(`div`,{className:`w-px bg-border`}),(0,H.jsxs)(`button`,{type:`button`,disabled:a||n,onClick:()=>u(!0),className:`flex flex-1 items-center justify-center gap-2 rounded-md py-2 text-sm text-muted-foreground transition-colors hover:bg-muted/50 disabled:opacity-50`,children:[(0,H.jsx)(co,{className:`size-4`}),`Library`]})]}),s&&(0,H.jsx)(`p`,{className:`text-xs text-destructive`,children:s}),(0,H.jsx)(P1,{open:l,onOpenChange:u,allowedTypes:[`image`],selectionMode:`multiple`,onSelect:e=>{if(e.length===0)return;let n=new Set(r),i=[...r],a={},o={};for(let t of e)n.has(t.id)||(n.add(t.id),i.push(t.id),a[t.id]=t.url,o[t.id]=t.filename);Object.keys(a).length>0&&setUrlCache(e=>({...e,...a})),Object.keys(o).length>0&&setNameCache(e=>({...e,...o})),i.length!==r.length&&t(i)}})]})}function R1({value:e,onChange:t,disabled:n=!1}){let[r,i]=(0,v.useState)(()=>e!=null&&e!==``?String(e):``);(0,v.useEffect)(()=>{if(e==null||e===``){i(``);return}let t=typeof e==`number`?e:parseFloat(String(e));!isNaN(t)&&t!==parseFloat(r)&&i(String(t))},[e]);function a(e){let n=e.target.value.replace(`,`,`.`);if(i(n),n===``||n===`-`){t(null);return}let r=parseFloat(n);isNaN(r)||t(r)}return(0,H.jsx)(Z,{type:`text`,inputMode:`decimal`,className:K(`w-full`,`text-base!`),value:r,placeholder:`0.00`,onChange:a,disabled:n})}function z1(e){if(typeof e==`object`&&e){let t=e;if(t.kind===`string`&&typeof t.value==`string`)return{kind:`string`,value:t.value};if(t.kind===`number`&&typeof t.value==`number`&&!isNaN(t.value))return{kind:`number`,value:t.value};if(t.kind===`boolean`&&typeof t.value==`boolean`)return{kind:`boolean`,value:t.value}}return typeof e==`number`&&!isNaN(e)?{kind:`number`,value:e}:typeof e==`boolean`?{kind:`boolean`,value:e}:{kind:`string`,value:typeof e==`string`?e:``}}function B1({value:e,onChange:t,inputId:n,disabled:r=!1}){let i=z1(e);function a(e){e===`string`&&t({kind:e,value:``}),e===`number`&&t({kind:e,value:0}),e===`boolean`&&t({kind:e,value:!1})}return(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(`div`,{className:`inline-flex items-center gap-1 rounded-md border border-border p-1`,children:[`string`,`number`,`boolean`].map(e=>(0,H.jsx)(`button`,{type:`button`,disabled:r,onClick:()=>a(e),className:K(`rounded px-2 py-1 text-xs transition-colors`,i.kind===e?`bg-accent text-accent-foreground`:`text-muted-foreground hover:bg-accent/60`),children:e===`string`?`Text`:e===`number`?`Number`:`Boolean`},e))}),i.kind===`string`&&(0,H.jsx)(Z,{className:K(`w-full`,`text-base md:text-base`),value:String(i.value),placeholder:`Value`,onChange:e=>t({kind:`string`,value:e.target.value}),disabled:r}),i.kind===`number`&&(0,H.jsx)(R1,{value:i.value,onChange:e=>t({kind:`number`,value:typeof e==`number`&&!isNaN(e)?e:0}),disabled:r}),i.kind===`boolean`&&(0,H.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,H.jsx)(FT,{id:n,checked:!!i.value,onCheckedChange:e=>t({kind:`boolean`,value:!!e}),disabled:r}),(0,H.jsx)(Y,{htmlFor:n,className:`cursor-pointer font-normal text-base`,children:i.value?`True`:`False`})]})]})}function V1({value:e,onChange:t,timezone:n,disabled:r=!1}){let[i,a]=(0,v.useState)(!1),[o,s]=(0,v.useState)(),[c,l]=(0,v.useState)(`00:00`);(0,v.useEffect)(()=>{if(!e){s(void 0),l(`00:00`);return}let t=new Date(e);isNaN(t.getTime())||(s(t),l(lv(e,n)))},[e,n]);function u(e){s(e),a(!1),e&&t(uv(e,c,n))}function d(e){l(e),o&&t(uv(o,e,n))}return(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsxs)($P,{open:i&&!r,onOpenChange:a,children:[(0,H.jsx)(eF,{asChild:!0,children:(0,H.jsxs)(q,{variant:`outline`,className:`w-40 justify-between font-normal text-base`,disabled:r,children:[o?WO(o,`MMM d, yyyy`):`Select date`,(0,H.jsx)(Va,{className:`size-4 opacity-50`})]})}),(0,H.jsx)(tF,{className:`w-auto overflow-hidden p-0`,align:`start`,children:(0,H.jsx)(ZP,{mode:`single`,selected:o,captionLayout:`dropdown`,defaultMonth:o,onSelect:u})})]}),(0,H.jsx)(Z,{type:`time`,className:`w-32 appearance-none bg-background [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:appearance-none text-base!`,value:c,onChange:e=>d(e.target.value),disabled:r}),e&&(0,H.jsx)(q,{type:`button`,variant:`ghost`,size:`icon`,className:`size-8 text-muted-foreground hover:text-foreground`,onClick:()=>{s(void 0),l(`00:00`),t(null)},disabled:r,children:(0,H.jsx)(cs,{className:`size-3.5`})})]})}function H1(e){return e.find(e=>e.name===`title`)?.name??e.find(e=>e.name===`name`)?.name??e.find(e=>e.type===`uid`)?.name??e.find(e=>e.type===`string`)?.name??e.find(e=>e.type===`text`)?.name??null}var U1={data:null,promise:null};function W1(){return U1.data?Promise.resolve(U1.data):(U1.promise||=fetch(`/cms/admin/content-types`,{credentials:`include`}).then(e=>e.ok?e.json():[]).then(e=>(U1.data=e,e)).catch(()=>[]),U1.promise)}function G1(e,t){return e.find(e=>e.tableName===t)??null}function K1(e,t,n){return fetch(`/cms/admin/content-types/${e}/entries?page=${t}&limit=${n}`,{credentials:`include`}).then(e=>e.ok?e.json():{data:[],total:0,page:t,limit:n}).catch(()=>({data:[],total:0,page:t,limit:n}))}async function q1(e){let t=await K1(e,1,100),n=Math.max(1,Math.ceil(t.total/100));return n===1?{data:t.data}:{data:[t,...await Promise.all(Array.from({length:n-1},(t,n)=>K1(e,n+2,100)))].flatMap(e=>e.data)}}function J1(e){let[t,n]=(0,v.useState)([]),[r,i]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{e&&(i(!0),W1().then(t=>{let n=G1(t,e);return n?q1(n.slug).then(e=>({ctDef:n,res:e})):Promise.resolve({ctDef:null,res:{data:[]}})}).then(({ctDef:e,res:t})=>{let r=e?H1(e.fields??[]):null;n(t.data.map(e=>({id:String(e.id),label:String((r&&e[r])??e.title??e.name??e.id)})))}).catch(()=>n([])).finally(()=>i(!1)))},[e]),{entries:t,loading:r}}function Y1(e,t,n){let[r,i]=(0,v.useState)([]),[a,o]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{if(!e||!n){i([]);return}o(!0),W1().then(t=>{let n=G1(t,e);return n?q1(n.slug).then(e=>({ctDef:n,res:e})):Promise.resolve({ctDef:null,res:{data:[]}})}).then(({ctDef:e,res:r})=>{let a=e?H1(e.fields??[]):null;i(r.data.filter(e=>String(e[t]??``)===n).map(e=>({id:String(e.id),label:String((a&&e[a])??e.title??e.name??e.id)})))}).catch(()=>i([])).finally(()=>o(!1))},[e,t,n]),{entries:r,loading:a}}function X1({relatedTable:e,relatedField:t,currentId:n}){let{entries:r,loading:i}=Y1(e,t,n);return n?i?(0,H.jsxs)(`div`,{className:`flex items-center gap-2 py-1`,children:[(0,H.jsx)(BC,{className:`size-3.5`}),(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Loading…`})]}):r.length===0?(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No linked entries.`}):(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:r.map(e=>(0,H.jsx)(`span`,{className:`inline-flex items-center rounded-md border bg-muted px-2 py-0.5 text-xs`,children:e.label},e.id))}):(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Save this entry first to see linked items.`})}function Z1({relationType:e,relatedTable:t,relatedField:n,currentEntryId:r,value:i,onChange:a,disabled:o=!1}){let s=e===`many-to-many`,[c,l]=(0,v.useState)(!1),u=(0,v.useId)(),{entries:d,loading:f}=J1(t);if(e===`one-to-many`)return(0,H.jsx)(X1,{relatedTable:t,relatedField:n,currentId:r});let p=s?Array.isArray(i)?i:[]:i&&!Array.isArray(i)?[i]:[];function m(e){return d.find(t=>t.id===e)?.label??e}function h(e){if(s){let t=p.includes(e)?p.filter(t=>t!==e):[...p,e];a(t.length>0?t:null)}else a(p[0]===e?null:e),l(!1)}function g(e){if(s){let t=p.filter(t=>t!==e);a(t.length>0?t:null)}else a(null)}let _=s?p.length>0?`${p.length} selected`:`Select entries…`:p.length>0?m(p[0]):`Select entry…`;return(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsxs)($P,{open:c&&!o,onOpenChange:l,children:[(0,H.jsx)(eF,{asChild:!0,children:(0,H.jsxs)(q,{variant:`outline`,role:`combobox`,"aria-expanded":c,"aria-controls":u,className:`w-full justify-between font-normal text-base`,disabled:o,children:[(0,H.jsx)(`span`,{className:`truncate text-left`,children:_}),(0,H.jsx)(Ga,{className:`ml-2 size-4 shrink-0 opacity-50`})]})}),(0,H.jsx)(tF,{className:`w-(--radix-popover-trigger-width) p-0`,align:`start`,children:(0,H.jsxs)(v1,{children:[(0,H.jsx)(y1,{placeholder:`Search…`}),(0,H.jsx)(b1,{id:u,children:f?(0,H.jsx)(`div`,{className:`flex items-center justify-center py-6`,children:(0,H.jsx)(BC,{className:`size-4`})}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(x1,{children:`No entries found.`}),(0,H.jsx)(S1,{children:d.map(e=>{let t=p.includes(e.id);return(0,H.jsxs)(w1,{value:e.label,onSelect:()=>{o||h(e.id)},children:[(0,H.jsx)(Ba,{className:`mr-2 size-4 ${t?`opacity-100`:`opacity-0`}`}),(0,H.jsx)(`span`,{className:`truncate`,children:e.label}),(0,H.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground opacity-60 shrink-0`,children:e.id.slice(0,8)})]},e.id)})})]})})]})})]}),p.length>0&&(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:p.map(e=>(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border bg-muted px-2 py-0.5 text-xs`,children:[m(e),(0,H.jsx)(`button`,{type:`button`,onClick:()=>g(e),disabled:o,className:`text-muted-foreground hover:text-foreground`,children:(0,H.jsx)(cs,{className:`size-3`})})]},e))})]})}var Q1={full:`col-span-6`,"two-thirds":`col-span-4`,half:`col-span-3`,third:`col-span-2`};function $1({field:e,value:t,onChange:n,disabled:r=!1}){let i=Array.isArray(t)?t:[],a=e.arrayFields??[];function o(){return Object.fromEntries(a.map(e=>[e.name,e.type===`boolean`?!1:null]))}function s(){n([...i,o()])}function c(e){n(i.filter((t,n)=>n!==e))}function l(e,t){let r=e+t;if(r<0||r>=i.length)return;let a=[...i];[a[e],a[r]]=[a[r],a[e]],n(a)}function u(e,t,r){n(i.map((n,i)=>i===e?{...n,[t]:r}:n))}return a.length===0?(0,H.jsx)(`div`,{className:`flex w-full items-center justify-center rounded-md border border-dashed p-4 text-xs text-muted-foreground`,children:`No sub-fields defined for this array.`}):(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(hM,{type:`single`,collapsible:!0,className:`w-full`,children:i.map((e,t)=>(0,H.jsxs)(gM,{value:`item-${t}`,className:`mb-2 rounded-md border border-dashed last:border-b transition-colors hover:bg-accent/50`,children:[(0,H.jsxs)(`div`,{className:`relative data-[state=open]:border-b data-[state=open]:border-border/50`,children:[(0,H.jsxs)(_M,{className:`w-full py-2 pl-3 pr-24 text-muted-foreground [&>svg]:hidden`,children:[`Item `,t+1]}),(0,H.jsxs)(`div`,{className:`absolute right-2 top-1/2 flex -translate-y-1/2 items-center gap-0.5`,children:[(0,H.jsx)(q,{size:`icon`,variant:`ghost`,disabled:r||t===0,onMouseDown:e=>e.stopPropagation(),onClick:()=>l(t,-1),className:`flex size-6 items-center justify-center rounded text-muted-foreground hover:bg-accent disabled:opacity-30`,children:(0,H.jsx)(Wa,{className:`size-3.5`})}),(0,H.jsx)(q,{size:`icon`,variant:`ghost`,disabled:r||t===i.length-1,onMouseDown:e=>e.stopPropagation(),onClick:()=>l(t,1),className:`flex size-6 items-center justify-center rounded text-muted-foreground hover:bg-accent disabled:opacity-30`,children:(0,H.jsx)(Va,{className:`size-3.5`})}),(0,H.jsx)(`button`,{type:`button`,onMouseDown:e=>e.stopPropagation(),onClick:()=>c(t),disabled:r,className:`flex size-6 items-center justify-center rounded text-destructive transition-colors hover:bg-destructive/10 hover:text-destructive`,children:(0,H.jsx)(Qo,{className:`size-3.5`})})]})]}),(0,H.jsx)(vM,{className:`px-3 pt-3`,children:(0,H.jsx)(`div`,{className:`grid grid-cols-6 gap-3`,children:a.map(n=>(0,H.jsxs)(`div`,{className:Q1[n.width??`full`]??`col-span-6`,children:[(0,H.jsx)(`div`,{className:`mb-1 flex items-center gap-1`,children:(0,H.jsxs)(Y,{className:`text-xs font-medium`,children:[n.name,n.required&&(0,H.jsx)(`span`,{className:`ml-0.5 text-destructive`,children:`*`})]})}),(0,H.jsx)(a0,{field:{...n,type:n.type},value:e[n.name]??null,onChange:e=>u(t,n.name,e),allValues:e,disabled:r})]},n.name))})})]},t))}),(0,H.jsxs)(`button`,{type:`button`,onClick:s,disabled:r,className:`flex w-full items-center justify-center gap-1.5 rounded-md border border-dashed py-2 text-xs text-muted-foreground transition-colors hover:bg-accent/50`,children:[(0,H.jsx)(Lo,{className:`size-3.5`}),`Add item`]})]})}var e0=3,t0=20;function n0({value:e,onChange:t,disabled:n=!1,depth:r=0}){let i=Array.isArray(e)?e:[],a=r+1<e0,o=i.length<t0;function s(){return{label:``,href:``}}function c(e,n){let r=(t,i)=>{let a=e[i];return t.map((t,o)=>{if(o!==a)return t;if(i===e.length-1)return n(t);let s=Array.isArray(t.items)?t.items:[];return{...t,items:r(s,i+1)}})};t(r(i,0))}function l(e,n){let r=(t,i)=>{if(i===e.length-1){let r=e[i],a=r+n;if(a<0||a>=t.length)return t;let o=[...t];return[o[r],o[a]]=[o[a],o[r]],o}let a=e[i];return t.map((e,t)=>{if(t!==a)return e;let n=Array.isArray(e.items)?e.items:[];return{...e,items:r(n,i+1)}})};t(r(i,0))}function u(e){let n=(t,r)=>{let i=e[r];return r===e.length-1?t.filter((e,t)=>t!==i):t.map((e,t)=>{if(t!==i)return e;let a=Array.isArray(e.items)?e.items:[];return{...e,items:n(a,r+1)}})};t(n(i,0))}function d(){o&&t([...i,s()])}return i.length===0?(0,H.jsxs)(`button`,{type:`button`,onClick:d,disabled:n||!o,className:`flex w-full items-center justify-center gap-1.5 rounded-md border border-dashed py-2 text-xs text-muted-foreground transition-colors hover:bg-accent/20`,children:[(0,H.jsx)(Lo,{className:`size-3.5`}),`Add item`]}):(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(hM,{type:`single`,collapsible:!0,className:`w-full`,children:i.map((e,t)=>{let o=[t],s=e.label?.trim()?e.label:`Item ${t+1}`;return(0,H.jsxs)(gM,{value:`navigation-item-${r}-${t}`,className:`mb-2 rounded-md border border-dashed last:border-b transition-colors hover:bg-accent/50`,children:[(0,H.jsxs)(`div`,{className:`relative data-[state=open]:border-b data-[state=open]:border-border/50`,children:[(0,H.jsx)(_M,{className:`w-full py-2 pl-3 pr-24 text-muted-foreground [&>svg]:hidden`,children:s}),(0,H.jsxs)(`div`,{className:`absolute right-2 top-1/2 flex -translate-y-1/2 items-center gap-0.5`,children:[(0,H.jsx)(q,{size:`icon`,variant:`ghost`,disabled:n||t===0,onMouseDown:e=>e.stopPropagation(),onClick:()=>l(o,-1),className:`flex size-6 items-center justify-center rounded text-muted-foreground hover:bg-accent disabled:opacity-30`,children:(0,H.jsx)(Wa,{className:`size-3.5`})}),(0,H.jsx)(q,{size:`icon`,variant:`ghost`,disabled:n||t===i.length-1,onMouseDown:e=>e.stopPropagation(),onClick:()=>l(o,1),className:`flex size-6 items-center justify-center rounded text-muted-foreground hover:bg-accent disabled:opacity-30`,children:(0,H.jsx)(Va,{className:`size-3.5`})}),(0,H.jsx)(`button`,{type:`button`,onMouseDown:e=>e.stopPropagation(),onClick:()=>u(o),disabled:n,className:`flex size-6 items-center justify-center rounded text-destructive transition-colors hover:bg-destructive/10 hover:text-destructive`,children:(0,H.jsx)(Qo,{className:`size-3.5`})})]})]}),(0,H.jsxs)(vM,{className:`px-3 pt-3`,children:[(0,H.jsxs)(`div`,{className:`grid grid-cols-6 gap-3`,children:[(0,H.jsxs)(`div`,{className:`col-span-3`,children:[(0,H.jsx)(Y,{className:`mb-1 block text-xs font-medium`,children:`label`}),(0,H.jsx)(Z,{className:`text-base`,value:e.label??``,onChange:e=>c(o,t=>({...t,label:e.target.value})),disabled:n})]}),(0,H.jsxs)(`div`,{className:`col-span-3`,children:[(0,H.jsx)(Y,{className:`mb-1 block text-xs font-medium`,children:`href`}),(0,H.jsx)(Z,{className:`text-base`,value:e.href??``,onChange:e=>c(o,t=>({...t,href:e.target.value})),disabled:n})]})]}),a?(0,H.jsxs)(`div`,{className:`mt-3 border-l border-border pl-3`,children:[(0,H.jsx)(`p`,{className:`mb-2 text-[11px] uppercase tracking-wide text-muted-foreground`,children:`Child items`}),(0,H.jsx)(n0,{value:e.items??[],onChange:e=>c(o,t=>({...t,items:Array.isArray(e)&&e.length>0?e:void 0})),disabled:n,depth:r+1})]}):(0,H.jsxs)(`p`,{className:`mt-3 text-[11px] text-muted-foreground`,children:[`Maximum depth reached (`,e0,` levels).`]})]})]},t)})}),(0,H.jsxs)(`button`,{type:`button`,onClick:d,disabled:n,className:`flex w-full items-center justify-center gap-1.5 rounded-md border border-dashed py-2 text-xs text-muted-foreground transition-colors hover:bg-accent/50`,children:[(0,H.jsx)(Lo,{className:`size-3.5`}),`Add item`]}),!o&&(0,H.jsxs)(`p`,{className:`text-[11px] text-muted-foreground`,children:[`Maximum `,t0,` items allowed per level.`]})]})}function r0(e){return e.normalize(`NFD`).replace(/[\u0300-\u036f]/g,``).toLowerCase().replace(/\s+/g,`-`).replace(/[^a-z0-9-]/g,``).replace(/^-+|-+$/g,``)}function i0({value:e,onChange:t,disabled:n=!1}){let r=(0,v.useRef)(null),i=(0,v.useRef)(null),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(!1),[d,f]=(0,v.useState)(null);function p(){return o(!0),new Promise(e=>{i.current=e})}function m(e){i.current?.(e),i.current=null}function h(e){e||m(null),o(e)}async function g(e){u(!0),f(null);try{let t=await NT(e);m([{id:t.id,src:t.url,filename:t.filename,alt:t.alt,title:t.caption,width:t.width,height:t.height}]),o(!1)}catch(e){f(e instanceof Error?e.message:`Upload failed.`)}finally{u(!1),r.current&&(r.current.value=``)}}return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:n?`pointer-events-none opacity-70`:``,children:(0,H.jsx)(S$,{value:String(e??``),onChange:t,placeholder:`Type or add your content here...`,onInsertImage:p})}),(0,H.jsx)(Yh,{open:a,onOpenChange:h,children:(0,H.jsxs)($h,{className:`max-w-sm`,children:[(0,H.jsx)(eg,{children:(0,H.jsx)(ng,{children:`Insert Image`})}),(0,H.jsx)(`input`,{ref:r,type:`file`,accept:`image/*`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];t&&g(t)}}),(0,H.jsxs)(`div`,{onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault();let t=e.dataTransfer.files[0];t&&g(t)},className:`flex w-full gap-2 rounded-md border border-dashed p-3`,children:[(0,H.jsxs)(`button`,{type:`button`,disabled:l,onClick:()=>r.current?.click(),className:`flex flex-1 items-center justify-center gap-2 rounded-md py-2 text-sm text-muted-foreground transition-colors hover:bg-muted/50 disabled:opacity-50`,children:[(0,H.jsx)(rs,{className:`size-4`}),l?`Uploading…`:`Upload`]}),(0,H.jsx)(`div`,{className:`w-px bg-border`}),(0,H.jsxs)(`button`,{type:`button`,disabled:l,onClick:()=>c(!0),className:`flex flex-1 items-center justify-center gap-2 rounded-md py-2 text-sm text-muted-foreground transition-colors hover:bg-muted/50 disabled:opacity-50`,children:[(0,H.jsx)(co,{className:`size-4`}),`Library`]})]}),d&&(0,H.jsx)(`p`,{className:`mt-1 text-xs text-destructive`,children:d})]})}),(0,H.jsx)(P1,{open:s,onOpenChange:e=>{!e&&!a&&m(null),c(e)},allowedTypes:[`image`],selectionMode:`multiple`,onSelect:e=>{m(e.map(e=>({id:e.id,src:e.url,filename:e.filename,alt:e.alt,title:e.caption,width:e.width,height:e.height}))),c(!1),o(!1)}})]})}function a0({field:e,value:t,onChange:n,allValues:r,disabled:i,errorMessage:a}){let o=(0,v.useRef)(null),{timezone:s}=Sa();(0,v.useEffect)(()=>{if(e.type!==`uid`||!e.targetField)return;let i=String(t??``).trim(),a=i===``||i===o.current,s=r,c=e.targetField,l=!!s.__localizationEnabled,u=s[c];if(u!=null&&String(u).trim()!==``){if(!a)return;let e=r0(String(u));e!==i&&(o.current=e,n(e));return}let d=s.localized&&typeof s.localized==`object`?s.localized:{};if(l){let e=typeof s.__defaultLocale==`string`?s.__defaultLocale:void 0,t=e&&d[e]&&typeof d[e]==`object`?d[e]:null;if(t&&t[c]!==void 0&&String(t[c]).trim()!==``){if(!a)return;let e=r0(String(t[c]));e!==i&&(o.current=e,n(e))}return}let f=Object.keys(d).filter(e=>!e.startsWith(`_`));for(let e of f){let t=d[e]&&typeof d[e]==`object`?d[e]:null;if(t&&t[c]!==void 0&&String(t[c]).trim()!==``){if(!a)return;let e=r0(String(t[c]));e!==i&&(o.current=e,n(e));return}}},[t,e.type,e.targetField,r[e.targetField??``],JSON.stringify(r.localized??{}),r.__localizationEnabled]);let c=`w-full`;return e.type===`boolean`?(0,H.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,H.jsx)(FT,{id:`field-${e.name}`,checked:!!t,onCheckedChange:e=>n(!!e),disabled:!!i}),(0,H.jsx)(Y,{htmlFor:`field-${e.name}`,className:`cursor-pointer font-normal text-base`,children:t?`Yes`:`No`})]}):e.type===`richtext`?(0,H.jsx)(i0,{value:t,onChange:n,disabled:!!i}):e.type===`text`?(0,H.jsx)(uE,{className:K(c,`text-base`),value:String(t??``),placeholder:O1(e.name),onChange:e=>n(e.target.value),disabled:!!i}):e.type===`number`?e.subtype===`float`?(0,H.jsx)(R1,{value:t,onChange:n,disabled:!!i}):(0,H.jsx)(Z,{type:`number`,className:K(c,`text-base!`),value:t==null?``:String(t),step:`1`,placeholder:`0`,onChange:e=>{let t=e.target.value;if(t===``){n(null);return}n(parseInt(t,10))},disabled:!!i}):e.type===`datetime`?(0,H.jsx)(V1,{value:t,onChange:n,timezone:s,disabled:!!i}):e.type===`uid`?(0,H.jsxs)(`div`,{children:[(0,H.jsx)(Z,{className:K(c,`text-base md:text-base`,a?`border-destructive focus-visible:ring-destructive/20`:``),value:String(t??``),placeholder:`auto-generated`,onChange:e=>{n(e.target.value)},disabled:!!i}),a&&(0,H.jsx)(`p`,{className:`mt-1 text-xs text-destructive`,children:a})]}):e.type===`media`?(0,H.jsx)(F1,{value:t,onChange:n,allowedTypes:e.allowedTypes,disabled:!!i}):e.type===`media-gallery`?(0,H.jsx)(L1,{value:t,onChange:n,disabled:!!i}):e.type===`relation`?(0,H.jsx)(Z1,{relationType:e.relationType??`many-to-one`,relatedTable:e.relatedTable??``,relatedField:e.relatedField??``,currentEntryId:String(r.id??``),value:t,onChange:n,disabled:!!i}):e.type===`array`?(0,H.jsx)($1,{field:e,value:t,onChange:n,disabled:!!i}):e.type===`mixed`?(0,H.jsx)(B1,{value:t,onChange:n,inputId:`field-${e.name}-mixed-boolean`,disabled:!!i}):e.type===`navigation`?(0,H.jsx)(n0,{value:t,onChange:n,disabled:!!i}):(0,H.jsx)(Z,{className:K(c,`text-base md:text-base`),value:String(t??``),placeholder:O1(e.name),onChange:e=>n(e.target.value),disabled:!!i})}function o0(e,t){switch(e){case`string`:return{icon:es,label:`Text (string)`,color:`text-blue-600`,bg:`bg-blue-50`};case`text`:return{icon:Yo,label:`Long text (string)`,color:`text-sky-600`,bg:`bg-sky-50`};case`richtext`:return{icon:ao,label:`Rich text (blocks)`,color:`text-violet-600`,bg:`bg-violet-50`};case`number`:return{icon:po,label:t===`float`?`Decimal (number)`:`Integer (number)`,color:`text-orange-600`,bg:`bg-orange-50`};case`boolean`:return{icon:Zo,label:`Boolean`,color:`text-emerald-600`,bg:`bg-emerald-50`};case`datetime`:return{icon:Ra,label:`Date & time`,color:`text-amber-600`,bg:`bg-amber-50`};case`media`:return{icon:vo,label:`Media`,color:`text-rose-600`,bg:`bg-rose-50`};case`mixed`:return{icon:To,label:`Mixed value`,color:`text-fuchsia-600`,bg:`bg-fuchsia-50`};case`media-gallery`:return{icon:wo,label:`Media Gallery`,color:`text-pink-600`,bg:`bg-pink-50`};case`relation`:return{icon:Eo,label:`Relation`,color:`text-indigo-600`,bg:`bg-indigo-50`};case`uid`:return{icon:so,label:`UID`,color:`text-teal-600`,bg:`bg-teal-50`};case`array`:return{icon:To,label:`Array`,color:`text-cyan-600`,bg:`bg-cyan-50`};case`navigation`:return{icon:Oo,label:`Navigation`,color:`text-cyan-600`,bg:`bg-cyan-50`}}}var s0={full:`col-span-6`,"two-thirds":`col-span-4`,half:`col-span-3`,third:`col-span-2`},c0={string:`half`,text:`full`,richtext:`full`,number:`third`,boolean:`third`,datetime:`half`,media:`half`,"media-gallery":`full`,relation:`half`,uid:`half`,array:`full`,navigation:`full`};function l0({width:e}){let t=`rounded-sm bg-current`;return e===`full`?(0,H.jsx)(`div`,{className:`flex w-4 gap-px`,children:(0,H.jsx)(`div`,{className:`${t} h-2 w-full`})}):e===`two-thirds`?(0,H.jsxs)(`div`,{className:`flex w-4 gap-px`,children:[(0,H.jsx)(`div`,{className:`${t} h-2 flex-1`}),(0,H.jsx)(`div`,{className:`${t} h-2 flex-1`}),(0,H.jsx)(`div`,{className:`h-2 flex-1 rounded-sm bg-current opacity-25`})]}):e===`half`?(0,H.jsxs)(`div`,{className:`flex w-4 gap-px`,children:[(0,H.jsx)(`div`,{className:`${t} h-2 flex-1`}),(0,H.jsx)(`div`,{className:`${t} h-2 flex-1`})]}):(0,H.jsxs)(`div`,{className:`flex w-4 gap-px`,children:[(0,H.jsx)(`div`,{className:`${t} h-2 flex-1`}),(0,H.jsx)(`div`,{className:`h-2 flex-1 rounded-sm bg-current opacity-25`}),(0,H.jsx)(`div`,{className:`h-2 flex-1 rounded-sm bg-current opacity-25`})]})}var u0=[{value:`full`,label:`Full width`},{value:`half`,label:`Half`},{value:`third`,label:`1/3`},{value:`two-thirds`,label:`2/3`}];function d0({field:e,onWidthChange:t,onArraySubFieldWidthChange:n,onEdit:r,onDelete:i,dragListeners:a,dragAttributes:o}){let{icon:s,label:c,color:l,bg:u}=o0(e.type,e.subtype),d=e.width??`full`,f=!!a,p=e.type===`array`;return(0,H.jsxs)(`div`,{className:`rounded-lg border border-border bg-card shadow-xs`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-3`,children:[f&&(0,H.jsx)(`button`,{type:`button`,className:`flex shrink-0 cursor-grab items-center text-muted-foreground/40 hover:text-muted-foreground active:cursor-grabbing`,...a,...o,children:(0,H.jsx)(fo,{className:`size-4`})}),(0,H.jsx)(`div`,{className:`flex size-8 shrink-0 items-center justify-center rounded-md ${u}`,children:(0,H.jsx)(s,{className:`size-4 ${l}`})}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,H.jsxs)(`p`,{className:`truncate text-sm font-medium leading-tight`,children:[e.name,e.required&&(0,H.jsx)(`span`,{className:`ml-1 text-destructive`,children:`*`})]}),e.relationType===`one-to-many`&&(0,H.jsx)(`span`,{className:`shrink-0 rounded border border-indigo-200 bg-indigo-50 px-1 py-px text-[10px] font-medium text-indigo-600`,children:`Auto`})]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.relationType===`one-to-many`?`Inverse relation · read-only`:c})]}),t&&!p&&(0,H.jsx)(`div`,{className:`flex shrink-0 items-center gap-px rounded-md border border-border p-0.5`,children:u0.map(({value:e,label:n})=>(0,H.jsx)(`button`,{type:`button`,title:n,onClick:()=>t(e),className:[`flex items-center justify-center rounded px-1.5 py-1 transition-colors`,d===e?`bg-foreground text-background`:`text-muted-foreground hover:text-foreground`].join(` `),children:(0,H.jsx)(l0,{width:e})},e))}),(r||i)&&(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[r&&(0,H.jsx)(`button`,{type:`button`,title:`Edit field`,onClick:r,className:`flex size-7 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground`,children:(0,H.jsx)(Io,{className:`size-3.5`})}),i&&(0,H.jsx)(`button`,{type:`button`,title:`Delete field`,onClick:i,className:`flex size-7 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive`,children:(0,H.jsx)(Qo,{className:`size-3.5`})})]})]}),p&&e.arrayFields&&e.arrayFields.length>0&&(0,H.jsx)(`div`,{className:`grid grid-cols-6 gap-2 px-3 pb-3`,children:e.arrayFields.map(e=>{let t=o0(e.type,e.subtype),r=t.icon;return(0,H.jsxs)(`div`,{className:`${s0[e.width??`full`]} rounded-md border border-dashed border-border p-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,H.jsx)(`div`,{className:`flex size-5 shrink-0 items-center justify-center rounded ${t.bg}`,children:(0,H.jsx)(r,{className:`size-3 ${t.color}`})}),(0,H.jsxs)(`span`,{className:`truncate text-xs font-medium`,children:[e.name,e.required&&(0,H.jsx)(`span`,{className:`ml-0.5 text-destructive`,children:`*`})]})]}),(0,H.jsx)(`p`,{className:`mt-0.5 truncate pl-6 text-[10px] text-muted-foreground`,children:t.label}),n&&(0,H.jsx)(`div`,{className:`mt-1 flex items-center gap-px rounded-md border border-border p-0.5`,children:u0.map(({value:t,label:r})=>(0,H.jsx)(`button`,{type:`button`,title:r,onClick:()=>n(e.name,t),className:[`flex items-center justify-center rounded px-1.5 py-1 transition-colors`,(e.width??`full`)===t?`bg-foreground text-background`:`text-muted-foreground hover:text-foreground`].join(` `),children:(0,H.jsx)(l0,{width:t})},t))})]},e.name)})})]})}function f0({ct:e,values:t,id:n,activeLocale:r,localizationEnabled:i,defaultLocale:a,readOnly:o,uidErrorField:s,setUidErrorField:c,handleLocalizedChange:l,handleChange:u}){return(0,H.jsx)(`div`,{className:`grid grid-cols-6 gap-4`,children:e.fields.map(d=>{let f=[`string`,`text`,`richtext`].includes(d.type),p=t.localized&&t.localized[r]?t.localized[r][d.name]:void 0,m=f&&i?p:t[d.name],h=d.type===`uid`&&d.targetField&&i&&[`string`,`text`,`richtext`].includes(e.fields.find(e=>e.name===d.targetField)?.type??``);return(0,H.jsx)(`div`,{className:s0[d.width??`full`],children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsxs)(Y,{htmlFor:`entry-${d.name}`,className:`capitalize`,children:[d.name.replace(/_/g,` `),d.required&&(0,H.jsx)(`span`,{className:`ml-1 text-destructive`,children:`*`})]}),(0,H.jsx)(a0,{field:d,value:m,onChange:e=>{d.type===`uid`&&s===d.name&&c(null),f&&i?l(r,d.name,e):u(d.name,e)},allValues:{...t,id:n,__activeLocale:r,__localizationEnabled:i,__defaultLocale:a},disabled:!!h||o,errorMessage:d.type===`uid`&&s===d.name?`${d.name} already exists.`:void 0})]})},d.name)})})}function p0({isNew:e,canDeleteCurrentEntry:t,isReadOnlySingle:n,deleting:r,onDeleteClick:i,status:a,readOnly:o,onRevertToDraft:s,busy:c,patching:l,showReviewerControl:u,assignedEditorId:d,assignedEditorAvatarUrl:f,assignedEditorFirstName:p,assignedEditorLastName:m,reviewerLabel:h,handleAssignEditor:g,canManageReviewer:_,isEditorRole:v,reviewerCandidates:y,showReviewerInfo:b,showReviewEditButton:x,onToggleReviewLock:S,showRejectButton:C,onReject:w,supportsPreviewUI:T,previewEnabled:E,canOpenPreview:D,onOpenPreview:O,previewSetupError:k,previewHint:A,onSaveDraft:j,editorialMode:M,saveDraftEnabled:N,onOpenScheduler:P,isContributorRole:F,canPublish:I,onPublish:L,publishLabel:R,isPublishedStale:ee}){return(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!e&&t&&!n&&(0,H.jsx)(q,{variant:`ghost`,size:`icon`,className:`text-muted-foreground hover:text-destructive`,onClick:i,disabled:r,children:(0,H.jsx)(Qo,{className:`size-4`})}),!e&&a===`published`&&!o&&(0,H.jsxs)(q,{variant:`outline`,onClick:s,disabled:c,children:[l?(0,H.jsx)(BC,{className:`size-4`}):null,`Revert to draft`]}),!e&&a===`scheduled`&&!o&&(0,H.jsxs)(q,{variant:`outline`,onClick:s,disabled:c,children:[l?(0,H.jsx)(BC,{className:`size-4`}):null,`Cancel schedule`]}),u&&(0,H.jsxs)(H_,{value:d??`none`,onValueChange:g,disabled:!_||c,children:[(0,H.jsx)(G_,{className:`h-10 min-h-10 max-h-10 w-42 py-0`,children:(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(hw,{avatarUrl:f??null,firstName:p??null,lastName:m??null,className:`size-5`,fallbackClassName:`text-[9px]`}),(0,H.jsx)(W_,{placeholder:h||`Assign editor`})]})}),(0,H.jsxs)(J_,{children:[!v&&(0,H.jsx)(X_,{value:`none`,children:`Unassign`}),y.map(e=>(0,H.jsx)(X_,{value:e.id,children:e.first_name||e.last_name||e.id},e.id))]})]}),!_&&b&&(0,H.jsxs)(`div`,{className:`inline-flex h-10 items-center gap-2 rounded-md border border-input px-3 text-sm`,children:[(0,H.jsx)(hw,{avatarUrl:f??null,firstName:p??null,lastName:m??null,className:`size-5`,fallbackClassName:`text-[9px]`}),(0,H.jsx)(`span`,{children:h||`Assigned editor`})]}),x&&(0,H.jsx)(q,{variant:`outline`,size:`icon`,onClick:S,disabled:c,children:(0,H.jsx)(Io,{className:`size-4`})}),C&&(0,H.jsx)(q,{variant:`outline`,size:`icon`,onClick:w,disabled:c,children:(0,H.jsx)(cs,{className:`size-4`})}),T&&E&&D&&(0,H.jsx)(q,{variant:`outline`,onClick:O,disabled:o||c||!!k,title:A??void 0,children:`Open preview`}),(0,H.jsxs)(q,{variant:`outline`,onClick:j,size:M?`icon`:`default`,disabled:!N,children:[c?(0,H.jsx)(BC,{className:`size-4`}):M?(0,H.jsx)(Ho,{className:`size-4`}):null,!M&&(a===`scheduled`?`Save draft (cancel schedule)`:`Save draft`)]}),a!==`scheduled`&&!(M&&F)&&(0,H.jsxs)(q,{variant:`outline`,onClick:P,size:M?`icon`:`default`,disabled:o||c,children:[(0,H.jsx)(La,{className:`size-4`}),!M&&`Schedule`]}),(0,H.jsxs)(q,{onClick:L,disabled:o||!I||c,children:[l?(0,H.jsx)(BC,{className:`size-4`}):null,a===`scheduled`?M&&F?`Review`:`Publish now`:a===`published`&&!ee?`Republish`:R]})]})}function m0({status:e,scheduledFor:t,timezone:n,reviewRejected:r,isPublishedStale:i}){return e===`scheduled`?(0,H.jsxs)(zC,{variant:`outline`,className:`border-blue-500 text-blue-600`,children:[(0,H.jsx)(La,{className:`mr-1 size-3`}),t?`Scheduled · ${cv(t,n)}`:`Scheduled`]}):e===`pending`?r?(0,H.jsx)(zC,{variant:`destructive`,children:`Pending`}):(0,H.jsx)(zC,{className:`bg-amber-500 text-black hover:bg-amber-500`,children:`Pending`}):e===`in_review`?(0,H.jsx)(zC,{variant:`outline`,children:`In Review`}):e===`published`?(0,H.jsx)(zC,{variant:i?`secondary`:`default`,children:i?`Published (pending changes)`:`Published`}):(0,H.jsx)(zC,{variant:`secondary`,children:`Draft`})}function h0({localizationEnabled:e,onToggleLocalization:t,readOnly:n,activeLocale:r,onActiveLocaleChange:i,locales:a}){return(0,H.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(uD,{checked:e,onCheckedChange:t,disabled:n}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`text-sm font-medium`,children:`Localization`}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Enable per-entry localization`})]})]}),(0,H.jsx)(`div`,{})]}),(0,H.jsx)(`div`,{children:e&&(0,H.jsx)(vE,{value:r,onValueChange:i,children:(0,H.jsx)(yE,{children:a.map(e=>(0,H.jsx)(bE,{value:e,disabled:n,children:e.toUpperCase()},e))})})})]})}function g0({visible:e,readOnly:t,calOpen:n,onCalOpenChange:r,schedDate:i,onSchedDateChange:a,schedTime:o,onSchedTimeChange:s,onConfirm:c,onCancel:l,canSchedule:u,busy:d}){return!e||t?null:(0,H.jsxs)(`div`,{className:`mb-6 flex items-end gap-2 rounded-lg border bg-muted/30 p-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{children:`Date`}),(0,H.jsxs)($P,{open:n,onOpenChange:r,children:[(0,H.jsx)(eF,{asChild:!0,children:(0,H.jsxs)(q,{variant:`outline`,className:`w-40 justify-between font-normal`,children:[i?WO(i,`MMM d, yyyy`):`Select date`,(0,H.jsx)(Va,{className:`size-4 opacity-50`})]})}),(0,H.jsx)(tF,{className:`w-auto overflow-hidden p-0`,align:`start`,children:(0,H.jsx)(ZP,{mode:`single`,selected:i,captionLayout:`dropdown`,defaultMonth:i??new Date,disabled:{before:new Date},onSelect:e=>{a(e),r(!1)}})})]})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsxs)(Y,{children:[`Time `,(0,H.jsx)(`span`,{className:`font-normal text-muted-foreground`,children:`(24h)`})]}),(0,H.jsx)(Z,{type:`time`,className:`w-32 appearance-none bg-background [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:appearance-none`,value:o,onChange:e=>s(e.target.value)})]}),(0,H.jsxs)(q,{onClick:c,disabled:!u||d,children:[d?(0,H.jsx)(BC,{className:`size-4`}):null,`Confirm`]}),(0,H.jsx)(q,{variant:`ghost`,onClick:l,children:`Cancel`})]})}function _0(e){return Array.isArray(e)?e.map(_0):e&&typeof e==`object`?Object.fromEntries(Object.entries(e).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>[e,_0(t)])):e}function v0(e){return JSON.stringify(_0(e))}function y0(e){let t=e.match(/Field "([^"]+)" already exists\.?/);return t?t[1]??null:null}var b0=null,x0=new Set([`string`,`text`,`richtext`]);function S0(){let{slug:e,id:t}=gr(),n=fr(),r=!t,{timezone:i,locales:a,defaultLocale:o,editorialMode:s}=Sa(),{user:c,status:l}=_a(),u=c?.role?.toLowerCase()??``,{data:d,loading:f}=ps(e?`/cms/admin/content-types/${e}`:null),{data:p}=ps(`/cms/admin/client-settings`),{data:m,loading:h}=ps(e&&t?`/cms/admin/entries/${e}/${t}`:null),{data:g}=ps(s&&[`editor`,`admin`,`super admin`].includes(c?.role?.toLowerCase()??``)?`/cms/admin/users`:null),{loading:_,request:y}=Zw(),{loading:b,request:x}=Zw(),{loading:S,request:C}=Zw(),[w,T]=(0,v.useState)({}),[E,D]=(0,v.useState)([]),[O,k]=(0,v.useState)(``),[A,j]=(0,v.useState)(!1),[M,N]=(0,v.useState)(`draft`),[P,F]=(0,v.useState)(``),[I,L]=(0,v.useState)(!1),[R,ee]=(0,v.useState)(!1),[te,ne]=(0,v.useState)(!1),[z,B]=(0,v.useState)(null),[re,V]=(0,v.useState)(null),[ie,ae]=(0,v.useState)(null),[oe,se]=(0,v.useState)(null),[ce,le]=(0,v.useState)(!1),[ue,de]=(0,v.useState)(null),[fe,pe]=(0,v.useState)(!1),[me,he]=(0,v.useState)(!1),[ge,_e]=(0,v.useState)(),[ve,ye]=(0,v.useState)(`09:00`),be=(0,v.useRef)(`{}`),xe=(0,v.useRef)(!1),Se=yD(p),Ce=d?.kind===`collection`&&d.previewEnabled!==!1,we=d?bD(Se,d.fields.map(e=>e.name)):null,Te=Ce&&Se.enabled&&!we,Ee=Ce&&Se.enabled&&we?we:Ce&&Se.enabled?null:`Preview is disabled. Configure Settings > Overview > Preview to enable it.`;(0,v.useEffect)(()=>{if(r){let e={};d?.fields.forEach(t=>{e[t.name]=t.type===`boolean`?!1:``}),e.localized={};let t=a&&a.length>0?a:[`en`];D(t),k(o??t[0]),j(!1),T(e),N(`draft`),F(``),L(!1),ne(!1),B(null),V(null),ae(null),se(null),le(!1),de(null),be.current=v0(e);return}if(!m||!d)return;let e={};d.fields.forEach(t=>{e[t.name]=m[t.name]??(t.type===`boolean`?!1:``)});let t=m.localized,n=t&&typeof t==`object`?t:{};e.localized=n;let s=Object.keys(n).filter(e=>!e.startsWith(`_`)),c=(n._meta||{}).enabled??s.length>0;if(s.length>0)D(s),k(s[0]);else{let e=a&&a.length>0?a:[`en`];D(e),k(o??e[0])}if(j(!!c),T(e),N(m.status??`draft`),ne(!!m.review_rejected),B(m.editor_id??null),V(m._editor_first_name??null),ae(m._editor_last_name??null),se(m._editor_avatar_url??null),le(!1),de(null),be.current=v0(e),m.scheduled_for?(F(m.scheduled_for),_e(new Date(m.scheduled_for)),ye(lv(m.scheduled_for,i))):F(``),m.status===`published`&&m.published_data){let t=(e,t)=>{if(t===`datetime`&&e&&typeof e==`string`){let t=/Z|[+-]\d{2}:\d{2}$/.test(e)?e:e+`Z`,n=new Date(t);return isNaN(n.getTime())?e:n.toISOString()}return e},n={},r={};d.fields.forEach(i=>{i.name in m.published_data&&(n[i.name]=t(m.published_data[i.name]??(i.type===`boolean`?!1:``),i.type),r[i.name]=t(e[i.name],i.type))}),L(v0(r)!==v0(n))}else L(!1)},[m,d,r]);let De=v0(w)!==be.current,Oe=Ir((0,v.useCallback)(()=>xe.current?!1:De,[De]));function ke(e,t){T(n=>({...n,[e]:t}))}function Ae(e,t,n){T(r=>{let i={...r},a=i.localized&&typeof i.localized==`object`?i.localized:{},o=a[e]&&typeof a[e]==`object`?a[e]:{};return o[t]=n,a[e]=o,i.localized=a,i})}function je(e){j(e),T(t=>{let n={...t},r=n.localized&&typeof n.localized==`object`?n.localized:{};if(r._meta||={},e&&o){if(!(r[o]&&typeof r[o]==`object`&&r[o])&&(r[o]={},d&&d.fields)){let e=r[o];d.fields.forEach(t=>{if([`string`,`text`,`richtext`].includes(t.type)){let r=n[t.name];r!=null&&r!==``&&(e[t.name]=r)}})}r._meta.primary=o}else if(!e&&o){let e=r[o]&&typeof r[o]==`object`?r[o]:null;e&&d&&d.fields&&d.fields.forEach(t=>{if([`string`,`text`,`richtext`,`uid`].includes(t.type)){let r=e[t.name];r!==void 0&&(n[t.name]=r)}})}return r._meta.enabled=e,n.localized=r,n})}function Me(){if(P)_e(new Date(P)),ye(lv(P,i));else{let e=new Date;e.setDate(e.getDate()+1),_e(e),ye(`09:00`)}pe(!0)}async function Ne(){if(!e||!d)return null;de(null);let n={},i=A&&w.localized&&typeof w.localized==`object`&&w.localized[o]&&typeof w.localized[o]==`object`?w.localized[o]:null;if(d.fields.forEach(e=>{let t=w[e.name];(t==null||t===``)&&i&&i[e.name]!==void 0&&(t=i[e.name]),e.type===`media`&&t===null?n[e.name]=null:(t===``&&x0.has(e.type)||t!==``&&t!=null)&&(n[e.name]=t)}),w.localized&&Object.keys(w.localized).length>0){let e=w.localized;e._meta||={},e._meta.enabled=A,e._meta.primary=o,n.localized=e}try{let i=await y(r?`/cms/admin/content-types/${e}/entries`:`/cms/admin/entries/${e}/${t}`,r?`POST`:`PUT`,n);return be.current=v0(w),i}catch(e){let t=y0(e instanceof Error?e.message:``);return t&&d.fields.some(e=>e.type===`uid`&&e.name===t)&&de(t),X.error(`Could not save draft`),null}}function Pe(e){!b0||b0.closed||(b0.location.href=e,b0.focus())}async function Fe(i){let a=await Ne();if(!a)return null;let o=a,s=M;if(M===`scheduled`){let n=r?a.id:t;try{o=await x(`/cms/admin/entries/${e}/${n}/status`,`PATCH`,{status:`draft`}),s=`draft`,N(`draft`),F(``),pe(!1)}catch{return X.error(`Could not save draft`),null}}else M===`published`&&(s=`published`,L(!0));if(i&&e&&Te&&!Se.syncUrl){let t=xD({config:Se,contentType:e,entry:o,status:s});t&&Pe(t)}return X.success(`Draft saved`),r&&(xe.current=!0,n(`/content/${e}/${o.id}`,{replace:!0})),{entry:o,status:s}}async function Ie(){await Fe(!0)}async function Le(){if(!e||!d||!Se.enabled||!ft)return;if(we){X.error(we);return}let n=m??null,i=M;if(r||De){let e=await Fe(!1);if(!e)return;n=e.entry,i=e.status}let a=xD({config:Se,contentType:e,entry:n??{...w,id:t,status:M},status:i});if(!a){X.error(`Preview URL could not be resolved for this entry.`);return}if(b0=window.open(a,gD),!b0){X.error(`Preview window was blocked by the browser.`);return}b0.focus()}async function Re(){if(!e)return;let i=t;if(De||r){let e=await Ne();if(!e)return;i=r?e.id:t,r&&(xe.current=!0)}let a=s&&(u===`contributor`||u===``||l!==`authenticated`);try{let t=await x(`/cms/admin/entries/${e}/${i}/status`,`PATCH`,{status:a?`pending`:`published`,review_rejected:!1});N(t?.status??(a?`pending`:`published`)),ne(!!t?.review_rejected),B(t?.editor_id??z),V(t?._editor_first_name??re),ae(t?._editor_last_name??ie),se(t?._editor_avatar_url??oe),F(``),L(!1),pe(!1),le(!1),X.success(`Entry published`),r&&n(`/content/${e}/${i}`,{replace:!0})}catch{X.error(`Could not publish entry`),r&&i&&n(`/content/${e}/${i}`,{replace:!0})}}async function ze(){if(!e||!ge||!ve)return;let a=uv(ge,ve,i);if(new Date(a)<=new Date)return;let o=t;if(De||r){let e=await Ne();if(!e)return;o=r?e.id:t,r&&(xe.current=!0)}try{await x(`/cms/admin/entries/${e}/${o}/status`,`PATCH`,{status:`scheduled`,scheduled_for:a}),N(`scheduled`),F(a),pe(!1),X.success(`Entry scheduled`),r&&n(`/content/${e}/${o}`,{replace:!0})}catch{X.error(`Could not schedule entry`),r&&o&&n(`/content/${e}/${o}`,{replace:!0})}}async function Be(){if(!(!e||!t))try{await x(`/cms/admin/entries/${e}/${t}/status`,`PATCH`,{status:`draft`}),N(`draft`),F(``),L(!1),X.success(`Reverted to draft`)}catch{X.error(`Could not revert entry`)}}async function Ve(){if(!(!e||!t))try{await C(`/cms/admin/entries/${e}/${t}`,`DELETE`),X.success(`Entry deleted`),xe.current=!0,n(`/content/${e}`,{replace:!0})}catch{X.error(`Could not delete entry`)}}async function He(n){if(!e||!t)return;let r=n===`none`?null:n;try{let n=await x(`/cms/admin/entries/${e}/${t}/status`,`PATCH`,{status:`in_review`,editor_id:r,review_locked_by_editor:m?.review_locked_by_editor??!1});N(n?.status??`in_review`),ne(!!n?.review_rejected),B(n?.editor_id??r),V(n?._editor_first_name??null),ae(n?._editor_last_name??null),se(n?._editor_avatar_url??null),le(!1),X.success(`Editor assigned`)}catch{X.error(`Could not assign editor`)}}async function Ue(){le(e=>!e)}async function We(){if(!(!e||!t))try{let n=await x(`/cms/admin/entries/${e}/${t}/status`,`PATCH`,{status:`pending`,review_rejected:!0});N(n?.status??`pending`),ne(!!n?.review_rejected),le(!1),X.success(`Entry rejected`)}catch{X.error(`Could not reject entry`)}}let Ge=f||!r&&h,Ke=_||b,qe=c?.permissions??[],Je=qe.includes(`*`)||qe.includes(`entries:write`),Ye=qe.includes(`*`)||qe.includes(`entries:delete`),Xe=u===`contributor`,Ze=u===`editor`,Qe=[`admin`,`super admin`].includes(u),$e=u===`viewer`,et=Xe||Ze,tt=Xe&&d?.kind===`single`,nt=r||String(m?.created_by??``)===String(c?.id??``),rt=s&&Xe&&M===`in_review`,it=s&&(Ze||Qe)&&!!z&&z===c?.id,at=it&&(M===`pending`||M===`in_review`)&&!te,ot=$e||!Je||tt||Xe&&!nt||s&&Xe&&M===`pending`&&!te||rt||s&&(Ze||Qe)&&(M===`pending`||M===`in_review`)&&(!it||!ce),st=Ye&&(!et||nt),ct=s&&Xe&&M===`pending`&&(te?!0:De)||De||M===`draft`||M===`scheduled`||!s&&M===`pending`||s&&M===`pending`&&!Xe||s&&M===`in_review`&&!Xe||I,lt=!!(ge&&ve),ut=s&&Xe?`Review`:`Publish`,dt=Ce,ft=M===`draft`||M===`scheduled`||M===`pending`||M===`in_review`||M===`published`&&I,pt=!ot&&!Ke&&(M===`scheduled`?!0:De);if(hD(`mod+s`,Ie,{enabled:pt,label:`Save draft`}),hD(`mod+shift+p`,Re,{enabled:ct&&!Ke&&!ot,label:`Publish`}),Ge)return(0,H.jsxs)(`div`,{className:`flex items-center gap-2 py-12 text-muted-foreground`,children:[(0,H.jsx)(BC,{className:`size-4`}),(0,H.jsx)(`span`,{className:`text-sm`,children:`Loading…`})]});if(!d)return null;let mt=(g??[]).filter(e=>Ze?e.id===c?.id:Qe?e.id===c?.id||(e.role_name??``).toLowerCase()===`editor`:!1),ht=!r&&s&&(Ze||Qe)&&(M===`pending`||M===`in_review`),gt=s&&!r&&ht,_t=s&&!r&&!!z,vt=at,yt=at,bt=re||ie;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(fs,{children:(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold -mt-2`,children:r?`New entry`:`Edit entry`}),(0,H.jsx)(m0,{status:M,scheduledFor:P,timezone:i,reviewRejected:te,isPublishedStale:I})]}),(0,H.jsx)(`p`,{className:`text-muted-foreground text-xs mt-1`,children:d.name}),dt&&Se.enabled&&we&&(0,H.jsx)(`p`,{className:`mt-1 text-xs text-amber-600`,children:we})]}),(0,H.jsx)(p0,{isNew:r,canDeleteCurrentEntry:st,isReadOnlySingle:tt,deleting:S,onDeleteClick:()=>ee(!0),status:M,readOnly:ot,onRevertToDraft:Be,busy:Ke,patching:b,showReviewerControl:gt,assignedEditorId:z,assignedEditorAvatarUrl:oe,assignedEditorFirstName:re,assignedEditorLastName:ie,reviewerLabel:bt,handleAssignEditor:He,canManageReviewer:ht,isEditorRole:Ze,reviewerCandidates:mt,showReviewerInfo:_t,showReviewEditButton:vt,onToggleReviewLock:Ue,showRejectButton:yt,onReject:We,supportsPreviewUI:dt,previewEnabled:Se.enabled,canOpenPreview:ft,onOpenPreview:Le,previewSetupError:we,previewHint:Ee,onSaveDraft:Ie,editorialMode:s,saveDraftEnabled:pt,onOpenScheduler:Me,isContributorRole:Xe,canPublish:ct,onPublish:Re,publishLabel:ut,isPublishedStale:I})]})}),(0,H.jsxs)(`section`,{className:`mt-24`,children:[(0,H.jsx)(g0,{visible:fe,readOnly:ot,calOpen:me,onCalOpenChange:he,schedDate:ge,onSchedDateChange:_e,schedTime:ve,onSchedTimeChange:ye,onConfirm:ze,onCancel:()=>pe(!1),canSchedule:lt,busy:Ke}),(0,H.jsx)(h0,{localizationEnabled:A,onToggleLocalization:je,readOnly:ot,activeLocale:O,onActiveLocaleChange:k,locales:E}),(0,H.jsx)(f0,{ct:d,values:w,id:t,activeLocale:O,localizationEnabled:A,defaultLocale:o,readOnly:ot,uidErrorField:ue,setUidErrorField:de,handleLocalizedChange:Ae,handleChange:ke}),(0,H.jsx)(Yh,{open:R,onOpenChange:ee,children:(0,H.jsxs)($h,{className:`max-w-sm`,children:[(0,H.jsx)(eg,{children:(0,H.jsx)(ng,{children:`Delete this entry?`})}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This action cannot be undone.`}),(0,H.jsxs)(tg,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>ee(!1),children:`Cancel`}),(0,H.jsxs)(q,{variant:`destructive`,onClick:Ve,disabled:S,children:[S?(0,H.jsx)(BC,{className:`size-4`}):null,`Delete`]})]})]})}),(0,H.jsx)(Yh,{open:Oe.state===`blocked`,onOpenChange:()=>Oe.reset?.(),children:(0,H.jsxs)($h,{className:`max-w-sm`,children:[(0,H.jsx)(eg,{children:(0,H.jsx)(ng,{children:`Unsaved changes`})}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Leave without saving?`}),(0,H.jsxs)(tg,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>Oe.reset?.(),children:`Stay`}),(0,H.jsx)(q,{variant:`destructive`,onClick:()=>Oe.proceed?.(),children:`Leave`})]})]})})]})]})}function C0({className:e,orientation:t=`horizontal`,decorative:n=!0,...r}){return(0,H.jsx)(aC,{"data-slot":`separator`,decorative:n,orientation:t,className:K(`shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px`,e),...r})}var w0=Ms(`group/field flex w-full gap-3 data-[invalid=true]:text-destructive`,{variants:{orientation:{vertical:[`flex-col [&>*]:w-full [&>.sr-only]:w-auto`],horizontal:[`flex-row items-center`,`[&>[data-slot=field-label]]:flex-auto`,`has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`],responsive:[`flex-col @md/field-group:flex-row @md/field-group:items-center [&>*]:w-full @md/field-group:[&>*]:w-auto [&>.sr-only]:w-auto`,`@md/field-group:[&>[data-slot=field-label]]:flex-auto`,`@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`]}},defaultVariants:{orientation:`vertical`}});function T0({className:e,orientation:t=`vertical`,...n}){return(0,H.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":t,className:K(w0({orientation:t}),e),...n})}function E0({className:e,...t}){return(0,H.jsx)(Y,{"data-slot":`field-label`,className:K(`group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50`,`has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>*]:data-[slot=field]:p-4`,`has-data-[state=checked]:border-primary has-data-[state=checked]:bg-primary/5 dark:has-data-[state=checked]:bg-primary/10`,e),...t})}function D0({page:e,totalPages:t,limit:n,onPageChange:r,onLimitChange:i}){return(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,H.jsxs)(T0,{orientation:`horizontal`,className:`w-fit`,children:[(0,H.jsx)(E0,{htmlFor:`select-rows-per-page`,children:`Rows per page`}),(0,H.jsxs)(H_,{value:String(n),onValueChange:e=>i(Number(e)),children:[(0,H.jsx)(G_,{className:`w-20`,id:`select-rows-per-page`,children:(0,H.jsx)(W_,{})}),(0,H.jsx)(J_,{align:`start`,children:(0,H.jsxs)(U_,{children:[(0,H.jsx)(X_,{value:`10`,children:`10`}),(0,H.jsx)(X_,{value:`30`,children:`30`}),(0,H.jsx)(X_,{value:`50`,children:`50`}),(0,H.jsx)(X_,{value:`70`,children:`70`}),(0,H.jsx)(X_,{value:`100`,children:`100`})]})})]})]}),(0,H.jsx)(IT,{className:`mx-0 w-auto`,children:(0,H.jsxs)(LT,{children:[(0,H.jsx)(RT,{children:(0,H.jsx)(BT,{href:`#`,onClick:t=>{t.preventDefault(),e>1&&r(e-1)},"aria-disabled":e===1,className:e===1?`pointer-events-none opacity-50`:``})}),(0,H.jsx)(RT,{children:(0,H.jsx)(VT,{href:`#`,onClick:n=>{n.preventDefault(),e<t&&r(e+1)},"aria-disabled":e===t,className:e===t?`pointer-events-none opacity-50`:``})})]})})]})}var O0={field:`created_at`,dir:`desc`},k0=[{name:`created_at`,label:`Created`},{name:`updated_at`,label:`Updated`},{name:`published_at`,label:`Published`}],A0=[{name:`created_at`,label:`Created`},{name:`updated_at`,label:`Updated`},{name:`pub_sch`,label:`Published`}],j0={draft:`Draft`,scheduled:`Scheduled`,published:`Published`,pending:`Pending`,in_review:`In Review`},M0=[`draft`,`pending`,`in_review`,`scheduled`,`published`];function N0(e){return e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function P0(e){if(!e)return null;let t=Number.parseInt(e.staleDraftDays??`30`,10);return{contentTypes:(()=>{try{let t=JSON.parse(e.contentTypes??`[]`);return Array.isArray(t)?t.filter(e=>typeof e==`object`&&!!e).map(e=>({slug:typeof e.slug==`string`?e.slug:``,enabled:e.enabled!==!1,checkStaleDrafts:e.checkStaleDrafts!==!1,requiredTextFields:Array.isArray(e.requiredTextFields)?e.requiredTextFields.filter(e=>typeof e==`string`):[],requiredMediaFields:Array.isArray(e.requiredMediaFields)?e.requiredMediaFields.filter(e=>typeof e==`string`):[]})).filter(e=>e.slug.length>0):[]}catch{return[]}})(),staleDraftDays:Number.isFinite(t)?t:30}}function F0(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return 0;let n=Date.now()-t.getTime();return Math.max(0,Math.floor(n/864e5))}function I0(e){return e==null?!0:typeof e==`string`?e.trim().length===0:Array.isArray(e)?e.length===0:!1}function L0(e){return e==null?!0:typeof e==`string`?e.trim().length===0:Array.isArray(e)?e.filter(e=>String(e??``).trim().length>0).length===0:!1}function R0(e){return e.find(e=>e.name===`title`)?.name??e.find(e=>e.name===`name`)?.name??e.find(e=>e.type===`uid`)?.name??e.find(e=>e.type===`string`)?.name??null}function z0(e){if(Array.isArray(e))return e.map(e=>String(e??``).trim()).filter(Boolean);let t=String(e??``).trim();return t?[t]:[]}function B0(e){return{visibleFields:e.slice(0,4).map(e=>e.name),visibleSystemCols:A0.map(e=>e.name),sort:O0}}function V0(e,t){if(!e)return B0(t);let n=(e.visibleFields??[]).filter(e=>{let n=String(e).split(`.`)[0];return t.some(e=>e.name===n)}),r=Array.isArray(e.visibleSystemCols)?e.visibleSystemCols.filter(e=>A0.some(t=>t.name===e)):A0.map(e=>e.name);return{visibleFields:n.length>0?n:t.slice(0,4).map(e=>e.name),visibleSystemCols:r,sort:e.sort??O0}}async function H0(e){let t=await fetch(`/cms/admin/users/me/prefs/view_${e}`,{credentials:`include`});if(!t.ok)return null;let{value:n}=await t.json();return n}async function U0(e,t){await fetch(`/cms/admin/users/me/prefs/view_${e}`,{method:`PUT`,credentials:`include`,headers:{"Content-Type":`application/json`},body:JSON.stringify({value:t})})}function W0({entry:e}){let t=e._author_first_name,n=e._author_last_name,r=t||n?[t,n].filter(Boolean).join(` `):null,i=(0,H.jsx)(hw,{avatarUrl:e._author_avatar_url,firstName:t,lastName:n,className:`size-7`,fallbackClassName:`text-[10px]`});return r?(0,H.jsxs)(Sp,{children:[(0,H.jsx)(Cp,{asChild:!0,children:i}),(0,H.jsx)(wp,{children:r})]}):i}function G0({allFields:e,fieldName:t,visible:n,setVisible:r}){let i=t.split(`.`)[0],a=e.find(e=>e.name===i)?.relatedSlug,{data:o}=ps(a?`/cms/admin/content-types/${a}`:null),s=n.find(e=>e.split(`.`)[0]===i),c=s&&s.includes(`.`)?s.split(`.`)[1]:void 0;function l(e,t){r(n=>n.map(n=>n.split(`.`)[0]===e?t?`${e}.${t}`:e:n))}return(0,v.useEffect)(()=>{if(!o?.fields||c)return;let e=R0(o.fields);e&&l(i,e)},[o,c,i]),o?.fields?(0,H.jsxs)(H_,{value:c,onValueChange:e=>l(i,e),children:[(0,H.jsx)(G_,{className:`h-8 w-32 text-sm`,children:(0,H.jsx)(W_,{})}),(0,H.jsx)(J_,{children:o.fields.map(e=>(0,H.jsx)(X_,{value:e.name,children:e.name},e.name))})]}):null}function K0({open:e,onOpenChange:t,allFields:n,config:r,onApply:i}){let[a,o]=(0,v.useState)(r.visibleFields),[s,c]=(0,v.useState)(r.visibleSystemCols),[l,u]=(0,v.useState)(r.sort);(0,v.useEffect)(()=>{e&&(o(r.visibleFields),c(r.visibleSystemCols),u(r.sort))},[e,r]);let d=n.filter(e=>!a.some(t=>t.split(`.`)[0]===e.name));function f(e,t){o(n=>{let r=n.indexOf(e);if(r===-1)return n;let i=[...n],a=r+t;return a<0||a>=i.length?n:([i[r],i[a]]=[i[a],i[r]],i)})}function p(e){o(t=>[...t,e])}function m(e){o(t=>t.filter(t=>t!==e))}let h=[...k0,...n.filter(e=>![`media`,`text`,`richtext`,`relation`].includes(e.type)).map(e=>({name:e.name,label:N0(e.name)}))];return(0,H.jsx)(Yh,{open:e,onOpenChange:t,children:(0,H.jsxs)($h,{className:`max-h-[90vh] max-w-md flex flex-col`,children:[(0,H.jsx)(eg,{className:`flex-none`,children:(0,H.jsx)(ng,{children:`Configure the view`})}),(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-5 py-1`,children:[(0,H.jsxs)(`div`,{className:d.length>0||s.length<A0.length?`flex-1 min-h-0 grid gap-5 [grid-template-rows:minmax(7rem,1fr)_minmax(7rem,1fr)]`:`flex min-h-0 flex-1 flex-col`,children:[(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-col`,children:[(0,H.jsx)(`p`,{className:`mb-2 flex-none text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`Displayed fields`}),a.length===0&&s.length===0?(0,H.jsx)(`p`,{className:`py-2 text-sm text-muted-foreground`,children:`No fields selected.`}):(0,H.jsxs)(`ul`,{className:`flex-1 min-h-0 space-y-1 overflow-y-auto`,children:[a.map((e,t)=>{let r=String(e).split(`.`)[0],i=n.find(e=>e.name===r);return(0,H.jsxs)(`li`,{className:`flex items-center gap-2 rounded-md border px-3 py-2 text-sm`,children:[(0,H.jsx)(`span`,{className:`flex-1 font-medium`,children:N0(r)}),i&&(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:i.type}),i&&i.type===`relation`&&(0,H.jsx)(`div`,{className:`ml-2`,children:(0,H.jsx)(G0,{allFields:n,fieldName:e,visible:a,setVisible:o})}),(0,H.jsx)(q,{size:`icon`,variant:`ghost`,disabled:t===0,onClick:()=>f(e,-1),className:`flex size-6 items-center justify-center rounded text-muted-foreground hover:bg-accent disabled:opacity-30`,children:(0,H.jsx)(Wa,{className:`size-3.5`})}),(0,H.jsx)(q,{size:`icon`,variant:`ghost`,disabled:t===a.length-1,onClick:()=>f(e,1),className:`flex size-6 items-center justify-center rounded text-muted-foreground hover:bg-accent disabled:opacity-30`,children:(0,H.jsx)(Va,{className:`size-3.5`})}),(0,H.jsx)(q,{size:`icon`,variant:`ghost`,onClick:()=>m(e),className:`flex size-6 items-center justify-center rounded text-muted-foreground hover:bg-destructive/10 hover:text-destructive`,children:(0,H.jsx)(qa,{className:`size-3.5`})})]},e)}),s.map(e=>{let t=A0.find(t=>t.name===e);return t?(0,H.jsxs)(`li`,{className:`flex items-center gap-2 rounded-md border px-3 py-2 text-sm`,children:[(0,H.jsx)(`span`,{className:`flex-1 font-medium`,children:t.label}),(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`system`}),(0,H.jsx)(q,{size:`icon`,variant:`ghost`,disabled:!0,className:`flex size-6 items-center justify-center rounded text-muted-foreground disabled:opacity-30`,children:(0,H.jsx)(Wa,{className:`size-3.5`})}),(0,H.jsx)(q,{size:`icon`,variant:`ghost`,disabled:!0,className:`flex size-6 items-center justify-center rounded text-muted-foreground disabled:opacity-30`,children:(0,H.jsx)(Va,{className:`size-3.5`})}),(0,H.jsx)(q,{size:`icon`,variant:`ghost`,onClick:()=>c(t=>t.filter(t=>t!==e)),className:`flex size-6 items-center justify-center rounded text-muted-foreground hover:bg-destructive/10 hover:text-destructive`,children:(0,H.jsx)(qa,{className:`size-3.5`})})]},e):null})]})]}),(d.length>0||s.length<A0.length)&&(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-col`,children:[(0,H.jsx)(`p`,{className:`mb-2 flex-none text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`Available fields`}),(0,H.jsxs)(`ul`,{className:`flex-1 min-h-0 space-y-1 overflow-y-auto`,children:[d.map(e=>(0,H.jsxs)(`li`,{className:`flex items-center gap-2 rounded-md border border-dashed px-3 py-2 text-sm text-muted-foreground`,children:[(0,H.jsx)(`span`,{className:`flex-1`,children:N0(e.name)}),(0,H.jsx)(`span`,{className:`text-xs`,children:e.type}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>p(e.name),className:`flex size-6 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-accent-foreground`,children:(0,H.jsx)(Ja,{className:`size-3.5`})})]},e.name)),A0.filter(e=>!s.includes(e.name)).map(e=>(0,H.jsxs)(`li`,{className:`flex items-center gap-2 rounded-md border border-dashed px-3 py-2 text-sm text-muted-foreground`,children:[(0,H.jsx)(`span`,{className:`flex-1`,children:e.label}),(0,H.jsx)(`span`,{className:`text-xs`,children:`system`}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>c(t=>[...t,e.name]),className:`flex size-6 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-accent-foreground`,children:(0,H.jsx)(Ja,{className:`size-3.5`})})]},e.name))]})]})]}),(0,H.jsxs)(`div`,{className:`flex-none`,children:[(0,H.jsx)(`p`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`Sort entries`}),(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,H.jsxs)(H_,{value:l.field,onValueChange:e=>u(t=>({...t,field:e})),children:[(0,H.jsx)(G_,{className:`h-8 text-sm`,children:(0,H.jsx)(W_,{})}),(0,H.jsx)(J_,{children:h.map(e=>(0,H.jsx)(X_,{value:e.name,children:e.label},e.name))})]}),(0,H.jsxs)(H_,{value:l.dir,onValueChange:e=>u(t=>({...t,dir:e})),children:[(0,H.jsx)(G_,{className:`h-8 text-sm`,children:(0,H.jsx)(W_,{})}),(0,H.jsxs)(J_,{children:[(0,H.jsx)(X_,{value:`asc`,children:`Ascending`}),(0,H.jsx)(X_,{value:`desc`,children:`Descending`})]})]})]})]})]}),(0,H.jsxs)(tg,{className:`flex-none`,children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,H.jsx)(q,{onClick:()=>{i({visibleFields:a,visibleSystemCols:s,sort:l}),t(!1)},children:`Apply`})]})]})})}function q0({hasIssues:e,title:t}){let n=e?{border:`border-amber-500/40`,dots:[`bg-amber-400`,`bg-amber-400`]}:{border:`border-emerald-500/40`,dots:[`bg-emerald-500`,`bg-emerald-500`]};return(0,H.jsxs)(Sp,{children:[(0,H.jsx)(Cp,{asChild:!0,children:(0,H.jsx)(`span`,{className:`inline-flex h-6 w-4 shrink-0 flex-col items-center justify-center gap-0.5 rounded-full border ${n.border}`,children:n.dots.map((e,t)=>(0,H.jsx)(`span`,{className:`block size-1.5 rounded-full ${e}`},t))})}),(0,H.jsx)(wp,{children:t})]})}function J0({value:e}){let[t,n]=(0,v.useState)(null);return(0,v.useEffect)(()=>{if(e.startsWith(`http`)){n(e);return}fetch(`/cms/admin/media/${e}/url`,{credentials:`include`}).then(e=>e.ok?e.json():null).then(e=>n(e?.url??null)).catch(()=>{})},[e]),t?/\.(jpe?g|png|gif|webp|avif|svg)(\?|$)/i.test(t)?(0,H.jsx)(`img`,{src:t,alt:``,className:`size-8 object-cover`}):(0,H.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,H.jsx)(oo,{className:`size-3.5 shrink-0`}),(0,H.jsx)(`span`,{className:`max-w-30 truncate`,children:`File`})]}):(0,H.jsx)(vo,{className:`size-4 text-muted-foreground`})}function Y0({relatedSlug:e,value:t,displayField:n}){let[r,i]=(0,v.useState)([]),[a,o]=(0,v.useState)(!1),s=z0(t);return(0,v.useEffect)(()=>{let r=z0(t);if(!e||r.length===0){i([]);return}let a=!1;return o(!0),(n?Promise.resolve(n):fetch(`/cms/admin/content-types/${e}`,{credentials:`include`}).then(e=>e.ok?e.json():null).then(e=>R0(e?.fields??[])).catch(()=>null)).then(t=>Promise.all(r.map(n=>fetch(`/cms/admin/entries/${e}/${n}`,{credentials:`include`}).then(e=>e.ok?e.json():null).then(e=>e?String((t&&e[t])??e.title??e.name??n):n).catch(()=>n)))).then(e=>{a||i(e.filter(Boolean))}).catch(()=>{a||i(r)}).finally(()=>{a||o(!1)}),()=>{a=!0}},[e,n,t]),s.length===0?(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):a&&r.length===0?(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`…`}):(0,H.jsx)(`span`,{className:`block max-w-50 truncate font-medium`,children:r.join(`, `)})}function X0({field:e,value:t,displayField:n}){let{timezone:r}=Sa();if(t==null||t===``)return(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});if(e.type===`boolean`)return t?(0,H.jsx)(Ba,{className:`size-4 text-primary`}):(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});if(e.type===`datetime`)return(0,H.jsx)(`span`,{children:cv(String(t),r)});if(e.type===`number`)return(0,H.jsx)(`span`,{children:String(t)});if(e.type===`media`)return(0,H.jsx)(J0,{value:String(t)});if(e.type===`relation`)return(0,H.jsx)(Y0,{relatedSlug:e.relatedSlug,value:t,displayField:n});if(e.type===`text`||e.type===`richtext`){let e=String(t);return(0,H.jsx)(`span`,{className:`block max-w-50 truncate text-muted-foreground`,children:e.length>60?e.slice(0,60)+`…`:e})}let i=String(t);return(0,H.jsx)(`span`,{className:e.type===`uid`?`block max-w-40 truncate font-mono text-xs text-muted-foreground`:`block max-w-50 truncate font-medium`,children:i.length>60?i.slice(0,60)+`…`:i})}function Z0({entry:e,fields:t,isStaleDraft:n=!1}){let{timezone:r}=Sa();if(e.status===`scheduled`)return(0,H.jsxs)(zC,{variant:`outline`,className:`border-blue-500 text-blue-600`,children:[(0,H.jsx)(La,{className:`mr-1 size-3`}),e.scheduled_for?sv(e.scheduled_for,r):`Scheduled`]});if(e.status===`draft`)return n?(0,H.jsx)(zC,{variant:`outline`,className:`border-amber-500 text-amber-500`,children:`Stale Draft`}):(0,H.jsx)(zC,{variant:`outline`,children:`Draft`});if(e.status===`pending`)return e.review_rejected?(0,H.jsx)(zC,{variant:`destructive`,children:`Pending`}):(0,H.jsx)(zC,{className:`bg-amber-500 text-black hover:bg-amber-500`,children:`Pending`});if(e.status===`in_review`)return(0,H.jsx)(zC,{variant:`outline`,children:`In Review`});let i=(e,t)=>{if(t===`datetime`&&e&&typeof e==`string`){let t=/Z|[+-]\d{2}:\d{2}$/.test(e)?e:e+`Z`,n=new Date(t);return isNaN(n.getTime())?e:n.toISOString()}return e};return e.published_data!=null&&t.some(t=>t.name in e.published_data&&JSON.stringify(i(e[t.name],t.type))!==JSON.stringify(i(e.published_data[t.name],t.type)))?(0,H.jsx)(zC,{variant:`secondary`,children:`Published*`}):(0,H.jsx)(zC,{variant:`default`,children:`Published`})}function Q0(){let{slug:e}=gr(),t=fr(),{timezone:n}=Sa(),{user:r}=_a(),[i,a]=ta(),o=Math.max(1,Number(i.get(`page`)??1)),s=i.get(`status`),c=s&&[`draft`,`scheduled`,`published`,`pending`,`in_review`].includes(s)?s:``,l=[10,30,50,70,100].includes(Number(i.get(`limit`)))?Number(i.get(`limit`)):10;function u(e){a(t=>(t.set(`page`,String(e)),t),{replace:!0})}function d(e){a(t=>(t.set(`limit`,String(e)),t.set(`page`,`1`),t),{replace:!0})}function f(e){a(t=>(e?t.set(`status`,e):t.delete(`status`),t.set(`page`,`1`),t),{replace:!0})}let[p,m]=(0,v.useState)(null),[h,g]=(0,v.useState)(!1),[_,y]=(0,v.useState)(null),[b,x]=(0,v.useState)(new Set),[S,C]=(0,v.useState)(!1),[w,T]=(0,v.useState)(!1),[E,D]=(0,v.useState)(``),[O,k]=(0,v.useState)(``),{loading:A,request:j}=Zw();(0,v.useEffect)(()=>{let e=setTimeout(()=>{k(E),u(1)},300);return()=>clearTimeout(e)},[E]);let{data:M,loading:N}=ps(e?`/cms/admin/content-types/${e}`:null),{data:P}=ps(`/cms/admin/addons/registry`),F=P?.addons.find(e=>e.id===`content-health`)??null,I=!!(F?.installed&&F.enabled&&F.compatible),{data:L}=ps(I?`/cms/admin/addons/content-health/settings`:null);(0,v.useEffect)(()=>{!M||!e||H0(e).then(e=>y(V0(e,M.fields))).catch(()=>y(defaultViewConfig(M.fields)))},[M?.slug]),(0,v.useEffect)(()=>{x(new Set)},[o,l]);let R=_??{visibleFields:M?.fields.slice(0,4).map(e=>e.name)??[],visibleSystemCols:A0.map(e=>e.name),sort:O0},{sort:ee}=R,te=P0(L),ne=e?te?.contentTypes.find(t=>t.slug===e&&t.enabled)??null:null,z=(R.visibleFields??[]).map(e=>{let t=String(e).split(`.`),n=t[0],r=t[1],i=M?.fields.find(e=>e.name===n);return i?{field:i,displayField:r}:null}).filter(Boolean),B=(M?.fields??[]).filter(e=>[`string`,`uid`,`text`,`richtext`].includes(e.type)).map(e=>e.name),{data:re,loading:V,refetch:ie}=ps(e&&_?`/cms/admin/content-types/${e}/entries?page=${o}&limit=${l}&sort=${ee.field}&order=${ee.dir}${c?`&status=${c}`:``}${O?`&search=${encodeURIComponent(O)}&searchFields=${B.join(`,`)}`:``}`:null),ae=[...new Set([...re?.available_statuses??[],...c?[c]:[]])].filter(e=>[`draft`,`scheduled`,`published`,`pending`,`in_review`].includes(e)).sort((e,t)=>M0.indexOf(e)-M0.indexOf(t));async function oe(){if(!(!p||!e)){try{await j(`/cms/admin/entries/${e}/${p}`,`DELETE`),X.success(`Entry deleted`)}catch{X.error(`Could not delete entry`)}m(null),ie()}}let se=r?.permissions??[],ce=se.includes(`*`)||se.includes(`entries:write`),le=se.includes(`*`)||se.includes(`entries:delete`),ue=r?.role?.toLowerCase()===`viewer`,de=r?.role?.toLowerCase()===`contributor`,fe=r?.role?.toLowerCase()===`editor`,pe=de||fe,me=e=>String(e.created_by??``)===String(r?.id??``),he=e=>!1,ge=e=>ce&&(!de||me(e))&&!he(e),_e=e=>le&&(!pe||me(e)),ve=[...b].filter(e=>{let t=(re?.data??[]).find(t=>t.id===e);return t?ge(t):!1}),ye=[...b].filter(e=>{let t=(re?.data??[]).find(t=>t.id===e);return t?_e(t):!1}),be=(re?.data??[]).map(e=>e.id),xe=be.length>0&&be.every(e=>b.has(e)),Se=!xe&&be.some(e=>b.has(e));function Ce(){x(e=>{let t=new Set(e);return xe?be.forEach(e=>t.delete(e)):be.forEach(e=>t.add(e)),t})}function we(e){x(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function Te(){if(!(!e||S)){C(!0);try{let t={"Content-Type":`application/json`};await Promise.all(ve.map(n=>fetch(`/cms/admin/entries/${e}/${n}/status`,{method:`PATCH`,credentials:`include`,headers:t,body:JSON.stringify({status:`draft`})}))),X.success(`Entries unpublished`),x(new Set),ie()}catch{X.error(`Could not unpublish entries`)}finally{C(!1)}}}async function Ee(){if(!(!e||S)){C(!0);try{await Promise.all(ye.map(t=>fetch(`/cms/admin/entries/${e}/${t}`,{method:`DELETE`,credentials:`include`}))),X.success(`Entries deleted`),T(!1),x(new Set),ie()}catch{X.error(`Could not delete entries`)}finally{C(!1)}}}function De(t){y(t),e&&U0(e,t).catch(()=>{}),u(1)}if(N||!_)return(0,H.jsxs)(`div`,{className:`flex items-center gap-2 py-12 text-muted-foreground`,children:[(0,H.jsx)(BC,{className:`size-4`}),(0,H.jsx)(`span`,{className:`text-sm`,children:`Loading…`})]});if(!M)return null;let Oe=Math.ceil((re?.total??0)/(re?.limit??20));return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(fs,{children:(0,H.jsxs)(`div`,{className:`mb-6 flex items-center justify-between gap-4`,children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold -mt-6`,children:M.name}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsxs)(q,{variant:`outline`,onClick:()=>g(!0),className:`gap-1.5`,children:[(0,H.jsx)(Wo,{className:`size-3.5`}),`View config`]}),ce&&(0,H.jsxs)(q,{onClick:()=>t(`/content/${e}/new`),className:`gap-2`,children:[(0,H.jsx)(Lo,{className:`size-4`}),`New entry`]})]})]})}),(0,H.jsxs)(`section`,{className:`mt-24`,children:[(0,H.jsxs)(`div`,{className:`mb-3 flex items-center gap-3`,children:[(0,H.jsxs)(H_,{value:c||`all`,onValueChange:e=>f(e===`all`?``:e),children:[(0,H.jsx)(G_,{className:`h-10 min-h-10 max-h-10 w-38`,children:(0,H.jsx)(W_,{placeholder:`All statuses`})}),(0,H.jsxs)(J_,{children:[(0,H.jsx)(X_,{value:`all`,children:`All statuses`}),ae.map(e=>(0,H.jsx)(X_,{value:e,children:j0[e]},e))]})]}),(0,H.jsxs)(`div`,{className:`relative w-52`,children:[(0,H.jsx)(Uo,{className:`absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground pointer-events-none`}),(0,H.jsx)(Z,{className:`pl-9`,placeholder:`Search entries…`,value:E,onChange:e=>D(e.target.value)})]}),!V&&re!=null&&(0,H.jsxs)(`span`,{className:`text-muted-foreground text-sm`,children:[(re?.data??[]).length,` / `,re.total,` `,re.total===1?`entry`:`entries`]})]}),V&&(0,H.jsxs)(`div`,{className:`flex items-center gap-2 py-12 text-muted-foreground`,children:[(0,H.jsx)(BC,{className:`size-4`}),(0,H.jsx)(`span`,{className:`text-sm`,children:`Loading entries…`})]}),!V&&(re?.data??[]).length===0&&!O&&!c&&(0,H.jsxs)(ZE,{className:`border`,children:[(0,H.jsxs)(QE,{children:[(0,H.jsx)(eD,{variant:`icon`,children:(0,H.jsx)(ao,{})}),(0,H.jsx)(tD,{children:`No entries yet`}),(0,H.jsxs)(nD,{children:[`Create your first entry for `,M.name,`.`]})]}),(0,H.jsx)(rD,{children:ce&&(0,H.jsx)(q,{onClick:()=>t(`/content/${e}/new`),children:`New entry`})})]}),!V&&(re?.data??[]).length===0&&(O||c)&&(0,H.jsx)(ZE,{className:`border`,children:(0,H.jsxs)(QE,{children:[(0,H.jsx)(eD,{variant:`icon`,children:(0,H.jsx)(Uo,{})}),(0,H.jsx)(tD,{children:`No results`}),(0,H.jsx)(nD,{children:O&&c?`No entries match "${O}" with status "${j0[c]}".`:O?`No entries match "${O}".`:`No entries with status "${j0[c]}".`})]})}),!V&&(re?.data??[]).length>0&&(0,H.jsxs)(xp,{children:[!ue&&b.size>0&&(0,H.jsxs)(`div`,{className:`mb-3 flex items-center gap-3 rounded-lg border border-border bg-muted/50 px-4 py-2.5`,children:[(0,H.jsxs)(`span`,{className:`text-sm font-medium`,children:[b.size,` selected`]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2 ml-auto`,children:[(0,H.jsxs)(q,{variant:`outline`,size:`sm`,disabled:S||ve.length===0,onClick:Te,children:[S?(0,H.jsx)(BC,{className:`size-3.5`}):null,`Unpublish`]}),le&&(0,H.jsxs)(q,{variant:`destructive`,size:`sm`,disabled:S||ye.length===0,onClick:()=>T(!0),children:[(0,H.jsx)(Qo,{className:`size-3.5`}),`Delete`]})]})]}),(0,H.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-border`,children:(0,H.jsxs)(VC,{className:`w-full`,children:[(0,H.jsx)(HC,{className:`border-b border-border font-bold uppercase`,children:(0,H.jsxs)(WC,{className:`hover:bg-transparent`,children:[(0,H.jsx)(GC,{className:`w-10 px-4 py-3`,children:!ue&&(0,H.jsx)(FT,{checked:xe?!0:Se?`indeterminate`:!1,onCheckedChange:Ce,"aria-label":`Select all`})}),z.map(e=>(0,H.jsx)(GC,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:N0(e.field.name)},e.field.name)),R.visibleSystemCols.includes(`created_at`)&&(0,H.jsx)(GC,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:`Created`}),R.visibleSystemCols.includes(`updated_at`)&&(0,H.jsx)(GC,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:`Updated`}),R.visibleSystemCols.includes(`pub_sch`)&&(0,H.jsx)(GC,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:`Published`}),(0,H.jsx)(GC,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:`Status`}),(0,H.jsx)(GC,{className:`w-10 px-4 py-3`}),(0,H.jsx)(GC,{className:`w-28 px-4 py-3`})]})}),(0,H.jsx)(UC,{className:`divide-y divide-border`,children:(re?.data??[]).map(r=>(0,H.jsxs)(WC,{className:`group transition-colors ${b.has(r.id)?`bg-muted/40`:`hover:bg-muted/30`} ${de&&!me(r)?`opacity-60`:``} ${he(r)?`opacity-60`:``}`,children:[(0,H.jsx)(KC,{className:`w-10 px-4 py-3`,children:!ue&&(0,H.jsx)(FT,{checked:b.has(r.id),onCheckedChange:()=>we(r.id),"aria-label":`Select row`})}),z.map(e=>{let t=r[e.field.name],n=t;return e.field.type===`relation`?n=t:e.displayField&&(n=t&&typeof t==`object`?t[e.displayField]:t&&typeof t==`object`?t.title:t),(0,H.jsx)(KC,{className:`px-4 py-3`,children:(0,H.jsx)(X0,{field:e.field,value:n,displayField:e.displayField})},e.field.name)}),R.visibleSystemCols.includes(`created_at`)&&(0,H.jsx)(KC,{className:`px-4 py-3 text-muted-foreground whitespace-nowrap`,children:sv(r.created_at,n)}),R.visibleSystemCols.includes(`updated_at`)&&(0,H.jsx)(KC,{className:`px-4 py-3 text-muted-foreground whitespace-nowrap`,children:sv(r.updated_at,n)}),R.visibleSystemCols.includes(`pub_sch`)&&(0,H.jsx)(KC,{className:`px-4 py-3 text-muted-foreground whitespace-nowrap`,children:r.status===`scheduled`&&r.scheduled_for?sv(r.scheduled_for,n):r.published_at?sv(r.published_at,n):`—`}),(0,H.jsx)(KC,{className:`px-4 py-3`,children:(()=>{let e=I&&ne?.checkStaleDrafts&&r.status===`draft`?F0(r.updated_at):0,t=!!ne?.checkStaleDrafts&&r.status===`draft`&&e>=(te?.staleDraftDays??30);return(0,H.jsx)(Z0,{entry:r,fields:M.fields,isStaleDraft:t})})()}),(0,H.jsx)(KC,{className:`px-4 py-3`,children:(()=>{let e=ne?.requiredTextFields?.filter(e=>I0(r[e]))??[],t=ne?.requiredMediaFields?.filter(e=>L0(r[e]))??[],n=[...e.length>0?[`Missing text: ${e.map(N0).join(`, `)}`]:[],...t.length>0?[`Missing media: ${t.map(N0).join(`, `)}`]:[]],i=n.length>0;return!I||!ne?null:(0,H.jsx)(q0,{hasIssues:i,title:n.length>0?`Content health indicator · ${n.join(` · `)}`:`Content health indicator · All configured text and media checks passed`})})()}),(0,H.jsx)(KC,{className:`px-4 py-3`,children:(0,H.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,H.jsx)(W0,{entry:r}),ue?(0,H.jsx)(q,{size:`icon`,variant:`ghost`,onClick:()=>t(`/content/${e}/${r.id}`),className:`flex size-8 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-accent-foreground`,children:(0,H.jsx)(no,{className:`size-3.5`})}):(0,H.jsxs)(H.Fragment,{children:[ge(r)&&(0,H.jsx)(q,{size:`icon`,variant:`ghost`,onClick:()=>t(`/content/${e}/${r.id}`),className:`flex size-8 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-accent-foreground`,children:(0,H.jsx)(Io,{className:`size-3.5`})}),_e(r)&&(0,H.jsx)(q,{size:`icon`,variant:`ghost`,onClick:()=>m(r.id),className:`flex size-8 items-center justify-center rounded text-destructive hover:bg-destructive/10 hover:text-destructive`,children:(0,H.jsx)(Qo,{className:`size-3.5`})})]})]})})]},r.id))})]})}),(0,H.jsx)(`div`,{className:`mt-4`,children:(0,H.jsx)(D0,{page:o,totalPages:Oe,limit:l,onPageChange:u,onLimitChange:d})})]}),_&&(0,H.jsx)(K0,{open:h,onOpenChange:g,allFields:M.fields,config:_,onApply:De}),(0,H.jsx)(Yh,{open:!!p,onOpenChange:e=>{e||m(null)},children:(0,H.jsxs)($h,{className:`max-w-sm`,children:[(0,H.jsx)(eg,{children:(0,H.jsx)(ng,{children:`Delete entry?`})}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This action cannot be undone.`}),(0,H.jsxs)(tg,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>m(null),children:`Cancel`}),(0,H.jsxs)(q,{variant:`destructive`,onClick:oe,disabled:A,children:[A?(0,H.jsx)(BC,{className:`size-4`}):null,`Delete`]})]})]})}),(0,H.jsx)(Yh,{open:w,onOpenChange:e=>{e||T(!1)},children:(0,H.jsxs)($h,{className:`max-w-sm`,children:[(0,H.jsx)(eg,{children:(0,H.jsxs)(ng,{children:[`Delete `,b.size,` `,b.size===1?`entry`:`entries`,`?`]})}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This action cannot be undone.`}),(0,H.jsxs)(tg,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>T(!1),children:`Cancel`}),(0,H.jsxs)(q,{variant:`destructive`,onClick:Ee,disabled:S,children:[S?(0,H.jsx)(BC,{className:`size-4`}):null,`Delete`]})]})]})})]})]})}function $0(){let{slug:e}=gr(),t=fr(),{user:n}=_a(),{data:r,loading:i}=ps(e?`/cms/admin/content-types/${e}`:null),a=r?.kind===`single`,{data:o,loading:s,error:c}=ps(a&&e?`/cms/admin/content-types/${e}/single`:null);return(0,v.useEffect)(()=>{if(!a||s)return;let r=n?.permissions??[],i=r.includes(`*`)||r.includes(`entries:write`);o?t(`/content/${e}/${o.id}`,{replace:!0}):c&&i&&t(`/content/${e}/new`,{replace:!0})},[a,s,o,c,e,t,n?.permissions]),i||a&&s?(0,H.jsxs)(`div`,{className:`flex items-center gap-2 py-12 text-muted-foreground`,children:[(0,H.jsx)(BC,{className:`size-4`}),(0,H.jsx)(`span`,{className:`text-sm`,children:`Loading…`})]}):a?o?null:(0,H.jsx)(`div`,{className:`py-12 text-sm text-muted-foreground`,children:`No entry is available for this Single Type.`}):(0,H.jsx)(Q0,{})}function e2(){let e=fr(),{data:t,loading:n}=ps(`/cms/admin/content-types`);return(0,v.useEffect)(()=>{t&&t.length>0&&e(`/content-types/${t[0].slug}`,{replace:!0})},[t,e]),n||t&&t.length>0?null:(0,H.jsxs)(ZE,{className:`border`,children:[(0,H.jsxs)(QE,{children:[(0,H.jsx)(eD,{variant:`icon`,children:(0,H.jsx)(So,{})}),(0,H.jsx)(tD,{children:`No content types yet`}),(0,H.jsx)(nD,{children:`Content types define the structure of your data. Create your first one to start managing content.`})]}),(0,H.jsx)(rD,{children:(0,H.jsx)(q,{onClick:()=>e(`/content-types/new`),children:`Create content type`})})]})}var t2=[{type:`string`,icon:es,label:`Text`,color:`text-blue-600`,bg:`bg-blue-50`},{type:`text`,icon:Yo,label:`Long Text`,color:`text-sky-600`,bg:`bg-sky-50`},{type:`richtext`,icon:ao,label:`Rich Text`,color:`text-violet-600`,bg:`bg-violet-50`},{type:`number`,subtype:`integer`,icon:po,label:`Integer`,color:`text-orange-600`,bg:`bg-orange-50`},{type:`number`,subtype:`float`,icon:po,label:`Decimal`,color:`text-orange-600`,bg:`bg-orange-50`},{type:`boolean`,icon:Zo,label:`Boolean`,color:`text-emerald-600`,bg:`bg-emerald-50`},{type:`datetime`,icon:Ra,label:`Date & Time`,color:`text-amber-600`,bg:`bg-amber-50`},{type:`media`,icon:vo,label:`Media`,color:`text-rose-600`,bg:`bg-rose-50`},{type:`mixed`,icon:To,label:`Mixed Value`,color:`text-fuchsia-600`,bg:`bg-fuchsia-50`}],n2={string:`half`,text:`full`,richtext:`full`,number:`third`,boolean:`third`,datetime:`half`,media:`half`,mixed:`half`},r2={type:`string`,subtype:void 0,name:``,required:!1,allowedTypes:[],width:`half`},i2=[{type:`string`,icon:es,label:`Text (string)`,description:`Titles, names, labels`,color:`text-blue-600`,bg:`bg-blue-50`},{type:`text`,icon:Yo,label:`Long text (string)`,description:`Plain text, paragraphs`,color:`text-sky-600`,bg:`bg-sky-50`},{type:`richtext`,icon:ao,label:`Rich text (blocks)`,description:`Formatted HTML content`,color:`text-violet-600`,bg:`bg-violet-50`},{type:`uid`,icon:so,label:`UID`,description:`Unique slug from a field`,color:`text-teal-600`,bg:`bg-teal-50`},{type:`boolean`,icon:Zo,label:`Boolean`,description:`True or false`,color:`text-emerald-600`,bg:`bg-emerald-50`},{type:`datetime`,icon:Ra,label:`Date & time`,description:`Timestamps and dates`,color:`text-amber-600`,bg:`bg-amber-50`},{type:`media`,icon:vo,label:`Media`,description:`Images, videos or files`,color:`text-rose-600`,bg:`bg-rose-50`},{type:`media-gallery`,icon:wo,label:`Media Gallery`,description:`Multiple images for galleries`,color:`text-pink-600`,bg:`bg-pink-50`},{type:`array`,icon:To,label:`Array`,description:`Repeatable list of items`,color:`text-cyan-600`,bg:`bg-cyan-50`},{type:`navigation`,icon:Oo,label:`Navigation`,description:`Nested navigation items`,color:`text-cyan-600`,bg:`bg-cyan-50`},{type:`number`,subtype:`integer`,icon:po,label:`Integer (number)`,description:`Whole numbers`,color:`text-orange-600`,bg:`bg-orange-50`},{type:`number`,subtype:`float`,icon:po,label:`Decimal (number)`,description:`Numbers with decimals`,color:`text-orange-600`,bg:`bg-orange-50`},{type:`relation`,icon:Eo,label:`Relation`,description:`Link to another content type`,color:`text-indigo-600`,bg:`bg-indigo-50`}],a2=[{value:`image`,label:`Images`},{value:`video`,label:`Videos`},{value:`audio`,label:`Audio`},{value:`document`,label:`Documents`}],o2=[{value:`many-to-one`,label:`Many-to-One`,description:`Many of these → one of the other`},{value:`one-to-one`,label:`One-to-One`,description:`One of these ↔ one of the other`},{value:`many-to-many`,label:`Many-to-Many`,description:`Many of these ↔ many of the other`}],s2=new Set(`all.analyse.analyze.and.any.array.as.asc.asymmetric.authorization.between.binary.both.case.cast.check.collate.column.constraint.create.cross.current_catalog.current_date.current_role.current_schema.current_time.current_timestamp.current_user.default.deferrable.desc.distinct.do.else.end.except.false.fetch.for.foreign.from.grant.group.having.in.initially.intersect.into.lateral.leading.limit.localtime.localtimestamp.not.null.offset.on.only.or.order.placing.primary.references.returning.select.session_user.some.symmetric.table.then.to.trailing.true.union.unique.user.using.variadic.when.where.window.with`.split(`.`));function c2(e){return s2.has(e.toLowerCase())}var l2={name:``,required:!1,relationType:`many-to-one`,relatedTable:``,relatedSlug:``,targetField:``,allowedTypes:[],arrayFields:[]};function u2({open:e,onOpenChange:t,existingNames:n,availableContentTypes:r,stringFields:i,initialField:a,onConfirm:o}){let[s,c]=(0,v.useState)(null),[l,u]=(0,v.useState)(l2),[d,f]=(0,v.useState)(``),[p,m]=(0,v.useState)(null),[h,g]=(0,v.useState)(null),[_,y]=(0,v.useState)(``),[b,x]=(0,v.useState)(``),S=!!a;(0,v.useEffect)(()=>{e?a&&(c(i2.find(e=>e.type===a.type&&(e.subtype??void 0)===(a.subtype??void 0))??null),u({name:a.name,required:a.required??!1,relationType:a.relationType??`many-to-one`,relatedTable:a.relatedTable??``,relatedSlug:a.relatedSlug??``,targetField:a.targetField??``,allowedTypes:a.allowedTypes??[],arrayFields:a.arrayFields??[]})):(c(null),u(l2),f(``),m(null),g(null),y(``),x(``))},[e,a]);function C(e){t(e)}function w(e){c(e),u(l2),f(``),m(null),y(``),x(``)}function T(){S||(c(null),u(l2),f(``),m(null),g(null),y(``),x(``))}function E(){m({...r2}),g(null),y(``)}function D(e){m(t=>t?{...t,type:e.type,subtype:e.subtype,width:n2[e.type]}:{...r2,type:e.type,subtype:e.subtype,width:n2[e.type]})}function O(){if(!p)return;let e=p.name.trim();if(!e){y(`Name is required`);return}if(!/^[a-z][a-z0-9_]*$/.test(e)){y(`Lowercase letters, digits and underscores only`);return}if(c2(e)){y(`This name is reserved by SQL. Choose another one.`);return}if(l.arrayFields.some((t,n)=>t.name===e&&n!==h)){y(`A sub-field with this name already exists`);return}let t={name:e,type:p.type,subtype:p.subtype,required:p.required||void 0,allowedTypes:p.type===`media`&&p.allowedTypes.length>0?p.allowedTypes:void 0,width:p.width};u(e=>({...e,arrayFields:h===null?[...e.arrayFields,t]:e.arrayFields.map((e,n)=>n===h?t:e)})),m(null),g(null),y(``)}function k(e){p||u(t=>({...t,arrayFields:t.arrayFields.filter(t=>t.name!==e)}))}function A(e){if(p)return;let t=l.arrayFields[e];t&&(m({type:t.type,subtype:t.subtype,name:t.name,required:!!t.required,allowedTypes:t.allowedTypes??[],width:t.width??n2[t.type]}),g(e),y(``))}function j(e,t){if(p)return;let n=e+t;n<0||n>=l.arrayFields.length||(u(t=>{let r=[...t.arrayFields];return[r[e],r[n]]=[r[n],r[e]],{...t,arrayFields:r}}),x(``))}function M(){let e=l.arrayFields.map(e=>e.name.trim());return e.some(e=>!e)?(x(`All sub-fields must have a name.`),!1):e.some(e=>!/^[a-z][a-z0-9_]*$/.test(e))?(x(`Sub-field names must use lowercase letters, digits and underscores.`),!1):e.some(e=>c2(e))?(x(`One or more sub-field names are reserved by SQL.`),!1):new Set(e).size===e.length?!0:(x(`Sub-field names must be unique.`),!1)}function N(){let e=l.name.trim();return e?/^[a-z][a-z0-9_]*$/.test(e)?c2(e)?(f(`This name is reserved by SQL. Choose another one.`),!1):n.includes(e)&&e!==a?.name?(f(`A field with this name already exists`),!1):!0:(f(`Lowercase letters, digits and underscores only`),!1):(f(`Name is required`),!1)}function P(){!s||!N()||s.type===`array`&&!M()||(o({name:l.name.trim(),type:s.type,subtype:s.subtype,required:l.required||void 0,relationType:s.type===`relation`?l.relationType:void 0,relatedTable:s.type===`relation`?l.relatedTable:void 0,relatedSlug:s.type===`relation`?l.relatedSlug:void 0,targetField:s.type===`uid`?l.targetField:void 0,allowedTypes:s.type===`media`&&l.allowedTypes.length>0?l.allowedTypes:s.type===`media-gallery`?[`image`]:void 0,arrayFields:s.type===`array`?l.arrayFields.map(e=>({...e,name:e.name.trim()})):void 0,width:a?.width??c0[s.type]}),C(!1))}let F=!!s,I=s?.label.replace(/\s*\(.*?\)/,``)??``,L=S?`Edit field`:F?`${I} field`:`Add a field`;return(0,H.jsx)(Yh,{open:e,onOpenChange:C,children:(0,H.jsxs)($h,{className:F?s?.type===`array`?`max-w-lg`:`max-w-md`:`max-w-3xl`,children:[(0,H.jsx)(eg,{children:(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[F&&!S&&(0,H.jsx)(`button`,{type:`button`,onClick:T,className:`flex size-7 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-accent-foreground`,children:(0,H.jsx)(Ma,{className:`size-4`})}),(0,H.jsx)(ng,{children:L})]})}),!F&&(0,H.jsx)(`div`,{className:`grid grid-cols-3 gap-2 pt-1`,children:i2.map(e=>{let t=e.icon,n=`${e.type}${e.subtype??``}`;return(0,H.jsxs)(`button`,{type:`button`,disabled:e.disabled,onClick:()=>!e.disabled&&w(e),className:`flex flex-col items-start gap-2 rounded-lg border border-border p-3 text-left transition-colors hover:border-primary hover:bg-accent disabled:cursor-not-allowed disabled:opacity-40`,children:[(0,H.jsx)(`div`,{className:`flex size-8 items-center justify-center rounded-md ${e.bg}`,children:(0,H.jsx)(t,{className:`size-4 ${e.color}`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`text-sm font-medium`,children:e.label}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.disabled?`Coming soon`:e.description})]})]},n)})}),F&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-4 pt-1`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`field-name`,children:`Field name`}),(0,H.jsx)(Z,{id:`field-name`,placeholder:`e.g. article_title`,value:l.name,onChange:e=>{u(t=>({...t,name:e.target.value})),f(``)},onKeyDown:e=>{e.key===`Enter`&&P()}}),d&&(0,H.jsx)(`p`,{className:`text-xs text-destructive`,children:d}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Lowercase letters, digits and underscores. Must start with a letter.`})]}),s?.type===`media`&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(Y,{children:`Allowed file types`}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground -mt-1`,children:`Leave all unchecked to allow any file type.`}),(0,H.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:a2.map(({value:e,label:t})=>(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(FT,{id:`media-type-${e}`,checked:l.allowedTypes.includes(e),onCheckedChange:t=>u(n=>({...n,allowedTypes:t?[...n.allowedTypes,e]:n.allowedTypes.filter(t=>t!==e)}))}),(0,H.jsx)(Y,{htmlFor:`media-type-${e}`,className:`cursor-pointer font-normal`,children:t})]},e))})]}),s?.type===`array`&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsx)(Y,{children:`Sub-fields`}),!p&&(0,H.jsxs)(`button`,{type:`button`,onClick:E,className:`flex items-center gap-1 rounded px-2 py-1 text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground`,children:[(0,H.jsx)(Lo,{className:`size-3`}),`Add sub-field`]})]}),l.arrayFields.length===0&&!p&&(0,H.jsx)(`p`,{className:`rounded-md border border-dashed border-border px-3 py-4 text-center text-xs text-muted-foreground`,children:`No sub-fields yet. Add at least one to make this field useful.`}),l.arrayFields.length>0&&(0,H.jsx)(`div`,{className:`grid grid-cols-6 gap-1.5`,children:l.arrayFields.map((e,t)=>{let n=t2.find(t=>t.type===e.type&&(t.subtype??void 0)===(e.subtype??void 0)),r=n?.icon??es;return(0,H.jsxs)(`div`,{className:`${s0[e.width??`full`]} rounded-md border border-dashed border-border p-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-start gap-1.5`,children:[(0,H.jsx)(`div`,{className:`mt-0.5 flex size-5 shrink-0 items-center justify-center rounded ${n?.bg??`bg-muted`}`,children:(0,H.jsx)(r,{className:`size-3 ${n?.color??`text-muted-foreground`}`})}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`p`,{className:`truncate text-xs font-medium`,children:[e.name,e.required&&(0,H.jsx)(`span`,{className:`ml-0.5 text-destructive`,children:`*`})]}),(0,H.jsx)(`p`,{className:`truncate text-[10px] text-muted-foreground`,children:n?.label})]})]}),(0,H.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1`,children:[(0,H.jsx)(`button`,{type:`button`,title:`Move up`,onClick:()=>j(t,-1),disabled:!!p||t===0,className:`flex size-6 items-center justify-center rounded border border-border text-muted-foreground hover:bg-accent disabled:opacity-30`,children:(0,H.jsx)(Wa,{className:`size-3`})}),(0,H.jsx)(`button`,{type:`button`,title:`Move down`,onClick:()=>j(t,1),disabled:!!p||t===l.arrayFields.length-1,className:`flex size-6 items-center justify-center rounded border border-border text-muted-foreground hover:bg-accent disabled:opacity-30`,children:(0,H.jsx)(Va,{className:`size-3`})}),(0,H.jsx)(`button`,{type:`button`,title:`Edit sub-field`,onClick:()=>A(t),disabled:!!p,className:`flex size-6 items-center justify-center rounded border border-border text-muted-foreground hover:bg-accent disabled:opacity-30`,children:(0,H.jsx)(Io,{className:`size-3`})}),(0,H.jsx)(`button`,{type:`button`,title:`Delete sub-field`,onClick:()=>k(e.name),disabled:!!p,className:`flex size-6 items-center justify-center rounded border border-border text-muted-foreground hover:text-destructive disabled:opacity-30`,children:(0,H.jsx)(Qo,{className:`size-3`})})]})]},e.name)})}),b&&(0,H.jsx)(`p`,{className:`text-xs text-destructive`,children:b}),p&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-lg border border-border bg-muted/30 p-3`,children:[(0,H.jsx)(`div`,{className:`grid grid-cols-4 gap-1.5`,children:t2.map(e=>{let t=e.icon,n=`${e.type}${e.subtype??``}`;return(0,H.jsxs)(`button`,{type:`button`,onClick:()=>D(e),className:[`flex items-center gap-1.5 rounded-md border px-2 py-1.5 text-left transition-colors`,p.type===e.type&&(p.subtype??void 0)===(e.subtype??void 0)?`border-primary bg-accent`:`border-border hover:border-primary hover:bg-accent`].join(` `),children:[(0,H.jsx)(`div`,{className:`flex size-5 shrink-0 items-center justify-center rounded ${e.bg}`,children:(0,H.jsx)(t,{className:`size-3 ${e.color}`})}),(0,H.jsx)(`span`,{className:`truncate text-xs font-medium`,children:e.label})]},n)})}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,H.jsx)(Z,{placeholder:`sub_field_name`,value:p.name,onChange:e=>{m(t=>t&&{...t,name:e.target.value}),y(``)},onKeyDown:e=>{e.key===`Enter`&&O()}}),_&&(0,H.jsx)(`p`,{className:`text-xs text-destructive`,children:_})]}),p.type===`media`&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(Y,{children:`Allowed file types`}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground -mt-1`,children:`Leave all unchecked to allow any file type.`}),(0,H.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:a2.map(({value:e,label:t})=>(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(FT,{id:`array-media-type-${e}`,checked:p.allowedTypes.includes(e),onCheckedChange:t=>m(n=>n&&{...n,allowedTypes:t?[...n.allowedTypes,e]:n.allowedTypes.filter(t=>t!==e)})}),(0,H.jsx)(Y,{htmlFor:`array-media-type-${e}`,className:`cursor-pointer font-normal`,children:t})]},e))})]}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,H.jsx)(FT,{id:`subfield-required`,checked:p.required,onCheckedChange:e=>m(t=>t&&{...t,required:!!e})}),(0,H.jsx)(Y,{htmlFor:`subfield-required`,className:`cursor-pointer font-normal text-sm`,children:`Required`})]}),(0,H.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,H.jsx)(q,{variant:`ghost`,size:`sm`,onClick:()=>{m(null),g(null),y(``)},children:`Cancel`}),(0,H.jsx)(q,{size:`sm`,onClick:O,children:h===null?`Add`:`Save`})]})]})]})]}),s?.type===`uid`&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{children:`Source field`}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`The slug will be auto-generated from this field's value.`}),i.length>0?(0,H.jsxs)(H_,{value:l.targetField,onValueChange:e=>u(t=>({...t,targetField:e})),children:[(0,H.jsx)(G_,{children:(0,H.jsx)(W_,{placeholder:`Select a text field`})}),(0,H.jsx)(J_,{children:i.map(e=>(0,H.jsx)(X_,{value:e.name,children:e.name},e.name))})]}):(0,H.jsx)(`p`,{className:`rounded-md border border-border bg-muted px-3 py-2 text-xs text-muted-foreground`,children:`No short text fields available. Add a string field first.`})]}),s?.type===`relation`&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{children:`Relation type`}),(0,H.jsx)(`div`,{className:`grid grid-cols-1 gap-1.5`,children:o2.map(e=>(0,H.jsx)(`button`,{type:`button`,onClick:()=>u(t=>({...t,relationType:e.value})),className:`flex items-start gap-3 rounded-md border px-3 py-2 text-left transition-colors hover:border-primary ${l.relationType===e.value?`border-primary bg-accent`:`border-border`}`,children:(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`text-sm font-medium leading-none`,children:e.label}),(0,H.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:e.description})]})},e.value))})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{children:`Related content type`}),r.length>0?(0,H.jsxs)(H_,{value:l.relatedTable,onValueChange:e=>{let t=r.find(t=>t.tableName===e);u(n=>({...n,relatedTable:e,relatedSlug:t?.slug??``}))},children:[(0,H.jsx)(G_,{children:(0,H.jsx)(W_,{placeholder:`Select a content type`})}),(0,H.jsx)(J_,{children:r.map(e=>(0,H.jsx)(X_,{value:e.tableName,children:e.name},e.tableName))})]}):(0,H.jsx)(Z,{placeholder:`table_name`,value:l.relatedTable,onChange:e=>u(t=>({...t,relatedTable:e.target.value}))})]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(FT,{id:`field-required`,checked:l.required,onCheckedChange:e=>u(t=>({...t,required:!!e}))}),(0,H.jsx)(Y,{htmlFor:`field-required`,className:`cursor-pointer font-normal`,children:`Required field`})]}),(0,H.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-border pt-3`,children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>C(!1),children:`Cancel`}),(0,H.jsx)(q,{onClick:P,children:S?`Save changes`:`Add field`})]})]})]})})}function d2(e){return e.toLowerCase().replace(/\s+/g,`-`).replace(/[^a-z0-9-]/g,``).replace(/^-+|-+$/g,``)}function f2(e){return e.replace(/-/g,`_`)}function p2({field:e,onWidthChange:t,onArraySubFieldWidthChange:n,onEdit:r,onDelete:i}){let{attributes:a,listeners:o,setNodeRef:s,transform:c,transition:l,isDragging:u}=pM({id:e.name});return(0,H.jsx)(`div`,{ref:s,style:{transform:Ek.Transform.toString(c),transition:l,opacity:u?.5:1},className:s0[e.width??`full`],children:(0,H.jsx)(d0,{field:e,dragListeners:o,dragAttributes:a,onWidthChange:t,onArraySubFieldWidthChange:n,onEdit:r,onDelete:i})})}function m2(){let{slug:e}=gr(),t=fr(),n=!e,{user:r}=_a(),i=r?.permissions??[],a=i.includes(`*`)||i.includes(`content-types:delete`),{data:o,loading:s}=ps(n?``:`/cms/admin/content-types/${e}`),{data:c,refetch:l}=ps(`/cms/admin/content-types`),{data:u}=ps(`/cms/admin/client-settings`),{loading:d,request:f}=Zw(),{loading:p,request:m}=Zw(),[h,g]=(0,v.useState)(``),[_,y]=(0,v.useState)(``),[b,x]=(0,v.useState)(`collection`),[S,C]=(0,v.useState)(!0),[w,T]=(0,v.useState)([]),[E,D]=(0,v.useState)(!1),[O,k]=(0,v.useState)(null),[A,j]=(0,v.useState)(!1),M=(0,v.useRef)({name:``,slug:``,previewEnabled:!0,fields:`[]`});(0,v.useEffect)(()=>(window.addEventListener(`plank:content-types-changed`,l),()=>window.removeEventListener(`plank:content-types-changed`,l)),[l]),(0,v.useEffect)(()=>{if(n){g(``),y(``),x(`collection`),C(!0),T([]),M.current={name:``,slug:``,previewEnabled:!0,fields:`[]`};return}o&&(g(o.name),y(o.slug),x(o.kind??`collection`),C(o.previewEnabled??!0),T(o.fields),M.current={name:o.name,slug:o.slug,previewEnabled:o.previewEnabled??!0,fields:JSON.stringify(o.fields)})},[o,n]),(0,v.useEffect)(()=>{n&&h&&y(d2(h))},[n,h]);let N=h!==M.current.name||S!==M.current.previewEnabled||JSON.stringify(w)!==M.current.fields,P=String(u?.preview_enabled??`false`).toLowerCase()===`true`&&b===`collection`,F=(0,v.useRef)(!1),I=Ir((0,v.useCallback)(()=>F.current?!1:N,[N])),L=Hk(Vk(HA,{activationConstraint:{distance:5}}));function R(e){let{active:t,over:n}=e;!n||t.id===n.id||T(e=>Jj(e,e.findIndex(e=>e.name===t.id),e.findIndex(e=>e.name===n.id)))}function ee(e){T(t=>[...t,e])}function te(e){T(t=>t.map(t=>t.name===O?.name?e:t)),k(null)}function ne(e){T(t=>t.filter(t=>t.name!==e))}function z(e,t){T(n=>n.map(n=>n.name===e?{...n,width:t}:n))}function B(e,t,n){T(r=>r.map(r=>r.name!==e||r.type!==`array`||!r.arrayFields?r:{...r,arrayFields:r.arrayFields.map(e=>e.name===t?{...e,width:n}:e)}))}async function re(){if(!h.trim()||!_.trim())return;let r=n?{name:h.trim(),slug:_,kind:b,previewEnabled:S,tableName:f2(_),fields:w}:{name:h.trim(),slug:_,previewEnabled:S,tableName:f2(_),fields:w};try{let i=await f(n?`/cms/admin/content-types`:`/cms/admin/content-types/${e}`,n?`POST`:`PUT`,r);g(i.name),y(i.slug),C(i.previewEnabled??!0),T(i.fields),M.current={name:i.name,slug:i.slug,previewEnabled:i.previewEnabled??!0,fields:JSON.stringify(i.fields)},window.dispatchEvent(new CustomEvent(`plank:content-types-changed`)),X.success(`Content type saved`),(n||i.slug!==e)&&(F.current=!0,t(`/content-types/${i.slug}`,{replace:!0}))}catch{X.error(`Could not save content type`)}}async function V(){if(a)try{await m(`/cms/admin/content-types/${e}`,`DELETE`),X.success(`Content type deleted`),window.dispatchEvent(new CustomEvent(`plank:content-types-changed`)),t(`/content-types`,{replace:!0})}catch{X.error(`Could not delete content type`)}}let ie=(c??[]).filter(t=>t.slug!==e).map(e=>({tableName:e.tableName,slug:e.slug,name:e.name})),ae=w.filter(e=>e.type===`string`),oe=w.map(e=>e.name);return hD(`mod+s`,re,{enabled:N&&!d&&!!h.trim(),label:`Save content type`}),hD(`mod+k`,()=>D(!0),{label:`Add field`}),!n&&s?(0,H.jsxs)(`div`,{className:`flex items-center gap-2 py-12 text-muted-foreground`,children:[(0,H.jsx)(BC,{className:`size-4`}),(0,H.jsx)(`span`,{className:`text-sm`,children:`Loading…`})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(fs,{children:(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,H.jsx)(`input`,{value:h,onChange:e=>g(e.target.value),placeholder:`Content type name`,className:`bg-transparent text-2xl font-bold outline-none placeholder:text-muted-foreground/40 -mt-2`}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,H.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`API ID:`}),(0,H.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:_||`—`})]}),n?(0,H.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border p-0.5`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>x(`collection`),className:`flex items-center gap-1.5 rounded px-2 py-0.5 text-xs font-medium transition-colors ${b===`collection`?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`}`,children:[(0,H.jsx)(ko,{className:`size-3`}),`Collection`]}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>x(`single`),className:`flex items-center gap-1.5 rounded px-2 py-0.5 text-xs font-medium transition-colors ${b===`single`?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`}`,children:[(0,H.jsx)(oo,{className:`size-3`}),`Single`]})]}):(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border px-2 py-0.5 text-xs font-medium text-muted-foreground ${b===`single`?`border-violet-500/30 bg-violet-500/10 text-violet-600 dark:text-violet-400`:``}`,children:[b===`single`?(0,H.jsx)(oo,{className:`size-3`}):(0,H.jsx)(ko,{className:`size-3`}),b===`single`?`Single`:`Collection`]}),P&&(0,H.jsxs)(`div`,{className:`ml-2 inline-flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,H.jsx)(uD,{id:`content-type-preview`,checked:S,onCheckedChange:C}),(0,H.jsx)(Y,{htmlFor:`content-type-preview`,className:`text-xs text-muted-foreground`,children:`Preview`})]})]})]}),(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[!n&&a&&(0,H.jsx)(q,{variant:`ghost`,size:`icon`,className:`text-muted-foreground hover:text-destructive`,onClick:()=>j(!0),disabled:p,children:(0,H.jsx)(Qo,{className:`size-4`})}),(0,H.jsxs)(q,{onClick:re,disabled:!N||d||!h.trim(),children:[d?(0,H.jsx)(BC,{className:`size-4`}):null,`Save`]})]})]})}),(0,H.jsxs)(`section`,{className:`mt-24`,children:[w.length>0?(()=>{let e=w.filter(e=>e.relationType!==`one-to-many`),t=w.filter(e=>e.relationType===`one-to-many`);return(0,H.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[e.length>0&&(0,H.jsx)(zj,{sensors:L,collisionDetection:Yk,onDragEnd:R,children:(0,H.jsx)(aM,{items:e.map(e=>e.name),strategy:tM,children:(0,H.jsx)(`div`,{className:`grid grid-cols-6 gap-3`,children:e.map(e=>(0,H.jsx)(p2,{field:e,onWidthChange:t=>z(e.name,t),onArraySubFieldWidthChange:(t,n)=>B(e.name,t,n),onEdit:()=>k(e),onDelete:()=>ne(e.name)},e.name))})})}),t.length>0&&(0,H.jsx)(`div`,{className:`grid grid-cols-6 gap-3`,children:t.map(e=>(0,H.jsx)(`div`,{className:`col-span-6`,children:(0,H.jsx)(d0,{field:e})},e.name))})]})})():(0,H.jsx)(ZE,{className:`border`,children:(0,H.jsxs)(QE,{children:[(0,H.jsx)(eD,{variant:`icon`,children:(0,H.jsx)(So,{})}),(0,H.jsx)(tD,{children:`No fields yet`}),(0,H.jsx)(nD,{children:`Add your first field to define this content type's structure.`})]})}),(0,H.jsx)(`div`,{className:`mt-4`,children:(0,H.jsxs)(q,{variant:`outline`,onClick:()=>D(!0),className:`gap-2`,children:[(0,H.jsx)(Lo,{className:`size-4`}),`Add field`]})}),(0,H.jsx)(u2,{open:E,onOpenChange:D,existingNames:oe,availableContentTypes:ie,stringFields:ae,onConfirm:ee}),(0,H.jsx)(u2,{open:!!O,onOpenChange:e=>{e||k(null)},existingNames:oe,availableContentTypes:ie,stringFields:ae,initialField:O??void 0,onConfirm:te}),(0,H.jsx)(Yh,{open:A,onOpenChange:j,children:(0,H.jsxs)($h,{className:`max-w-sm`,children:[(0,H.jsx)(eg,{children:(0,H.jsxs)(ng,{children:[`Delete "`,h,`"?`]})}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This will permanently delete the content type and all its entries. This action cannot be undone.`}),(0,H.jsxs)(tg,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>j(!1),children:`Cancel`}),(0,H.jsxs)(q,{variant:`destructive`,onClick:V,disabled:p,children:[p?(0,H.jsx)(BC,{className:`size-4`}):null,`Delete`]})]})]})}),(0,H.jsx)(Yh,{open:I.state===`blocked`,onOpenChange:()=>I.reset?.(),children:(0,H.jsxs)($h,{className:`max-w-sm`,children:[(0,H.jsx)(eg,{children:(0,H.jsx)(ng,{children:`Unsaved changes`})}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`You have unsaved changes. Leave without saving?`}),(0,H.jsxs)(tg,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>I.reset?.(),children:`Stay`}),(0,H.jsx)(q,{variant:`destructive`,onClick:()=>I.proceed?.(),children:`Leave`})]})]})})]})]})}function h2(e,t){return typeof e==`function`?e(t):e}function g2(e,t){return n=>{t.setState(t=>({...t,[e]:h2(n,t[e])}))}}function _2(e){return e instanceof Function}function v2(e){return Array.isArray(e)&&e.every(e=>typeof e==`number`)}function y2(e,t){let n=[],r=e=>{e.forEach(e=>{n.push(e);let i=t(e);i!=null&&i.length&&r(i)})};return r(e),n}function b2(e,t,n){let r=[],i;return a=>{let o;n.key&&n.debug&&(o=Date.now());let s=e(a);if(!(s.length!==r.length||s.some((e,t)=>r[t]!==e)))return i;r=s;let c;if(n.key&&n.debug&&(c=Date.now()),i=t(...s),n==null||n.onChange==null||n.onChange(i),n.key&&n.debug&&n!=null&&n.debug()){let e=Math.round((Date.now()-o)*100)/100,t=Math.round((Date.now()-c)*100)/100,r=t/16,i=(e,t)=>{for(e=String(e);e.length<t;)e=` `+e;return e};console.info(`%c⏱ ${i(t,5)} /${i(e,5)} ms`,`
221
+ font-size: .6rem;
222
+ font-weight: bold;
223
+ color: hsl(${Math.max(0,Math.min(120-120*r,120))}deg 100% 31%);`,n?.key)}return i}}function x2(e,t,n,r){return{debug:()=>e?.debugAll??e[t],key:!1,onChange:r}}function S2(e,t,n,r){let i={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(r),renderValue:()=>i.getValue()??e.options.renderFallbackValue,getContext:b2(()=>[e,n,t,i],(e,t,n,r)=>({table:e,column:t,row:n,cell:r,getValue:r.getValue,renderValue:r.renderValue}),x2(e.options,`debugCells`,`cell.getContext`))};return e._features.forEach(r=>{r.createCell==null||r.createCell(i,n,t,e)},{}),i}function C2(e,t,n,r){let i={...e._getDefaultColumnDef(),...t},a=i.accessorKey,o=i.id??(a?typeof String.prototype.replaceAll==`function`?a.replaceAll(`.`,`_`):a.replace(/\./g,`_`):void 0)??(typeof i.header==`string`?i.header:void 0),s;if(i.accessorFn?s=i.accessorFn:a&&(s=a.includes(`.`)?e=>{let t=e;for(let e of a.split(`.`))t=t?.[e];return t}:e=>e[i.accessorKey]),!o)throw Error();let c={id:`${String(o)}`,accessorFn:s,parent:r,depth:n,columnDef:i,columns:[],getFlatColumns:b2(()=>[!0],()=>[c,...c.columns?.flatMap(e=>e.getFlatColumns())],x2(e.options,`debugColumns`,`column.getFlatColumns`)),getLeafColumns:b2(()=>[e._getOrderColumnsFn()],e=>{var t;return(t=c.columns)!=null&&t.length?e(c.columns.flatMap(e=>e.getLeafColumns())):[c]},x2(e.options,`debugColumns`,`column.getLeafColumns`))};for(let t of e._features)t.createColumn==null||t.createColumn(c,e);return c}var w2=`debugHeaders`;function T2(e,t,n){let r={id:n.id??t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{let e=[],t=n=>{n.subHeaders&&n.subHeaders.length&&n.subHeaders.map(t),e.push(n)};return t(r),e},getContext:()=>({table:e,header:r,column:t})};return e._features.forEach(t=>{t.createHeader==null||t.createHeader(r,e)}),r}var E2={createTable:e=>{e.getHeaderGroups=b2(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>{let a=r?.map(e=>n.find(t=>t.id===e)).filter(Boolean)??[],o=i?.map(e=>n.find(t=>t.id===e)).filter(Boolean)??[],s=n.filter(e=>!(r!=null&&r.includes(e.id))&&!(i!=null&&i.includes(e.id)));return D2(t,[...a,...s,...o],e)},x2(e.options,w2,`getHeaderGroups`)),e.getCenterHeaderGroups=b2(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>(n=n.filter(e=>!(r!=null&&r.includes(e.id))&&!(i!=null&&i.includes(e.id))),D2(t,n,e,`center`)),x2(e.options,w2,`getCenterHeaderGroups`)),e.getLeftHeaderGroups=b2(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,r)=>D2(t,r?.map(e=>n.find(t=>t.id===e)).filter(Boolean)??[],e,`left`),x2(e.options,w2,`getLeftHeaderGroups`)),e.getRightHeaderGroups=b2(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,r)=>D2(t,r?.map(e=>n.find(t=>t.id===e)).filter(Boolean)??[],e,`right`),x2(e.options,w2,`getRightHeaderGroups`)),e.getFooterGroups=b2(()=>[e.getHeaderGroups()],e=>[...e].reverse(),x2(e.options,w2,`getFooterGroups`)),e.getLeftFooterGroups=b2(()=>[e.getLeftHeaderGroups()],e=>[...e].reverse(),x2(e.options,w2,`getLeftFooterGroups`)),e.getCenterFooterGroups=b2(()=>[e.getCenterHeaderGroups()],e=>[...e].reverse(),x2(e.options,w2,`getCenterFooterGroups`)),e.getRightFooterGroups=b2(()=>[e.getRightHeaderGroups()],e=>[...e].reverse(),x2(e.options,w2,`getRightFooterGroups`)),e.getFlatHeaders=b2(()=>[e.getHeaderGroups()],e=>e.map(e=>e.headers).flat(),x2(e.options,w2,`getFlatHeaders`)),e.getLeftFlatHeaders=b2(()=>[e.getLeftHeaderGroups()],e=>e.map(e=>e.headers).flat(),x2(e.options,w2,`getLeftFlatHeaders`)),e.getCenterFlatHeaders=b2(()=>[e.getCenterHeaderGroups()],e=>e.map(e=>e.headers).flat(),x2(e.options,w2,`getCenterFlatHeaders`)),e.getRightFlatHeaders=b2(()=>[e.getRightHeaderGroups()],e=>e.map(e=>e.headers).flat(),x2(e.options,w2,`getRightFlatHeaders`)),e.getCenterLeafHeaders=b2(()=>[e.getCenterFlatHeaders()],e=>e.filter(e=>{var t;return!((t=e.subHeaders)!=null&&t.length)}),x2(e.options,w2,`getCenterLeafHeaders`)),e.getLeftLeafHeaders=b2(()=>[e.getLeftFlatHeaders()],e=>e.filter(e=>{var t;return!((t=e.subHeaders)!=null&&t.length)}),x2(e.options,w2,`getLeftLeafHeaders`)),e.getRightLeafHeaders=b2(()=>[e.getRightFlatHeaders()],e=>e.filter(e=>{var t;return!((t=e.subHeaders)!=null&&t.length)}),x2(e.options,w2,`getRightLeafHeaders`)),e.getLeafHeaders=b2(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(e,t,n)=>[...e[0]?.headers??[],...t[0]?.headers??[],...n[0]?.headers??[]].map(e=>e.getLeafHeaders()).flat(),x2(e.options,w2,`getLeafHeaders`))}};function D2(e,t,n,r){let i=0,a=function(e,t){t===void 0&&(t=1),i=Math.max(i,t),e.filter(e=>e.getIsVisible()).forEach(e=>{var n;(n=e.columns)!=null&&n.length&&a(e.columns,t+1)},0)};a(e);let o=[],s=(e,t)=>{let i={depth:t,id:[r,`${t}`].filter(Boolean).join(`_`),headers:[]},a=[];e.forEach(e=>{let o=[...a].reverse()[0],s=e.column.depth===i.depth,c,l=!1;if(s&&e.column.parent?c=e.column.parent:(c=e.column,l=!0),o&&o?.column===c)o.subHeaders.push(e);else{let i=T2(n,c,{id:[r,t,c.id,e?.id].filter(Boolean).join(`_`),isPlaceholder:l,placeholderId:l?`${a.filter(e=>e.column===c).length}`:void 0,depth:t,index:a.length});i.subHeaders.push(e),a.push(i)}i.headers.push(e),e.headerGroup=i}),o.push(i),t>0&&s(a,t-1)};s(t.map((e,t)=>T2(n,e,{depth:i,index:t})),i-1),o.reverse();let c=e=>e.filter(e=>e.column.getIsVisible()).map(e=>{let t=0,n=0,r=[0];e.subHeaders&&e.subHeaders.length?(r=[],c(e.subHeaders).forEach(e=>{let{colSpan:n,rowSpan:i}=e;t+=n,r.push(i)})):t=1;let i=Math.min(...r);return n+=i,e.colSpan=t,e.rowSpan=n,{colSpan:t,rowSpan:n}});return c(o[0]?.headers??[]),o}var O2=(e,t,n,r,i,a,o)=>{let s={id:t,index:r,original:n,depth:i,parentId:o,_valuesCache:{},_uniqueValuesCache:{},getValue:t=>{if(s._valuesCache.hasOwnProperty(t))return s._valuesCache[t];let n=e.getColumn(t);if(n!=null&&n.accessorFn)return s._valuesCache[t]=n.accessorFn(s.original,r),s._valuesCache[t]},getUniqueValues:t=>{if(s._uniqueValuesCache.hasOwnProperty(t))return s._uniqueValuesCache[t];let n=e.getColumn(t);if(n!=null&&n.accessorFn)return n.columnDef.getUniqueValues?(s._uniqueValuesCache[t]=n.columnDef.getUniqueValues(s.original,r),s._uniqueValuesCache[t]):(s._uniqueValuesCache[t]=[s.getValue(t)],s._uniqueValuesCache[t])},renderValue:t=>s.getValue(t)??e.options.renderFallbackValue,subRows:a??[],getLeafRows:()=>y2(s.subRows,e=>e.subRows),getParentRow:()=>s.parentId?e.getRow(s.parentId,!0):void 0,getParentRows:()=>{let e=[],t=s;for(;;){let n=t.getParentRow();if(!n)break;e.push(n),t=n}return e.reverse()},getAllCells:b2(()=>[e.getAllLeafColumns()],t=>t.map(t=>S2(e,s,t,t.id)),x2(e.options,`debugRows`,`getAllCells`)),_getAllCellsByColumnId:b2(()=>[s.getAllCells()],e=>e.reduce((e,t)=>(e[t.column.id]=t,e),{}),x2(e.options,`debugRows`,`getAllCellsByColumnId`))};for(let t=0;t<e._features.length;t++){let n=e._features[t];n==null||n.createRow==null||n.createRow(s,e)}return s},k2={createColumn:(e,t)=>{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},A2=(e,t,n)=>{var r,i;let a=n==null||(r=n.toString())==null?void 0:r.toLowerCase();return!!(!((i=e.getValue(t))==null||(i=i.toString())==null||(i=i.toLowerCase())==null)&&i.includes(a))};A2.autoRemove=e=>B2(e);var j2=(e,t,n)=>{var r;return!!(!((r=e.getValue(t))==null||(r=r.toString())==null)&&r.includes(n))};j2.autoRemove=e=>B2(e);var M2=(e,t,n)=>{var r;return((r=e.getValue(t))==null||(r=r.toString())==null?void 0:r.toLowerCase())===n?.toLowerCase()};M2.autoRemove=e=>B2(e);var N2=(e,t,n)=>e.getValue(t)?.includes(n);N2.autoRemove=e=>B2(e);var P2=(e,t,n)=>!n.some(n=>{var r;return!((r=e.getValue(t))!=null&&r.includes(n))});P2.autoRemove=e=>B2(e)||!(e!=null&&e.length);var F2=(e,t,n)=>n.some(n=>e.getValue(t)?.includes(n));F2.autoRemove=e=>B2(e)||!(e!=null&&e.length);var I2=(e,t,n)=>e.getValue(t)===n;I2.autoRemove=e=>B2(e);var L2=(e,t,n)=>e.getValue(t)==n;L2.autoRemove=e=>B2(e);var R2=(e,t,n)=>{let[r,i]=n,a=e.getValue(t);return a>=r&&a<=i};R2.resolveFilterValue=e=>{let[t,n]=e,r=typeof t==`number`?t:parseFloat(t),i=typeof n==`number`?n:parseFloat(n),a=t===null||Number.isNaN(r)?-1/0:r,o=n===null||Number.isNaN(i)?1/0:i;if(a>o){let e=a;a=o,o=e}return[a,o]},R2.autoRemove=e=>B2(e)||B2(e[0])&&B2(e[1]);var z2={includesString:A2,includesStringSensitive:j2,equalsString:M2,arrIncludes:N2,arrIncludesAll:P2,arrIncludesSome:F2,equals:I2,weakEquals:L2,inNumberRange:R2};function B2(e){return e==null||e===``}var V2={getDefaultColumnDef:()=>({filterFn:`auto`}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:g2(`columnFilters`,e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{let n=t.getCoreRowModel().flatRows[0]?.getValue(e.id);return typeof n==`string`?z2.includesString:typeof n==`number`?z2.inNumberRange:typeof n==`boolean`||typeof n==`object`&&n?z2.equals:Array.isArray(n)?z2.arrIncludes:z2.weakEquals},e.getFilterFn=()=>_2(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn===`auto`?e.getAutoFilterFn():t.options.filterFns?.[e.columnDef.filterFn]??z2[e.columnDef.filterFn],e.getCanFilter=()=>(e.columnDef.enableColumnFilter??!0)&&(t.options.enableColumnFilters??!0)&&(t.options.enableFilters??!0)&&!!e.accessorFn,e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var n;return(n=t.getState().columnFilters)==null||(n=n.find(t=>t.id===e.id))==null?void 0:n.value},e.getFilterIndex=()=>t.getState().columnFilters?.findIndex(t=>t.id===e.id)??-1,e.setFilterValue=n=>{t.setColumnFilters(t=>{let r=e.getFilterFn(),i=t?.find(t=>t.id===e.id),a=h2(n,i?i.value:void 0);if(H2(r,a,e))return t?.filter(t=>t.id!==e.id)??[];let o={id:e.id,value:a};return i?t?.map(t=>t.id===e.id?o:t)??[]:t!=null&&t.length?[...t,o]:[o]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{let n=e.getAllLeafColumns();e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(e=>h2(t,e)?.filter(e=>{let t=n.find(t=>t.id===e.id);return!(t&&H2(t.getFilterFn(),e.value,t))}))},e.resetColumnFilters=t=>{e.setColumnFilters(t?[]:e.initialState?.columnFilters??[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function H2(e,t,n){return(e&&e.autoRemove?e.autoRemove(t,n):!1)||t===void 0||typeof t==`string`&&!t}var U2={sum:(e,t,n)=>n.reduce((t,n)=>{let r=n.getValue(e);return t+(typeof r==`number`?r:0)},0),min:(e,t,n)=>{let r;return n.forEach(t=>{let n=t.getValue(e);n!=null&&(r>n||r===void 0&&n>=n)&&(r=n)}),r},max:(e,t,n)=>{let r;return n.forEach(t=>{let n=t.getValue(e);n!=null&&(r<n||r===void 0&&n>=n)&&(r=n)}),r},extent:(e,t,n)=>{let r,i;return n.forEach(t=>{let n=t.getValue(e);n!=null&&(r===void 0?n>=n&&(r=i=n):(r>n&&(r=n),i<n&&(i=n)))}),[r,i]},mean:(e,t)=>{let n=0,r=0;if(t.forEach(t=>{let i=t.getValue(e);i!=null&&(i=+i)>=i&&(++n,r+=i)}),n)return r/n},median:(e,t)=>{if(!t.length)return;let n=t.map(t=>t.getValue(e));if(!v2(n))return;if(n.length===1)return n[0];let r=Math.floor(n.length/2),i=n.sort((e,t)=>e-t);return n.length%2==0?(i[r-1]+i[r])/2:i[r]},unique:(e,t)=>Array.from(new Set(t.map(t=>t.getValue(e))).values()),uniqueCount:(e,t)=>new Set(t.map(t=>t.getValue(e))).size,count:(e,t)=>t.length},W2={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t;return((t=e.getValue())==null||t.toString==null?void 0:t.toString())??null},aggregationFn:`auto`}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:g2(`grouping`,e),groupedColumnMode:`reorder`}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(t=>t!=null&&t.includes(e.id)?t.filter(t=>t!==e.id):[...t??[],e.id])},e.getCanGroup=()=>(e.columnDef.enableGrouping??!0)&&(t.options.enableGrouping??!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue),e.getIsGrouped=()=>t.getState().grouping?.includes(e.id),e.getGroupedIndex=()=>t.getState().grouping?.indexOf(e.id),e.getToggleGroupingHandler=()=>{let t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{let n=t.getCoreRowModel().flatRows[0]?.getValue(e.id);if(typeof n==`number`)return U2.sum;if(Object.prototype.toString.call(n)===`[object Date]`)return U2.extent},e.getAggregationFn=()=>{if(!e)throw Error();return _2(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn===`auto`?e.getAutoAggregationFn():t.options.aggregationFns?.[e.columnDef.aggregationFn]??U2[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{e.setGrouping(t?[]:e.initialState?.grouping??[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];let r=t.getColumn(n);return r!=null&&r.columnDef.getGroupingValue?(e._groupingValuesCache[n]=r.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},e._groupingValuesCache={}},createCell:(e,t,n,r)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var t;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((t=n.subRows)!=null&&t.length)}}};function G2(e,t,n){if(!(t!=null&&t.length)||!n)return e;let r=e.filter(e=>!t.includes(e.id));return n===`remove`?r:[...t.map(t=>e.find(e=>e.id===t)).filter(Boolean),...r]}var K2={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:g2(`columnOrder`,e)}),createColumn:(e,t)=>{e.getIndex=b2(e=>[r4(t,e)],t=>t.findIndex(t=>t.id===e.id),x2(t.options,`debugColumns`,`getIndex`)),e.getIsFirstColumn=n=>r4(t,n)[0]?.id===e.id,e.getIsLastColumn=n=>{let r=r4(t,n);return r[r.length-1]?.id===e.id}},createTable:e=>{e.setColumnOrder=t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{e.setColumnOrder(t?[]:e.initialState.columnOrder??[])},e._getOrderColumnsFn=b2(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(e,t,n)=>r=>{let i=[];if(!(e!=null&&e.length))i=r;else{let t=[...e],n=[...r];for(;n.length&&t.length;){let e=t.shift(),r=n.findIndex(t=>t.id===e);r>-1&&i.push(n.splice(r,1)[0])}i=[...i,...n]}return G2(i,t,n)},x2(e.options,`debugTable`,`_getOrderColumnsFn`))}},q2=()=>({left:[],right:[]}),J2={getInitialState:e=>({columnPinning:q2(),...e}),getDefaultOptions:e=>({onColumnPinningChange:g2(`columnPinning`,e)}),createColumn:(e,t)=>{e.pin=n=>{let r=e.getLeafColumns().map(e=>e.id).filter(Boolean);t.setColumnPinning(e=>n===`right`?{left:(e?.left??[]).filter(e=>!(r!=null&&r.includes(e))),right:[...(e?.right??[]).filter(e=>!(r!=null&&r.includes(e))),...r]}:n===`left`?{left:[...(e?.left??[]).filter(e=>!(r!=null&&r.includes(e))),...r],right:(e?.right??[]).filter(e=>!(r!=null&&r.includes(e)))}:{left:(e?.left??[]).filter(e=>!(r!=null&&r.includes(e))),right:(e?.right??[]).filter(e=>!(r!=null&&r.includes(e)))})},e.getCanPin=()=>e.getLeafColumns().some(e=>(e.columnDef.enablePinning??!0)&&(t.options.enableColumnPinning??t.options.enablePinning??!0)),e.getIsPinned=()=>{let n=e.getLeafColumns().map(e=>e.id),{left:r,right:i}=t.getState().columnPinning,a=n.some(e=>r?.includes(e)),o=n.some(e=>i?.includes(e));return a?`left`:o?`right`:!1},e.getPinnedIndex=()=>{var n;let r=e.getIsPinned();return r?((n=t.getState().columnPinning)==null||(n=n[r])==null?void 0:n.indexOf(e.id))??-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=b2(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(e,t,n)=>{let r=[...t??[],...n??[]];return e.filter(e=>!r.includes(e.column.id))},x2(t.options,`debugRows`,`getCenterVisibleCells`)),e.getLeftVisibleCells=b2(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(e,t)=>(t??[]).map(t=>e.find(e=>e.column.id===t)).filter(Boolean).map(e=>({...e,position:`left`})),x2(t.options,`debugRows`,`getLeftVisibleCells`)),e.getRightVisibleCells=b2(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(e,t)=>(t??[]).map(t=>e.find(e=>e.column.id===t)).filter(Boolean).map(e=>({...e,position:`right`})),x2(t.options,`debugRows`,`getRightVisibleCells`))},createTable:e=>{e.setColumnPinning=t=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>e.setColumnPinning(t?q2():e.initialState?.columnPinning??q2()),e.getIsSomeColumnsPinned=t=>{let n=e.getState().columnPinning;return t?!!n[t]?.length:!!(n.left?.length||n.right?.length)},e.getLeftLeafColumns=b2(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(e,t)=>(t??[]).map(t=>e.find(e=>e.id===t)).filter(Boolean),x2(e.options,`debugColumns`,`getLeftLeafColumns`)),e.getRightLeafColumns=b2(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(e,t)=>(t??[]).map(t=>e.find(e=>e.id===t)).filter(Boolean),x2(e.options,`debugColumns`,`getRightLeafColumns`)),e.getCenterLeafColumns=b2(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(e,t,n)=>{let r=[...t??[],...n??[]];return e.filter(e=>!r.includes(e.id))},x2(e.options,`debugColumns`,`getCenterLeafColumns`))}};function Y2(e){return e||(typeof document<`u`?document:null)}var X2={size:150,minSize:20,maxSize:2**53-1},Z2=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),Q2={getDefaultColumnDef:()=>X2,getInitialState:e=>({columnSizing:{},columnSizingInfo:Z2(),...e}),getDefaultOptions:e=>({columnResizeMode:`onEnd`,columnResizeDirection:`ltr`,onColumnSizingChange:g2(`columnSizing`,e),onColumnSizingInfoChange:g2(`columnSizingInfo`,e)}),createColumn:(e,t)=>{e.getSize=()=>{let n=t.getState().columnSizing[e.id];return Math.min(Math.max(e.columnDef.minSize??X2.minSize,n??e.columnDef.size??X2.size),e.columnDef.maxSize??X2.maxSize)},e.getStart=b2(e=>[e,r4(t,e),t.getState().columnSizing],(t,n)=>n.slice(0,e.getIndex(t)).reduce((e,t)=>e+t.getSize(),0),x2(t.options,`debugColumns`,`getStart`)),e.getAfter=b2(e=>[e,r4(t,e),t.getState().columnSizing],(t,n)=>n.slice(e.getIndex(t)+1).reduce((e,t)=>e+t.getSize(),0),x2(t.options,`debugColumns`,`getAfter`)),e.resetSize=()=>{t.setColumnSizing(t=>{let{[e.id]:n,...r}=t;return r})},e.getCanResize=()=>(e.columnDef.enableResizing??!0)&&(t.options.enableColumnResizing??!0),e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let t=0,n=e=>{e.subHeaders.length?e.subHeaders.forEach(n):t+=e.column.getSize()??0};return n(e),t},e.getStart=()=>{if(e.index>0){let t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},e.getResizeHandler=n=>{let r=t.getColumn(e.column.id),i=r?.getCanResize();return a=>{if(!r||!i||(a.persist==null||a.persist(),t4(a)&&a.touches&&a.touches.length>1))return;let o=e.getSize(),s=e?e.getLeafHeaders().map(e=>[e.column.id,e.column.getSize()]):[[r.id,r.getSize()]],c=t4(a)?Math.round(a.touches[0].clientX):a.clientX,l={},u=(e,n)=>{typeof n==`number`&&(t.setColumnSizingInfo(e=>{let r=t.options.columnResizeDirection===`rtl`?-1:1,i=(n-(e?.startOffset??0))*r,a=Math.max(i/(e?.startSize??0),-.999999);return e.columnSizingStart.forEach(e=>{let[t,n]=e;l[t]=Math.round(Math.max(n+n*a,0)*100)/100}),{...e,deltaOffset:i,deltaPercentage:a}}),(t.options.columnResizeMode===`onChange`||e===`end`)&&t.setColumnSizing(e=>({...e,...l})))},d=e=>u(`move`,e),f=e=>{u(`end`,e),t.setColumnSizingInfo(e=>({...e,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},p=Y2(n),m={moveHandler:e=>d(e.clientX),upHandler:e=>{p?.removeEventListener(`mousemove`,m.moveHandler),p?.removeEventListener(`mouseup`,m.upHandler),f(e.clientX)}},h={moveHandler:e=>(e.cancelable&&(e.preventDefault(),e.stopPropagation()),d(e.touches[0].clientX),!1),upHandler:e=>{p?.removeEventListener(`touchmove`,h.moveHandler),p?.removeEventListener(`touchend`,h.upHandler),e.cancelable&&(e.preventDefault(),e.stopPropagation()),f(e.touches[0]?.clientX)}},g=e4()?{passive:!1}:!1;t4(a)?(p?.addEventListener(`touchmove`,h.moveHandler,g),p?.addEventListener(`touchend`,h.upHandler,g)):(p?.addEventListener(`mousemove`,m.moveHandler,g),p?.addEventListener(`mouseup`,m.upHandler,g)),t.setColumnSizingInfo(e=>({...e,startOffset:c,startSize:o,deltaOffset:0,deltaPercentage:0,columnSizingStart:s,isResizingColumn:r.id}))}}},createTable:e=>{e.setColumnSizing=t=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{e.setColumnSizing(t?{}:e.initialState.columnSizing??{})},e.resetHeaderSizeInfo=t=>{e.setColumnSizingInfo(t?Z2():e.initialState.columnSizingInfo??Z2())},e.getTotalSize=()=>e.getHeaderGroups()[0]?.headers.reduce((e,t)=>e+t.getSize(),0)??0,e.getLeftTotalSize=()=>e.getLeftHeaderGroups()[0]?.headers.reduce((e,t)=>e+t.getSize(),0)??0,e.getCenterTotalSize=()=>e.getCenterHeaderGroups()[0]?.headers.reduce((e,t)=>e+t.getSize(),0)??0,e.getRightTotalSize=()=>e.getRightHeaderGroups()[0]?.headers.reduce((e,t)=>e+t.getSize(),0)??0}},$2=null;function e4(){if(typeof $2==`boolean`)return $2;let e=!1;try{let t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener(`test`,n,t),window.removeEventListener(`test`,n)}catch{e=!1}return $2=e,$2}function t4(e){return e.type===`touchstart`}var n4={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:g2(`columnVisibility`,e)}),createColumn:(e,t)=>{e.toggleVisibility=n=>{e.getCanHide()&&t.setColumnVisibility(t=>({...t,[e.id]:n??!e.getIsVisible()}))},e.getIsVisible=()=>{let n=e.columns;return(n.length?n.some(e=>e.getIsVisible()):t.getState().columnVisibility?.[e.id])??!0},e.getCanHide=()=>(e.columnDef.enableHiding??!0)&&(t.options.enableHiding??!0),e.getToggleVisibilityHandler=()=>t=>{e.toggleVisibility==null||e.toggleVisibility(t.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=b2(()=>[e.getAllCells(),t.getState().columnVisibility],e=>e.filter(e=>e.column.getIsVisible()),x2(t.options,`debugRows`,`_getAllVisibleCells`)),e.getVisibleCells=b2(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(e,t,n)=>[...e,...t,...n],x2(t.options,`debugRows`,`getVisibleCells`))},createTable:e=>{let t=(t,n)=>b2(()=>[n(),n().filter(e=>e.getIsVisible()).map(e=>e.id).join(`_`)],e=>e.filter(e=>e.getIsVisible==null?void 0:e.getIsVisible()),x2(e.options,`debugColumns`,t));e.getVisibleFlatColumns=t(`getVisibleFlatColumns`,()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=t(`getVisibleLeafColumns`,()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=t(`getLeftVisibleLeafColumns`,()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=t(`getRightVisibleLeafColumns`,()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=t(`getCenterVisibleLeafColumns`,()=>e.getCenterLeafColumns()),e.setColumnVisibility=t=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(t),e.resetColumnVisibility=t=>{e.setColumnVisibility(t?{}:e.initialState.columnVisibility??{})},e.toggleAllColumnsVisible=t=>{t??=!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((e,n)=>({...e,[n.id]:t||!(n.getCanHide!=null&&n.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(e=>!(e.getIsVisible!=null&&e.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(e=>e.getIsVisible==null?void 0:e.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>t=>{e.toggleAllColumnsVisible(t.target?.checked)}}};function r4(e,t){return t?t===`center`?e.getCenterVisibleLeafColumns():t===`left`?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}var i4={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,`__global__`),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,`__global__`),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,`__global__`),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},a4={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:g2(`globalFilter`,e),globalFilterFn:`auto`,getColumnCanGlobalFilter:t=>{var n;let r=(n=e.getCoreRowModel().flatRows[0])==null||(n=n._getAllCellsByColumnId()[t.id])==null?void 0:n.getValue();return typeof r==`string`||typeof r==`number`}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>(e.columnDef.enableGlobalFilter??!0)&&(t.options.enableGlobalFilter??!0)&&(t.options.enableFilters??!0)&&((t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))??!0)&&!!e.accessorFn},createTable:e=>{e.getGlobalAutoFilterFn=()=>z2.includesString,e.getGlobalFilterFn=()=>{let{globalFilterFn:t}=e.options;return _2(t)?t:t===`auto`?e.getGlobalAutoFilterFn():e.options.filterFns?.[t]??z2[t]},e.setGlobalFilter=t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},o4={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:g2(`expanded`,e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{if(!t){e._queue(()=>{t=!0});return}if(e.options.autoResetAll??e.options.autoResetExpanded??!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}},e.setExpanded=t=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(t),e.toggleAllRowsExpanded=t=>{t??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=t=>{e.setExpanded(t?{}:e.initialState?.expanded??{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(e=>e.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>t=>{t.persist==null||t.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{let t=e.getState().expanded;return t===!0||Object.values(t).some(Boolean)},e.getIsAllRowsExpanded=()=>{let t=e.getState().expanded;return typeof t==`boolean`?t===!0:!(!Object.keys(t).length||e.getRowModel().flatRows.some(e=>!e.getIsExpanded()))},e.getExpandedDepth=()=>{let t=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(e=>{let n=e.split(`.`);t=Math.max(t,n.length)}),t},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,t)=>{e.toggleExpanded=n=>{t.setExpanded(r=>{let i=r===!0?!0:!!(r!=null&&r[e.id]),a={};if(r===!0?Object.keys(t.getRowModel().rowsById).forEach(e=>{a[e]=!0}):a=r,n??=!i,!i&&n)return{...a,[e.id]:!0};if(i&&!n){let{[e.id]:t,...n}=a;return n}return r})},e.getIsExpanded=()=>{let n=t.getState().expanded;return!!((t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))??(n===!0||n?.[e.id]))},e.getCanExpand=()=>{var n;return(t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))??((t.options.enableExpanding??!0)&&!!((n=e.subRows)!=null&&n.length))},e.getIsAllParentsExpanded=()=>{let n=!0,r=e;for(;n&&r.parentId;)r=t.getRow(r.parentId,!0),n=r.getIsExpanded();return n},e.getToggleExpandedHandler=()=>{let t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},s4=0,c4=10,l4=()=>({pageIndex:s4,pageSize:c4}),u4={getInitialState:e=>({...e,pagination:{...l4(),...e?.pagination}}),getDefaultOptions:e=>({onPaginationChange:g2(`pagination`,e)}),createTable:e=>{let t=!1,n=!1;e._autoResetPageIndex=()=>{if(!t){e._queue(()=>{t=!0});return}if(e.options.autoResetAll??e.options.autoResetPageIndex??!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}},e.setPagination=t=>e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(e=>h2(t,e)),e.resetPagination=t=>{e.setPagination(t?l4():e.initialState.pagination??l4())},e.setPageIndex=t=>{e.setPagination(n=>{let r=h2(t,n.pageIndex),i=e.options.pageCount===void 0||e.options.pageCount===-1?2**53-1:e.options.pageCount-1;return r=Math.max(0,Math.min(r,i)),{...n,pageIndex:r}})},e.resetPageIndex=t=>{var n;e.setPageIndex(t?s4:((n=e.initialState)==null||(n=n.pagination)==null?void 0:n.pageIndex)??s4)},e.resetPageSize=t=>{var n;e.setPageSize(t?c4:((n=e.initialState)==null||(n=n.pagination)==null?void 0:n.pageSize)??c4)},e.setPageSize=t=>{e.setPagination(e=>{let n=Math.max(1,h2(t,e.pageSize)),r=e.pageSize*e.pageIndex,i=Math.floor(r/n);return{...e,pageIndex:i,pageSize:n}})},e.setPageCount=t=>e.setPagination(n=>{let r=h2(t,e.options.pageCount??-1);return typeof r==`number`&&(r=Math.max(-1,r)),{...n,pageCount:r}}),e.getPageOptions=b2(()=>[e.getPageCount()],e=>{let t=[];return e&&e>0&&(t=[...Array(e)].fill(null).map((e,t)=>t)),t},x2(e.options,`debugTable`,`getPageOptions`)),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{let{pageIndex:t}=e.getState().pagination,n=e.getPageCount();return n===-1?!0:n===0?!1:t<n-1},e.previousPage=()=>e.setPageIndex(e=>e-1),e.nextPage=()=>e.setPageIndex(e=>e+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>e.options.pageCount??Math.ceil(e.getRowCount()/e.getState().pagination.pageSize),e.getRowCount=()=>e.options.rowCount??e.getPrePaginationRowModel().rows.length}},d4=()=>({top:[],bottom:[]}),f4={getInitialState:e=>({rowPinning:d4(),...e}),getDefaultOptions:e=>({onRowPinningChange:g2(`rowPinning`,e)}),createRow:(e,t)=>{e.pin=(n,r,i)=>{let a=r?e.getLeafRows().map(e=>{let{id:t}=e;return t}):[],o=i?e.getParentRows().map(e=>{let{id:t}=e;return t}):[],s=new Set([...o,e.id,...a]);t.setRowPinning(e=>n===`bottom`?{top:(e?.top??[]).filter(e=>!(s!=null&&s.has(e))),bottom:[...(e?.bottom??[]).filter(e=>!(s!=null&&s.has(e))),...Array.from(s)]}:n===`top`?{top:[...(e?.top??[]).filter(e=>!(s!=null&&s.has(e))),...Array.from(s)],bottom:(e?.bottom??[]).filter(e=>!(s!=null&&s.has(e)))}:{top:(e?.top??[]).filter(e=>!(s!=null&&s.has(e))),bottom:(e?.bottom??[]).filter(e=>!(s!=null&&s.has(e)))})},e.getCanPin=()=>{let{enableRowPinning:n,enablePinning:r}=t.options;return typeof n==`function`?n(e):n??r??!0},e.getIsPinned=()=>{let n=[e.id],{top:r,bottom:i}=t.getState().rowPinning,a=n.some(e=>r?.includes(e)),o=n.some(e=>i?.includes(e));return a?`top`:o?`bottom`:!1},e.getPinnedIndex=()=>{let n=e.getIsPinned();return n?((n===`top`?t.getTopRows():t.getBottomRows())?.map(e=>{let{id:t}=e;return t}))?.indexOf(e.id)??-1:-1}},createTable:e=>{e.setRowPinning=t=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>e.setRowPinning(t?d4():e.initialState?.rowPinning??d4()),e.getIsSomeRowsPinned=t=>{let n=e.getState().rowPinning;return t?!!n[t]?.length:!!(n.top?.length||n.bottom?.length)},e._getPinnedRows=(t,n,r)=>(e.options.keepPinnedRows??!0?(n??[]).map(t=>{let n=e.getRow(t,!0);return n.getIsAllParentsExpanded()?n:null}):(n??[]).map(e=>t.find(t=>t.id===e))).filter(Boolean).map(e=>({...e,position:r})),e.getTopRows=b2(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,n)=>e._getPinnedRows(t,n,`top`),x2(e.options,`debugRows`,`getTopRows`)),e.getBottomRows=b2(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,n)=>e._getPinnedRows(t,n,`bottom`),x2(e.options,`debugRows`,`getBottomRows`)),e.getCenterRows=b2(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(e,t,n)=>{let r=new Set([...t??[],...n??[]]);return e.filter(e=>!r.has(e.id))},x2(e.options,`debugRows`,`getCenterRows`))}},p4={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:g2(`rowSelection`,e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>e.setRowSelection(t?{}:e.initialState.rowSelection??{}),e.toggleAllRowsSelected=t=>{e.setRowSelection(n=>{t=t===void 0?!e.getIsAllRowsSelected():t;let r={...n},i=e.getPreGroupedRowModel().flatRows;return t?i.forEach(e=>{e.getCanSelect()&&(r[e.id]=!0)}):i.forEach(e=>{delete r[e.id]}),r})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(n=>{let r=t===void 0?!e.getIsAllPageRowsSelected():t,i={...n};return e.getRowModel().rows.forEach(t=>{m4(i,t.id,r,!0,e)}),i}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=b2(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?h4(e,n):{rows:[],flatRows:[],rowsById:{}},x2(e.options,`debugTable`,`getSelectedRowModel`)),e.getFilteredSelectedRowModel=b2(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?h4(e,n):{rows:[],flatRows:[],rowsById:{}},x2(e.options,`debugTable`,`getFilteredSelectedRowModel`)),e.getGroupedSelectedRowModel=b2(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?h4(e,n):{rows:[],flatRows:[],rowsById:{}},x2(e.options,`debugTable`,`getGroupedSelectedRowModel`)),e.getIsAllRowsSelected=()=>{let t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState(),r=!!(t.length&&Object.keys(n).length);return r&&t.some(e=>e.getCanSelect()&&!n[e.id])&&(r=!1),r},e.getIsAllPageRowsSelected=()=>{let t=e.getPaginationRowModel().flatRows.filter(e=>e.getCanSelect()),{rowSelection:n}=e.getState(),r=!!t.length;return r&&t.some(e=>!n[e.id])&&(r=!1),r},e.getIsSomeRowsSelected=()=>{let t=Object.keys(e.getState().rowSelection??{}).length;return t>0&&t<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{let t=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:t.filter(e=>e.getCanSelect()).some(e=>e.getIsSelected()||e.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(n,r)=>{let i=e.getIsSelected();t.setRowSelection(a=>{if(n=n===void 0?!i:n,e.getCanSelect()&&i===n)return a;let o={...a};return m4(o,e.id,n,r?.selectChildren??!0,t),o})},e.getIsSelected=()=>{let{rowSelection:n}=t.getState();return g4(e,n)},e.getIsSomeSelected=()=>{let{rowSelection:n}=t.getState();return _4(e,n)===`some`},e.getIsAllSubRowsSelected=()=>{let{rowSelection:n}=t.getState();return _4(e,n)===`all`},e.getCanSelect=()=>typeof t.options.enableRowSelection==`function`?t.options.enableRowSelection(e):t.options.enableRowSelection??!0,e.getCanSelectSubRows=()=>typeof t.options.enableSubRowSelection==`function`?t.options.enableSubRowSelection(e):t.options.enableSubRowSelection??!0,e.getCanMultiSelect=()=>typeof t.options.enableMultiRowSelection==`function`?t.options.enableMultiRowSelection(e):t.options.enableMultiRowSelection??!0,e.getToggleSelectedHandler=()=>{let t=e.getCanSelect();return n=>{t&&e.toggleSelected(n.target?.checked)}}}},m4=(e,t,n,r,i)=>{var a;let o=i.getRow(t,!0);n?(o.getCanMultiSelect()||Object.keys(e).forEach(t=>delete e[t]),o.getCanSelect()&&(e[t]=!0)):delete e[t],r&&(a=o.subRows)!=null&&a.length&&o.getCanSelectSubRows()&&o.subRows.forEach(t=>m4(e,t.id,n,r,i))};function h4(e,t){let n=e.getState().rowSelection,r=[],i={},a=function(e,t){return e.map(e=>{var t;let o=g4(e,n);if(o&&(r.push(e),i[e.id]=e),(t=e.subRows)!=null&&t.length&&(e={...e,subRows:a(e.subRows)}),o)return e}).filter(Boolean)};return{rows:a(t.rows),flatRows:r,rowsById:i}}function g4(e,t){return t[e.id]??!1}function _4(e,t,n){var r;if(!((r=e.subRows)!=null&&r.length))return!1;let i=!0,a=!1;return e.subRows.forEach(e=>{if(!(a&&!i)&&(e.getCanSelect()&&(g4(e,t)?a=!0:i=!1),e.subRows&&e.subRows.length)){let n=_4(e,t);n===`all`?a=!0:(n===`some`&&(a=!0),i=!1)}}),i?`all`:a?`some`:!1}var v4=/([0-9]+)/gm,y4=(e,t,n)=>D4(E4(e.getValue(n)).toLowerCase(),E4(t.getValue(n)).toLowerCase()),b4=(e,t,n)=>D4(E4(e.getValue(n)),E4(t.getValue(n))),x4=(e,t,n)=>T4(E4(e.getValue(n)).toLowerCase(),E4(t.getValue(n)).toLowerCase()),S4=(e,t,n)=>T4(E4(e.getValue(n)),E4(t.getValue(n))),C4=(e,t,n)=>{let r=e.getValue(n),i=t.getValue(n);return r>i?1:r<i?-1:0},w4=(e,t,n)=>T4(e.getValue(n),t.getValue(n));function T4(e,t){return e===t?0:e>t?1:-1}function E4(e){return typeof e==`number`?isNaN(e)||e===1/0||e===-1/0?``:String(e):typeof e==`string`?e:``}function D4(e,t){let n=e.split(v4).filter(Boolean),r=t.split(v4).filter(Boolean);for(;n.length&&r.length;){let e=n.shift(),t=r.shift(),i=parseInt(e,10),a=parseInt(t,10),o=[i,a].sort();if(isNaN(o[0])){if(e>t)return 1;if(t>e)return-1;continue}if(isNaN(o[1]))return isNaN(i)?-1:1;if(i>a)return 1;if(a>i)return-1}return n.length-r.length}var O4={alphanumeric:y4,alphanumericCaseSensitive:b4,text:x4,textCaseSensitive:S4,datetime:C4,basic:w4},k4=[E2,n4,K2,J2,k2,V2,i4,a4,{getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:`auto`,sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:g2(`sorting`,e),isMultiSortEvent:e=>e.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{let n=t.getFilteredRowModel().flatRows.slice(10),r=!1;for(let t of n){let n=t?.getValue(e.id);if(Object.prototype.toString.call(n)===`[object Date]`)return O4.datetime;if(typeof n==`string`&&(r=!0,n.split(v4).length>1))return O4.alphanumeric}return r?O4.text:O4.basic},e.getAutoSortDir=()=>typeof t.getFilteredRowModel().flatRows[0]?.getValue(e.id)==`string`?`asc`:`desc`,e.getSortingFn=()=>{if(!e)throw Error();return _2(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn===`auto`?e.getAutoSortingFn():t.options.sortingFns?.[e.columnDef.sortingFn]??O4[e.columnDef.sortingFn]},e.toggleSorting=(n,r)=>{let i=e.getNextSortingOrder(),a=n!=null;t.setSorting(o=>{let s=o?.find(t=>t.id===e.id),c=o?.findIndex(t=>t.id===e.id),l=[],u,d=a?n:i===`desc`;return u=o!=null&&o.length&&e.getCanMultiSort()&&r?s?`toggle`:`add`:o!=null&&o.length&&c!==o.length-1?`replace`:s?`toggle`:`replace`,u===`toggle`&&(a||i||(u=`remove`)),u===`add`?(l=[...o,{id:e.id,desc:d}],l.splice(0,l.length-(t.options.maxMultiSortColCount??2**53-1))):l=u===`toggle`?o.map(t=>t.id===e.id?{...t,desc:d}:t):u===`remove`?o.filter(t=>t.id!==e.id):[{id:e.id,desc:d}],l})},e.getFirstSortDir=()=>e.columnDef.sortDescFirst??t.options.sortDescFirst??e.getAutoSortDir()===`desc`?`desc`:`asc`,e.getNextSortingOrder=n=>{let r=e.getFirstSortDir(),i=e.getIsSorted();return i?i!==r&&(t.options.enableSortingRemoval??!0)&&(!n||(t.options.enableMultiRemove??!0))?!1:i===`desc`?`asc`:`desc`:r},e.getCanSort=()=>(e.columnDef.enableSorting??!0)&&(t.options.enableSorting??!0)&&!!e.accessorFn,e.getCanMultiSort=()=>e.columnDef.enableMultiSort??t.options.enableMultiSort??!!e.accessorFn,e.getIsSorted=()=>{let n=t.getState().sorting?.find(t=>t.id===e.id);return n?n.desc?`desc`:`asc`:!1},e.getSortIndex=()=>t.getState().sorting?.findIndex(t=>t.id===e.id)??-1,e.clearSorting=()=>{t.setSorting(t=>t!=null&&t.length?t.filter(t=>t.id!==e.id):[])},e.getToggleSortingHandler=()=>{let n=e.getCanSort();return r=>{n&&(r.persist==null||r.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(r):!1))}}},createTable:e=>{e.setSorting=t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{e.setSorting(t?[]:e.initialState?.sorting??[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},W2,o4,u4,f4,p4,Q2];function A4(e){let t=[...k4,...e._features??[]],n={_features:t},r=n._features.reduce((e,t)=>Object.assign(e,t.getDefaultOptions==null?void 0:t.getDefaultOptions(n)),{}),i=e=>n.options.mergeOptions?n.options.mergeOptions(r,e):{...r,...e},a={...e.initialState??{}};n._features.forEach(e=>{a=(e.getInitialState==null?void 0:e.getInitialState(a))??a});let o=[],s=!1,c={_features:t,options:{...r,...e},initialState:a,_queue:e=>{o.push(e),s||(s=!0,Promise.resolve().then(()=>{for(;o.length;)o.shift()();s=!1}).catch(e=>setTimeout(()=>{throw e})))},reset:()=>{n.setState(n.initialState)},setOptions:e=>{n.options=i(h2(e,n.options))},getState:()=>n.options.state,setState:e=>{n.options.onStateChange==null||n.options.onStateChange(e)},_getRowId:(e,t,r)=>(n.options.getRowId==null?void 0:n.options.getRowId(e,t,r))??`${r?[r.id,t].join(`.`):t}`,getCoreRowModel:()=>(n._getCoreRowModel||=n.options.getCoreRowModel(n),n._getCoreRowModel()),getRowModel:()=>n.getPaginationRowModel(),getRow:(e,t)=>{let r=(t?n.getPrePaginationRowModel():n.getRowModel()).rowsById[e];if(!r&&(r=n.getCoreRowModel().rowsById[e],!r))throw Error();return r},_getDefaultColumnDef:b2(()=>[n.options.defaultColumn],e=>(e??={},{header:e=>{let t=e.header.column.columnDef;return t.accessorKey?t.accessorKey:t.accessorFn?t.id:null},cell:e=>{var t;return((t=e.renderValue())==null||t.toString==null?void 0:t.toString())??null},...n._features.reduce((e,t)=>Object.assign(e,t.getDefaultColumnDef==null?void 0:t.getDefaultColumnDef()),{}),...e}),x2(e,`debugColumns`,`_getDefaultColumnDef`)),_getColumnDefs:()=>n.options.columns,getAllColumns:b2(()=>[n._getColumnDefs()],e=>{let t=function(e,r,i){return i===void 0&&(i=0),e.map(e=>{let a=C2(n,e,i,r),o=e;return a.columns=o.columns?t(o.columns,a,i+1):[],a})};return t(e)},x2(e,`debugColumns`,`getAllColumns`)),getAllFlatColumns:b2(()=>[n.getAllColumns()],e=>e.flatMap(e=>e.getFlatColumns()),x2(e,`debugColumns`,`getAllFlatColumns`)),_getAllFlatColumnsById:b2(()=>[n.getAllFlatColumns()],e=>e.reduce((e,t)=>(e[t.id]=t,e),{}),x2(e,`debugColumns`,`getAllFlatColumnsById`)),getAllLeafColumns:b2(()=>[n.getAllColumns(),n._getOrderColumnsFn()],(e,t)=>t(e.flatMap(e=>e.getLeafColumns())),x2(e,`debugColumns`,`getAllLeafColumns`)),getColumn:e=>n._getAllFlatColumnsById()[e]};Object.assign(n,c);for(let e=0;e<n._features.length;e++){let t=n._features[e];t==null||t.createTable==null||t.createTable(n)}return n}function j4(){return e=>b2(()=>[e.options.data],t=>{let n={rows:[],flatRows:[],rowsById:{}},r=function(t,i,a){i===void 0&&(i=0);let o=[];for(let c=0;c<t.length;c++){let l=O2(e,e._getRowId(t[c],c,a),t[c],c,i,void 0,a?.id);if(n.flatRows.push(l),n.rowsById[l.id]=l,o.push(l),e.options.getSubRows){var s;l.originalSubRows=e.options.getSubRows(t[c],c),(s=l.originalSubRows)!=null&&s.length&&(l.subRows=r(l.originalSubRows,i+1,l))}}return o};return n.rows=r(t),n},x2(e.options,`debugTable`,`getRowModel`,()=>e._autoResetPageIndex()))}function M4(e,t){return e?N4(e)?v.createElement(e,t):e:null}function N4(e){return P4(e)||typeof e==`function`||F4(e)}function P4(e){return typeof e==`function`&&(()=>{let t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function F4(e){return typeof e==`object`&&typeof e.$$typeof==`symbol`&&[`react.memo`,`react.forward_ref`].includes(e.$$typeof.description)}function I4(e){let t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=v.useState(()=>({current:A4(t)})),[r,i]=v.useState(()=>n.current.initialState);return n.current.setOptions(t=>({...t,...e,state:{...r,...e.state},onStateChange:t=>{i(t),e.onStateChange==null||e.onStateChange(t)}})),n.current}var L4={"full-access":`default`,"mcp-server":`outline`,"read-only":`secondary`},R4={"full-access":`Full access`,"mcp-server":`MCP Server`,"read-only":`Read only`};function z4({value:e}){let[t,n]=(0,v.useState)(!1);function r(){navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),2e3)}return(0,H.jsx)(q,{type:`button`,size:`icon`,variant:`outline`,className:`shrink-0`,onClick:r,children:t?(0,H.jsx)(Ba,{className:`size-4 text-green-500`}):(0,H.jsx)(Qa,{className:`size-4`})})}var B4={name:``,accessType:``};function V4(){let{user:e}=_a(),{data:t,loading:n,refetch:r}=ps(`/cms/admin/api-tokens`),{request:i,loading:a,error:o}=Zw(),s=e?.permissions??[],c=s.includes(`*`)||s.includes(`settings:api-tokens:write`),l=s.includes(`*`)||s.includes(`settings:api-tokens:delete`),[u,d]=(0,v.useState)(!1),[f,p]=(0,v.useState)(B4),[m,h]=(0,v.useState)(null),[g,_]=(0,v.useState)(null),y=[{accessorKey:`name`,header:`Name`},{accessorKey:`access_type`,header:`Access`,cell:({getValue:e})=>{let t=e();return(0,H.jsx)(zC,{variant:L4[t]??`secondary`,children:R4[t]??t})}},{accessorKey:`created_at`,header:`Created`,cell:({getValue:e})=>new Date(e()).toLocaleDateString(`en-US`,{year:`numeric`,month:`short`,day:`numeric`})},{id:`actions`,header:``,cell:({row:e})=>l?(0,H.jsx)(q,{size:`icon`,variant:`ghost`,className:`flex size-8 items-center justify-center rounded text-destructive hover:bg-destructive/10 hover:text-destructive`,onClick:()=>_(e.original),children:(0,H.jsx)(Qo,{className:`size-3.5`})}):null}],b=I4({data:t??[],columns:y,getCoreRowModel:j4()});async function x(e){e.preventDefault();try{h(await i(`/cms/admin/api-tokens`,`POST`,{name:f.name,accessType:f.accessType})),r(),X.success(`API token created`)}catch{X.error(`Could not create token`)}}function S(){d(!1),h(null),p(B4)}async function C(){try{await i(`/cms/admin/api-tokens/${g.id}`,`DELETE`),_(null),r(),X.success(`Token revoked`)}catch{X.error(`Could not revoke token`)}}return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(fs,{children:(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold -mt-2`,children:`API Tokens`}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Manage tokens for consuming the public API and the instance MCP endpoint.`})]}),(0,H.jsxs)(q,{onClick:()=>d(!0),disabled:!c,children:[(0,H.jsx)(Lo,{className:`size-4`}),`New token`]})]})}),(0,H.jsxs)(`section`,{className:`mt-24`,children:[(0,H.jsx)(`div`,{className:`rounded-md border`,children:(0,H.jsxs)(VC,{children:[(0,H.jsx)(HC,{className:`font-bold uppercase`,children:b.getHeaderGroups().map(e=>(0,H.jsx)(WC,{className:`hover:bg-transparent`,children:e.headers.map(e=>(0,H.jsx)(GC,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:M4(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,H.jsx)(UC,{children:n?(0,H.jsx)(WC,{children:(0,H.jsx)(KC,{colSpan:y.length,className:`h-24`,children:(0,H.jsx)(BC,{className:`mx-auto size-5`})})}):b.getRowModel().rows.length===0?(0,H.jsx)(WC,{children:(0,H.jsx)(KC,{colSpan:y.length,className:`h-24 text-center text-muted-foreground`,children:`No tokens yet.`})}):b.getRowModel().rows.map(e=>(0,H.jsx)(WC,{children:e.getVisibleCells().map(e=>(0,H.jsx)(KC,{className:`px-4 py-3`,children:M4(e.column.columnDef.cell,e.getContext())},e.id))},e.id))})]})}),(0,H.jsx)(Yh,{open:u,onOpenChange:e=>{e||S()},children:(0,H.jsx)($h,{className:`sm:max-w-md`,children:m?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(eg,{children:(0,H.jsx)(ng,{children:`Token generated`})}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,H.jsx)(`div`,{className:`rounded-md border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-800 dark:border-amber-900 dark:bg-amber-950 dark:text-amber-200`,children:`Make sure to copy your token now. You won't be able to see it again.`}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{children:`Token`}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(Z,{readOnly:!0,value:m.token,className:`font-mono text-xs`}),(0,H.jsx)(z4,{value:m.token})]})]})]}),(0,H.jsx)(tg,{children:(0,H.jsx)(q,{onClick:S,children:`Done`})})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(eg,{children:(0,H.jsx)(ng,{children:`New API token`})}),(0,H.jsxs)(`form`,{id:`create-token-form`,onSubmit:x,className:`flex flex-col gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`token-name`,children:`Name`}),(0,H.jsx)(Z,{id:`token-name`,placeholder:`e.g. Production frontend`,value:f.name,onChange:e=>p(t=>({...t,name:e.target.value})),required:!0})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`token-access`,children:`Access type`}),(0,H.jsxs)(H_,{value:f.accessType,onValueChange:e=>p(t=>({...t,accessType:e})),children:[(0,H.jsx)(G_,{id:`token-access`,children:(0,H.jsx)(W_,{placeholder:`Select access type`})}),(0,H.jsxs)(J_,{children:[(0,H.jsx)(X_,{value:`read-only`,children:`Read only`}),(0,H.jsx)(X_,{value:`full-access`,children:`Full access`}),(0,H.jsx)(X_,{value:`mcp-server`,children:`MCP Server`})]})]})]}),o&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:o})]}),(0,H.jsxs)(tg,{children:[(0,H.jsx)(q,{variant:`outline`,type:`button`,onClick:S,children:`Cancel`}),(0,H.jsx)(q,{type:`submit`,form:`create-token-form`,disabled:a||!f.accessType||!c,children:a?`Generating…`:`Generate token`})]})]})})}),(0,H.jsx)(Yh,{open:!!g,onOpenChange:e=>{e||_(null)},children:(0,H.jsxs)($h,{className:`sm:max-w-sm`,children:[(0,H.jsx)(eg,{children:(0,H.jsx)(ng,{children:`Revoke token`})}),(0,H.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Are you sure you want to revoke`,` `,(0,H.jsx)(`span`,{className:`font-medium text-foreground`,children:g?.name}),`? Any client using it will immediately lose access.`]}),(0,H.jsxs)(tg,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>_(null),children:`Cancel`}),(0,H.jsx)(q,{variant:`destructive`,onClick:C,disabled:a||!l,children:a?`Revoking…`:`Revoke`})]})]})})]})]})}var H4=`••••••••`;function U4({values:e,onChange:t,disabled:n=!1}){return(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`local-uploads-dir`,children:`Upload directory`}),(0,H.jsx)(Z,{id:`local-uploads-dir`,placeholder:`public/uploads`,value:e[`local.uploads_dir`]??``,onChange:e=>t(`local.uploads_dir`,e.target.value),disabled:n}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Path on disk where files are stored. Relative to the server working directory.`})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`local-public-url`,children:`Public URL`}),(0,H.jsx)(Z,{id:`local-public-url`,placeholder:`http://localhost:1337`,value:e[`local.public_url`]??``,onChange:e=>t(`local.public_url`,e.target.value),disabled:n}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Base URL used to build file URLs. Should match the server's public address.`})]})]})}function W4({id:e,label:t,fieldKey:n,values:r,onChange:i,placeholder:a,disabled:o=!1}){let[s,c]=(0,v.useState)(!1),l=r[n]===H4,u=r[n]??``;return(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:e,children:t}),(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(Z,{id:e,type:s?`text`:`password`,placeholder:l?`Leave blank to keep current value`:a,value:l?``:u,onChange:e=>i(n,e.target.value),className:`pr-9`,disabled:o}),(0,H.jsx)(`button`,{type:`button`,className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,onClick:()=>c(e=>!e),tabIndex:-1,disabled:o,children:s?(0,H.jsx)(to,{className:`size-4`}):(0,H.jsx)(no,{className:`size-4`})})]}),l&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`A value is already saved. Enter a new one to replace it.`})]})}function G4({values:e,onChange:t,disabled:n=!1}){return(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`s3-access-key`,children:`Access key ID`}),(0,H.jsx)(Z,{id:`s3-access-key`,placeholder:`AKIAIOSFODNN7EXAMPLE`,value:e[`s3.access_key_id`]??``,onChange:e=>t(`s3.access_key_id`,e.target.value),disabled:n})]}),(0,H.jsx)(W4,{id:`s3-secret-key`,label:`Secret access key`,fieldKey:`s3.secret_access_key`,values:e,onChange:t,disabled:n})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`s3-region`,children:`Region`}),(0,H.jsx)(Z,{id:`s3-region`,placeholder:`us-east-1`,value:e[`s3.region`]??``,onChange:e=>t(`s3.region`,e.target.value),disabled:n})]}),(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`s3-bucket`,children:`Bucket`}),(0,H.jsx)(Z,{id:`s3-bucket`,placeholder:`my-bucket`,value:e[`s3.bucket`]??``,onChange:e=>t(`s3.bucket`,e.target.value),disabled:n})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`s3-path-prefix`,children:`Path prefix`}),(0,H.jsx)(Z,{id:`s3-path-prefix`,placeholder:`cms/media`,value:e[`s3.path_prefix`]??``,onChange:e=>t(`s3.path_prefix`,e.target.value),disabled:n}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Optional. Shared bucket subfolder.`})]})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`s3-public-url`,children:`Public URL`}),(0,H.jsx)(Z,{id:`s3-public-url`,placeholder:`https://cdn.example.com`,value:e[`s3.public_url`]??``,onChange:e=>t(`s3.public_url`,e.target.value),disabled:n}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Optional. Leave blank to use the default S3 URL.`})]})]})}function K4({values:e,onChange:t,disabled:n=!1}){return(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`r2-access-key`,children:`Access key ID`}),(0,H.jsx)(Z,{id:`r2-access-key`,placeholder:`R2 access key ID`,value:e[`r2.access_key_id`]??``,onChange:e=>t(`r2.access_key_id`,e.target.value),disabled:n})]}),(0,H.jsx)(W4,{id:`r2-secret-key`,label:`Secret access key`,fieldKey:`r2.secret_access_key`,values:e,onChange:t,disabled:n})]}),(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`r2-bucket`,children:`Bucket`}),(0,H.jsx)(Z,{id:`r2-bucket`,placeholder:`my-bucket`,value:e[`r2.bucket`]??``,onChange:e=>t(`r2.bucket`,e.target.value),disabled:n})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`r2-path-prefix`,children:`Path prefix`}),(0,H.jsx)(Z,{id:`r2-path-prefix`,placeholder:`cms/media`,value:e[`r2.path_prefix`]??``,onChange:e=>t(`r2.path_prefix`,e.target.value),disabled:n}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Optional. Shared bucket subfolder.`})]})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsxs)(Y,{htmlFor:`r2-public-url`,children:[`Public URL `,(0,H.jsx)(`span`,{className:`text-destructive`,children:`*`})]}),(0,H.jsx)(Z,{id:`r2-public-url`,placeholder:`https://assets.example.com`,value:e[`r2.public_url`]??``,onChange:e=>t(`r2.public_url`,e.target.value),disabled:n}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Required. R2 does not generate public URLs automatically.`})]})]})}function q4(){let{user:e}=_a(),{data:t,loading:n}=ps(`/cms/admin/settings/media`),{loading:r,error:i,request:a}=Zw(),[o,s]=(0,v.useState)(null),[c,l]=(0,v.useState)(!1),u=o??t??{provider:`local`},d=u.provider||`local`,f=e?.permissions??[],p=f.includes(`*`)||f.includes(`settings:overview:write`);function m(e,t){s({...u,[e]:t})}function h(e){s({...u,provider:e})}async function g(e){e.preventDefault();try{await a(`/cms/admin/settings/media`,`PUT`,u),l(!0),setTimeout(()=>l(!1),2500),X.success(`Media settings saved`)}catch{X.error(`Could not save media settings`)}}return n?(0,H.jsxs)(`div`,{className:`flex items-center gap-2 py-8 text-muted-foreground`,children:[(0,H.jsx)(BC,{className:`size-4`}),(0,H.jsx)(`span`,{className:`text-sm`,children:`Loading settings…`})]}):(0,H.jsxs)(`form`,{onSubmit:g,className:`space-y-8`,children:[(0,H.jsxs)(`div`,{className:`border-b pb-4`,children:[(0,H.jsx)(`h2`,{className:`text-2xl font-semibold`,children:`Storage`}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Configure where uploaded files are stored.`})]}),(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`provider`,children:`Storage provider`}),(0,H.jsxs)(H_,{value:d,onValueChange:e=>h(e),children:[(0,H.jsx)(G_,{id:`provider`,disabled:!p,children:(0,H.jsx)(W_,{})}),(0,H.jsxs)(J_,{children:[(0,H.jsx)(X_,{value:`local`,children:`Local`}),(0,H.jsx)(X_,{value:`s3`,children:`Amazon S3`}),(0,H.jsx)(X_,{value:`r2`,children:`Cloudflare R2`})]})]})]}),d===`r2`&&(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`r2-account-id`,children:`Account ID`}),(0,H.jsx)(Z,{id:`r2-account-id`,placeholder:`023e105f4ecef8ad9ca31a8372d0c353`,value:u[`r2.account_id`]??``,onChange:e=>m(`r2.account_id`,e.target.value),disabled:!p}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Found in the Cloudflare dashboard under R2 > Overview.`})]})]}),(0,H.jsxs)(`div`,{className:`border-t pt-6`,children:[d===`local`&&(0,H.jsx)(U4,{values:u,onChange:m,disabled:!p}),d===`s3`&&(0,H.jsx)(G4,{values:u,onChange:m,disabled:!p}),d===`r2`&&(0,H.jsx)(K4,{values:u,onChange:m,disabled:!p})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(q,{type:`submit`,disabled:r||!p,children:r?`Saving…`:`Save`}),c&&(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Changes saved.`}),i&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:i})]})]})}var J4=`••••••••`;function Y4({id:e,label:t,fieldKey:n,values:r,onChange:i,placeholder:a,disabled:o=!1}){let[s,c]=(0,v.useState)(!1),l=r[n]===J4,u=r[n]??``;return(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:e,children:t}),(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(Z,{id:e,type:s?`text`:`password`,placeholder:l?`Leave blank to keep current value`:a,value:l?``:u,onChange:e=>i(n,e.target.value),className:`pr-9`,disabled:o}),(0,H.jsx)(`button`,{type:`button`,className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,onClick:()=>c(e=>!e),tabIndex:-1,disabled:o,children:s?(0,H.jsx)(to,{className:`size-4`}):(0,H.jsx)(no,{className:`size-4`})})]}),l&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`A value is already saved. Enter a new one to replace it.`})]})}function X4(){let{user:e}=_a(),{data:t,loading:n}=ps(`/cms/admin/settings/mailing`),{loading:r,error:i,request:a}=Zw(),[o,s]=(0,v.useState)(null),[c,l]=(0,v.useState)(!1),u=o??t??{enabled:`false`,"smtp.port":`587`},d=String(u.enabled??`false`).toLowerCase()===`true`,f=String(u[`smtp.secure`]??`false`).toLowerCase()===`true`,p=e?.permissions??[],m=p.includes(`*`)||p.includes(`settings:overview:write`);function h(e,t){s({...u,[e]:t})}async function g(e){e.preventDefault();try{await a(`/cms/admin/settings/mailing`,`PUT`,u),l(!0),setTimeout(()=>l(!1),2500),X.success(`Mailing settings saved`)}catch{X.error(`Could not save mailing settings`)}}return n?(0,H.jsxs)(`div`,{className:`flex items-center gap-2 py-8 text-muted-foreground`,children:[(0,H.jsx)(BC,{className:`size-4`}),(0,H.jsx)(`span`,{className:`text-sm`,children:`Loading settings…`})]}):(0,H.jsxs)(`form`,{onSubmit:g,className:`space-y-8`,children:[(0,H.jsxs)(`div`,{className:`border-b pb-4`,children:[(0,H.jsx)(`h2`,{className:`text-2xl font-semibold`,children:`Mailing`}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Configure SMTP for transactional emails such as password recovery.`})]}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between rounded-md border p-3`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(Y,{htmlFor:`mailing-enabled`,children:`Enable transactional email`}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Plank will use these SMTP settings when an email needs to be sent.`})]}),(0,H.jsx)(uD,{id:`mailing-enabled`,checked:d,onCheckedChange:e=>h(`enabled`,String(e)),disabled:!m})]}),(0,H.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 md:grid-cols-2`,children:[(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`smtp-host`,children:`SMTP host`}),(0,H.jsx)(Z,{id:`smtp-host`,placeholder:`smtp.postmarkapp.com`,value:u[`smtp.host`]??``,onChange:e=>h(`smtp.host`,e.target.value),disabled:!m})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`smtp-port`,children:`SMTP port`}),(0,H.jsx)(Z,{id:`smtp-port`,inputMode:`numeric`,placeholder:`587`,value:u[`smtp.port`]??``,onChange:e=>h(`smtp.port`,e.target.value),disabled:!m})]})]}),(0,H.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 md:grid-cols-2`,children:[(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`smtp-user`,children:`SMTP username`}),(0,H.jsx)(Z,{id:`smtp-user`,placeholder:`Postmark server token`,value:u[`smtp.user`]??``,onChange:e=>h(`smtp.user`,e.target.value),disabled:!m})]}),(0,H.jsx)(Y4,{id:`smtp-password`,label:`SMTP password`,fieldKey:`smtp.password`,values:u,onChange:h,placeholder:`Postmark server token`,disabled:!m})]}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between rounded-md border p-3`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(Y,{htmlFor:`smtp-secure`,children:`Use secure connection`}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Enable for SMTPS on port 465. Leave off for STARTTLS on port 587.`})]}),(0,H.jsx)(uD,{id:`smtp-secure`,checked:f,onCheckedChange:e=>h(`smtp.secure`,String(e)),disabled:!m})]}),(0,H.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 md:grid-cols-2`,children:[(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`mail-from-name`,children:`From name`}),(0,H.jsx)(Z,{id:`mail-from-name`,placeholder:`Plank CMS`,value:u[`from.name`]??``,onChange:e=>h(`from.name`,e.target.value),disabled:!m})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`mail-from-email`,children:`From email`}),(0,H.jsx)(Z,{id:`mail-from-email`,type:`email`,placeholder:`no-reply@example.com`,value:u[`from.email`]??``,onChange:e=>h(`from.email`,e.target.value),disabled:!m})]})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`mail-reply-to`,children:`Reply-to email`}),(0,H.jsx)(Z,{id:`mail-reply-to`,type:`email`,placeholder:`support@example.com`,value:u.reply_to??``,onChange:e=>h(`reply_to`,e.target.value),disabled:!m}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Optional. Leave blank to omit Reply-To.`})]}),(0,H.jsxs)(`div`,{className:`rounded-md border border-dashed p-4 text-sm text-muted-foreground`,children:[`Postmark example: host `,(0,H.jsx)(`code`,{children:`smtp.postmarkapp.com`}),`, port `,(0,H.jsx)(`code`,{children:`587`}),`, username and password set to your server token.`]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(q,{type:`submit`,disabled:r||!m,children:r?`Saving…`:`Save`}),c&&(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Changes saved.`}),i&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:i})]})]})}var Z4={name:`@plank-cms/admin`,version:`0.31.0`,type:`module`,scripts:{build:`vite build`,dev:`vite`,lint:`eslint src/`},dependencies:{"@dnd-kit/core":`6.3.1`,"@dnd-kit/sortable":`10.0.0`,"@dnd-kit/utilities":`3.2.2`,"@radix-ui/react-avatar":`1.1.11`,"@radix-ui/react-checkbox":`1.3.3`,"@radix-ui/react-dialog":`1.1.15`,"@radix-ui/react-dropdown-menu":`2.1.16`,"@radix-ui/react-label":`2.1.8`,"@radix-ui/react-popover":`1.1.15`,"@radix-ui/react-select":`2.2.6`,"@radix-ui/react-separator":`1.1.8`,"@radix-ui/react-slot":`1.2.4`,"@radix-ui/react-switch":`1.2.6`,"@radix-ui/react-tabs":`1.1.13`,"@radix-ui/react-tooltip":`1.2.8`,"@tanstack/react-table":`8.21.3`,"@tiptap/extension-image":`3.22.4`,"@tiptap/pm":`3.22.4`,"@tiptap/react":`3.22.4`,"@tiptap/starter-kit":`3.22.4`,"class-variance-authority":`0.7.1`,clsx:`2.1.1`,cmdk:`1.1.1`,"date-fns":`4.1.0`,"hls.js":`1.6.16`,"input-otp":`1.4.2`,"lucide-react":`1.8.0`,"next-themes":`0.4.6`,"qrcode.react":`4.2.0`,"radix-ui":`1.4.3`,react:`19.2.5`,"react-day-picker":`9.14.0`,"react-dom":`19.2.5`,"react-router-dom":`7.14.1`,sonner:`2.0.7`,"tailwind-merge":`3.5.0`},devDependencies:{"@tailwindcss/vite":`4.2.3`,"@types/react":`19.2.14`,"@types/react-dom":`19.2.3`,"@types/react-router-dom":`5.3.3`,"@vitejs/plugin-react":`6.0.1`,tailwindcss:`4.2.3`,vite:`8.0.9`}},Q4=[{value:`UTC`,label:`UTC — Coordinated Universal Time`},{value:`America/New_York`,label:`America/New_York — Eastern Time (UTC-5/4)`},{value:`America/Chicago`,label:`America/Chicago — Central Time (UTC-6/5)`},{value:`America/Denver`,label:`America/Denver — Mountain Time (UTC-7/6)`},{value:`America/Los_Angeles`,label:`America/Los_Angeles — Pacific Time (UTC-8/7)`},{value:`America/Anchorage`,label:`America/Anchorage — Alaska Time (UTC-9/8)`},{value:`America/Honolulu`,label:`America/Honolulu — Hawaii Time (UTC-10)`},{value:`America/Mexico_City`,label:`America/Mexico_City — Mexico City (UTC-6/5)`},{value:`America/El_Salvador`,label:`America/El_Salvador — El Salvador (UTC-6)`},{value:`America/Bogota`,label:`America/Bogota — Colombia Time (UTC-5)`},{value:`America/Lima`,label:`America/Lima — Peru Time (UTC-5)`},{value:`America/Santiago`,label:`America/Santiago — Chile Time (UTC-4/3)`},{value:`America/Argentina/Buenos_Aires`,label:`America/Buenos_Aires — Argentina (UTC-3)`},{value:`America/Sao_Paulo`,label:`America/Sao_Paulo — Brasília Time (UTC-3/2)`},{value:`Atlantic/Reykjavik`,label:`Atlantic/Reykjavik — Iceland (UTC+0)`},{value:`Europe/London`,label:`Europe/London — GMT/BST (UTC+0/1)`},{value:`Europe/Paris`,label:`Europe/Paris — Central European Time (UTC+1/2)`},{value:`Europe/Berlin`,label:`Europe/Berlin — Central European Time (UTC+1/2)`},{value:`Europe/Madrid`,label:`Europe/Madrid — Central European Time (UTC+1/2)`},{value:`Europe/Rome`,label:`Europe/Rome — Central European Time (UTC+1/2)`},{value:`Europe/Helsinki`,label:`Europe/Helsinki — Eastern European Time (UTC+2/3)`},{value:`Europe/Istanbul`,label:`Europe/Istanbul — Turkey Time (UTC+3)`},{value:`Europe/Moscow`,label:`Europe/Moscow — Moscow Standard Time (UTC+3)`},{value:`Asia/Dubai`,label:`Asia/Dubai — Gulf Standard Time (UTC+4)`},{value:`Asia/Karachi`,label:`Asia/Karachi — Pakistan Standard Time (UTC+5)`},{value:`Asia/Kolkata`,label:`Asia/Kolkata — India Standard Time (UTC+5:30)`},{value:`Asia/Dhaka`,label:`Asia/Dhaka — Bangladesh Standard Time (UTC+6)`},{value:`Asia/Bangkok`,label:`Asia/Bangkok — Indochina Time (UTC+7)`},{value:`Asia/Singapore`,label:`Asia/Singapore — Singapore Time (UTC+8)`},{value:`Asia/Shanghai`,label:`Asia/Shanghai — China Standard Time (UTC+8)`},{value:`Asia/Tokyo`,label:`Asia/Tokyo — Japan Standard Time (UTC+9)`},{value:`Asia/Seoul`,label:`Asia/Seoul — Korea Standard Time (UTC+9)`},{value:`Australia/Sydney`,label:`Australia/Sydney — AEST/AEDT (UTC+10/11)`},{value:`Australia/Melbourne`,label:`Australia/Melbourne — AEST/AEDT (UTC+10/11)`},{value:`Pacific/Auckland`,label:`Pacific/Auckland — New Zealand (UTC+12/13)`}];function $4(){let{user:e}=_a(),{data:t,loading:n}=ps(`/cms/admin/settings/general`),{request:r,loading:i}=Zw(),{request:a,loading:o}=Zw(),{request:s,loading:c}=Zw(),{refreshSettings:l}=Sa(),[u,d]=(0,v.useState)(`UTC`),[f,p]=(0,v.useState)([]),[m,h]=(0,v.useState)(`en`),[g,_]=(0,v.useState)(``),[y,b]=(0,v.useState)(!1),x=e?.permissions??[],S=x.includes(`*`)||x.includes(`settings:overview:write`);(0,v.useEffect)(()=>{if(t?.timezone&&d(t.timezone),t?.locales)try{let e=JSON.parse(t.locales);Array.isArray(e)&&p(e)}catch{p((t.locales||``).split(`,`).map(e=>e.trim()).filter(Boolean))}t?.default_locale&&h(t.default_locale),b(String(t?.editorial_mode??`false`).toLowerCase()===`true`)},[t]);async function C(){try{await a(`/cms/admin/settings/general`,`PUT`,{locales:JSON.stringify(f),default_locale:m}),l(),X.success(`Locales saved`)}catch{X.error(`Could not save locales`)}}return n?(0,H.jsx)(BC,{}):(0,H.jsxs)(`div`,{className:`space-y-6`,children:[(0,H.jsx)($_,{children:(0,H.jsxs)(rv,{className:`flex items-center gap-4 py-2`,children:[(0,H.jsx)(`img`,{src:`/admin/plank-logo-w.svg`,alt:`Plank CMS`,className:`h-10 w-auto`}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`font-bold`,children:`Plank CMS by AM25`}),(0,H.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Version `,Z4.version]})]})]})}),(0,H.jsxs)(`div`,{className:`border-b pb-4`,children:[(0,H.jsx)(`h2`,{className:`text-2xl font-semibold`,children:`Commons`}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`General settings that apply across the CMS.`})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(Y,{htmlFor:`timezone`,children:`Timezone`}),(0,H.jsxs)(H_,{value:u,onValueChange:e=>{d(e),(async()=>{try{await r(`/cms/admin/settings/general`,`PUT`,{timezone:e}),l(),X.success(`Timezone saved`)}catch{X.error(`Could not save timezone`)}})()},children:[(0,H.jsx)(G_,{id:`timezone`,className:`w-full`,disabled:!S,children:(0,H.jsx)(W_,{})}),(0,H.jsx)(J_,{className:`max-h-72`,children:Q4.map(e=>(0,H.jsx)(X_,{value:e.value,children:e.label},e.value))})]}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Used to display dates and times across the admin panel.`}),i&&(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Saving…`})]})]}),(0,H.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 md:grid-cols-2`,children:[(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{children:`Locales`}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(Z,{placeholder:`E.g. "en"`,value:g,onChange:e=>_(e.target.value),className:`h-9 w-full`,disabled:!S}),(0,H.jsx)(q,{variant:`outline`,className:`h-9`,disabled:!S,onClick:()=>{let e=g.trim().toLowerCase();e&&(f.includes(e)||p(t=>[...t,e]),_(``))},children:`Add`})]}),(0,H.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:f.map(e=>(0,H.jsx)(q,{variant:`ghost`,size:`sm`,onClick:()=>p(t=>t.filter(t=>t!==e)),disabled:!S,children:e.toUpperCase()},e))})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`default-locale`,children:`Default locale`}),(0,H.jsxs)(H_,{value:m,onValueChange:h,children:[(0,H.jsx)(G_,{id:`default-locale`,className:`w-full`,disabled:!S,children:(0,H.jsx)(W_,{})}),(0,H.jsx)(J_,{className:`max-h-72`,children:f.length===0?(0,H.jsx)(X_,{value:m,children:m}):f.map(e=>(0,H.jsx)(X_,{value:e,children:e.toUpperCase()},e))})]}),(0,H.jsx)(`div`,{className:`pt-2 flex justify-end`,children:(0,H.jsx)(q,{variant:`outline`,onClick:C,disabled:o||!S,children:o?`Saving…`:`Save`})})]})]}),(0,H.jsx)(C0,{}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between rounded-md border p-3`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(Y,{htmlFor:`editorial-mode`,children:`Editorial Mode`}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Enables Editor and Viewer workflows for editorial review.`})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(uD,{id:`editorial-mode`,checked:y,onCheckedChange:e=>{b(e),(async()=>{try{await s(`/cms/admin/settings/general`,`PUT`,{editorial_mode:String(e)}),l(),X.success(`Editorial Mode saved`)}catch{X.error(`Could not save Editorial Mode`)}})()},disabled:!S}),c&&(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Saving…`})]})]})]})}function e3(){let{user:e}=_a(),{data:t,loading:n}=ps(`/cms/admin/settings/preview`),{request:r,loading:i}=Zw(),a=e?.permissions??[],o=a.includes(`*`)||a.includes(`settings:overview:write`),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(``),[d,f]=(0,v.useState)(``),[p,m]=(0,v.useState)(`slug`);(0,v.useEffect)(()=>{let e=vD(t);c(e.enabled),u(e.syncUrl),f(e.urlTemplate),m(e.slugField)},[t]);async function h(e){e.preventDefault();try{await r(`/cms/admin/settings/preview`,`PUT`,{enabled:String(s),sync_url:l.trim(),url_template:d.trim(),slug_field:p.trim()||`slug`}),X.success(`Preview settings saved`)}catch{X.error(`Could not save preview settings`)}}return n?(0,H.jsx)(BC,{}):(0,H.jsxs)(`div`,{className:`space-y-6`,children:[(0,H.jsxs)(`div`,{className:`border-b pb-4`,children:[(0,H.jsx)(`h2`,{className:`text-2xl font-semibold`,children:`Live Preview`}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Configure a single frontend preview target that Plank can open and sync after saves.`})]}),(0,H.jsxs)(`form`,{onSubmit:h,className:`space-y-6`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between rounded-md border p-3`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(Y,{htmlFor:`preview-enabled`,children:`Enable preview integration`}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Shows the preview action in the entry editor and syncs a connected frontend tab.`})]}),(0,H.jsx)(uD,{id:`preview-enabled`,checked:s,onCheckedChange:c,disabled:!o})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`preview-sync-url`,children:`Preview sync webhook URL`}),(0,H.jsx)(Z,{id:`preview-sync-url`,value:l,onChange:e=>u(e.target.value),placeholder:`https://frontend.example.com/api/plank/preview-sync`,disabled:!o}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Optional. When set, Plank will POST a preview sync payload to this endpoint on each entry save while preview is enabled.`})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`preview-url-template`,children:`Preview URL template`}),(0,H.jsx)(Z,{id:`preview-url-template`,value:d,onChange:e=>f(e.target.value),placeholder:`https://frontend.example.com/draft/{contentType}/{slug}`,disabled:!o}),(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Supported placeholders: `,`{contentType}`,`, `,`{entryId}`,`, `,`{slug}`,`, `,`{status}`,`. The final result must be an absolute URL.`]})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`preview-slug-field`,children:`Slug field`}),(0,H.jsx)(Z,{id:`preview-slug-field`,value:p,onChange:e=>m(e.target.value),placeholder:`slug`,disabled:!o}),(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Used when the template contains `,`{slug}`,`. Defaults to `,(0,H.jsx)(`code`,{children:`slug`}),`.`]})]}),(0,H.jsxs)(`div`,{className:`rounded-md border border-dashed p-4 text-sm text-muted-foreground`,children:[`Example:`,` `,(0,H.jsxs)(`code`,{children:[`https://frontend.example.com/draft/`,`{contentType}`,`/`,`{slug}`]})]}),(0,H.jsx)(`div`,{className:`flex justify-end`,children:(0,H.jsx)(q,{type:`submit`,variant:`outline`,disabled:i||!o,children:i?`Saving…`:`Save`})})]})]})}function t3(){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(fs,{children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold -mt-2`,children:`Overview`}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`General configuration for your CMS instance.`})]}),(0,H.jsxs)(vE,{defaultValue:`general`,className:`mt-24`,children:[(0,H.jsxs)(yE,{className:`mb-6`,children:[(0,H.jsx)(bE,{value:`general`,children:`General`}),(0,H.jsx)(bE,{value:`preview`,children:`Preview`}),(0,H.jsx)(bE,{value:`media`,children:`Media Library`}),(0,H.jsx)(bE,{value:`mailing`,children:`Mailing`})]}),(0,H.jsx)(xE,{value:`general`,children:(0,H.jsx)($4,{})}),(0,H.jsx)(xE,{value:`preview`,children:(0,H.jsx)(e3,{})}),(0,H.jsx)(xE,{value:`media`,children:(0,H.jsx)(q4,{})}),(0,H.jsx)(xE,{value:`mailing`,children:(0,H.jsx)(X4,{})})]})]})}var n3=[{key:`content-types`,label:`Content Types`,actions:[`read`,`write`,`delete`]},{key:`entries`,label:`Entries`,actions:[`read`,`write`,`delete`]},{key:`media`,label:`Media`,actions:[`read`,`write`,`delete`]},{key:`addons`,label:`Add-ons`,actions:[`read`,`write`]},{key:`settings:overview`,label:`Settings / Overview`,actions:[`read`,`write`]},{key:`settings:users`,label:`Settings / Users`,actions:[`read`,`write`,`delete`]},{key:`settings:roles`,label:`Settings / Roles`,actions:[`read`,`write`]},{key:`settings:api-tokens`,label:`Settings / API Tokens`,actions:[`read`,`write`,`delete`]},{key:`settings:webhooks`,label:`Settings / Webhooks`,actions:[`read`,`write`,`delete`]}],r3=[{key:`read`,label:`R`},{key:`write`,label:`W`},{key:`delete`,label:`D`}],i3=[`Super Admin`,`Admin`,`Editor`,`Contributor`],a3=`w-44 min-w-44 max-w-44`;function o3(e){return Object.fromEntries(e.map(e=>[e.id,new Set(e.permissions)]))}function s3(e,t){return e.includes(t)}function c3(){let{user:e}=_a(),{editorialMode:t}=Sa(),{data:n,loading:r,refetch:i}=ps(`/cms/admin/roles`),{request:a,loading:o}=Zw(),[s,c]=(0,v.useState)({}),[l,u]=(0,v.useState)(new Set),[d,f]=(0,v.useState)(!1);(0,v.useEffect)(()=>{n&&c(o3(n))},[n]);function p(e,t){c(n=>{let r=new Set(n[e]);return r.has(t)?r.delete(t):r.add(t),{...n,[e]:r}}),u(t=>new Set(t).add(e))}async function m(e){try{await a(`/cms/admin/roles/${e.id}`,`PUT`,{permissions:Array.from(s[e.id]??[])}),u(t=>{let n=new Set(t);return n.delete(e.id),n}),X.success(`Permissions saved`)}catch{X.error(`Could not save permissions`)}}async function h(){try{await a(`/cms/admin/roles/reset`,`POST`),f(!1),u(new Set),i(),X.success(`Permissions reset to defaults`)}catch{X.error(`Could not reset permissions`)}}let g=e?.role===`Super Admin`,_=(n??[]).filter(e=>e.name!==`Super Admin`).filter(e=>e.name!==`Viewer`).filter(e=>t||![`Editor`,`Viewer`].includes(e.name)).sort((e,t)=>{let n=i3.indexOf(e.name),r=i3.indexOf(t.name),i=n===-1?2**53-1:n,a=r===-1?2**53-1:r;return i===a?e.name.localeCompare(t.name):i-a}),y=(n??[]).find(e=>e.name===`Super Admin`);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(fs,{children:(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold -mt-2`,children:`Roles`}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Configure what each role can do across the CMS.`})]}),g&&(0,H.jsxs)(q,{variant:`outline`,onClick:()=>f(!0),children:[(0,H.jsx)(Vo,{className:`size-4`}),`Reset defaults`]})]})}),(0,H.jsxs)(`section`,{className:`mt-24`,children:[(0,H.jsx)(`div`,{className:`rounded-md border`,children:(0,H.jsxs)(VC,{children:[(0,H.jsxs)(HC,{children:[(0,H.jsxs)(WC,{className:`hover:bg-transparent`,children:[(0,H.jsx)(GC,{className:`w-40`,rowSpan:2}),y&&(0,H.jsx)(GC,{colSpan:3,className:`border-l text-center ${a3}`,children:y.name}),_.map(e=>(0,H.jsx)(GC,{colSpan:3,className:`border-l ${a3}`,children:(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,H.jsx)(`span`,{children:e.name}),(0,H.jsxs)(q,{size:`sm`,variant:l.has(e.id)?`default`:`ghost`,className:`h-6 px-2 text-xs`,disabled:!l.has(e.id)||o,onClick:()=>m(e),children:[(0,H.jsx)(Ho,{className:`size-3`}),`Save`]})]})},e.id))]}),(0,H.jsxs)(WC,{className:`hover:bg-transparent`,children:[y&&r3.map((e,t)=>(0,H.jsx)(GC,{className:`w-12 text-center font-normal ${t===0?`border-l`:``}`,children:e.label},e.key)),_.map(e=>r3.map((t,n)=>(0,H.jsx)(GC,{className:`w-12 text-center font-normal ${n===0?`border-l`:``}`,children:t.label},`${e.id}-${t.key}`)))]})]}),(0,H.jsx)(UC,{children:r?(0,H.jsx)(WC,{children:(0,H.jsx)(KC,{colSpan:99,className:`h-24`,children:(0,H.jsx)(BC,{className:`mx-auto size-5`})})}):n3.map(({key:e,label:t,actions:n})=>(0,H.jsxs)(WC,{children:[(0,H.jsx)(KC,{className:`font-medium`,children:t}),y&&r3.map((e,t)=>(0,H.jsx)(KC,{className:`text-center ${t===0?`border-l`:``}`,children:s3(n,e.key)?(0,H.jsx)(FT,{checked:!0,disabled:!0}):(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})},e.key)),_.map(t=>r3.map((r,i)=>{let a=s3(n,r.key),o=`${e}:${r.key}`;return(0,H.jsx)(KC,{className:`text-center ${i===0?`border-l`:``}`,children:a?(0,H.jsx)(FT,{checked:s[t.id]?.has(o)??!1,onCheckedChange:()=>p(t.id,o)}):(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})},`${t.id}-${r.key}`)}))]},e))})]})}),t&&(0,H.jsxs)(`div`,{className:`mt-3 rounded-md border bg-muted/30 p-3`,children:[(0,H.jsx)(`p`,{className:`text-sm font-medium`,children:`Viewer`}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Read-only role intended for external reviewers (for example, clients validating content before approval).`})]}),t&&(0,H.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:`Note: Editor and Contributor can share the same base permissions, but their effective scope is different in the content layer. Contributors are restricted to their own entries for certain actions, while Editors can operate on entries more broadly depending on the configured rules.`}),(0,H.jsx)(Yh,{open:d,onOpenChange:f,children:(0,H.jsxs)($h,{className:`sm:max-w-sm`,children:[(0,H.jsx)(eg,{children:(0,H.jsx)(ng,{children:`Reset to defaults`})}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This will restore all role permissions to their original configuration. Any custom changes will be lost.`}),(0,H.jsxs)(tg,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>f(!1),children:`Cancel`}),(0,H.jsx)(q,{variant:`destructive`,onClick:h,disabled:o,children:o?`Resetting…`:`Reset`})]})]})})]})]})}var l3={"super admin":`default`,admin:`secondary`,contributor:`outline`,editor:`secondary`,viewer:`outline`},u3=`ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz23456789`;function d3(e=8){let t=new Uint32Array(e);return crypto.getRandomValues(t),Array.from(t,e=>u3[e%57]).join(``)}function f3({roleId:e,roleName:t,roles:n}){let r=n.find(t=>t.id===e),i=t??r?.name??e;return(0,H.jsx)(zC,{variant:l3[i.toLowerCase()]??`secondary`,children:i})}function p3({user:e,currentUserId:t,currentUserRole:n,onEdit:r,onResetPassword:i,onDelete:a}){let o=e.id===t,s=(e.role_name??``).toLowerCase()===`super admin`,c=n.toLowerCase()===`super admin`;return(0,H.jsxs)(`div`,{className:`flex items-center justify-end gap-1`,children:[(0,H.jsx)(q,{size:`icon`,variant:`ghost`,className:`flex size-7 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-accent-foreground`,disabled:s&&!o&&!c,onClick:()=>r(e),"aria-label":`Edit user`,children:(0,H.jsx)(Io,{className:`size-3.5`})}),(0,H.jsx)(q,{size:`icon`,variant:`ghost`,className:`flex size-8 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-accent-foreground`,disabled:o||!c,onClick:()=>i(e),"aria-label":`Reset password`,children:(0,H.jsx)(xo,{className:`size-3.5`})}),(0,H.jsx)(q,{size:`icon`,variant:`ghost`,className:`flex size-8 items-center justify-center rounded text-destructive hover:bg-destructive/10 hover:text-destructive`,disabled:o||s&&!c,onClick:()=>a(e),"aria-label":`Delete user`,children:(0,H.jsx)(Qo,{className:`size-3.5`})})]})}var m3={email:``,password:``,firstName:``,lastName:``,roleId:``,enabled:!0};function h3(){let{user:e,updateUser:t}=_a(),{editorialMode:n}=Sa(),{data:r,loading:i,refetch:a}=ps(`/cms/admin/users`),{data:o,loading:s}=ps(`/cms/admin/roles`),c=i||s,{request:l,loading:u,error:d}=Zw(),[f,p]=(0,v.useState)(!1),[m,h]=(0,v.useState)(m3),[g,_]=(0,v.useState)(null),[y,b]=(0,v.useState)({email:``,roleId:``,firstName:``,lastName:``,enabled:!0}),[x,S]=(0,v.useState)(null),[C,w]=(0,v.useState)(null),[T,E]=(0,v.useState)(``),D=o??[],O=e?.role?.toLowerCase()===`super admin`,k=D.filter(e=>n||![`Editor`,`Viewer`].includes(e.name)),A=O?k:k.filter(e=>e.name.toLowerCase()!==`super admin`),j=(0,v.useMemo)(()=>[{id:`name`,header:`Name`,cell:({row:e})=>{let{first_name:t,last_name:n}=e.original;return!t&&!n?(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):(0,H.jsx)(`span`,{className:`font-bold`,children:[t,n].filter(Boolean).join(` `)})}},{accessorKey:`email`,header:`Email`},{accessorKey:`role_id`,header:`Role`,cell:({row:e,getValue:t})=>(0,H.jsx)(f3,{roleId:t(),roleName:e.original.role_name,roles:D})},{accessorKey:`enabled`,header:`Enabled`,cell:({row:t,getValue:n})=>(0,H.jsx)(uD,{checked:!!(n()??!0),onCheckedChange:async e=>{try{await l(`/cms/admin/users/${t.original.id}`,`PUT`,{enabled:e}),a(),X.success(`User updated`)}catch{X.error(`Could not update user`)}},disabled:t.original.id===e?.id||u})},{id:`actions`,header:``,cell:({row:t})=>(0,H.jsx)(p3,{user:t.original,currentUserId:e?.id??``,currentUserRole:e?.role??``,onEdit:e=>{_(e),b({email:e.email,roleId:e.role_id,firstName:e.first_name??``,lastName:e.last_name??``,enabled:e.enabled??!0})},onResetPassword:e=>{w(e),E(d3())},onDelete:S})}],[D,e?.id,e?.role,l,a,u]),M=I4({data:(0,v.useMemo)(()=>[...r??[]].sort((e,t)=>{let n=[e.first_name,e.last_name].filter(Boolean).join(` `)||e.email,r=[t.first_name,t.last_name].filter(Boolean).join(` `)||t.email;return n.localeCompare(r)}),[r]),columns:j,getCoreRowModel:j4()});async function N(e){e.preventDefault();try{await l(`/cms/admin/users`,`POST`,m),p(!1),h(m3),a(),X.success(`User created`)}catch{X.error(`Could not create user`)}}async function P(n){n.preventDefault();try{await l(`/cms/admin/users/${g.id}`,`PUT`,y),g.id===e?.id&&t({email:y.email,firstName:y.firstName||null,lastName:y.lastName||null}),_(null),a(),X.success(`User updated`)}catch{X.error(`Could not update user`)}}async function F(){try{await l(`/cms/admin/users/${x.id}`,`DELETE`),S(null),a(),X.success(`User deleted`)}catch{X.error(`Could not delete user`)}}async function I(e){e.preventDefault();try{await l(`/cms/admin/users/${C.id}/password/reset`,`POST`,{password:T}),w(null),E(``),X.success(`Password reset`)}catch{X.error(`Could not reset password`)}}async function L(){try{await navigator.clipboard.writeText(T),X.success(`Password copied`)}catch{X.error(`Could not copy password`)}}return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(fs,{children:(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold -mt-2`,children:`Users`}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Manage who has access to the admin panel.`})]}),(0,H.jsxs)(q,{onClick:()=>p(!0),children:[(0,H.jsx)(Lo,{className:`size-4`}),`New user`]})]})}),(0,H.jsxs)(`section`,{className:`mt-24`,children:[(0,H.jsx)(`div`,{className:`rounded-md border`,children:(0,H.jsxs)(VC,{children:[(0,H.jsx)(HC,{className:`font-bold uppercase`,children:M.getHeaderGroups().map(e=>(0,H.jsx)(WC,{className:`hover:bg-transparent`,children:e.headers.map(e=>(0,H.jsx)(GC,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:M4(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,H.jsx)(UC,{children:c?(0,H.jsx)(WC,{children:(0,H.jsx)(KC,{colSpan:j.length,className:`h-24`,children:(0,H.jsx)(BC,{className:`mx-auto size-5`})})}):M.getRowModel().rows.length===0?(0,H.jsx)(WC,{children:(0,H.jsx)(KC,{colSpan:j.length,className:`h-24 text-center text-muted-foreground`,children:`No users found.`})}):M.getRowModel().rows.map(e=>(0,H.jsx)(WC,{children:e.getVisibleCells().map(e=>(0,H.jsx)(KC,{className:`px-4 py-3`,children:M4(e.column.columnDef.cell,e.getContext())},e.id))},e.id))})]})}),(0,H.jsx)(Yh,{open:f,onOpenChange:p,children:(0,H.jsxs)($h,{className:`sm:max-w-md`,children:[(0,H.jsx)(eg,{children:(0,H.jsx)(ng,{children:`New user`})}),(0,H.jsxs)(`form`,{id:`create-user-form`,onSubmit:N,className:`flex flex-col gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`c-email`,children:`Email`}),(0,H.jsx)(Z,{id:`c-email`,type:`email`,placeholder:`user@example.com`,value:m.email,onChange:e=>h(t=>({...t,email:e.target.value})),required:!0})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`c-password`,children:`Password`}),(0,H.jsx)(Z,{id:`c-password`,type:`password`,placeholder:`Min. 8 characters`,value:m.password,onChange:e=>h(t=>({...t,password:e.target.value})),required:!0})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`c-fname`,children:`First name`}),(0,H.jsx)(Z,{id:`c-fname`,value:m.firstName,onChange:e=>h(t=>({...t,firstName:e.target.value})),required:!0})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`c-lname`,children:`Last name`}),(0,H.jsx)(Z,{id:`c-lname`,value:m.lastName,onChange:e=>h(t=>({...t,lastName:e.target.value})),required:!0})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`c-role`,children:`Role`}),(0,H.jsxs)(H_,{value:m.roleId,onValueChange:e=>h(t=>({...t,roleId:e})),children:[(0,H.jsx)(G_,{id:`c-role`,children:(0,H.jsx)(W_,{placeholder:`Select a role`})}),(0,H.jsx)(J_,{children:A.map(e=>(0,H.jsx)(X_,{value:e.id,children:e.name.charAt(0).toUpperCase()+e.name.slice(1)},e.id))})]})]}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between rounded-md border p-3`,children:[(0,H.jsx)(Y,{htmlFor:`c-enabled`,children:`Enabled`}),(0,H.jsx)(uD,{id:`c-enabled`,checked:m.enabled,onCheckedChange:e=>h(t=>({...t,enabled:e}))})]}),d&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:d})]}),(0,H.jsxs)(tg,{children:[(0,H.jsx)(q,{variant:`outline`,type:`button`,onClick:()=>p(!1),children:`Cancel`}),(0,H.jsx)(q,{type:`submit`,form:`create-user-form`,disabled:u,children:u?`Creating…`:`Create user`})]})]})}),(0,H.jsx)(Yh,{open:!!g,onOpenChange:e=>{e||_(null)},children:(0,H.jsxs)($h,{className:`sm:max-w-md`,children:[(0,H.jsx)(eg,{children:(0,H.jsx)(ng,{children:`Edit user`})}),(0,H.jsxs)(`form`,{id:`edit-user-form`,onSubmit:P,className:`flex flex-col gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`e-email`,children:`Email`}),(0,H.jsx)(Z,{id:`e-email`,type:`email`,value:y.email,onChange:e=>b(t=>({...t,email:e.target.value})),required:!0})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`e-fname`,children:`First name`}),(0,H.jsx)(Z,{id:`e-fname`,value:y.firstName,onChange:e=>b(t=>({...t,firstName:e.target.value}))})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`e-lname`,children:`Last name`}),(0,H.jsx)(Z,{id:`e-lname`,value:y.lastName,onChange:e=>b(t=>({...t,lastName:e.target.value}))})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`e-role`,children:`Role`}),(0,H.jsxs)(H_,{value:y.roleId,onValueChange:e=>b(t=>({...t,roleId:e})),children:[(0,H.jsx)(G_,{id:`e-role`,children:(0,H.jsx)(W_,{placeholder:`Select a role`})}),(0,H.jsx)(J_,{children:A.map(e=>(0,H.jsx)(X_,{value:e.id,children:e.name.charAt(0).toUpperCase()+e.name.slice(1)},e.id))})]})]}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between rounded-md border p-3`,children:[(0,H.jsx)(Y,{htmlFor:`e-enabled`,children:`Enabled`}),(0,H.jsx)(uD,{id:`e-enabled`,checked:y.enabled,onCheckedChange:e=>b(t=>({...t,enabled:e}))})]}),d&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:d})]}),(0,H.jsxs)(tg,{children:[(0,H.jsx)(q,{variant:`outline`,type:`button`,onClick:()=>_(null),children:`Cancel`}),(0,H.jsx)(q,{type:`submit`,form:`edit-user-form`,disabled:u,children:u?`Saving…`:`Save changes`})]})]})}),(0,H.jsx)(Yh,{open:!!C,onOpenChange:e=>{e||(w(null),E(``))},children:(0,H.jsxs)($h,{className:`sm:max-w-sm`,children:[(0,H.jsx)(eg,{children:(0,H.jsx)(ng,{children:`Reset password`})}),(0,H.jsxs)(`form`,{id:`reset-password-form`,onSubmit:I,className:`flex flex-col gap-4`,children:[(0,H.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Set a new password for`,` `,(0,H.jsx)(`span`,{className:`font-medium text-foreground`,children:C?.email}),`. This will disable 2FA and sign out existing sessions.`]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`reset-password`,children:`Generated password`}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`div`,{id:`reset-password`,className:`flex min-h-10 flex-1 items-center rounded-md border bg-muted px-3 py-2 font-mono text-sm break-all`,children:T}),(0,H.jsx)(q,{type:`button`,size:`icon`,variant:`outline`,onClick:L,"aria-label":`Copy password`,children:(0,H.jsx)(Qa,{className:`size-4`})}),(0,H.jsx)(q,{type:`button`,size:`icon`,variant:`outline`,onClick:()=>E(d3()),"aria-label":`Generate new password`,children:(0,H.jsx)(Bo,{className:`size-4`})})]})]}),d&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:d})]}),(0,H.jsxs)(tg,{children:[(0,H.jsx)(q,{variant:`outline`,type:`button`,onClick:()=>{w(null),E(``)},children:`Cancel`}),(0,H.jsx)(q,{type:`submit`,form:`reset-password-form`,disabled:u,children:u?`Resetting…`:`Reset password`})]})]})}),(0,H.jsx)(Yh,{open:!!x,onOpenChange:e=>{e||S(null)},children:(0,H.jsxs)($h,{className:`sm:max-w-sm`,children:[(0,H.jsx)(eg,{children:(0,H.jsx)(ng,{children:`Delete user`})}),(0,H.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Are you sure you want to delete`,` `,(0,H.jsx)(`span`,{className:`font-medium text-foreground`,children:x?.email}),`? This action cannot be undone.`]}),d&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:d}),(0,H.jsxs)(tg,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>S(null),children:`Cancel`}),(0,H.jsx)(q,{variant:`destructive`,onClick:F,disabled:u,children:u?`Deleting…`:`Delete`})]})]})})]})]})}var g3=[{value:`entry.published`,label:`Entry published`},{value:`entry.unpublished`,label:`Entry unpublished`},{value:`entry.created`,label:`Entry created`},{value:`entry.updated`,label:`Entry updated`},{value:`entry.deleted`,label:`Entry deleted`}],_3={name:``,url:``,events:[]};function v3(){let{user:e}=_a(),{data:t,loading:n,refetch:r}=ps(`/cms/admin/webhooks`),{request:i,loading:a,error:o}=Zw(),s=e?.permissions??[],c=s.includes(`*`)||s.includes(`settings:webhooks:write`),l=s.includes(`*`)||s.includes(`settings:webhooks:delete`),[u,d]=(0,v.useState)(!1),[f,p]=(0,v.useState)(_3),[m,h]=(0,v.useState)(null),g=[{accessorKey:`name`,header:`Name`},{accessorKey:`url`,header:`URL`,cell:({getValue:e})=>(0,H.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground truncate max-w-xs block`,children:e()})},{accessorKey:`events`,header:`Events`,cell:({getValue:e})=>(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e().map(e=>(0,H.jsx)(zC,{variant:`secondary`,className:`text-xs font-mono`,children:e},e))})},{accessorKey:`created_at`,header:`Created`,cell:({getValue:e})=>new Date(e()).toLocaleDateString(`en-US`,{year:`numeric`,month:`short`,day:`numeric`})},{id:`actions`,header:``,cell:({row:e})=>l?(0,H.jsx)(q,{size:`icon`,variant:`ghost`,className:`size-8 text-destructive hover:text-destructive`,onClick:()=>h(e.original),children:(0,H.jsx)(Qo,{className:`size-3.5`})}):null}],_=I4({data:t??[],columns:g,getCoreRowModel:j4()});function y(e){p(t=>({...t,events:t.events.includes(e)?t.events.filter(t=>t!==e):[...t.events,e]}))}async function b(e){e.preventDefault();try{await i(`/cms/admin/webhooks`,`POST`,f),d(!1),p(_3),r(),X.success(`Webhook saved`)}catch{X.error(`Could not save webhook`)}}async function x(){try{await i(`/cms/admin/webhooks/${m.id}`,`DELETE`),h(null),r(),X.success(`Webhook deleted`)}catch{X.error(`Could not delete webhook`)}}return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(fs,{children:(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold -mt-2`,children:`Webhooks`}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Notify external services when content events occur.`})]}),(0,H.jsxs)(q,{onClick:()=>d(!0),disabled:!c,children:[(0,H.jsx)(Lo,{className:`size-4`}),`New webhook`]})]})}),(0,H.jsxs)(`section`,{className:`mt-24`,children:[(0,H.jsx)(`div`,{className:`rounded-md border`,children:(0,H.jsxs)(VC,{children:[(0,H.jsx)(HC,{className:`font-bold uppercase`,children:_.getHeaderGroups().map(e=>(0,H.jsx)(WC,{className:`hover:bg-transparent`,children:e.headers.map(e=>(0,H.jsx)(GC,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:M4(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,H.jsx)(UC,{children:n?(0,H.jsx)(WC,{children:(0,H.jsx)(KC,{colSpan:g.length,className:`h-24`,children:(0,H.jsx)(BC,{className:`mx-auto size-5`})})}):_.getRowModel().rows.length===0?(0,H.jsx)(WC,{children:(0,H.jsx)(KC,{colSpan:g.length,className:`h-24 text-center text-muted-foreground`,children:`No webhooks yet.`})}):_.getRowModel().rows.map(e=>(0,H.jsx)(WC,{children:e.getVisibleCells().map(e=>(0,H.jsx)(KC,{className:`px-4 py-3`,children:M4(e.column.columnDef.cell,e.getContext())},e.id))},e.id))})]})}),(0,H.jsx)(Yh,{open:u,onOpenChange:e=>{e||(d(!1),p(_3))},children:(0,H.jsxs)($h,{className:`sm:max-w-md`,children:[(0,H.jsx)(eg,{children:(0,H.jsx)(ng,{children:`New webhook`})}),(0,H.jsxs)(`form`,{id:`create-webhook-form`,onSubmit:b,className:`flex flex-col gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`webhook-name`,children:`Name`}),(0,H.jsx)(Z,{id:`webhook-name`,placeholder:`e.g. Dokploy deploy`,value:f.name,onChange:e=>p(t=>({...t,name:e.target.value})),required:!0})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`webhook-url`,children:`URL`}),(0,H.jsx)(Z,{id:`webhook-url`,type:`url`,placeholder:`https://...`,value:f.url,onChange:e=>p(t=>({...t,url:e.target.value})),required:!0})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(Y,{children:`Events`}),g3.map(({value:e,label:t})=>(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(FT,{id:`event-${e}`,checked:f.events.includes(e),onCheckedChange:()=>y(e)}),(0,H.jsxs)(`label`,{htmlFor:`event-${e}`,className:`text-sm cursor-pointer`,children:[t,(0,H.jsx)(`span`,{className:`ml-2 font-mono text-xs text-muted-foreground`,children:e})]})]},e))]}),o&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:o})]}),(0,H.jsxs)(tg,{children:[(0,H.jsx)(q,{variant:`outline`,type:`button`,onClick:()=>{d(!1),p(_3)},children:`Cancel`}),(0,H.jsx)(q,{type:`submit`,form:`create-webhook-form`,disabled:a||f.events.length===0||!c,children:a?`Creating…`:`Create webhook`})]})]})}),(0,H.jsx)(Yh,{open:!!m,onOpenChange:e=>{e||h(null)},children:(0,H.jsxs)($h,{className:`sm:max-w-sm`,children:[(0,H.jsx)(eg,{children:(0,H.jsx)(ng,{children:`Delete webhook`})}),(0,H.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Are you sure you want to delete`,` `,(0,H.jsx)(`span`,{className:`font-medium text-foreground`,children:m?.name}),`? It will stop receiving events immediately.`]}),(0,H.jsxs)(tg,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>h(null),children:`Cancel`}),(0,H.jsx)(q,{variant:`destructive`,onClick:x,disabled:a||!l,children:a?`Deleting…`:`Delete`})]})]})})]})]})}function y3({items:e}){let{pathname:t}=lr();function n(e){return t===e||t.startsWith(e+`/`)}return(0,H.jsx)(`nav`,{className:`flex flex-col gap-0.5 p-2`,children:e.map(({label:e,to:t,icon:r})=>(0,H.jsxs)(Ji,{to:t,className:[`flex items-center gap-2.5 rounded-md px-2.5 py-1.5 text-sm transition-colors`,n(t)?`bg-sidebar-accent text-sidebar-accent-foreground font-medium`:`text-sidebar-foreground hover:bg-sidebar-accent/50 hover:text-sidebar-accent-foreground`].join(` `),children:[r&&(0,H.jsx)(r,{className:`size-3.5 shrink-0`}),(0,H.jsx)(`span`,{className:`truncate`,children:e})]},t))})}function b3(){let{data:e,refetch:t}=ps(`/cms/admin/addons/registry`);(0,v.useEffect)(()=>{function e(){t()}return window.addEventListener(iD,e),()=>window.removeEventListener(iD,e)},[t]);let n=(e?.addons??[]).filter(oD),r=new Map((e?.slots.addonsSections??[]).map(e=>[e.addonId,e.title])),i=[{label:`Overview`,to:`/add-ons/overview`,icon:Ia},...n.map(e=>({label:r.get(e.id)??e.name,to:`/add-ons/${e.id}`,icon:Fo}))];return(0,H.jsxs)(`div`,{className:`flex flex-col`,children:[(0,H.jsx)(`div`,{className:`border-b border-sidebar-border px-4 py-3`,children:(0,H.jsx)(`p`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider`,children:`Add-ons`})}),(0,H.jsx)(y3,{items:i})]})}function x3(e){let{setContent:t}=ds();(0,v.useEffect)(()=>(t(e),()=>t(null)),[])}function S3(){return x3((0,H.jsx)(b3,{})),(0,H.jsx)($r,{})}var C3=[{to:`/`,icon:Co,label:`Dashboard`,permission:null},{to:`/content`,icon:ao,label:`Content`,permission:null},{to:`/media`,icon:vo,label:`Media`,permission:null},{to:`/content-types`,icon:So,label:`Content Types`,permission:`content-types:write`},{to:`/add-ons`,icon:Ro,label:`Add-ons`,permission:`addons:read`},{to:`/settings`,icon:Wo,label:`Settings`,permission:`settings:overview:read`}];function w3(e){let[t=0,n=0,r=0]=e.trim().replace(/^v/i,``).split(`-`)[0].split(`.`).map(e=>Number.parseInt(e,10)||0);return[t,n,r]}function T3(e,t){if(!t)return 0;let[n,r,i]=w3(e),[a,o,s]=w3(t);return a===n?Math.abs(o===r?s-i:o-r):Math.abs(a-n)*100+Math.abs(o-r)}function E3(e){return e>=5?{panel:`border-rose-600/20 bg-[#370815] text-rose-600`,label:`text-rose-600/80`,button:`border-rose-600/20 bg-[#370815] text-rose-600 hover:bg-[#45101b] hover:text-rose-500`}:e>=3?{panel:`border-amber-400/20 bg-[#3b2d08] text-amber-400`,label:`text-amber-400/80`,button:`border-amber-400/20 bg-[#3b2d08] text-amber-400 hover:bg-[#4a3809] hover:text-amber-300`}:{panel:`border-emerald-500/20 bg-[#082019] text-emerald-500`,label:`text-emerald-500/80`,button:`border-emerald-500/20 bg-[#082019] text-emerald-500 hover:bg-[#0d2c23] hover:text-emerald-400`}}function D3(){let{user:e,logout:t}=_a(),{pathname:n}=lr(),r=fr(),{content:i}=ds(),{data:a}=ps(`/cms/admin/content-types`),{data:o}=ps(`/cms/admin/version`),s=(a??[]).filter(e=>e.kind===`collection`),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(!1),f=E3(o?T3(o.currentVersion,o.latestVersion):0);function p(e){return e===`/`?n===`/`:n===e||n.startsWith(e+`/`)}let m=e?.permissions??[],h=e?.role?.toLowerCase()===`viewer`,g=C3.filter(({to:e,permission:t})=>h?e===`/content`:!t||m.includes(`*`)||m.includes(t));async function _(){if(o?.updateCommand)try{await navigator.clipboard.writeText(o.updateCommand),d(!0),X.success(`Update command copied`)}catch{X.error(`Could not copy the update command`)}}function y(e){l(e),e||d(!1)}return(0,H.jsx)(xp,{delayDuration:300,children:(0,H.jsxs)(`div`,{className:`flex h-svh overflow-hidden bg-background`,children:[(0,H.jsxs)(`aside`,{className:`flex h-full w-14 shrink-0 flex-col items-center gap-4 border-r border-sidebar-border bg-sidebar py-4`,children:[(0,H.jsx)(Ji,{to:`/`,children:(0,H.jsx)(`img`,{src:`/admin/plank-logo-w.svg`,alt:`Plank CMS`,className:`px-3 pb-4`})}),(e?.permissions?.includes(`*`)||e?.permissions?.includes(`entries:write`))&&s.length>0&&(0,H.jsx)(`div`,{className:`mt-4 px-3`,children:(0,H.jsx)(q,{size:`icon`,onClick:()=>{let e=s.find(e=>e.isDefault)??s[0];e&&r(`/content/${e.slug}/new`)},children:(0,H.jsx)(Lo,{className:`size-4`})})}),(0,H.jsx)(`nav`,{className:`flex flex-1 flex-col items-center gap-1 pt-2`,children:g.map(({to:e,icon:t,label:n})=>(0,H.jsxs)(Sp,{children:[(0,H.jsx)(Cp,{asChild:!0,children:(0,H.jsx)(q,{asChild:!0,size:`icon`,variant:p(e)?`secondary`:`ghost`,children:(0,H.jsx)(Ji,{to:e,end:e===`/`,children:(0,H.jsx)(t,{className:`size-4`})})})}),(0,H.jsx)(wp,{side:`right`,children:n})]},e))}),o?.updateAvailable&&(0,H.jsx)(`div`,{className:`px-3`,children:(0,H.jsxs)(Yh,{open:c,onOpenChange:y,children:[(0,H.jsxs)(Sp,{children:[(0,H.jsx)(Cp,{asChild:!0,children:(0,H.jsx)(q,{size:`icon`,variant:`outline`,className:f.button,onClick:()=>l(!0),children:(0,H.jsx)(Pa,{className:`size-4`})})}),(0,H.jsxs)(wp,{side:`right`,children:[`Update to `,o.latestVersion]})]}),(0,H.jsxs)($h,{className:`max-w-xl`,children:[(0,H.jsxs)(eg,{children:[(0,H.jsx)(ng,{children:`Update available`}),(0,H.jsxs)(rg,{children:[`Plank `,o.latestVersion,` is ready. Run the command below in your project terminal to update your installation.`]})]}),(0,H.jsxs)(`div`,{className:`space-y-5`,children:[(0,H.jsxs)(`div`,{className:`grid gap-3 rounded-lg border p-4 sm:grid-cols-2 ${f.panel}`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`text-xs font-medium uppercase ${f.label}`,children:`Current version`}),(0,H.jsx)(`p`,{className:`mt-1 text-base font-semibold`,children:o.currentVersion})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`text-xs font-medium uppercase ${f.label}`,children:`Latest version`}),(0,H.jsx)(`p`,{className:`mt-1 text-base font-semibold`,children:o.latestVersion})]})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(Y,{htmlFor:`plank-update-command`,children:`Update command`}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(Z,{id:`plank-update-command`,value:o.updateCommand,readOnly:!0,className:`font-mono text-sm`}),(0,H.jsxs)(q,{type:`button`,variant:`outline`,onClick:_,children:[u?(0,H.jsx)(Ba,{className:`size-4`}):(0,H.jsx)(Qa,{className:`size-4`}),u?`Copied`:`Copy`]})]})]}),(0,H.jsx)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:(0,H.jsx)(q,{asChild:!0,variant:`outline`,children:(0,H.jsxs)(`a`,{href:o.changelogUrl,target:`_blank`,rel:`noreferrer`,children:[`View changelog`,(0,H.jsx)(Na,{className:`size-4`})]})})})]})]})]})}),(0,H.jsxs)(HT,{children:[(0,H.jsx)(UT,{asChild:!0,children:(0,H.jsx)(q,{variant:`ghost`,size:`icon`,className:`rounded-full`,children:(0,H.jsx)(hw,{avatarUrl:e?.avatarUrl,firstName:e?.firstName,lastName:e?.lastName,email:e?.email})})}),(0,H.jsxs)(KT,{side:`right`,align:`end`,className:`w-52`,children:[(0,H.jsxs)(YT,{className:`font-normal`,children:[(0,H.jsx)(`p`,{className:`truncate text-sm font-medium`,children:e?.email}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground capitalize`,children:e?.role})]}),(0,H.jsx)(JT,{}),(0,H.jsxs)(qT,{onClick:()=>r(`/profile`),children:[(0,H.jsx)(is,{}),`Profile`]}),(0,H.jsx)(JT,{}),(0,H.jsxs)(qT,{onClick:t,className:`text-destructive focus:text-destructive`,children:[(0,H.jsx)(jo,{}),`Log out`]})]})]})]}),(0,H.jsx)(`main`,{className:`flex-1 overflow-y-auto`,children:(0,H.jsx)(`div`,{className:`w-full mx-auto px-4 mb-16 ${i?`max-w-7xl`:`max-w-9xl`}`,children:(0,H.jsx)($r,{})})}),i&&(0,H.jsx)(`aside`,{className:`flex h-full w-64 shrink-0 flex-col border-l border-sidebar-border bg-background`,children:i})]})})}function O3(){return(0,H.jsx)(us,{children:(0,H.jsx)(D3,{})})}function k3(){let{pathname:e}=lr(),{user:t}=_a(),{data:n,loading:r,error:i,refetch:a}=ps(`/cms/admin/content-types`),{request:o}=Zw(),s=t?.permissions??[],c=s.includes(`*`)||s.includes(`content-types:write`);async function l(e,t){e.preventDefault(),e.stopPropagation();try{await o(`/cms/admin/content-types/${t}/default`,`PUT`),a(),X.success(`Default content type updated`)}catch{X.error(`Could not update default`)}}function u(t){return e===`/content/${t}`||e.startsWith(`/content/${t}/`)}let d=(n??[]).filter(e=>e.kind===`collection`),f=(n??[]).filter(e=>e.kind===`single`);return(0,H.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,H.jsx)(`div`,{className:`shrink-0 border-b border-sidebar-border px-4 py-3`,children:(0,H.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Content`})}),r&&(0,H.jsx)(`div`,{className:`flex items-center justify-center py-6`,children:(0,H.jsx)(BC,{className:`size-4`})}),i&&(0,H.jsx)(`p`,{className:`px-4 py-3 text-xs text-destructive`,children:i}),!r&&!i&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,H.jsx)(`div`,{className:`shrink-0 px-4 py-2`,children:(0,H.jsx)(`p`,{className:`text-[11px] font-medium uppercase tracking-wider text-muted-foreground/60`,children:`Collection Types`})}),(0,H.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:d.length===0?(0,H.jsx)(`p`,{className:`px-4 pb-3 text-xs text-muted-foreground`,children:`No collection types yet.`}):(0,H.jsx)(`nav`,{className:`flex flex-col gap-0.5 px-2 pb-2`,children:d.map(e=>(0,H.jsxs)(Ji,{to:`/content/${e.slug}`,className:[`group flex items-center gap-2.5 rounded-md px-2.5 py-1.5 text-sm transition-colors`,u(e.slug)?`bg-sidebar-accent text-sidebar-accent-foreground font-medium`:`text-sidebar-foreground hover:bg-sidebar-accent/50 hover:text-sidebar-accent-foreground`].join(` `),children:[(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),c&&(0,H.jsx)(`button`,{type:`button`,title:e.isDefault?`Default content type`:`Set as default`,onClick:t=>l(t,e.slug),className:[`shrink-0 rounded transition-colors`,e.isDefault?`text-amber-400`:`text-transparent group-hover:text-muted-foreground/40 hover:!text-amber-400`].join(` `),children:(0,H.jsx)(qo,{className:`size-3.5 ${e.isDefault?`fill-amber-400`:``}`})})]},e.slug))})})]}),(0,H.jsx)(`div`,{className:`shrink-0 border-t border-sidebar-border`}),(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,H.jsx)(`div`,{className:`shrink-0 px-4 py-2`,children:(0,H.jsx)(`p`,{className:`text-[11px] font-medium uppercase tracking-wider text-muted-foreground/60`,children:`Single Types`})}),(0,H.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:f.length===0?(0,H.jsx)(`p`,{className:`px-4 pb-3 text-xs text-muted-foreground`,children:`No single types yet.`}):(0,H.jsx)(`nav`,{className:`flex flex-col gap-0.5 px-2 pb-2`,children:f.map(e=>(0,H.jsx)(Ji,{to:`/content/${e.slug}`,className:[`group flex items-center gap-2.5 rounded-md px-2.5 py-1.5 text-sm transition-colors`,u(e.slug)?`bg-sidebar-accent text-sidebar-accent-foreground font-medium`:`text-sidebar-foreground hover:bg-sidebar-accent/50 hover:text-sidebar-accent-foreground`].join(` `),children:(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name})},e.slug))})})]})]})]})}function A3(){return x3((0,H.jsx)(k3,{})),(0,H.jsx)($r,{})}function j3(){let e=fr(),{pathname:t}=lr(),{data:n,loading:r,error:i,refetch:a}=ps(`/cms/admin/content-types`);(0,v.useEffect)(()=>(window.addEventListener(`plank:content-types-changed`,a),()=>window.removeEventListener(`plank:content-types-changed`,a)),[a]);function o(e){let n=`/content-types/${e}`;return t===n||t.startsWith(n+`/`)}return(0,H.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,H.jsx)(`div`,{className:`border-b border-sidebar-border px-4 py-3`,children:(0,H.jsx)(`p`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider`,children:`Content Types`})}),(0,H.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[r&&(0,H.jsx)(`div`,{className:`flex items-center justify-center py-6`,children:(0,H.jsx)(BC,{className:`size-4`})}),i&&(0,H.jsx)(`p`,{className:`px-4 py-3 text-xs text-destructive`,children:i}),!r&&!i&&(n??[]).length===0&&(0,H.jsx)(`p`,{className:`px-4 py-3 text-xs text-muted-foreground`,children:`No content types yet.`}),!r&&!i&&(n??[]).length>0&&(0,H.jsx)(`nav`,{className:`flex flex-col gap-0.5 p-2`,children:(n??[]).map(e=>(0,H.jsxs)(Ji,{to:`/content-types/${e.slug}`,className:[`flex items-center gap-2.5 rounded-md px-2.5 py-1.5 text-sm transition-colors`,o(e.slug)?`bg-sidebar-accent text-sidebar-accent-foreground font-medium`:`text-sidebar-foreground hover:bg-sidebar-accent/50 hover:text-sidebar-accent-foreground`].join(` `),children:[(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),e.kind===`single`&&(0,H.jsx)(oo,{className:`size-3.5 shrink-0 text-violet-500 dark:text-violet-400`})]},e.slug))})]}),(0,H.jsx)(`div`,{className:`border-t border-sidebar-border p-3`,children:(0,H.jsxs)(q,{variant:`outline`,className:`w-full justify-start gap-2`,onClick:()=>e(`/content-types/new`),children:[(0,H.jsx)(Lo,{className:`size-3.5`}),`New Content Type`]})})]})}function M3(){return x3((0,H.jsx)(j3,{})),(0,H.jsx)($r,{})}function N3(e,t){return e.includes(`*`)||e.includes(t)}function P3({children:e,roles:t,permission:n,redirectTo:r=`/`}){let{status:i,user:a}=_a();return i===`idle`?null:i===`unauthenticated`?(0,H.jsx)(Qr,{to:`/login`,replace:!0}):t&&a&&!t.map(e=>e.toLowerCase()).includes(a.role.toLowerCase())||n&&a&&!N3(a.permissions,n)?(0,H.jsx)(Qr,{to:r,replace:!0}):(0,H.jsx)(H.Fragment,{children:e})}function F3(e,t){return e?.permissions.includes(`*`)||e?.permissions.includes(t)||!1}function I3(){let{user:e}=_a(),t=[{label:`Overview`,to:`/settings/overview`,icon:Wo,permission:`settings:overview:read`},{label:`Users`,to:`/settings/users`,icon:as,permission:`settings:users:read`},{label:`Roles`,to:`/settings/roles`,icon:Go,permission:`settings:roles:read`},{label:`API Tokens`,to:`/settings/api-tokens`,icon:xo,permission:`settings:api-tokens:read`},{label:`Webhooks`,to:`/settings/webhooks`,icon:ss,permission:`settings:webhooks:read`}].filter(({permission:t})=>F3(e,t));return(0,H.jsxs)(`div`,{className:`flex flex-col`,children:[(0,H.jsx)(`div`,{className:`border-b border-sidebar-border px-4 py-3`,children:(0,H.jsx)(`p`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider`,children:`Settings`})}),(0,H.jsx)(y3,{items:t})]})}function L3(){return x3((0,H.jsx)(I3,{})),(0,H.jsx)($r,{})}var R3=[`Super Admin`,`Admin`,`Editor`,`Contributor`],z3=Hi([{path:`/login`,element:(0,H.jsx)(CT,{})},{path:`/reset-password`,element:(0,H.jsx)(wT,{})},{element:(0,H.jsx)(P3,{children:(0,H.jsx)(O3,{})}),children:[{index:!0,element:(0,H.jsx)(P3,{roles:R3,redirectTo:`/content`,children:(0,H.jsx)(xw,{})})},{path:`content`,element:(0,H.jsx)(A3,{}),children:[{index:!0,element:(0,H.jsx)(pD,{})},{path:`:slug`,element:(0,H.jsx)($0,{})},{path:`:slug/new`,element:(0,H.jsx)(P3,{permission:`entries:write`,redirectTo:`/content`,children:(0,H.jsx)(S0,{})})},{path:`:slug/:id`,element:(0,H.jsx)(S0,{})}]},{path:`media`,element:(0,H.jsx)(P3,{roles:R3,redirectTo:`/content`,children:(0,H.jsx)(mE,{})})},{path:`content-types`,element:(0,H.jsx)(P3,{permission:`content-types:write`,roles:R3,redirectTo:`/content`,children:(0,H.jsx)(M3,{})}),children:[{index:!0,element:(0,H.jsx)(e2,{})},{path:`new`,element:(0,H.jsx)(m2,{})},{path:`:slug`,element:(0,H.jsx)(m2,{})}]},{path:`add-ons`,element:(0,H.jsx)(P3,{permission:`addons:read`,roles:R3,redirectTo:`/content`,children:(0,H.jsx)(S3,{})}),children:[{index:!0,element:(0,H.jsx)(Qr,{to:`overview`,replace:!0})},{path:`overview`,element:(0,H.jsx)(P3,{permission:`addons:read`,children:(0,H.jsx)(fD,{})})},{path:`:addonId`,element:(0,H.jsx)(P3,{permission:`addons:read`,children:(0,H.jsx)(lD,{})})}]},{path:`settings`,element:(0,H.jsx)(P3,{permission:`settings:overview:read`,roles:R3,redirectTo:`/content`,children:(0,H.jsx)(L3,{})}),children:[{index:!0,element:(0,H.jsx)(Qr,{to:`overview`,replace:!0})},{path:`overview`,element:(0,H.jsx)(P3,{permission:`settings:overview:read`,children:(0,H.jsx)(t3,{})})},{path:`users`,element:(0,H.jsx)(P3,{permission:`settings:users:read`,children:(0,H.jsx)(h3,{})})},{path:`roles`,element:(0,H.jsx)(P3,{permission:`settings:roles:read`,children:(0,H.jsx)(c3,{})})},{path:`api-tokens`,element:(0,H.jsx)(P3,{permission:`settings:api-tokens:read`,children:(0,H.jsx)(V4,{})})},{path:`webhooks`,element:(0,H.jsx)(P3,{permission:`settings:webhooks:read`,children:(0,H.jsx)(v3,{})})}]},{path:`profile`,element:(0,H.jsx)(XE,{})}]},{path:`*`,element:(0,H.jsx)(Qr,{to:`/`,replace:!0})}],{basename:`/admin/`.replace(/\/$/,``)||`/`});function B3(){return(0,H.jsx)(ga,{children:(0,H.jsx)(xa,{children:(0,H.jsx)(ya,{children:(0,H.jsx)(fa,{router:z3})})})})}var V3=({...e})=>{let{theme:t=`system`}=T();return(0,H.jsx)(Xw,{theme:t,className:`toaster group`,icons:{success:(0,H.jsx)(Ka,{className:`size-4`}),info:(0,H.jsx)(yo,{className:`size-4`}),warning:(0,H.jsx)($o,{className:`size-4`}),error:(0,H.jsx)(No,{className:`size-4`}),loading:(0,H.jsx)(Ao,{className:`size-4 animate-spin`})},style:{"--normal-bg":`var(--popover)`,"--normal-text":`var(--popover-foreground)`,"--normal-border":`var(--border)`,"--border-radius":`var(--radius)`},...e})};function H3({...e}){return(0,H.jsx)(V3,{toastOptions:{classNames:{toast:`border ![font-family:var(--font-sans)]`,success:`bg-[#082019]! text-emerald-500! border-emerald-500/20!`,error:`bg-[#370815]! text-rose-600! border-rose-600/20!`,warning:`bg-[#3b2d08]! text-amber-400! border-amber-400/20!`,info:`bg-[#0c1b3a]! text-blue-500! border-blue-500/20!`,title:`font-bold!`,description:`opacity-80!`}},...e})}window.React=v,window.PlankAddonAdminModules=window.PlankAddonAdminModules??{},(0,_.createRoot)(document.getElementById(`root`)).render((0,H.jsx)(v.StrictMode,{children:(0,H.jsxs)(E,{attribute:`class`,defaultTheme:`dark`,enableSystem:!0,disableTransitionOnChange:!0,children:[(0,H.jsx)(B3,{}),(0,H.jsx)(H3,{})]})}));