@plank-cms/plank 0.19.0 → 0.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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),H=ne(null),ie=ne(null);function ae(e,t){switch(B(H,t),B(V,e),B(re,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Kd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Kd(t),e=qd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}z(re),B(re,e)}function oe(){z(re),z(V),z(H)}function se(e){e.memoizedState!==null&&B(ie,e);var t=re.current,n=qd(t,e.type);t!==n&&(B(V,e),B(re,n))}function ce(e){V.current===e&&(z(re),z(V)),ie.current===e&&(z(ie),rp._currentValue=R)}var le,ue;function de(e){if(le===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);le=t&&t[1]||``,ue=-1<e.stack.indexOf(`
2
+ at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
3
+ `+le+e+ue}var fe=!1;function pe(e,t){if(!e||fe)return``;fe=!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{fe=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?de(n):``}function me(e,t){switch(e.tag){case 26:case 27:case 5:return de(e.type);case 16:return de(`Lazy`);case 13:return e.child!==t&&t!==null?de(`Suspense Fallback`):de(`Suspense`);case 19:return de(`SuspenseList`);case 0:case 15:return pe(e.type,!1);case 11:return pe(e.type.render,!1);case 1:return pe(e.type,!0);case 31:return de(`Activity`);default:return``}}function he(e){try{var t=``,n=null;do t+=me(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
7
+ Error generating stack: `+e.message+`
8
+ `+e.stack}}var ge=Object.prototype.hasOwnProperty,_e=t.unstable_scheduleCallback,ve=t.unstable_cancelCallback,ye=t.unstable_shouldYield,be=t.unstable_requestPaint,xe=t.unstable_now,Se=t.unstable_getCurrentPriorityLevel,Ce=t.unstable_ImmediatePriority,we=t.unstable_UserBlockingPriority,Te=t.unstable_NormalPriority,Ee=t.unstable_LowPriority,De=t.unstable_IdlePriority,Oe=t.log,ke=t.unstable_setDisableYieldValue,Ae=null,je=null;function Me(e){if(typeof Oe==`function`&&ke(e),je&&typeof je.setStrictMode==`function`)try{je.setStrictMode(Ae,e)}catch{}}var Ne=Math.clz32?Math.clz32:Ie,Pe=Math.log,Fe=Math.LN2;function Ie(e){return e>>>=0,e===0?32:31-(Pe(e)/Fe|0)|0}var Le=256,Re=262144,ze=4194304;function Be(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 Ve(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=Be(n))):i=Be(o):i=Be(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Be(n))):i=Be(o)):i=Be(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 He(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ue(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 We(){var e=ze;return ze<<=1,!(ze&62914560)&&(ze=4194304),e}function Ge(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ke(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function qe(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-Ne(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&&Je(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Je(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Ne(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function Ye(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Ne(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function Xe(e,t){var n=t&-t;return n=n&42?1:Ze(n),(n&(e.suspendedLanes|t))===0?n:0}function Ze(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 Qe(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function $e(){var e=L.p;return e===0?(e=window.event,e===void 0?32:yp(e.type)):e}function et(e,t){var n=L.p;try{return L.p=e,t()}finally{L.p=n}}var tt=Math.random().toString(36).slice(2),nt=`__reactFiber$`+tt,rt=`__reactProps$`+tt,it=`__reactContainer$`+tt,at=`__reactEvents$`+tt,ot=`__reactListeners$`+tt,st=`__reactHandles$`+tt,ct=`__reactResources$`+tt,lt=`__reactMarker$`+tt;function ut(e){delete e[nt],delete e[rt],delete e[at],delete e[ot],delete e[st]}function dt(e){var t=e[nt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[it]||n[nt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=gf(e);e!==null;){if(n=e[nt])return n;e=gf(e)}return t}e=n,n=e.parentNode}return null}function ft(e){if(e=e[nt]||e[it]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function pt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function mt(e){var t=e[ct];return t||=e[ct]={hoistableStyles:new Map,hoistableScripts:new Map},t}function ht(e){e[lt]=!0}var gt=new Set,_t={};function vt(e,t){yt(e,t),yt(e+`Capture`,t)}function yt(e,t){for(_t[e]=t,e=0;e<t.length;e++)gt.add(t[e])}var bt=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]*$`),xt={},St={};function Ct(e){return ge.call(St,e)?!0:ge.call(xt,e)?!1:bt.test(e)?St[e]=!0:(xt[e]=!0,!1)}function wt(e,t,n){if(Ct(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 Tt(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 Et(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 Dt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Ot(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function kt(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 At(e){if(!e._valueTracker){var t=Ot(e)?`checked`:`value`;e._valueTracker=kt(e,t,``+e[t])}}function jt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Ot(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function Mt(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 Nt=/[\n"\\]/g;function Pt(e){return e.replace(Nt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Ft(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=``+Dt(t)):e.value!==``+Dt(t)&&(e.value=``+Dt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Lt(e,o,Dt(n)):Lt(e,o,Dt(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=``+Dt(s):e.removeAttribute(`name`)}function It(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)){At(e);return}n=n==null?``:``+Dt(n),t=t==null?n:``+Dt(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),At(e)}function Lt(e,t,n){t===`number`&&Mt(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Rt(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=``+Dt(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 zt(e,t,n){if(t!=null&&(t=``+Dt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Dt(n)}function Bt(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=Dt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),At(e)}function Vt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ht=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 Ut(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||Ht.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Wt(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&&Ut(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&Ut(e,o,t[o])}function Gt(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 Kt=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`]]),qt=/^[\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 Jt(e){return qt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function Yt(){}var Xt=null;function Zt(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Qt=null,$t=null;function en(e){var t=ft(e);if(t&&(e=t.stateNode)){var n=e[rt]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Ft(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="`+Pt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[rt]||null;if(!a)throw Error(i(90));Ft(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&&jt(r)}break a;case`textarea`:zt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Rt(e,!!n.multiple,t,!1)}}}var tn=!1;function nn(e,t,n){if(tn)return e(t,n);tn=!0;try{return e(t)}finally{if(tn=!1,(Qt!==null||$t!==null)&&(Su(),Qt&&(t=Qt,e=$t,$t=Qt=null,en(t),e)))for(t=0;t<e.length;t++)en(e[t])}}function rn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[rt]||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 an=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),on=!1;if(an)try{var sn={};Object.defineProperty(sn,`passive`,{get:function(){on=!0}}),window.addEventListener(`test`,sn,sn),window.removeEventListener(`test`,sn,sn)}catch{on=!1}var cn=null,ln=null,un=null;function dn(){if(un)return un;var e,t=ln,n=t.length,r,i=`value`in cn?cn.value:cn.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 un=i.slice(e,1<r?1-r:void 0)}function fn(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 pn(){return!0}function mn(){return!1}function hn(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)?pn:mn,this.isPropagationStopped=mn,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=pn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=pn)},persist:function(){},isPersistent:pn}),t}var gn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},_n=hn(gn),vn=m({},gn,{view:0,detail:0}),yn=hn(vn),bn,xn,Sn,Cn=m({},vn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Pn,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!==Sn&&(Sn&&e.type===`mousemove`?(bn=e.screenX-Sn.screenX,xn=e.screenY-Sn.screenY):xn=bn=0,Sn=e),bn)},movementY:function(e){return`movementY`in e?e.movementY:xn}}),wn=hn(Cn),Tn=hn(m({},Cn,{dataTransfer:0})),En=hn(m({},vn,{relatedTarget:0})),Dn=hn(m({},gn,{animationName:0,elapsedTime:0,pseudoElement:0})),On=hn(m({},gn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),kn=hn(m({},gn,{data:0})),An={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},jn={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`},Mn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Nn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Mn[e])?!!t[e]:!1}function Pn(){return Nn}var Fn=hn(m({},vn,{key:function(e){if(e.key){var t=An[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=fn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?jn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Pn,charCode:function(e){return e.type===`keypress`?fn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?fn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),In=hn(m({},Cn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Ln=hn(m({},vn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Pn})),Rn=hn(m({},gn,{propertyName:0,elapsedTime:0,pseudoElement:0})),zn=hn(m({},Cn,{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})),Bn=hn(m({},gn,{newState:0,oldState:0})),Vn=[9,13,27,32],Hn=an&&`CompositionEvent`in window,Un=null;an&&`documentMode`in document&&(Un=document.documentMode);var Wn=an&&`TextEvent`in window&&!Un,Gn=an&&(!Hn||Un&&8<Un&&11>=Un),Kn=` `,qn=!1;function Jn(e,t){switch(e){case`keyup`:return Vn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Yn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Xn=!1;function Zn(e,t){switch(e){case`compositionend`:return Yn(t);case`keypress`:return t.which===32?(qn=!0,Kn):null;case`textInput`:return e=t.data,e===Kn&&qn?null:e;default:return null}}function Qn(e,t){if(Xn)return e===`compositionend`||!Hn&&Jn(e,t)?(e=dn(),un=ln=cn=null,Xn=!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 Gn&&t.locale!==`ko`?null:t.data;default:return null}}var $n={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 er(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!$n[e.type]:t===`textarea`}function tr(e,t,n,r){Qt?$t?$t.push(r):$t=[r]:Qt=r,t=Ad(t,`onChange`),0<t.length&&(n=new _n(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var nr=null,rr=null;function ir(e){Sd(e,0)}function ar(e){if(jt(pt(e)))return e}function or(e,t){if(e===`change`)return t}var sr=!1;if(an){var cr;if(an){var lr=`oninput`in document;if(!lr){var ur=document.createElement(`div`);ur.setAttribute(`oninput`,`return;`),lr=typeof ur.oninput==`function`}cr=lr}else cr=!1;sr=cr&&(!document.documentMode||9<document.documentMode)}function dr(){nr&&(nr.detachEvent(`onpropertychange`,fr),rr=nr=null)}function fr(e){if(e.propertyName===`value`&&ar(rr)){var t=[];tr(t,rr,e,Zt(e)),nn(ir,t)}}function pr(e,t,n){e===`focusin`?(dr(),nr=t,rr=n,nr.attachEvent(`onpropertychange`,fr)):e===`focusout`&&dr()}function mr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return ar(rr)}function hr(e,t){if(e===`click`)return ar(t)}function gr(e,t){if(e===`input`||e===`change`)return ar(t)}function _r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var vr=typeof Object.is==`function`?Object.is:_r;function yr(e,t){if(vr(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(!ge.call(t,i)||!vr(e[i],t[i]))return!1}return!0}function br(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function xr(e,t){var n=br(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=br(n)}}function Sr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Sr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Cr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Mt(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=Mt(e.document)}return t}function wr(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 Tr=an&&`documentMode`in document&&11>=document.documentMode,Er=null,Dr=null,Or=null,kr=!1;function Ar(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;kr||Er==null||Er!==Mt(r)||(r=Er,`selectionStart`in r&&wr(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}),Or&&yr(Or,r)||(Or=r,r=Ad(Dr,`onSelect`),0<r.length&&(t=new _n(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Er)))}function jr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Mr={animationend:jr(`Animation`,`AnimationEnd`),animationiteration:jr(`Animation`,`AnimationIteration`),animationstart:jr(`Animation`,`AnimationStart`),transitionrun:jr(`Transition`,`TransitionRun`),transitionstart:jr(`Transition`,`TransitionStart`),transitioncancel:jr(`Transition`,`TransitionCancel`),transitionend:jr(`Transition`,`TransitionEnd`)},Nr={},Pr={};an&&(Pr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Mr.animationend.animation,delete Mr.animationiteration.animation,delete Mr.animationstart.animation),`TransitionEvent`in window||delete Mr.transitionend.transition);function Fr(e){if(Nr[e])return Nr[e];if(!Mr[e])return e;var t=Mr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Pr)return Nr[e]=t[n];return e}var Ir=Fr(`animationend`),Lr=Fr(`animationiteration`),Rr=Fr(`animationstart`),zr=Fr(`transitionrun`),Br=Fr(`transitionstart`),Vr=Fr(`transitioncancel`),Hr=Fr(`transitionend`),Ur=new Map,Wr=`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(` `);Wr.push(`scrollEnd`);function Gr(e,t){Ur.set(e,t),vt(t,[e])}var Kr=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)},qr=[],Jr=0,Yr=0;function Xr(){for(var e=Jr,t=Yr=Jr=0;t<e;){var n=qr[t];qr[t++]=null;var r=qr[t];qr[t++]=null;var i=qr[t];qr[t++]=null;var a=qr[t];if(qr[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&&ei(n,i,a)}}function Zr(e,t,n,r){qr[Jr++]=e,qr[Jr++]=t,qr[Jr++]=n,qr[Jr++]=r,Yr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Qr(e,t,n,r){return Zr(e,t,n,r),ti(e)}function $r(e,t){return Zr(e,null,null,t),ti(e)}function ei(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-Ne(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function ti(e){if(50<pu)throw pu=0,mu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var ni={};function ri(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 ii(e,t,n,r){return new ri(e,t,n,r)}function ai(e){return e=e.prototype,!(!e||!e.isReactComponent)}function oi(e,t){var n=e.alternate;return n===null?(n=ii(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 si(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 ci(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)ai(e)&&(s=1);else if(typeof e==`string`)s=Jf(e,n,re.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case k:return e=ii(31,n,t,a),e.elementType=k,e.lanes=o,e;case y:return li(n.children,a,o,t);case b:s=8,a|=24;break;case x:return e=ii(12,n,t,a|2),e.elementType=x,e.lanes=o,e;case T:return e=ii(13,n,t,a),e.elementType=T,e.lanes=o,e;case E:return e=ii(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=ii(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function li(e,t,n,r){return e=ii(7,e,r,t),e.lanes=n,e}function ui(e,t,n){return e=ii(6,e,null,t),e.lanes=n,e}function di(e){var t=ii(18,null,null,0);return t.stateNode=e,t}function fi(e,t,n){return t=ii(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var pi=new WeakMap;function mi(e,t){if(typeof e==`object`&&e){var n=pi.get(e);return n===void 0?(t={value:e,source:t,stack:he(t)},pi.set(e,t),t):n}return{value:e,source:t,stack:he(t)}}var hi=[],gi=0,_i=null,vi=0,yi=[],bi=0,xi=null,Si=1,Ci=``;function wi(e,t){hi[gi++]=vi,hi[gi++]=_i,_i=e,vi=t}function Ti(e,t,n){yi[bi++]=Si,yi[bi++]=Ci,yi[bi++]=xi,xi=e;var r=Si;e=Ci;var i=32-Ne(r)-1;r&=~(1<<i),n+=1;var a=32-Ne(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Si=1<<32-Ne(t)+i|n<<i|r,Ci=a+e}else Si=1<<a|n<<i|r,Ci=e}function Ei(e){e.return!==null&&(wi(e,1),Ti(e,1,0))}function Di(e){for(;e===_i;)_i=hi[--gi],hi[gi]=null,vi=hi[--gi],hi[gi]=null;for(;e===xi;)xi=yi[--bi],yi[bi]=null,Ci=yi[--bi],yi[bi]=null,Si=yi[--bi],yi[bi]=null}function Oi(e,t){yi[bi++]=Si,yi[bi++]=Ci,yi[bi++]=xi,Si=t.id,Ci=t.overflow,xi=e}var ki=null,Ai=null,ji=!1,Mi=null,Ni=!1,Pi=Error(i(519));function Fi(e){throw Vi(mi(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Pi}function Ii(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[nt]=e,t[rt]=r,n){case`dialog`:Cd(`cancel`,t),Cd(`close`,t);break;case`iframe`:case`object`:case`embed`:Cd(`load`,t);break;case`video`:case`audio`:for(n=0;n<bd.length;n++)Cd(bd[n],t);break;case`source`:Cd(`error`,t);break;case`img`:case`image`:case`link`:Cd(`error`,t),Cd(`load`,t);break;case`details`:Cd(`toggle`,t);break;case`input`:Cd(`invalid`,t),It(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Cd(`invalid`,t);break;case`textarea`:Cd(`invalid`,t),Bt(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||Id(t.textContent,n)?(r.popover!=null&&(Cd(`beforetoggle`,t),Cd(`toggle`,t)),r.onScroll!=null&&Cd(`scroll`,t),r.onScrollEnd!=null&&Cd(`scrollend`,t),r.onClick!=null&&(t.onclick=Yt),t=!0):t=!1,t||Fi(e,!0)}function Li(e){for(ki=e.return;ki;)switch(ki.tag){case 5:case 31:case 13:Ni=!1;return;case 27:case 3:Ni=!0;return;default:ki=ki.return}}function Ri(e){if(e!==ki)return!1;if(!ji)return Li(e),ji=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!==`form`&&n!==`button`)||Jd(e.type,e.memoizedProps)),n=!n),n&&Ai&&Fi(e),Li(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Ai=hf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Ai=hf(e)}else t===27?(t=Ai,nf(e.type)?(e=mf,mf=null,Ai=e):Ai=t):Ai=ki?pf(e.stateNode.nextSibling):null;return!0}function zi(){Ai=ki=null,ji=!1}function Bi(){var e=Mi;return e!==null&&($l===null?$l=e:$l.push.apply($l,e),Mi=null),e}function Vi(e){Mi===null?Mi=[e]:Mi.push(e)}var Hi=ne(null),Ui=null,Wi=null;function Gi(e,t,n){B(Hi,t._currentValue),t._currentValue=n}function Ki(e){e._currentValue=Hi.current,z(Hi)}function qi(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 Ji(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),qi(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),qi(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 Yi(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;vr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===ie.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[rp]:e.push(rp))}a=a.return}e!==null&&Ji(t,e,n,r),t.flags|=262144}function Xi(e){for(e=e.firstContext;e!==null;){if(!vr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Zi(e){Ui=e,Wi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Qi(e){return ea(Ui,e)}function $i(e,t){return Ui===null&&Zi(e),ea(e,t)}function ea(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Wi===null){if(e===null)throw Error(i(308));Wi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Wi=Wi.next=t;return n}var ta=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()})}},na=t.unstable_scheduleCallback,ra=t.unstable_NormalPriority,ia={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function aa(){return{controller:new ta,data:new Map,refCount:0}}function oa(e){e.refCount--,e.refCount===0&&na(ra,function(){e.controller.abort()})}var sa=null,ca=0,la=0,ua=null;function da(e,t){if(sa===null){var n=sa=[];ca=0,la=md(),ua={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return ca++,t.then(fa,fa),t}function fa(){if(--ca===0&&sa!==null){ua!==null&&(ua.status=`fulfilled`);var e=sa;sa=null,la=0,ua=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function U(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 pa=I.S;I.S=function(e,t){nu=xe(),typeof t==`object`&&t&&typeof t.then==`function`&&da(e,t),pa!==null&&pa(e,t)};var ma=ne(null);function ha(){var e=ma.current;return e===null?Ll.pooledCache:e}function ga(e,t){t===null?B(ma,ma.current):B(ma,t.pool)}function _a(){var e=ha();return e===null?null:{parent:ia._currentValue,pool:e}}var va=Error(i(460)),ya=Error(i(474)),ba=Error(i(542)),xa={then:function(){}};function Sa(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Ca(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Yt,Yt),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Da(e),e;default:if(typeof t.status==`string`)t.then(Yt,Yt);else{if(e=Ll,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,Da(e),e}throw Ta=t,va}}function wa(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Ta=e,va):e}}var Ta=null;function Ea(){if(Ta===null)throw Error(i(459));var e=Ta;return Ta=null,e}function Da(e){if(e===va||e===ba)throw Error(i(483))}var Oa=null,ka=0;function Aa(e){var t=ka;return ka+=1,Oa===null&&(Oa=[]),Ca(Oa,e,t)}function ja(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=oi(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=ui(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&&wa(i)===t.type)?(t=a(t,n.props),ja(t,n),t.return=e,t):(t=ci(n.type,n.key,n.props,null,e.mode,r),ja(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=fi(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=li(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=ui(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case _:return n=ci(t.type,t.key,t.props,null,e.mode,n),ja(n,t),n.return=e,n;case v:return t=fi(t,e.mode,n),t.return=e,t;case O:return t=wa(t),f(e,t,n)}if(F(t)||M(t))return t=li(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Aa(t),n);if(t.$$typeof===C)return f(e,$i(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=wa(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,Aa(n),r);if(n.$$typeof===C)return p(e,t,$i(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=wa(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,Aa(r),i);if(r.$$typeof===C)return m(e,t,n,$i(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),ji&&wi(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 ji&&wi(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)}),ji&&wi(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),ji&&wi(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 ji&&wi(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)}),ji&&wi(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&&wa(l)===r.type){n(e,r.sibling),c=a(r,o.props),ja(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===y?(c=li(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=ci(o.type,o.key,o.props,null,e.mode,c),ja(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=fi(o,e.mode,c),c.return=e,e=c}return s(e);case O:return o=wa(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,Aa(o),c);if(o.$$typeof===C)return b(e,r,$i(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=ui(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{ka=0;var i=b(e,t,n,r);return Oa=null,i}catch(t){if(t===va||t===ba)throw t;var a=ii(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var W=Na(!0),Pa=Na(!1),Fa=!1;function Ia(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function La(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 Ra(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function za(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Il&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ti(e),ei(e,null,n),t}return Zr(e,r,t,n),ti(e)}function Ba(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,Ye(e,n)}}function Va(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 Ha=!1;function Ua(){if(Ha){var e=ua;if(e!==null)throw e}}function Wa(e,t,n,r){Ha=!1;var i=e.updateQueue;Fa=!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?(zl&f)===f:(r&f)===f){f!==0&&f===la&&(Ha=!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:Fa=!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),ql|=o,e.lanes=o,e.memoizedState=d}}function Ga(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Ka(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Ga(n[e],t)}var qa=ne(null),Ja=ne(0);function Ya(e,t){e=Gl,B(Ja,e),B(qa,t),Gl=e|t.baseLanes}function Xa(){B(Ja,Gl),B(qa,qa.current)}function Za(){Gl=Ja.current,z(qa),z(Ja)}var Qa=ne(null),$a=null;function eo(e){var t=e.alternate;B(ao,ao.current&1),B(Qa,e),$a===null&&(t===null||qa.current!==null||t.memoizedState!==null)&&($a=e)}function to(e){B(ao,ao.current),B(Qa,e),$a===null&&($a=e)}function no(e){e.tag===22?(B(ao,ao.current),B(Qa,e),$a===null&&($a=e)):ro(e)}function ro(){B(ao,ao.current),B(Qa,Qa.current)}function io(e){z(Qa),$a===e&&($a=null),z(ao)}var ao=ne(0);function oo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||uf(n)||df(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 so=0,co=null,lo=null,uo=null,fo=!1,po=!1,mo=!1,ho=0,go=0,_o=null,vo=0;function yo(){throw Error(i(321))}function bo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!vr(e[n],t[n]))return!1;return!0}function xo(e,t,n,r,i,a){return so=a,co=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,I.H=e===null||e.memoizedState===null?zs:Bs,mo=!1,a=n(r,i),mo=!1,po&&(a=Co(t,n,r,i)),So(e),a}function So(e){I.H=Rs;var t=lo!==null&&lo.next!==null;if(so=0,uo=lo=co=null,fo=!1,go=0,_o=null,t)throw Error(i(300));e===null||rc||(e=e.dependencies,e!==null&&Xi(e)&&(rc=!0))}function Co(e,t,n,r){co=e;var a=0;do{if(po&&(_o=null),go=0,po=!1,25<=a)throw Error(i(301));if(a+=1,uo=lo=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=Vs,o=t(n,r)}while(po);return o}function wo(){var e=I.H,t=e.useState()[0];return t=typeof t.then==`function`?jo(t):t,e=e.useState()[0],(lo===null?null:lo.memoizedState)!==e&&(co.flags|=1024),t}function To(){var e=ho!==0;return ho=0,e}function Eo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Do(e){if(fo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}fo=!1}so=0,uo=lo=co=null,po=!1,go=ho=0,_o=null}function Oo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return uo===null?co.memoizedState=uo=e:uo=uo.next=e,uo}function ko(){if(lo===null){var e=co.alternate;e=e===null?null:e.memoizedState}else e=lo.next;var t=uo===null?co.memoizedState:uo.next;if(t!==null)uo=t,lo=e;else{if(e===null)throw co.alternate===null?Error(i(467)):Error(i(310));lo=e,e={memoizedState:lo.memoizedState,baseState:lo.baseState,baseQueue:lo.baseQueue,queue:lo.queue,next:null},uo===null?co.memoizedState=uo=e:uo=uo.next=e}return uo}function Ao(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function jo(e){var t=go;return go+=1,_o===null&&(_o=[]),e=Ca(_o,e,t),t=co,(uo===null?t.memoizedState:uo.next)===null&&(t=t.alternate,I.H=t===null||t.memoizedState===null?zs:Bs),e}function Mo(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return jo(e);if(e.$$typeof===C)return Qi(e)}throw Error(i(438,String(e)))}function No(e){var t=null,n=co.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=co.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=Ao(),co.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 Po(e,t){return typeof t==`function`?t(e):t}function Fo(e){return Io(ko(),lo,e)}function Io(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?(so&f)===f:(zl&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===la&&(d=!0);else if((so&p)===p){u=u.next,p===la&&(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,co.lanes|=p,ql|=p;f=u.action,mo&&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,co.lanes|=f,ql|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!vr(o,e.memoizedState)&&(rc=!0,d&&(n=ua,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 Lo(e){var t=ko(),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);vr(o,t.memoizedState)||(rc=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Ro(e,t,n){var r=co,a=ko(),o=ji;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!vr((lo||a).memoizedState,n);if(s&&(a.memoizedState=n,rc=!0),a=a.queue,us(Vo.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||uo!==null&&uo.memoizedState.tag&1){if(r.flags|=2048,is(9,{destroy:void 0},Bo.bind(null,r,a,n,t),null),Ll===null)throw Error(i(349));o||so&127||zo(r,t,n)}return n}function zo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=co.updateQueue,t===null?(t=Ao(),co.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Bo(e,t,n,r){t.value=n,t.getSnapshot=r,Ho(t)&&Uo(e)}function Vo(e,t,n){return n(function(){Ho(t)&&Uo(e)})}function Ho(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!vr(e,n)}catch{return!0}}function Uo(e){var t=$r(e,2);t!==null&&_u(t,e,2)}function Wo(e){var t=Oo();if(typeof e==`function`){var n=e;if(e=n(),mo){Me(!0);try{n()}finally{Me(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Po,lastRenderedState:e},t}function Go(e,t,n,r){return e.baseState=n,Io(e,lo,typeof r==`function`?r:Po)}function Ko(e,t,n,r,a){if(Fs(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,qo(t,o)):(o.next=n.next,t.pending=n.next=o)}}function qo(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),Jo(e,t,s)}catch(n){Xo(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),I.T=a}}else try{a=n(i,r),Jo(e,t,a)}catch(n){Xo(e,t,n)}}function Jo(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Yo(e,t,n)},function(n){return Xo(e,t,n)}):Yo(e,t,n)}function Yo(e,t,n){t.status=`fulfilled`,t.value=n,Zo(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,qo(e,n)))}function Xo(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Zo(t),t=t.next;while(t!==r)}e.action=null}function Zo(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Qo(e,t){return t}function $o(e,t){if(ji){var n=Ll.formState;if(n!==null){a:{var r=co;if(ji){if(Ai){b:{for(var i=Ai,a=Ni;i.nodeType!==8;){if(!a){i=null;break b}if(i=pf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Ai=pf(i.nextSibling),r=i.data===`F!`;break a}}Fi(r)}r=!1}r&&(t=n[0])}}return n=Oo(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qo,lastRenderedState:t},n.queue=r,n=Ms.bind(null,co,r),r.dispatch=n,r=Wo(!1),a=Ps.bind(null,co,!1,r.queue),r=Oo(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Ko.bind(null,co,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function es(e){return ts(ko(),lo,e)}function ts(e,t,n){if(t=Io(e,t,Qo)[0],e=Fo(Po)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=jo(t)}catch(e){throw e===va?ba:e}else r=t;t=ko();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(co.flags|=2048,is(9,{destroy:void 0},ns.bind(null,i,n),null)),[r,a,e]}function ns(e,t){e.action=t}function rs(e){var t=ko(),n=lo;if(n!==null)return ts(t,n,e);ko(),t=t.memoizedState,n=ko();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function is(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=co.updateQueue,t===null&&(t=Ao(),co.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 as(){return ko().memoizedState}function ss(e,t,n,r){var i=Oo();co.flags|=e,i.memoizedState=is(1|t,{destroy:void 0},n,r===void 0?null:r)}function cs(e,t,n,r){var i=ko();r=r===void 0?null:r;var a=i.memoizedState.inst;lo!==null&&r!==null&&bo(r,lo.memoizedState.deps)?i.memoizedState=is(t,a,n,r):(co.flags|=e,i.memoizedState=is(1|t,a,n,r))}function ls(e,t){ss(8390656,8,e,t)}function us(e,t){cs(2048,8,e,t)}function ds(e){co.flags|=4;var t=co.updateQueue;if(t===null)t=Ao(),co.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function fs(e){var t=ko().memoizedState;return ds({ref:t,nextImpl:e}),function(){if(Il&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function ps(e,t){return cs(4,2,e,t)}function ms(e,t){return cs(4,4,e,t)}function hs(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 gs(e,t,n){n=n==null?null:n.concat([e]),cs(4,4,hs.bind(null,t,e),n)}function _s(){}function vs(e,t){var n=ko();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&bo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function ys(e,t){var n=ko();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&bo(t,r[1]))return r[0];if(r=e(),mo){Me(!0);try{e()}finally{Me(!1)}}return n.memoizedState=[r,t],r}function bs(e,t,n){return n===void 0||so&1073741824&&!(zl&261930)?e.memoizedState=t:(e.memoizedState=n,e=gu(),co.lanes|=e,ql|=e,n)}function xs(e,t,n,r){return vr(n,t)?n:qa.current===null?!(so&42)||so&1073741824&&!(zl&261930)?(rc=!0,e.memoizedState=n):(e=gu(),co.lanes|=e,ql|=e,t):(e=bs(e,n,r),vr(e,t)||(rc=!0),e)}function Ss(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,Ps(e,!1,t,n);try{var c=i(),l=I.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Ns(e,t,U(c,r),hu(e)):Ns(e,t,r,hu(e))}catch(n){Ns(e,t,{then:function(){},status:`rejected`,reason:n},hu())}finally{L.p=a,o!==null&&s.types!==null&&(o.types=s.types),I.T=o}}function Cs(){}function ws(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=Ts(e).queue;Ss(e,a,t,R,n===null?Cs:function(){return Es(e),n(r)})}function Ts(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:Po,lastRenderedState:R},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Po,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Es(e){var t=Ts(e);t.next===null&&(t=e.alternate.memoizedState),Ns(e,t.next.queue,{},hu())}function Ds(){return Qi(rp)}function Os(){return ko().memoizedState}function ks(){return ko().memoizedState}function As(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=hu();e=Ra(n);var r=za(t,e,n);r!==null&&(_u(r,t,n),Ba(r,t,n)),t={cache:aa()},e.payload=t;return}t=t.return}}function js(e,t,n){var r=hu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Fs(e)?Is(t,n):(n=Qr(e,t,n,r),n!==null&&(_u(n,e,r),Ls(n,t,r)))}function Ms(e,t,n){Ns(e,t,n,hu())}function Ns(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Fs(e))Is(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,vr(s,o))return Zr(e,t,i,0),Ll===null&&Xr(),!1}catch{}if(n=Qr(e,t,i,r),n!==null)return _u(n,e,r),Ls(n,t,r),!0}return!1}function Ps(e,t,n,r){if(r={lane:2,revertLane:md(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Fs(e)){if(t)throw Error(i(479))}else t=Qr(e,n,r,2),t!==null&&_u(t,e,2)}function Fs(e){var t=e.alternate;return e===co||t!==null&&t===co}function Is(e,t){po=fo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ls(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ye(e,n)}}var Rs={readContext:Qi,use:Mo,useCallback:yo,useContext:yo,useEffect:yo,useImperativeHandle:yo,useLayoutEffect:yo,useInsertionEffect:yo,useMemo:yo,useReducer:yo,useRef:yo,useState:yo,useDebugValue:yo,useDeferredValue:yo,useTransition:yo,useSyncExternalStore:yo,useId:yo,useHostTransitionStatus:yo,useFormState:yo,useActionState:yo,useOptimistic:yo,useMemoCache:yo,useCacheRefresh:yo};Rs.useEffectEvent=yo;var zs={readContext:Qi,use:Mo,useCallback:function(e,t){return Oo().memoizedState=[e,t===void 0?null:t],e},useContext:Qi,useEffect:ls,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),ss(4194308,4,hs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ss(4194308,4,e,t)},useInsertionEffect:function(e,t){ss(4,2,e,t)},useMemo:function(e,t){var n=Oo();t=t===void 0?null:t;var r=e();if(mo){Me(!0);try{e()}finally{Me(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Oo();if(n!==void 0){var i=n(t);if(mo){Me(!0);try{n(t)}finally{Me(!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=js.bind(null,co,e),[r.memoizedState,e]},useRef:function(e){var t=Oo();return e={current:e},t.memoizedState=e},useState:function(e){e=Wo(e);var t=e.queue,n=Ms.bind(null,co,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:_s,useDeferredValue:function(e,t){return bs(Oo(),e,t)},useTransition:function(){var e=Wo(!1);return e=Ss.bind(null,co,e.queue,!0,!1),Oo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=co,a=Oo();if(ji){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Ll===null)throw Error(i(349));zl&127||zo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,ls(Vo.bind(null,r,o,e),[e]),r.flags|=2048,is(9,{destroy:void 0},Bo.bind(null,r,o,n,t),null),n},useId:function(){var e=Oo(),t=Ll.identifierPrefix;if(ji){var n=Ci,r=Si;n=(r&~(1<<32-Ne(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=ho++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=vo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Ds,useFormState:$o,useActionState:$o,useOptimistic:function(e){var t=Oo();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Ps.bind(null,co,!0,n),n.dispatch=t,[e,t]},useMemoCache:No,useCacheRefresh:function(){return Oo().memoizedState=As.bind(null,co)},useEffectEvent:function(e){var t=Oo(),n={impl:e};return t.memoizedState=n,function(){if(Il&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Bs={readContext:Qi,use:Mo,useCallback:vs,useContext:Qi,useEffect:us,useImperativeHandle:gs,useInsertionEffect:ps,useLayoutEffect:ms,useMemo:ys,useReducer:Fo,useRef:as,useState:function(){return Fo(Po)},useDebugValue:_s,useDeferredValue:function(e,t){return xs(ko(),lo.memoizedState,e,t)},useTransition:function(){var e=Fo(Po)[0],t=ko().memoizedState;return[typeof e==`boolean`?e:jo(e),t]},useSyncExternalStore:Ro,useId:Os,useHostTransitionStatus:Ds,useFormState:es,useActionState:es,useOptimistic:function(e,t){return Go(ko(),lo,e,t)},useMemoCache:No,useCacheRefresh:ks};Bs.useEffectEvent=fs;var Vs={readContext:Qi,use:Mo,useCallback:vs,useContext:Qi,useEffect:us,useImperativeHandle:gs,useInsertionEffect:ps,useLayoutEffect:ms,useMemo:ys,useReducer:Lo,useRef:as,useState:function(){return Lo(Po)},useDebugValue:_s,useDeferredValue:function(e,t){var n=ko();return lo===null?bs(n,e,t):xs(n,lo.memoizedState,e,t)},useTransition:function(){var e=Lo(Po)[0],t=ko().memoizedState;return[typeof e==`boolean`?e:jo(e),t]},useSyncExternalStore:Ro,useId:Os,useHostTransitionStatus:Ds,useFormState:rs,useActionState:rs,useOptimistic:function(e,t){var n=ko();return lo===null?(n.baseState=e,[e,n.queue.dispatch]):Go(n,lo,e,t)},useMemoCache:No,useCacheRefresh:ks};Vs.useEffectEvent=fs;function Hs(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 Us={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=hu(),i=Ra(r);i.payload=t,n!=null&&(i.callback=n),t=za(e,i,r),t!==null&&(_u(t,e,r),Ba(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=hu(),i=Ra(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=za(e,i,r),t!==null&&(_u(t,e,r),Ba(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=hu(),r=Ra(n);r.tag=2,t!=null&&(r.callback=t),t=za(e,r,n),t!==null&&(_u(t,e,n),Ba(t,e,n))}};function Ws(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?!yr(n,r)||!yr(i,a):!0}function Gs(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&&Us.enqueueReplaceState(t,t.state,null)}function Ks(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 qs(e){Kr(e)}function Js(e){console.error(e)}function Ys(e){Kr(e)}function Xs(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Zs(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 Qs(e,t,n){return n=Ra(n),n.tag=3,n.payload={element:null},n.callback=function(){Xs(e,t)},n}function $s(e){return e=Ra(e),e.tag=3,e}function ec(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(){Zs(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Zs(t,n,r),typeof i!=`function`&&(au===null?au=new Set([this]):au.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function tc(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Yi(t,n,a,!0),n=Qa.current,n!==null){switch(n.tag){case 31:case 13:return $a===null?ku():n.alternate===null&&Kl===0&&(Kl=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===xa?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Ju(e,r,a)),!1;case 22:return n.flags|=65536,r===xa?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)),Ju(e,r,a)),!1}throw Error(i(435,n.tag))}return Ju(e,r,a),ku(),!1}if(ji)return t=Qa.current,t===null?(r!==Pi&&(t=Error(i(423),{cause:r}),Vi(mi(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=mi(r,n),a=Qs(e.stateNode,r,a),Va(e,a),Kl!==4&&(Kl=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==Pi&&(e=Error(i(422),{cause:r}),Vi(mi(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=mi(o,n),Ql===null?Ql=[o]:Ql.push(o),Kl!==4&&(Kl=2),t===null)return!0;r=mi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Qs(n.stateNode,r,e),Va(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`&&(au===null||!au.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=$s(a),ec(a,e,n,r),Va(n,a),!1}n=n.return}while(n!==null);return!1}var nc=Error(i(461)),rc=!1;function ic(e,t,n,r){t.child=e===null?Pa(t,null,n,r):W(t,e.child,n,r)}function ac(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 Zi(t),r=xo(e,t,n,o,a,i),s=To(),e!==null&&!rc?(Eo(e,t,i),Oc(e,t,i)):(ji&&s&&Ei(t),t.flags|=1,ic(e,t,r,i),t.child)}function oc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ai(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,sc(e,t,a,r,i)):(e=ci(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!kc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?yr:n,n(o,r)&&e.ref===t.ref)return Oc(e,t,i)}return t.flags|=1,e=oi(a,r),e.ref=t.ref,e.return=t,t.child=e}function sc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(yr(a,r)&&e.ref===t.ref)if(rc=!1,t.pendingProps=r=a,kc(e,i))e.flags&131072&&(rc=!0);else return t.lanes=e.lanes,Oc(e,t,i)}return hc(e,t,n,r,i)}function cc(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 uc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ga(t,a===null?null:a.cachePool),a===null?Xa():Ya(t,a),no(t);else return r=t.lanes=536870912,uc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&ga(t,null),Xa(),ro(t)):(ga(t,a.cachePool),Ya(t,a),ro(t),t.memoizedState=null);return ic(e,t,i,n),t.child}function lc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function uc(e,t,n,r,i){var a=ha();return a=a===null?null:{parent:ia._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&ga(t,null),Xa(),no(t),e!==null&&Yi(e,t,r,!0),t.childLanes=i,null}function dc(e,t){return t=wc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function fc(e,t,n){return W(t,e.child,null,n),e=dc(t,t.pendingProps),e.flags|=2,io(t),t.memoizedState=null,e}function pc(e,t,n){var r=t.pendingProps,a=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(ji){if(r.mode===`hidden`)return e=dc(t,r),t.lanes=536870912,lc(null,e);if(to(t),(e=Ai)?(e=lf(e,Ni),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:xi===null?null:{id:Si,overflow:Ci},retryLane:536870912,hydrationErrors:null},n=di(e),n.return=t,t.child=n,ki=t,Ai=null)):e=null,e===null)throw Fi(t);return t.lanes=536870912,null}return dc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(to(t),a)if(t.flags&256)t.flags&=-257,t=fc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558));else if(rc||Yi(e,t,n,!1),a=(n&e.childLanes)!==0,rc||a){if(r=Ll,r!==null&&(s=Xe(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,$r(e,s),_u(r,e,s),nc;ku(),t=fc(e,t,n)}else e=o.treeContext,Ai=pf(s.nextSibling),ki=t,ji=!0,Mi=null,Ni=!1,e!==null&&Oi(t,e),t=dc(t,r),t.flags|=4096;return t}return e=oi(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function mc(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 hc(e,t,n,r,i){return Zi(t),n=xo(e,t,n,r,void 0,i),r=To(),e!==null&&!rc?(Eo(e,t,i),Oc(e,t,i)):(ji&&r&&Ei(t),t.flags|=1,ic(e,t,n,i),t.child)}function gc(e,t,n,r,i,a){return Zi(t),t.updateQueue=null,n=Co(t,r,n,i),So(e),r=To(),e!==null&&!rc?(Eo(e,t,a),Oc(e,t,a)):(ji&&r&&Ei(t),t.flags|=1,ic(e,t,n,a),t.child)}function _c(e,t,n,r,i){if(Zi(t),t.stateNode===null){var a=ni,o=n.contextType;typeof o==`object`&&o&&(a=Qi(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Us,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Ia(t),o=n.contextType,a.context=typeof o==`object`&&o?Qi(o):ni,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Hs(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&&Us.enqueueReplaceState(a,a.state,null),Wa(t,r,a,i),Ua(),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=Ks(n,s);a.props=c;var l=a.context,u=n.contextType;o=ni,typeof u==`object`&&u&&(o=Qi(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)&&Gs(t,a,r,o),Fa=!1;var f=t.memoizedState;a.state=f,Wa(t,r,a,i),Ua(),l=t.memoizedState,s||f!==l||Fa?(typeof d==`function`&&(Hs(t,n,d,r),l=t.memoizedState),(c=Fa||Ws(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,La(e,t),o=t.memoizedProps,u=Ks(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=ni,typeof l==`object`&&l&&(c=Qi(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)&&Gs(t,a,r,c),Fa=!1,f=t.memoizedState,a.state=f,Wa(t,r,a,i),Ua();var p=t.memoizedState;o!==d||f!==p||Fa||e!==null&&e.dependencies!==null&&Xi(e.dependencies)?(typeof s==`function`&&(Hs(t,n,s,r),p=t.memoizedState),(u=Fa||Ws(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Xi(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,mc(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=W(t,e.child,null,i),t.child=W(t,null,n,i)):ic(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Oc(e,t,i),e}function vc(e,t,n,r){return zi(),t.flags|=256,ic(e,t,n,r),t.child}var yc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function bc(e){return{baseLanes:e,cachePool:_a()}}function xc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=Xl),e}function Sc(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:(ao.current&2)!=0),s&&(a=!0,t.flags&=-129),s=(t.flags&32)!=0,t.flags&=-33,e===null){if(ji){if(a?eo(t):ro(t),(e=Ai)?(e=lf(e,Ni),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:xi===null?null:{id:Si,overflow:Ci},retryLane:536870912,hydrationErrors:null},n=di(e),n.return=t,t.child=n,ki=t,Ai=null)):e=null,e===null)throw Fi(t);return df(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(ro(t),a=t.mode,c=wc({mode:`hidden`,children:c},a),r=li(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=bc(n),r.childLanes=xc(e,s,n),t.memoizedState=yc,lc(null,r)):(eo(t),Cc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(eo(t),t.flags&=-257,t=G(e,t,n)):t.memoizedState===null?(ro(t),c=r.fallback,a=t.mode,r=wc({mode:`visible`,children:r.children},a),c=li(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,W(t,e.child,null,n),r=t.child,r.memoizedState=bc(n),r.childLanes=xc(e,s,n),t.memoizedState=yc,t=lc(null,r)):(ro(t),t.child=e.child,t.flags|=128,t=null);else if(eo(t),df(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,Vi({value:r,source:null,stack:null}),t=G(e,t,n)}else if(rc||Yi(e,t,n,!1),s=(n&e.childLanes)!==0,rc||s){if(s=Ll,s!==null&&(r=Xe(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,$r(e,r),_u(s,e,r),nc;uf(c)||ku(),t=G(e,t,n)}else uf(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Ai=pf(c.nextSibling),ki=t,ji=!0,Mi=null,Ni=!1,e!==null&&Oi(t,e),t=Cc(t,r.children),t.flags|=4096);return t}return a?(ro(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=oi(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=li(c,a,n,null),c.flags|=2):c=oi(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,lc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=bc(n):(a=c.cachePool,a===null?a=_a():(l=ia._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=xc(e,s,n),t.memoizedState=yc,lc(e.child,r)):(eo(t),n=e.child,e=n.sibling,n=oi(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 Cc(e,t){return t=wc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function wc(e,t){return e=ii(22,e,null,t),e.lanes=0,e}function G(e,t,n){return W(t,e.child,null,n),e=Cc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Tc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),qi(e.return,t,n)}function Ec(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 Dc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=ao.current,s=(o&2)!=0;if(s?(o=o&1|2,t.flags|=128):o&=1,B(ao,o),ic(e,t,r,n),r=ji?vi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Tc(e,n,t);else if(e.tag===19)Tc(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&&oo(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Ec(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&&oo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Ec(t,!0,n,null,a,r);break;case`together`:Ec(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Oc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),ql|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Yi(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=oi(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=oi(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function kc(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&Xi(e))):!0}function Ac(e,t,n){switch(t.tag){case 3:ae(t,t.stateNode.containerInfo),Gi(t,ia,e.memoizedState.cache),zi();break;case 27:case 5:se(t);break;case 4:ae(t,t.stateNode.containerInfo);break;case 10:Gi(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,to(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(eo(t),e=Oc(e,t,n),e===null?null:e.sibling):Sc(e,t,n):(eo(t),t.flags|=128,null);eo(t);break;case 19:var i=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=(Yi(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return Dc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),B(ao,ao.current),r)break;return null;case 22:return t.lanes=0,cc(e,t,n,t.pendingProps);case 24:Gi(t,ia,e.memoizedState.cache)}return Oc(e,t,n)}function jc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)rc=!0;else{if(!kc(e,n)&&!(t.flags&128))return rc=!1,Ac(e,t,n);rc=!!(e.flags&131072)}else rc=!1,ji&&t.flags&1048576&&Ti(t,vi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=wa(t.elementType),t.type=e,typeof e==`function`)ai(e)?(r=Ks(e,r),t.tag=1,t=_c(null,t,e,r,n)):(t.tag=0,t=hc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===w){t.tag=11,t=ac(null,t,e,r,n);break a}else if(a===D){t.tag=14,t=oc(null,t,e,r,n);break a}}throw t=P(e)||e,Error(i(306,t,``))}}return t;case 0:return hc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Ks(r,t.pendingProps),_c(e,t,r,a,n);case 3:a:{if(ae(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,La(e,t),Wa(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Gi(t,ia,r),r!==o.cache&&Ji(t,[ia],n,!0),Ua(),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=vc(e,t,r,n);break a}else if(r!==a){a=mi(Error(i(424)),t),Vi(a),t=vc(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(Ai=pf(e.firstChild),ki=t,ji=!0,Mi=null,Ni=!0,n=Pa(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(zi(),r===a){t=Oc(e,t,n);break a}ic(e,t,r,n)}t=t.child}return t;case 26:return mc(e,t),e===null?(n=Pf(t.type,null,t.pendingProps,null))?t.memoizedState=n:ji||(n=t.type,e=t.pendingProps,r=Gd(H.current).createElement(n),r[nt]=t,r[rt]=e,zd(r,n,e),ht(r),t.stateNode=r):t.memoizedState=Pf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return se(t),e===null&&ji&&(r=t.stateNode=_f(t.type,t.pendingProps,H.current),ki=t,Ni=!0,a=Ai,nf(t.type)?(mf=a,Ai=pf(r.firstChild)):Ai=a),ic(e,t,t.pendingProps.children,n),mc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&ji&&((a=r=Ai)&&(r=sf(r,t.type,t.pendingProps,Ni),r===null?a=!1:(t.stateNode=r,ki=t,Ai=pf(r.firstChild),Ni=!1,a=!0)),a||Fi(t)),se(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,Jd(a,o)?r=null:s!==null&&Jd(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=xo(e,t,wo,null,null,n),rp._currentValue=a),mc(e,t),ic(e,t,r,n),t.child;case 6:return e===null&&ji&&((e=n=Ai)&&(n=cf(n,t.pendingProps,Ni),n===null?e=!1:(t.stateNode=n,ki=t,Ai=null,e=!0)),e||Fi(t)),null;case 13:return Sc(e,t,n);case 4:return ae(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=W(t,null,r,n):ic(e,t,r,n),t.child;case 11:return ac(e,t,t.type,t.pendingProps,n);case 7:return ic(e,t,t.pendingProps,n),t.child;case 8:return ic(e,t,t.pendingProps.children,n),t.child;case 12:return ic(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Gi(t,t.type,r.value),ic(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,Zi(t),a=Qi(a),r=r(a),t.flags|=1,ic(e,t,r,n),t.child;case 14:return oc(e,t,t.type,t.pendingProps,n);case 15:return sc(e,t,t.type,t.pendingProps,n);case 19:return Dc(e,t,n);case 31:return pc(e,t,n);case 22:return cc(e,t,n,t.pendingProps);case 24:return Zi(t),r=Qi(ia),e===null?(a=ha(),a===null&&(a=Ll,o=aa(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},Ia(t),Gi(t,ia,a)):((e.lanes&n)!==0&&(La(e,t),Wa(t,null,null,n),Ua()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,Gi(t,ia,r),r!==a.cache&&Ji(t,[ia],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Gi(t,ia,r))),ic(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function K(e){e.flags|=4}function Mc(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(Eu())e.flags|=8192;else throw Ta=xa,ya}else e.flags&=-16777217}function Nc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Yf(t))if(Eu())e.flags|=8192;else throw Ta=xa,ya}function Pc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:We(),e.lanes|=t,Zl|=t)}function Fc(e,t){if(!ji)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 Ic(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 Lc(e,t,n){var r=t.pendingProps;switch(Di(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ic(t),null;case 1:return Ic(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Ki(ia),oe(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Ri(t)?K(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Bi())),Ic(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(K(t),o===null?(Ic(t),Mc(t,a,null,r,n)):(Ic(t),Nc(t,o))):o?o===e.memoizedState?(Ic(t),t.flags&=-16777217):(K(t),Ic(t),Nc(t,o)):(e=e.memoizedProps,e!==r&&K(t),Ic(t),Mc(t,a,e,r,n)),null;case 27:if(ce(t),n=H.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&K(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Ic(t),null}e=re.current,Ri(t)?Ii(t,e):(e=_f(a,r,n),t.stateNode=e,K(t))}return Ic(t),null;case 5:if(ce(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&K(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Ic(t),null}if(o=re.current,Ri(t))Ii(t,o);else{var s=Gd(H.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[nt]=t,o[rt]=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(zd(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&&K(t)}}return Ic(t),Mc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&K(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=H.current,Ri(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=ki,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[nt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Id(e.nodeValue,n)),e||Fi(t,!0)}else e=Gd(e).createTextNode(r),e[nt]=t,t.stateNode=e}return Ic(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Ri(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[nt]=t}else zi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ic(t),e=!1}else n=Bi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(io(t),t):(io(t),null);if(t.flags&128)throw Error(i(558))}return Ic(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Ri(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[nt]=t}else zi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ic(t),a=!1}else a=Bi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(io(t),t):(io(t),null)}return io(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),Pc(t,t.updateQueue),Ic(t),null);case 4:return oe(),e===null&&Ed(t.stateNode.containerInfo),Ic(t),null;case 10:return Ki(t.type),Ic(t),null;case 19:if(z(ao),r=t.memoizedState,r===null)return Ic(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)Fc(r,!1);else{if(Kl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=oo(e),o!==null){for(t.flags|=128,Fc(r,!1),e=o.updateQueue,t.updateQueue=e,Pc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)si(n,e),n=n.sibling;return B(ao,ao.current&1|2),ji&&wi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&xe()>ru&&(t.flags|=128,a=!0,Fc(r,!1),t.lanes=4194304)}else{if(!a)if(e=oo(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Pc(t,e),Fc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!ji)return Ic(t),null}else 2*xe()-r.renderingStartTime>ru&&n!==536870912&&(t.flags|=128,a=!0,Fc(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?(Ic(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=xe(),e.sibling=null,n=ao.current,B(ao,a?n&1|2:n&1),ji&&wi(t,r.treeForkCount),e);case 22:case 23:return io(t),Za(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Ic(t),t.subtreeFlags&6&&(t.flags|=8192)):Ic(t),n=t.updateQueue,n!==null&&Pc(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(ma),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Ki(ia),Ic(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Rc(e,t){switch(Di(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ki(ia),oe(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ce(t),null;case 31:if(t.memoizedState!==null){if(io(t),t.alternate===null)throw Error(i(340));zi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(io(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));zi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return z(ao),null;case 4:return oe(),null;case 10:return Ki(t.type),null;case 22:case 23:return io(t),Za(),e!==null&&z(ma),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ki(ia),null;case 25:return null;default:return null}}function zc(e,t){switch(Di(t),t.tag){case 3:Ki(ia),oe();break;case 26:case 27:case 5:ce(t);break;case 4:oe();break;case 31:t.memoizedState!==null&&io(t);break;case 13:io(t);break;case 19:z(ao);break;case 10:Ki(t.type);break;case 22:case 23:io(t),Za(),e!==null&&z(ma);break;case 24:Ki(ia)}}function Bc(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){qu(t,t.return,e)}}function Vc(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){qu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){qu(t,t.return,e)}}function Hc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Ka(t,n)}catch(t){qu(e,e.return,t)}}}function Uc(e,t,n){n.props=Ks(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){qu(e,t,n)}}function Wc(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){qu(e,t,n)}}function Gc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){qu(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){qu(e,t,n)}else n.current=null}function Kc(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){qu(e,e.return,t)}}function qc(e,t,n){try{var r=e.stateNode;Bd(r,e.type,n,t),r[rt]=t}catch(t){qu(e,e.return,t)}}function Jc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&nf(e.type)||e.tag===4}function Yc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Jc(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&&nf(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 q(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=Yt));else if(r!==4&&(r===27&&nf(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(q(e,t,n),e=e.sibling;e!==null;)q(e,t,n),e=e.sibling}function Xc(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&&nf(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Xc(e,t,n),e=e.sibling;e!==null;)Xc(e,t,n),e=e.sibling}function J(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);zd(t,r,n),t[nt]=e,t[rt]=n}catch(t){qu(e,e.return,t)}}var Zc=!1,Qc=!1,$c=!1,el=typeof WeakSet==`function`?WeakSet:Set,tl=null;function nl(e,t){if(e=e.containerInfo,Ud=fp,e=Cr(e),wr(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(Wd={focusedElem:e,selectionRange:n},fp=!1,tl=t;tl!==null;)if(t=tl,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,tl=e;else for(;tl!==null;){switch(t=tl,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=Ks(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){qu(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)of(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:of(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,tl=e;break}tl=t.return}}function rl(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:vl(e,n),r&4&&Bc(5,n);break;case 1:if(vl(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){qu(n,n.return,e)}else{var i=Ks(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){qu(n,n.return,e)}}r&64&&Hc(n),r&512&&Wc(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{Ka(e,t)}catch(e){qu(n,n.return,e)}}break;case 27:t===null&&r&4&&J(n);case 26:case 5:vl(e,n),t===null&&r&4&&Kc(n),r&512&&Wc(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=Zu.bind(null,n),ff(e,n))));break;case 22:if(r=n.memoizedState!==null||Zc,!r){t=t!==null&&t.memoizedState!==null||Qc,i=Zc;var a=Qc;Zc=r,(Qc=t)&&!a?bl(e,n,(n.subtreeFlags&8772)!=0):vl(e,n),Zc=i,Qc=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&&ut(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(je&&typeof je.onCommitFiberUnmount==`function`)try{je.onCommitFiberUnmount(Ae,n)}catch{}switch(n.tag){case 26:Qc||Gc(n,t),sl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Qc||Gc(n,t);var r=al,i=ol;nf(n.type)&&(al=n.stateNode,ol=!1),sl(e,t,n),vf(n.stateNode),al=r,ol=i;break;case 5:Qc||Gc(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){qu(n,t,e)}else try{al.removeChild(n.stateNode)}catch(e){qu(n,t,e)}break;case 18:al!==null&&(ol?(e=al,rf(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Rp(e)):rf(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:Vc(2,n,t),Qc||Vc(4,n,t),sl(e,t,n);break;case 1:Qc||(Gc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Uc(n,t,r)),sl(e,t,n);break;case 21:sl(e,t,n);break;case 22:Qc=(r=Qc)||n.memoizedState!==null,sl(e,t,n),Qc=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{Rp(e)}catch(e){qu(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{Rp(e)}catch(e){qu(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 el),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new el),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=Qu.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(nf(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&&(Vc(3,e,e.return),Bc(3,e),Vc(5,e,e.return));break;case 1:pl(t,e),gl(e),r&512&&(Qc||n===null||Gc(n,n.return)),r&64&&Zc&&(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&&(Qc||n===null||Gc(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[lt]||o[nt]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),zd(o,r,n),o[nt]=e,ht(o),r=o;break a;case`link`:var s=Kf(`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),zd(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=Kf(`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),zd(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[nt]=e,ht(o),r=o}e.stateNode=r}else qf(a,e.type,e.stateNode);else e.stateNode=Vf(a,r,e.memoizedProps);else o===r?r===null&&e.stateNode!==null&&qc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?qf(a,e.type,e.stateNode):Vf(a,r,e.memoizedProps))}break;case 27:pl(t,e),gl(e),r&512&&(Qc||n===null||Gc(n,n.return)),n!==null&&r&4&&qc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(pl(t,e),gl(e),r&512&&(Qc||n===null||Gc(n,n.return)),e.flags&32){a=e.stateNode;try{Vt(a,``)}catch(t){qu(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,qc(e,a,n===null?a:n.memoizedProps)),r&1024&&($c=!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){qu(e,e.return,t)}}break;case 3:if(Gf=null,a=ml,ml=xf(t.containerInfo),pl(t,e),ml=a,gl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Rp(t.containerInfo)}catch(t){qu(e,e.return,t)}$c&&($c=!1,_l(e));break;case 4:r=ml,ml=xf(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)&&(tu=xe()),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=Zc,d=Qc;if(Zc=u||a,Qc=d||l,pl(t,e),Qc=d,Zc=u,gl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||Zc||Qc||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){qu(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){qu(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?af(m,!0):af(l.stateNode,!1)}catch(e){qu(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(Jc(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;Xc(e,Yc(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(Vt(o,``),n.flags&=-33),Xc(e,Yc(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;q(e,Yc(e),s);break;default:throw Error(i(161))}}catch(t){qu(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;)rl(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:Vc(4,t,t.return),yl(t);break;case 1:Gc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Uc(t,t.return,n),yl(t);break;case 27:vf(t.stateNode);case 26:case 5:Gc(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),Bc(4,a);break;case 1:if(bl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){qu(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++)Ga(c[i],s)}catch(e){qu(r,r.return,e)}}n&&o&64&&Hc(a),Wc(a,a.return);break;case 27:J(a);case 26:case 5:bl(i,a,n),n&&r===null&&o&4&&Kc(a),Wc(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),Wc(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&&oa(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&&oa(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&&Bc(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&&oa(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){qu(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),Bc(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 Y=8192;function Dl(e,t,n){if(e.subtreeFlags&Y)for(e=e.child;e!==null;)Ol(e,t,n),e=e.sibling}function Ol(e,t,n){switch(e.tag){case 26:Dl(e,t,n),e.flags&Y&&e.memoizedState!==null&&Xf(n,ml,e.memoizedState,e.memoizedProps);break;case 5:Dl(e,t,n);break;case 3:case 4:var r=ml;ml=xf(e.stateNode.containerInfo),Dl(e,t,n),ml=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Y,Y=16777216,Dl(e,t,n),Y=r):Dl(e,t,n));break;default:Dl(e,t,n)}}function kl(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 Al(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];tl=r,Nl(r,e)}kl(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)jl(e),e=e.sibling}function jl(e){switch(e.tag){case 0:case 11:case 15:Al(e),e.flags&2048&&Vc(9,e,e.return);break;case 3:Al(e);break;case 12:Al(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ml(e)):Al(e);break;default:Al(e)}}function Ml(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];tl=r,Nl(r,e)}kl(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Vc(8,t,t.return),Ml(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Ml(t));break;default:Ml(t)}e=e.sibling}}function Nl(e,t){for(;tl!==null;){var n=tl;switch(n.tag){case 0:case 11:case 15:Vc(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:oa(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,tl=r;else a:for(n=e;tl!==null;){r=tl;var i=r.sibling,a=r.return;if(il(r),r===n){tl=null;break a}if(i!==null){i.return=a,tl=i;break a}tl=a}}}var Pl={getCacheForType:function(e){var t=Qi(ia),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Qi(ia).controller.signal}},Fl=typeof WeakMap==`function`?WeakMap:Map,Il=0,Ll=null,Rl=null,zl=0,Bl=0,Vl=null,Hl=!1,Ul=!1,Wl=!1,Gl=0,Kl=0,ql=0,Jl=0,Yl=0,Xl=0,Zl=0,Ql=null,$l=null,eu=!1,tu=0,nu=0,ru=1/0,iu=null,au=null,ou=0,su=null,cu=null,lu=0,uu=0,du=null,fu=null,pu=0,mu=null;function hu(){return Il&2&&zl!==0?zl&-zl:I.T===null?$e():md()}function gu(){if(Xl===0)if(!(zl&536870912)||ji){var e=Re;Re<<=1,!(Re&3932160)&&(Re=262144),Xl=e}else Xl=536870912;return e=Qa.current,e!==null&&(e.flags|=32),Xl}function _u(e,t,n){(e===Ll&&(Bl===2||Bl===9)||e.cancelPendingCommit!==null)&&(wu(e,0),xu(e,zl,Xl,!1)),Ke(e,n),(!(Il&2)||e!==Ll)&&(e===Ll&&(!(Il&2)&&(Jl|=n),Kl===4&&xu(e,zl,Xl,!1)),od(e))}function vu(e,t,n){if(Il&6)throw Error(i(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||He(e,t),a=r?Mu(e,t):Au(e,t,!0),o=r;do{if(a===0){Ul&&!r&&xu(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!bu(n)){a=Au(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=Ql;var l=c.current.memoizedState.isDehydrated;if(l&&(wu(c,s).flags|=256),s=Au(c,s,!1),s!==2){if(Wl&&!l){c.errorRecoveryDisabledLanes|=o,Jl|=o,a=4;break a}o=$l,$l=a,o!==null&&($l===null?$l=o:$l.push.apply($l,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){wu(e,0),xu(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:xu(r,t,Xl,!Hl);break a;case 2:$l=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=tu+300-xe(),10<a)){if(xu(r,t,Xl,!Hl),Ve(r,0,!0)!==0)break a;lu=t,r.timeoutHandle=Zd(yu.bind(null,r,n,$l,iu,eu,t,Xl,Jl,Zl,Hl,o,`Throttled`,-0,0),a);break a}yu(r,n,$l,iu,eu,t,Xl,Jl,Zl,Hl,o,null,-0,0)}}break}while(1);od(e)}function yu(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:Yt},Ol(t,a,d);var m=(a&62914560)===a?tu-xe():(a&4194048)===a?nu-xe():0;if(m=Qf(d,m),m!==null){lu=a,e.cancelPendingCommit=m(zu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),xu(e,a,o,!l);return}}zu(e,t,a,n,r,i,o,s,c)}function bu(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(!vr(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 xu(e,t,n,r){t&=~Yl,t&=~Jl,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Ne(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Je(e,n,t)}function Su(){return Il&6?!0:(sd(0,!1),!1)}function Cu(){if(Rl!==null){if(Bl===0)var e=Rl.return;else e=Rl,Wi=Ui=null,Do(e),Oa=null,ka=0,e=Rl;for(;e!==null;)zc(e.alternate,e),e=e.return;Rl=null}}function wu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,Qd(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),lu=0,Cu(),Ll=e,Rl=n=oi(e.current,null),zl=t,Bl=0,Vl=null,Hl=!1,Ul=He(e,t),Wl=!1,Zl=Xl=Yl=Jl=ql=Kl=0,$l=Ql=null,eu=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Ne(r),a=1<<i;t|=e[i],r&=~a}return Gl=t,Xr(),n}function Tu(e,t){co=null,I.H=Rs,t===va||t===ba?(t=Ea(),Bl=3):t===ya?(t=Ea(),Bl=4):Bl=t===nc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Vl=t,Rl===null&&(Kl=1,Xs(e,mi(t,e.current)))}function Eu(){var e=Qa.current;return e===null?!0:(zl&4194048)===zl?$a===null:(zl&62914560)===zl||zl&536870912?e===$a:!1}function Du(){var e=I.H;return I.H=Rs,e===null?Rs:e}function Ou(){var e=I.A;return I.A=Pl,e}function ku(){Kl=4,Hl||(zl&4194048)!==zl&&Qa.current!==null||(Ul=!0),!(ql&134217727)&&!(Jl&134217727)||Ll===null||xu(Ll,zl,Xl,!1)}function Au(e,t,n){var r=Il;Il|=2;var i=Du(),a=Ou();(Ll!==e||zl!==t)&&(iu=null,wu(e,t)),t=!1;var o=Kl;a:do try{if(Bl!==0&&Rl!==null){var s=Rl,c=Vl;switch(Bl){case 8:Cu(),o=6;break a;case 3:case 2:case 9:case 6:Qa.current===null&&(t=!0);var l=Bl;if(Bl=0,Vl=null,Iu(e,s,c,l),n&&Ul){o=0;break a}break;default:l=Bl,Bl=0,Vl=null,Iu(e,s,c,l)}}ju(),o=Kl;break}catch(t){Tu(e,t)}while(1);return t&&e.shellSuspendCounter++,Wi=Ui=null,Il=r,I.H=i,I.A=a,Rl===null&&(Ll=null,zl=0,Xr()),o}function ju(){for(;Rl!==null;)Pu(Rl)}function Mu(e,t){var n=Il;Il|=2;var r=Du(),a=Ou();Ll!==e||zl!==t?(iu=null,ru=xe()+500,wu(e,t)):Ul=He(e,t);a:do try{if(Bl!==0&&Rl!==null){t=Rl;var o=Vl;b:switch(Bl){case 1:Bl=0,Vl=null,Iu(e,t,o,1);break;case 2:case 9:if(Sa(o)){Bl=0,Vl=null,Fu(t);break}t=function(){Bl!==2&&Bl!==9||Ll!==e||(Bl=7),od(e)},o.then(t,t);break a;case 3:Bl=7;break a;case 4:Bl=5;break a;case 7:Sa(o)?(Bl=0,Vl=null,Fu(t)):(Bl=0,Vl=null,Iu(e,t,o,7));break;case 5:var s=null;switch(Rl.tag){case 26:s=Rl.memoizedState;case 5:case 27:var c=Rl;if(s?Yf(s):c.stateNode.complete){Bl=0,Vl=null;var l=c.sibling;if(l!==null)Rl=l;else{var u=c.return;u===null?Rl=null:(Rl=u,Lu(u))}break b}}Bl=0,Vl=null,Iu(e,t,o,5);break;case 6:Bl=0,Vl=null,Iu(e,t,o,6);break;case 8:Cu(),Kl=6;break a;default:throw Error(i(462))}}Nu();break}catch(t){Tu(e,t)}while(1);return Wi=Ui=null,I.H=r,I.A=a,Il=n,Rl===null?(Ll=null,zl=0,Xr(),Kl):0}function Nu(){for(;Rl!==null&&!ye();)Pu(Rl)}function Pu(e){var t=jc(e.alternate,e,Gl);e.memoizedProps=e.pendingProps,t===null?Lu(e):Rl=t}function Fu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=gc(n,t,t.pendingProps,t.type,void 0,zl);break;case 11:t=gc(n,t,t.pendingProps,t.type.render,t.ref,zl);break;case 5:Do(t);default:zc(n,t),t=Rl=si(t,Gl),t=jc(n,t,Gl)}e.memoizedProps=e.pendingProps,t===null?Lu(e):Rl=t}function Iu(e,t,n,r){Wi=Ui=null,Do(t),Oa=null,ka=0;var i=t.return;try{if(tc(e,i,t,n,zl)){Kl=1,Xs(e,mi(n,e.current)),Rl=null;return}}catch(t){if(i!==null)throw Rl=i,t;Kl=1,Xs(e,mi(n,e.current)),Rl=null;return}t.flags&32768?(ji||r===1?e=!0:Ul||zl&536870912?e=!1:(Hl=e=!0,(r===2||r===9||r===3||r===6)&&(r=Qa.current,r!==null&&r.tag===13&&(r.flags|=16384))),Ru(t,e)):Lu(t)}function Lu(e){var t=e;do{if(t.flags&32768){Ru(t,Hl);return}e=t.return;var n=Lc(t.alternate,t,Gl);if(n!==null){Rl=n;return}if(t=t.sibling,t!==null){Rl=t;return}Rl=t=e}while(t!==null);Kl===0&&(Kl=5)}function Ru(e,t){do{var n=Rc(e.alternate,e);if(n!==null){n.flags&=32767,Rl=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Rl=e;return}Rl=e=n}while(e!==null);Kl=6,Rl=null}function zu(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Wu();while(ou!==0);if(Il&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=Yr,qe(e,n,o,s,c,l),e===Ll&&(Rl=Ll=null,zl=0),cu=t,su=e,lu=n,uu=o,du=a,fu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,$u(Te,function(){return Gu(),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=Il,Il|=4;try{nl(e,t,n)}finally{Il=s,L.p=a,I.T=r}}ou=1,Bu(),Vu(),Hu()}}function Bu(){if(ou===1){ou=0;var e=su,t=cu,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=Il;Il|=4;try{hl(t,e);var a=Wd,o=Cr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&Sr(s.ownerDocument.documentElement,s)){if(c!==null&&wr(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 _=xr(s,h),v=xr(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}}fp=!!Ud,Wd=Ud=null}finally{Il=i,L.p=r,I.T=n}}e.current=t,ou=2}}function Vu(){if(ou===2){ou=0;var e=su,t=cu,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=Il;Il|=4;try{rl(e,t.alternate,t)}finally{Il=i,L.p=r,I.T=n}}ou=3}}function Hu(){if(ou===4||ou===3){ou=0,be();var e=su,t=cu,n=lu,r=fu;t.subtreeFlags&10256||t.flags&10256?ou=5:(ou=0,cu=su=null,Uu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(au=null),Qe(n),t=t.stateNode,je&&typeof je.onCommitFiberRoot==`function`)try{je.onCommitFiberRoot(Ae,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}}lu&3&&Wu(),od(e),i=e.pendingLanes,n&261930&&i&42?e===mu?pu++:(pu=0,mu=e):pu=0,sd(0,!1)}}function Uu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,oa(t)))}function Wu(){return Bu(),Vu(),Hu(),Gu()}function Gu(){if(ou!==5)return!1;var e=su,t=uu;uu=0;var n=Qe(lu),r=I.T,a=L.p;try{L.p=32>n?32:n,I.T=null,n=du,du=null;var o=su,s=lu;if(ou=0,cu=su=null,lu=0,Il&6)throw Error(i(331));var c=Il;if(Il|=4,jl(o.current),wl(o,o.current,s,n),Il=c,sd(0,!1),je&&typeof je.onPostCommitFiberRoot==`function`)try{je.onPostCommitFiberRoot(Ae,o)}catch{}return!0}finally{L.p=a,I.T=r,Uu(e,t)}}function Ku(e,t,n){t=mi(n,t),t=Qs(e.stateNode,t,2),e=za(e,t,2),e!==null&&(Ke(e,2),od(e))}function qu(e,t,n){if(e.tag===3)Ku(e,e,n);else for(;t!==null;){if(t.tag===3){Ku(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(au===null||!au.has(r))){e=mi(n,e),n=$s(2),r=za(t,n,2),r!==null&&(ec(n,r,t,e),Ke(r,2),od(r));break}}t=t.return}}function Ju(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Fl;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)||(Wl=!0,i.add(n),e=Yu.bind(null,e,t,n),t.then(e,e))}function Yu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Ll===e&&(zl&n)===n&&(Kl===4||Kl===3&&(zl&62914560)===zl&&300>xe()-tu?!(Il&2)&&wu(e,0):Yl|=n,Zl===zl&&(Zl=0)),od(e)}function Xu(e,t){t===0&&(t=We()),e=$r(e,t),e!==null&&(Ke(e,t),od(e))}function Zu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Xu(e,n)}function Qu(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),Xu(e,n)}function $u(e,t){return _e(e,t)}var ed=null,td=null,nd=!1,rd=!1,id=!1,ad=0;function od(e){e!==td&&e.next===null&&(td===null?ed=td=e:td=td.next=e),rd=!0,nd||(nd=!0,pd())}function sd(e,t){if(!id&&rd){id=!0;do for(var n=!1,r=ed;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-Ne(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,fd(r,a))}else a=zl,a=Ve(r,r===Ll?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||He(r,a)||(n=!0,fd(r,a));r=r.next}while(n);id=!1}}function cd(){ld()}function ld(){rd=nd=!1;var e=0;ad!==0&&Xd()&&(e=ad);for(var t=xe(),n=null,r=ed;r!==null;){var i=r.next,a=ud(r,t);a===0?(r.next=null,n===null?ed=i:n.next=i,i===null&&(td=n)):(n=r,(e!==0||a&3)&&(rd=!0)),r=i}ou!==0&&ou!==5||sd(e,!1),ad!==0&&(ad=0)}function ud(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Ne(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Ue(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Ll,n=zl,n=Ve(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Bl===2||Bl===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&ve(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||He(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&ve(r),Qe(n)){case 2:case 8:n=we;break;case 32:n=Te;break;case 268435456:n=De;break;default:n=Te}return r=dd.bind(null,e),n=_e(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&ve(r),e.callbackPriority=2,e.callbackNode=null,2}function dd(e,t){if(ou!==0&&ou!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Wu()&&e.callbackNode!==n)return null;var r=zl;return r=Ve(e,e===Ll?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(vu(e,r,t),ud(e,xe()),e.callbackNode!=null&&e.callbackNode===n?dd.bind(null,e):null)}function fd(e,t){if(Wu())return null;vu(e,t,!0)}function pd(){ef(function(){Il&6?_e(Ce,cd):ld()})}function md(){if(ad===0){var e=la;e===0&&(e=Le,Le<<=1,!(Le&261888)&&(Le=256)),ad=e}return ad}function hd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Jt(``+e)}function gd(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 _d(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=hd((i[rt]||null).action),o=r.submitter;o&&(t=(t=o[rt]||null)?hd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new _n(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(ad!==0){var e=o?gd(i,o):new FormData(i);ws(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?gd(i,o):new FormData(i),ws(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var vd=0;vd<Wr.length;vd++){var yd=Wr[vd];Gr(yd.toLowerCase(),`on`+(yd[0].toUpperCase()+yd.slice(1)))}Gr(Ir,`onAnimationEnd`),Gr(Lr,`onAnimationIteration`),Gr(Rr,`onAnimationStart`),Gr(`dblclick`,`onDoubleClick`),Gr(`focusin`,`onFocus`),Gr(`focusout`,`onBlur`),Gr(zr,`onTransitionRun`),Gr(Br,`onTransitionStart`),Gr(Vr,`onTransitionCancel`),Gr(Hr,`onTransitionEnd`),yt(`onMouseEnter`,[`mouseout`,`mouseover`]),yt(`onMouseLeave`,[`mouseout`,`mouseover`]),yt(`onPointerEnter`,[`pointerout`,`pointerover`]),yt(`onPointerLeave`,[`pointerout`,`pointerover`]),vt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),vt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),vt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),vt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),vt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),vt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var bd=`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(` `),xd=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(bd));function Sd(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){Kr(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){Kr(e)}i.currentTarget=null,a=c}}}}function Cd(e,t){var n=t[at];n===void 0&&(n=t[at]=new Set);var r=e+`__bubble`;n.has(r)||(Dd(t,e,2,!1),n.add(r))}function wd(e,t,n){var r=0;t&&(r|=4),Dd(n,e,r,t)}var Td=`_reactListening`+Math.random().toString(36).slice(2);function Ed(e){if(!e[Td]){e[Td]=!0,gt.forEach(function(t){t!==`selectionchange`&&(xd.has(t)||wd(t,!1,e),wd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Td]||(t[Td]=!0,wd(`selectionchange`,!1,t))}}function Dd(e,t,n,r){switch(yp(t)){case 2:var i=pp;break;case 8:i=mp;break;default:i=hp}n=i.bind(null,t,n,e),i=void 0,!on||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 Od(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=dt(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}nn(function(){var r=a,i=Zt(n),s=[];a:{var c=Ur.get(e);if(c!==void 0){var l=_n,u=e;switch(e){case`keypress`:if(fn(n)===0)break a;case`keydown`:case`keyup`:l=Fn;break;case`focusin`:u=`focus`,l=En;break;case`focusout`:u=`blur`,l=En;break;case`beforeblur`:case`afterblur`:l=En;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=wn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Tn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Ln;break;case Ir:case Lr:case Rr:l=Dn;break;case Hr:l=Rn;break;case`scroll`:case`scrollend`:l=yn;break;case`wheel`:l=zn;break;case`copy`:case`cut`:case`paste`:l=On;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=In;break;case`toggle`:case`beforetoggle`:l=Bn}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=rn(m,p),g!=null&&d.push(kd(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!==Xt&&(u=n.relatedTarget||n.fromElement)&&(dt(u)||u[it]))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?dt(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=wn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=In,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:pt(l),h=u==null?c:pt(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,dt(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=jd,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&&Md(s,c,l,d,!1),u!==null&&f!==null&&Md(s,f,u,d,!0)}}a:{if(c=r?pt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=or;else if(er(c))if(sr)v=gr;else{v=mr;var y=pr}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&Gt(r.elementType)&&(v=or):v=hr;if(v&&=v(e,r)){tr(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&Lt(c,`number`,c.value)}switch(y=r?pt(r):window,e){case`focusin`:(er(y)||y.contentEditable===`true`)&&(Er=y,Dr=r,Or=null);break;case`focusout`:Or=Dr=Er=null;break;case`mousedown`:kr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:kr=!1,Ar(s,n,i);break;case`selectionchange`:if(Tr)break;case`keydown`:case`keyup`:Ar(s,n,i)}var b;if(Hn)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 Xn?Jn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Gn&&n.locale!==`ko`&&(Xn||x!==`onCompositionStart`?x===`onCompositionEnd`&&Xn&&(b=dn()):(cn=i,ln=`value`in cn?cn.value:cn.textContent,Xn=!0)),y=Ad(r,x),0<y.length&&(x=new kn(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=Yn(n),b!==null&&(x.data=b)))),(b=Wn?Zn(e,n):Qn(e,n))&&(x=Ad(r,`onBeforeInput`),0<x.length&&(y=new kn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),_d(s,e,r,n,i)}Sd(s,t)})}function kd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Ad(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=rn(e,n),i!=null&&r.unshift(kd(e,i,a)),i=rn(e,t),i!=null&&r.push(kd(e,i,a))),e.tag===3)return r;e=e.return}return[]}function jd(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Md(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=rn(n,a),l!=null&&o.unshift(kd(n,l,c))):i||(l=rn(n,a),l!=null&&o.push(kd(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Nd=/\r\n?/g,Pd=/\u0000|\uFFFD/g;function Fd(e){return(typeof e==`string`?e:``+e).replace(Nd,`
9
+ `).replace(Pd,``)}function Id(e,t){return t=Fd(t),Fd(e)===t}function Ld(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Vt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Vt(e,``+r);break;case`className`:Tt(e,`class`,r);break;case`tabIndex`:Tt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Tt(e,n,r);break;case`style`:Wt(e,r,o);break;case`data`:if(t!==`object`){Tt(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=Jt(``+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`&&Ld(e,t,`name`,a.name,a,null),Ld(e,t,`formEncType`,a.formEncType,a,null),Ld(e,t,`formMethod`,a.formMethod,a,null),Ld(e,t,`formTarget`,a.formTarget,a,null)):(Ld(e,t,`encType`,a.encType,a,null),Ld(e,t,`method`,a.method,a,null),Ld(e,t,`target`,a.target,a,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Jt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Yt);break;case`onScroll`:r!=null&&Cd(`scroll`,e);break;case`onScrollEnd`:r!=null&&Cd(`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=Jt(``+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`:Cd(`beforetoggle`,e),Cd(`toggle`,e),wt(e,`popover`,r);break;case`xlinkActuate`:Et(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Et(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Et(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Et(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Et(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Et(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Et(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Et(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Et(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:wt(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=Kt.get(n)||n,wt(e,n,r))}}function Rd(e,t,n,r,a,o){switch(n){case`style`:Wt(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`?Vt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Vt(e,``+r);break;case`onScroll`:r!=null&&Cd(`scroll`,e);break;case`onScrollEnd`:r!=null&&Cd(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=Yt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!_t.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[rt]||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,``):wt(e,n,r)}}}function zd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Cd(`error`,e),Cd(`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:Ld(e,t,o,s,n,null)}}a&&Ld(e,t,`srcSet`,n.srcSet,n,null),r&&Ld(e,t,`src`,n.src,n,null);return;case`input`:Cd(`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:Ld(e,t,r,d,n,null)}}It(e,o,c,l,u,s,a,!1);return;case`select`:for(a in Cd(`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:Ld(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Rt(e,!!r,n,!0):Rt(e,!!r,t,!1);return;case`textarea`:for(s in Cd(`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:Ld(e,t,s,c,n,null)}Bt(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:Ld(e,t,l,r,n,null)}return;case`dialog`:Cd(`beforetoggle`,e),Cd(`toggle`,e),Cd(`cancel`,e),Cd(`close`,e);break;case`iframe`:case`object`:Cd(`load`,e);break;case`video`:case`audio`:for(r=0;r<bd.length;r++)Cd(bd[r],e);break;case`image`:Cd(`error`,e),Cd(`load`,e);break;case`details`:Cd(`toggle`,e);break;case`embed`:case`source`:case`link`:Cd(`error`,e),Cd(`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:Ld(e,t,u,r,n,null)}return;default:if(Gt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Rd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Ld(e,t,c,r,n,null))}function Bd(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)||Ld(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&&Ld(e,t,p,m,r,f)}}Ft(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)||Ld(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&&Ld(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Rt(e,!!n,n?[]:``,!1):Rt(e,!!n,t,!0)):Rt(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:Ld(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&&Ld(e,t,s,a,r,o)}zt(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:Ld(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:Ld(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)&&Ld(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:Ld(e,t,u,p,r,m)}return;default:if(Gt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Rd(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||Rd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Ld(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||Ld(e,t,f,p,r,m)}function Vd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Hd(){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&&Vd(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&&Vd(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 Ud=null,Wd=null;function Gd(e){return e.nodeType===9?e:e.ownerDocument}function Kd(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 qd(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 Jd(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 Yd=null;function Xd(){var e=window.event;return e&&e.type===`popstate`?e===Yd?!1:(Yd=e,!0):(Yd=null,!1)}var Zd=typeof setTimeout==`function`?setTimeout:void 0,Qd=typeof clearTimeout==`function`?clearTimeout:void 0,$d=typeof Promise==`function`?Promise:void 0,ef=typeof queueMicrotask==`function`?queueMicrotask:$d===void 0?Zd:function(e){return $d.resolve(null).then(e).catch(tf)};function tf(e){setTimeout(function(){throw e})}function nf(e){return e===`head`}function rf(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),Rp(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)vf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,vf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[lt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&vf(e.ownerDocument.body);n=i}while(n);Rp(t)}function af(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 of(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`:of(n),ut(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function sf(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[lt])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=pf(e.nextSibling),e===null)break}return null}function cf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=pf(e.nextSibling),e===null))return null;return e}function lf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=pf(e.nextSibling),e===null))return null;return e}function uf(e){return e.data===`$?`||e.data===`$~`}function df(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function ff(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 pf(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 mf=null;function hf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return pf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function gf(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 _f(e,t,n){switch(t=Gd(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 vf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);ut(e)}var yf=new Map,bf=new Set;function xf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Sf=L.d;L.d={f:Cf,r:wf,D:Df,C:Of,L:kf,m:Af,X:Mf,S:jf,M:Nf};function Cf(){var e=Sf.f(),t=Su();return e||t}function wf(e){var t=ft(e);t!==null&&t.tag===5&&t.type===`form`?Es(t):Sf.r(e)}var Tf=typeof document>`u`?null:document;function Ef(e,t,n){var r=Tf;if(r&&typeof t==`string`&&t){var i=Pt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),bf.has(i)||(bf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),zd(t,`link`,e),ht(t),r.head.appendChild(t)))}}function Df(e){Sf.D(e),Ef(`dns-prefetch`,e,null)}function Of(e,t){Sf.C(e,t),Ef(`preconnect`,e,t)}function kf(e,t,n){Sf.L(e,t,n);var r=Tf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Pt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Pt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Pt(n.imageSizes)+`"]`)):i+=`[href="`+Pt(e)+`"]`;var a=i;switch(t){case`style`:a=Ff(e);break;case`script`:a=zf(e)}yf.has(a)||(e=m({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),yf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(If(a))||t===`script`&&r.querySelector(Bf(a))||(t=r.createElement(`link`),zd(t,`link`,e),ht(t),r.head.appendChild(t)))}}function Af(e,t){Sf.m(e,t);var n=Tf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Pt(r)+`"][href="`+Pt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=zf(e)}if(!yf.has(a)&&(e=m({rel:`modulepreload`,href:e},t),yf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Bf(a)))return}r=n.createElement(`link`),zd(r,`link`,e),ht(r),n.head.appendChild(r)}}}function jf(e,t,n){Sf.S(e,t,n);var r=Tf;if(r&&e){var i=mt(r).hoistableStyles,a=Ff(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(If(a)))s.loading=5;else{e=m({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=yf.get(a))&&Uf(e,n);var c=o=r.createElement(`link`);ht(c),zd(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,Hf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Mf(e,t){Sf.X(e,t);var n=Tf;if(n&&e){var r=mt(n).hoistableScripts,i=zf(e),a=r.get(i);a||(a=n.querySelector(Bf(i)),a||(e=m({src:e,async:!0},t),(t=yf.get(i))&&Wf(e,t),a=n.createElement(`script`),ht(a),zd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Nf(e,t){Sf.M(e,t);var n=Tf;if(n&&e){var r=mt(n).hoistableScripts,i=zf(e),a=r.get(i);a||(a=n.querySelector(Bf(i)),a||(e=m({src:e,async:!0,type:`module`},t),(t=yf.get(i))&&Wf(e,t),a=n.createElement(`script`),ht(a),zd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Pf(e,t,n,r){var a=(a=H.current)?xf(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=Ff(n.href),n=mt(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=Ff(n.href);var o=mt(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(If(e)))&&!o._p&&(s.instance=o,s.state.loading=5),yf.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},yf.set(e,n),o||Rf(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=zf(n),n=mt(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 Ff(e){return`href="`+Pt(e)+`"`}function If(e){return`link[rel="stylesheet"][`+e+`]`}function Lf(e){return m({},e,{"data-precedence":e.precedence,precedence:null})}function Rf(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}),zd(t,`link`,n),ht(t),e.head.appendChild(t))}function zf(e){return`[src="`+Pt(e)+`"]`}function Bf(e){return`script[async]`+e}function Vf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Pt(n.href)+`"]`);if(r)return t.instance=r,ht(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`),ht(r),zd(r,`style`,a),Hf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Ff(n.href);var o=e.querySelector(If(a));if(o)return t.state.loading|=4,t.instance=o,ht(o),o;r=Lf(n),(a=yf.get(a))&&Uf(r,a),o=(e.ownerDocument||e).createElement(`link`),ht(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),zd(o,`link`,r),t.state.loading|=4,Hf(o,n.precedence,e),t.instance=o;case`script`:return o=zf(n.src),(a=e.querySelector(Bf(o)))?(t.instance=a,ht(a),a):(r=n,(a=yf.get(o))&&(r=m({},n),Wf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),ht(a),zd(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,Hf(r,n.precedence,e));return t.instance}function Hf(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 Uf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Wf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Gf=null;function Kf(e,t,n){if(Gf===null){var r=new Map,i=Gf=new Map;i.set(n,r)}else i=Gf,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[lt]||a[nt]||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 qf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Jf(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 Yf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Xf(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=Ff(r.href),a=t.querySelector(If(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=$f.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,ht(a);return}a=t.ownerDocument||t,r=Lf(r),(i=yf.get(i))&&Uf(r,i),a=a.createElement(`link`),ht(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),zd(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=$f.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Zf=0;function Qf(e,t){return e.stylesheets&&e.count===0&&tp(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&tp(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Zf===0&&(Zf=62500*Hd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&tp(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Zf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function $f(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)tp(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var ep=null;function tp(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ep=new Map,t.forEach(np,e),ep=null,$f.call(e))}function np(e,t){if(!(t.state.loading&4)){var n=ep.get(e);if(n)var r=n.get(null);else{n=new Map,ep.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=$f.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 rp={$$typeof:C,Provider:null,Consumer:null,_currentValue:R,_currentValue2:R,_threadCount:0};function ip(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=Ge(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ge(0),this.hiddenUpdates=Ge(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 ap(e,t,n,r,i,a,o,s,c,l,u,d){return e=new ip(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ii(3,null,null,t),e.current=a,a.stateNode=e,t=aa(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Ia(a),e}function op(e){return e?(e=ni,e):ni}function sp(e,t,n,r,i,a){i=op(i),r.context===null?r.context=i:r.pendingContext=i,r=Ra(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=za(e,r,t),n!==null&&(_u(n,e,t),Ba(n,e,t))}function cp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function lp(e,t){cp(e,t),(e=e.alternate)&&cp(e,t)}function up(e){if(e.tag===13||e.tag===31){var t=$r(e,67108864);t!==null&&_u(t,e,67108864),lp(e,67108864)}}function dp(e){if(e.tag===13||e.tag===31){var t=hu();t=Ze(t);var n=$r(e,t);n!==null&&_u(n,e,t),lp(e,t)}}var fp=!0;function pp(e,t,n,r){var i=I.T;I.T=null;var a=L.p;try{L.p=2,hp(e,t,n,r)}finally{L.p=a,I.T=i}}function mp(e,t,n,r){var i=I.T;I.T=null;var a=L.p;try{L.p=8,hp(e,t,n,r)}finally{L.p=a,I.T=i}}function hp(e,t,n,r){if(fp){var i=gp(r);if(i===null)Od(e,t,r,_p,n),Op(e,r);else if(Ap(i,e,t,n,r))r.stopPropagation();else if(Op(e,r),t&4&&-1<Dp.indexOf(e)){for(;i!==null;){var a=ft(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Be(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Ne(o);s.entanglements[1]|=c,o&=~c}od(a),!(Il&6)&&(ru=xe()+500,sd(0,!1))}}break;case 31:case 13:s=$r(a,2),s!==null&&_u(s,a,2),Su(),lp(a,2)}if(a=gp(r),a===null&&Od(e,t,r,_p,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Od(e,t,r,null,n)}}function gp(e){return e=Zt(e),vp(e)}var _p=null;function vp(e){if(_p=null,e=dt(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 _p=e,null}function yp(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(Se()){case Ce:return 2;case we:return 8;case Te:case Ee:return 32;case De:return 268435456;default:return 32}default:return 32}}var bp=!1,xp=null,Sp=null,Cp=null,wp=new Map,Tp=new Map,Ep=[],Dp=`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 Op(e,t){switch(e){case`focusin`:case`focusout`:xp=null;break;case`dragenter`:case`dragleave`:Sp=null;break;case`mouseover`:case`mouseout`:Cp=null;break;case`pointerover`:case`pointerout`:wp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Tp.delete(t.pointerId)}}function kp(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=ft(t),t!==null&&up(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Ap(e,t,n,r,i){switch(t){case`focusin`:return xp=kp(xp,e,t,n,r,i),!0;case`dragenter`:return Sp=kp(Sp,e,t,n,r,i),!0;case`mouseover`:return Cp=kp(Cp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return wp.set(a,kp(wp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Tp.set(a,kp(Tp.get(a)||null,e,t,n,r,i)),!0}return!1}function jp(e){var t=dt(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,et(e.priority,function(){dp(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,et(e.priority,function(){dp(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 Mp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=gp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Xt=r,n.target.dispatchEvent(r),Xt=null}else return t=ft(n),t!==null&&up(t),e.blockedOn=n,!1;t.shift()}return!0}function Np(e,t,n){Mp(e)&&n.delete(t)}function Pp(){bp=!1,xp!==null&&Mp(xp)&&(xp=null),Sp!==null&&Mp(Sp)&&(Sp=null),Cp!==null&&Mp(Cp)&&(Cp=null),wp.forEach(Np),Tp.forEach(Np)}function Fp(e,n){e.blockedOn===n&&(e.blockedOn=null,bp||(bp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Pp)))}var Ip=null;function Lp(e){Ip!==e&&(Ip=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Ip===e&&(Ip=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(vp(r||n)===null)continue;break}var a=ft(n);a!==null&&(e.splice(t,3),t-=3,ws(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Rp(e){function t(t){return Fp(t,e)}xp!==null&&Fp(xp,e),Sp!==null&&Fp(Sp,e),Cp!==null&&Fp(Cp,e),wp.forEach(t),Tp.forEach(t);for(var n=0;n<Ep.length;n++){var r=Ep[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Ep.length&&(n=Ep[0],n.blockedOn===null);)jp(n),n.blockedOn===null&&Ep.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[rt]||null;if(typeof a==`function`)o||Lp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[rt]||null)s=o.formAction;else if(vp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Lp(n)}}}function zp(){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 Bp(e){this._internalRoot=e}Vp.prototype.render=Bp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;sp(n,hu(),e,t,null,null)},Vp.prototype.unmount=Bp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;sp(e.current,2,null,e,null,null),Su(),t[it]=null}};function Vp(e){this._internalRoot=e}Vp.prototype.unstable_scheduleHydration=function(e){if(e){var t=$e();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Ep.length&&t!==0&&t<Ep[n].priority;n++);Ep.splice(n,0,e),n===0&&jp(e)}};var Hp=n.version;if(Hp!==`19.2.5`)throw Error(i(527,Hp,`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 Up={bundleType:0,version:`19.2.5`,rendererPackageName:`react-dom`,currentDispatcherRef:I,reconcilerVersion:`19.2.5`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Wp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Wp.isDisabled&&Wp.supportsFiber)try{Ae=Wp.inject(Up),je=Wp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=qs,s=Js,c=Ys;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=ap(e,1,!1,null,null,n,r,null,o,s,c,zp),e[it]=t.current,Ed(e),new Bp(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 oe(``,{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:se(t)}return le(t,n,null,e)}function V(e,t){if(e===!1||e==null)throw Error(t)}function H(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function ie(){return Math.random().toString(36).substring(2,10)}function ae(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 oe(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?ce(t):t,state:n,key:t&&t.key||r||ie(),unstable_mask:i}}function se({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 ce(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 le(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:oe(h.location,e,t);n&&n(r,e),l=u()+1;let d=ae(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:oe(h.location,e,t);n&&n(r,e),l=u();let i=ae(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 ue(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 ue(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:se(e);return r=r.replace(/ $/,`%20`),!t&&r.startsWith(`//`)&&(r=n+r),new URL(r,n)}var de,fe=class{constructor(e){if(ne(this,de,new Map),e)for(let[t,n]of e)this.set(t,n)}get(e){if(te(this,de).has(e))return te(this,de).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw Error(`No value found for context`)}set(e,t){te(this,de).set(e,t)}};de=new WeakMap;var pe=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`children`]);function me(e){return pe.has(e)}var he=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`middleware`,`children`]);function ge(e){return he.has(e)}function _e(e){return e.index===!0}function ve(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`),_e(e)){let n={...e,id:s};return r[s]=ye(n,t(n)),n}else{let n={...e,id:s,children:void 0};return r[s]=ye(n,t(n)),e.children&&(n.children=ve(e.children,t,o,r,i)),n}})}function ye(e,t){return Object.assign(e,{...t,...typeof t.lazy==`object`&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function be(e,t,n=`/`){return xe(e,t,n,!1)}function xe(e,t,n,r){let i=ze((typeof t==`string`?ce(t):t).pathname||`/`,n);if(i==null)return null;let a=Ce(e);Te(a);let o=null;for(let e=0;o==null&&e<a.length;++e){let t=Re(i);o=Fe(a[e],t,r)}return o}function Se(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 Ce(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=Xe([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}".`),Ce(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:Ne(l,e.index),routesMeta:u})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of we(e.path))a(e,t,!0,n)}),t}function we(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=we(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 Te(e){e.sort((e,t)=>e.score===t.score?Pe(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var Ee=/^:[\w-]+$/,De=3,Oe=2,ke=1,Ae=10,je=-2,Me=e=>e===`*`;function Ne(e,t){let n=e.split(`/`),r=n.length;return n.some(Me)&&(r+=je),t&&(r+=Oe),n.filter(e=>!Me(e)).reduce((e,t)=>e+(Ee.test(t)?De:t===``?ke:Ae),r)}function Pe(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 Fe(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=Ie({path:s.relativePath,caseSensitive:s.caseSensitive,end:c},l),d=s.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=Ie({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:Xe([a,u.pathname]),pathnameBase:Qe(Xe([a,u.pathnameBase])),route:d}),u.pathnameBase!==`/`&&(a=Xe([a,u.pathnameBase]))}return o}function Ie(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Le(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 Le(e,t=!1,n=!0){H(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 Re(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return H(!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 ze(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 Be({basename:e,pathname:t}){return t===`/`?e:Xe([e,t])}var Ve=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,He=e=>Ve.test(e);function Ue(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?ce(e):e,a;return n?(n=Ye(n),a=n.startsWith(`/`)?We(n.substring(1),`/`):We(n,t)):a=t,{pathname:a,search:$e(r),hash:et(i)}}function We(e,t){let n=Ze(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function Ge(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 Ke(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function qe(e){let t=Ke(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function Je(e,t,n,r=!1){let i;typeof e==`string`?i=ce(e):(i={...e},V(!i.pathname||!i.pathname.includes(`?`),Ge(`?`,`pathname`,`search`,i)),V(!i.pathname||!i.pathname.includes(`#`),Ge(`#`,`pathname`,`hash`,i)),V(!i.search||!i.search.includes(`#`),Ge(`#`,`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=Ue(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var Ye=e=>e.replace(/\/\/+/g,`/`),Xe=e=>Ye(e.join(`/`)),Ze=e=>e.replace(/\/+$/,``),Qe=e=>Ze(e).replace(/^\/*/,`/`),$e=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,et=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,tt=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 nt(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function rt(e){return Xe(e.map(e=>e.route.path).filter(Boolean))||`/`}var it=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function at(e,t){let n=e;if(typeof n!=`string`||!Ve.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(it)try{let e=new URL(window.location.href),r=n.startsWith(`//`)?new URL(e.protocol+n):new URL(n),a=ze(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{H(!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 ot=Symbol(`Uninstrumented`);function st(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=lt(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=lt(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[ot]??i,a=lt(n[e],t,(...e)=>dt(e[0]));a&&(e===`loader`&&t.hydrate===!0&&(a.hydrate=!0),a[ot]=t,r[e]=a)}}),t.middleware&&t.middleware.length>0&&n.middleware.length>0&&(r.middleware=t.middleware.map(e=>{let t=e[ot]??e,r=lt(n.middleware,t,(...e)=>dt(e[0]));return r?(r[ot]=t,r):e})),r}function ct(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[ot]??e.navigate,r=lt(n.navigate,t,(...t)=>{let[n,r]=t;return{to:typeof n==`number`||typeof n==`string`?n:n?se(n):`.`,...ft(e,r??{})}});r&&(r[ot]=t,e.navigate=r)}if(n.fetch.length>0){let t=e.fetch[ot]??e.fetch,r=lt(n.fetch,t,(...t)=>{let[n,,r,i]=t;return{href:r??`.`,fetcherKey:n,...ft(e,i??{})}});r&&(r[ot]=t,e.fetch=r)}return e}function lt(e,t,n){return e.length===0?null:async(...r)=>{let i=await ut(e,n(...r),()=>t(...r),e.length-1);if(i.type===`error`)throw i.value;return i.value}}async function ut(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=ut(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 dt(e){let{request:t,context:n,params:r,unstable_pattern:i}=e;return{request:pt(t),params:{...r},unstable_pattern:i,context:mt(n)}}function ft(e,t){return{currentUrl:se(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 pt(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function mt(e){if(gt(e)){let t={...e};return Object.freeze(t),t}else return{get:t=>e.get(t)}}var ht=Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);function gt(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`)===ht}var _t=[`POST`,`PUT`,`PATCH`,`DELETE`],vt=new Set(_t),yt=[`GET`,..._t],bt=new Set(yt),xt=new Set([301,302,303,307,308]),St=new Set([307,308]),Ct={state:`idle`,location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},wt={state:`idle`,data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Tt={state:`unblocked`,proceed:void 0,reset:void 0,location:void 0},Et=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),Dt=`remix-router-transitions`,Ot=Symbol(`ResetLoaderData`);function kt(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||Et,a=i;if(e.unstable_instrumentations){let t=e.unstable_instrumentations;a=e=>({...i(e),...st(t.map(e=>e.route).filter(Boolean),e)})}let o={},s=ve(e.routes,a,void 0,o),c,l=e.basename||`/`;l.startsWith(`/`)||(l=`/${l}`);let u=e.dataStrategy||Kt,d={unstable_passThroughRequests:!1,...e.future},f=null,p=new Set,m=null,h=null,g=null,_=e.hydrationData!=null,v=be(s,e.history.location,l),y=!1,b=null,x,S;if(v==null&&!e.patchRoutesOnNavigation){let t=_n(404,{pathname:e.history.location.pathname}),{matches:n,route:r}=gn(s);x=!0,S=!x,v=n,b={[r.id]:t}}else if(v&&!e.hydrationData&&$e(v,s,e.history.location.pathname).active&&(v=null),!v){x=!1,S=!x,v=[];let t=$e(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=>Pt(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=Ft(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:Ct,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,ie=null;function ae(){if(f=e.history.listen(({action:t,location:n,delta:r})=>{if(re){re(),re=void 0;return}H(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=qe({currentLocation:w.location,nextLocation:n,historyAction:t});if(i&&r!=null){let t=new Promise(e=>{re=e});e.history.go(r*-1),Ke(i,{state:`blocked`,location:n,proceed(){Ke(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,Tt),de({blockers:e})}}),E?.resolve(),E=null;return}return ge(t,n)}),n){Vn(t,A);let e=()=>Hn(t,A);t.addEventListener(`pagehide`,e),j=()=>t.removeEventListener(`pagehide`,e)}return w.initialized||ge(`POP`,w.location,{initialHydration:!0}),C}function se(){f&&f(),j&&j(),p.clear(),O&&O.abort(),w.fetchers.forEach((e,t)=>Ie(t)),w.blockers.forEach((e,t)=>Ge(t))}function le(e){return p.add(e),()=>p.delete(e)}function de(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=>Ie(e)),r.forEach(e=>w.fetchers.delete(e))}function pe(t,n,{flushSync:r}={}){let i=w.actionData!=null&&w.navigation.formMethod!=null&&Mn(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?pn(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,Tt)));let u=M?!1:Qe(t,n.matches||w.matches),d=D===!0||w.navigation.formMethod!=null&&Mn(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}}de({...n,actionData:a,loaderData:o,historyAction:T,location:t,initialized:!0,renderFallback:!1,navigation:Ct,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,ie?.resolve(),ie=null}async function me(t,n){if(E?.resolve(),E=null,typeof t==`number`){E||=Un();let n=E.promise;return e.history.go(t),n}let{path:r,submission:i,error:a}=Mt(!1,jt(w.location,w.matches,l,t,n?.fromRouteId,n?.relative),n),o;n?.unstable_mask&&(o={pathname:``,search:``,hash:``,...typeof n.unstable_mask==`string`?ce(n.unstable_mask):{...w.location.unstable_mask,...n.unstable_mask}});let s=w.location,c=oe(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&&Mn(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=qe({currentLocation:s,nextLocation:c,historyAction:d});if(m){Ke(m,{state:`blocked`,location:c,proceed(){Ke(m,{state:`proceeding`,proceed:void 0,reset:void 0,location:c}),me(t,n)},reset(){let e=new Map(w.blockers);e.set(m,Tt),de({blockers:e})}});return}await ge(d,c,{submission:i,pendingError:a,preventScrollReset:f,replace:n&&n.replace,enableViewTransition:n&&n.viewTransition,flushSync:p,callSiteDefaultShouldRevalidate:n&&n.unstable_defaultShouldRevalidate})}function he(){ie||=Un(),je(),de({revalidation:`loading`});let e=ie.promise;return w.navigation.state===`submitting`?e:w.navigation.state===`idle`?(ge(w.historyAction,w.location,{startUninterruptedRevalidation:!0}),e):(ge(T||w.historyAction,w.navigation.location,{overrideNavigation:w.navigation,enableViewTransition:k===!0}),e)}async function ge(t,n,r){O&&O.abort(),O=null,T=t,M=(r&&r.startUninterruptedRevalidation)===!0,Ze(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:be(i,n,l),u=(r&&r.flushSync)===!0;if(o&&w.initialized&&!N&&bn(w.location,n)&&!(r&&r.submission&&Mn(r.submission.formMethod))){pe(n,{matches:o},{flushSync:u});return}let d=$e(o,i,n.pathname);if(d.active&&d.matches&&(o=d.matches),!o){let{error:e,notFoundMatches:t,route:r}=Je(n.pathname);pe(n,{matches:t,loaderData:{},errors:{[r.id]:e}},{flushSync:u});return}O=new AbortController;let f=sn(e.history,n,O.signal,r&&r.submission),p=e.getContext?await e.getContext():new fe,m;if(r&&r.pendingError)m=[hn(o).route.id,{type:`error`,error:r.pendingError}];else if(r&&r.submission&&Mn(r.submission.formMethod)){let t=await _e(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(Tn(r)&&nt(r.error)&&r.error.status===404){O=null,pe(n,{matches:t.matches,loaderData:{},errors:{[e]:r.error}});return}}o=t.matches||o,m=t.pendingActionResult,a=In(n,r.submission),u=!1,d.active=!1,f=sn(e.history,f.url,f.signal)}let{shortCircuited:h,matches:g,loaderData:_,errors:v}=await ye(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,pe(n,{matches:g||o,...mn(m),loaderData:_,errors:v}))}async function _e(t,n,i,c,u,d,f,p={}){if(je(),de({navigation:Ln(n,i)},{flushSync:p.flushSync===!0}),d){let e=await et(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}=gn(s);return{matches:t,pendingActionResult:[n.id,{type:`error`,error:e.error}]}}let t=hn(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}=Je(n.pathname);return{matches:e,pendingActionResult:[r.id,{type:`error`,error:t}]}}}let m,h=Pn(c,n);if(!h.route.action&&!h.route.lazy)m={type:`error`,error:_n(405,{method:t.method,pathname:n.pathname,routeId:h.route.id})};else{let e=await ke(t,n,Qt(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(En(m)){let n;return n=p&&p.replace!=null?p.replace:on(m.response.headers.get(`Location`),new URL(t.url),l,e.history)===w.location.pathname+w.location.search,await Oe(t,m,!0,{submission:i,replace:n}),{shortCircuited:!0}}if(Tn(m)){let e=hn(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 ye(t,n,i,u,d,f,p,m,h,g,_,v,y){let b=f||In(n,p),x=p||m||Fn(b),S=!M&&!g;if(d){if(S){let e=Ce(v);de({navigation:b,...e===void 0?{}:{actionData:e}},{flushSync:_})}let e=await et(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}=gn(s);return{matches:t,loaderData:{},errors:{[n.id]:e.error}}}let t=hn(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}=Je(n.pathname);return{matches:t,loaderData:{},errors:{[r.id]:e}}}}let C=c||s,{dsMatches:T,revalidatingFetchers:E}=Nt(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=Ve();return pe(n,{matches:i,loaderData:{},errors:v&&Tn(v[1])?{[v[0]]:v[1].error}:null,...mn(v),...e?{fetchers:new Map(w.fetchers)}:{}},{flushSync:_}),{shortCircuited:!0}}if(S){let e={};if(!d){e.navigation=b;let t=Ce(v);t!==void 0&&(e.actionData=t)}E.length>0&&(e.fetchers=we(E)),de(e,{flushSync:_})}E.forEach(e=>{Re(e.key),e.controller&&F.set(e.key,e.controller)});let D=()=>E.forEach(e=>Re(e.key));O&&O.signal.addEventListener(`abort`,D);let{loaderResults:k,fetcherResults:A}=await Ae(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=vn(k);if(j)return await Oe(t,j.result,!0,{replace:h}),{shortCircuited:!0};if(j=vn(A),j)return ee.add(j.key),await Oe(t,j.result,!0,{replace:h}),{shortCircuited:!0};let{loaderData:R,errors:ne}=fn(w,i,k,v,E,A);g&&w.errors&&(ne={...w.errors,...ne});let B=Ve(),re=Ue(L),V=B||re||E.length>0;return{matches:i,loaderData:R,errors:ne,...V?{fetchers:new Map(w.fetchers)}:{}}}function Ce(e){if(e&&!Tn(e[1]))return{[e[0]]:e[1].data};if(w.actionData)return Object.keys(w.actionData).length===0?null:w.actionData}function we(e){return e.forEach(e=>{let t=w.fetchers.get(e.key),n=Rn(void 0,t?t.data:void 0);w.fetchers.set(e.key,n)}),new Map(w.fetchers)}async function Te(t,n,r,i){Re(t);let a=(i&&i.flushSync)===!0,o=c||s,u=jt(w.location,w.matches,l,r,n,i?.relative),d=be(o,u,l),f=$e(d,o,u);if(f.active&&f.matches&&(d=f.matches),!d){Ne(t,n,_n(404,{pathname:u}),{flushSync:a});return}let{path:p,submission:m,error:h}=Mt(!0,u,i);if(h){Ne(t,n,h,{flushSync:a});return}let g=e.getContext?await e.getContext():new fe,_=(i&&i.preventScrollReset)===!0;if(m&&Mn(m.formMethod)){await Ee(t,n,p,d,g,f.active,a,_,m,i&&i.unstable_defaultShouldRevalidate);return}te.set(t,{routeId:n,path:p}),await De(t,n,p,d,g,f.active,a,_,m)}async function Ee(t,n,i,u,d,f,p,m,h,g){je(),te.delete(t),Me(t,zn(h,w.fetchers.get(t)),{flushSync:p});let _=new AbortController,v=sn(e.history,i,_.signal,h);if(f){let e=await et(u,new URL(v.url).pathname,v.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){Ne(t,n,e.error,{flushSync:p});return}else if(e.matches)u=e.matches;else{Ne(t,n,_n(404,{pathname:i}),{flushSync:p});return}}let y=Pn(u,i);if(!y.route.action&&!y.route.lazy){Ne(t,n,_n(405,{method:h.formMethod,pathname:i,routeId:n}),{flushSync:p});return}F.set(t,_);let b=I,x=Qt(a,o,v,i,u,y,r,d),S=await ke(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(En(C)||Tn(C)){Me(t,Bn(void 0));return}}else{if(En(C))if(F.delete(t),L>b){Me(t,Bn(void 0));return}else return ee.add(t),Me(t,Rn(h)),Oe(v,C,!1,{fetcherSubmission:h,preventScrollReset:m});if(Tn(C)){Ne(t,n,C.error);return}}let E=w.navigation.location||w.location,D=sn(e.history,E,_.signal),k=c||s,A=w.navigation.state===`idle`?w.matches:be(k,w.navigation.location,l);V(A,`Didn't find any matches after fetcher action`);let j=++I;R.set(t,j);let M=Rn(h,C.data);w.fetchers.set(t,M);let{dsMatches:ne,revalidatingFetchers:B}=Nt(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=Rn(void 0,n?n.data:void 0);w.fetchers.set(t,r),Re(t),e.controller&&F.set(t,e.controller)}),de({fetchers:new Map(w.fetchers)});let re=()=>B.forEach(e=>Re(e.key));_.signal.addEventListener(`abort`,re);let{loaderResults:H,fetcherResults:ie}=await Ae(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=Bn(C.data);w.fetchers.set(t,e)}let ae=vn(H);if(ae)return Oe(D,ae.result,!1,{preventScrollReset:m});if(ae=vn(ie),ae)return ee.add(ae.key),Oe(D,ae.result,!1,{preventScrollReset:m});let{loaderData:oe,errors:se}=fn(w,A,H,void 0,B,ie);Ue(j),w.navigation.state===`loading`&&j>L?(V(T,`Expected pending action`),O&&O.abort(),pe(w.navigation.location,{matches:A,loaderData:oe,errors:se,fetchers:new Map(w.fetchers)})):(de({errors:se,loaderData:pn(w.loaderData,oe,A,se),fetchers:new Map(w.fetchers)}),N=!1)}async function De(t,n,i,s,c,l,u,d,f){let p=w.fetchers.get(t);Me(t,Rn(f,p?p.data:void 0),{flushSync:u});let m=new AbortController,h=sn(e.history,i,m.signal);if(l){let e=await et(s,new URL(h.url).pathname,h.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){Ne(t,n,e.error,{flushSync:u});return}else if(e.matches)s=e.matches;else{Ne(t,n,_n(404,{pathname:i}),{flushSync:u});return}}let g=Pn(s,i);F.set(t,m);let _=I,v=(await ke(h,i,Qt(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)){Me(t,Bn(void 0));return}if(En(v))if(L>_){Me(t,Bn(void 0));return}else{ee.add(t),await Oe(h,v,!1,{preventScrollReset:d});return}if(Tn(v)){Ne(t,n,v.error);return}Me(t,Bn(v.data))}}async function Oe(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=on(d,new URL(r.url),l,e.history);let f=oe(w.location,d,{_isRedirect:!0});if(n){let e=!1;if(i.response.headers.has(`X-Remix-Reload-Document`))e=!0;else if(He(d)){let n=ue(d,!0);e=n.origin!==t.location.origin||ze(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=Fn(w.navigation));let _=o||s;St.has(i.response.status)&&_&&Mn(_.formMethod)?await ge(p,f,{submission:{..._,formAction:d},preventScrollReset:c||D,enableViewTransition:a?k:void 0}):await ge(p,f,{overrideNavigation:In(f,o),fetcherSubmission:s,preventScrollReset:c||D,enableViewTransition:a?k:void 0})}async function ke(e,t,n,r,i){let a,o={};try{a=await $t(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(!Mn(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(wn(r)){let i=r.result;o[t]={type:`redirect`,response:rn(i,e,t,n,l)}}else o[t]=await nn(r);return o}async function Ae(e,t,n,r,i){let a=ke(n,r,e,i,null),o=Promise.all(t.map(async e=>{if(e.matches&&e.match&&e.request&&e.controller){let t=(await ke(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:_n(404,{pathname:e.path})}})}));return{loaderResults:await a,fetcherResults:(await o).reduce((e,t)=>Object.assign(e,t),{})}}function je(){N=!0,te.forEach((e,t)=>{F.has(t)&&P.add(t),Re(t)})}function Me(e,t,n={}){w.fetchers.set(e,t),de({fetchers:new Map(w.fetchers)},{flushSync:(n&&n.flushSync)===!0})}function Ne(e,t,n,r={}){let i=hn(w.matches,t);Ie(e),de({errors:{[i.route.id]:n},fetchers:new Map(w.fetchers)},{flushSync:(r&&r.flushSync)===!0})}function Pe(e){return ne.set(e,(ne.get(e)||0)+1),z.has(e)&&z.delete(e),w.fetchers.get(e)||wt}function Fe(e,t){Re(e,t?.reason),Me(e,Bn(null))}function Ie(e){let t=w.fetchers.get(e);F.has(e)&&!(t&&t.state===`loading`&&R.has(e))&&Re(e),te.delete(e),R.delete(e),ee.delete(e),z.delete(e),P.delete(e),w.fetchers.delete(e)}function Le(e){let t=(ne.get(e)||0)-1;t<=0?(ne.delete(e),z.add(e)):ne.set(e,t),de({fetchers:new Map(w.fetchers)})}function Re(e,t){let n=F.get(e);n&&(n.abort(t),F.delete(e))}function Be(e){for(let t of e){let e=Bn(Pe(t).data);w.fetchers.set(t,e)}}function Ve(){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 Be(e),t}function Ue(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`&&(Re(n),R.delete(n),t.push(n))}return Be(t),t.length>0}function We(e,t){let n=w.blockers.get(e)||Tt;return B.get(e)!==t&&B.set(e,t),n}function Ge(e){w.blockers.delete(e),B.delete(e)}function Ke(e,t){let n=w.blockers.get(e)||Tt;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),de({blockers:r})}function qe({currentLocation:e,nextLocation:t,historyAction:n}){if(B.size===0)return;B.size>1&&H(!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 Je(e){let t=_n(404,{pathname:e}),{matches:n,route:r}=gn(c||s);return{notFoundMatches:n,route:r,error:t}}function Ye(e,t,n){if(m=e,g=t,h=n||null,!_&&w.navigation===Ct){_=!0;let e=Qe(w.location,w.matches);e!=null&&de({restoreScrollPosition:e})}return()=>{m=null,g=null,h=null}}function Xe(e,t){return h&&h(e,t.map(e=>Se(e,w.loaderData)))||e.key}function Ze(e,t){if(m&&g){let n=Xe(e,t);m[n]=g()}}function Qe(e,t){if(m){let n=Xe(e,t),r=m[n];if(typeof r==`number`)return r}return null}function $e(t,n,r){if(e.patchRoutesOnNavigation){if(!t)return{active:!0,matches:xe(n,r,l,!0)||[]};if(Object.keys(t[0].params).length>0)return{active:!0,matches:xe(n,r,l,!0)}}return{active:!1,matches:null}}async function et(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||zt(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=be(d,n,l),m=null;if(p&&(Object.keys(p[0].params).length===0||(m=xe(d,n,l,!0),!(m&&u.length<m.length&&tt(u,m.slice(0,u.length))))))return{type:`success`,matches:p};if(m||=xe(d,n,l,!0),!m||tt(u,m))return{type:`success`,matches:null};u=m}}function tt(e,t){return e.length===t.length&&e.every((e,n)=>e.route.id===t[n].route.id)}function rt(e){o={},c=ve(e,a,void 0,o)}function it(e,t,n=!1){let r=c==null;zt(e,t,c||s,o,a,n),r&&(s=[...s],de({}))}return C={get basename(){return l},get future(){return d},get state(){return w},get routes(){return s},get window(){return t},initialize:ae,subscribe:le,enableScrollRestoration:Ye,navigate:me,fetch:Te,revalidate:he,createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:Pe,resetFetcher:Fe,deleteFetcher:Le,dispose:se,getBlocker:We,deleteBlocker:Ge,patchRoutes:it,_internalFetchControllers:F,_internalSetRoutes:rt,_internalSetStateDoNotUseOrYouWillBreakYourApp(e){de(e)}},e.unstable_instrumentations&&(C=ct(C,e.unstable_instrumentations.map(e=>e.router).filter(Boolean))),C}function At(e){return e!=null&&(`formData`in e&&e.formData!=null||`body`in e&&e.body!==void 0)}function jt(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=Je(r||`.`,qe(o),ze(e.pathname,n)||e.pathname,a===`path`);if(r??(c.search=e.search,c.hash=e.hash),(r==null||r===``||r===`.`)&&s){let e=Nn(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=Be({basename:n,pathname:c.pathname})),se(c)}function Mt(e,t,n){if(!n||!At(n))return{path:t};if(n.formMethod&&!jn(n.formMethod))return{path:t,error:_n(405,{method:n.formMethod})};let r=()=>({path:t,error:_n(400,{type:`invalid-body`})}),i=(n.formMethod||`get`).toUpperCase(),a=yn(t);if(n.body!==void 0){if(n.formEncType===`text/plain`){if(!Mn(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(!Mn(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=ln(n.formData),s=n.formData;else if(n.body instanceof FormData)o=ln(n.body),s=n.body;else if(n.body instanceof URLSearchParams)o=n.body,s=un(o);else if(n.body==null)o=new URLSearchParams,s=new FormData;else try{o=new URLSearchParams(n.body),s=un(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(Mn(c.formMethod))return{path:t,submission:c};let l=ce(t);return e&&l.search&&Nn(l.search)&&o.append(`index`,``),l.search=`?${o}`,{path:se(l),submission:c}}function Nt(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b){let x=y?Tn(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&&Tn(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=rt(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(!Pt(s))f=!1;else if(u){let{shouldLoad:e}=Ft(s,a.loaderData,a.errors);f=e}else It(a.loaderData,a.matches[o],i)&&(f=!0);if(f!==null)return Zt(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?Lt(a.matches[o],i)&&(p=!0):p=!0;let m={...D,defaultShouldRevalidate:p};return Zt(n,r,e,c,O,i,l,t,Rt(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=be(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=Pn(y,e.path),S=new AbortController,C=sn(i,e.path,S.signal),w=null;if(f.has(s))f.delete(s),w=Qt(n,r,C,e.path,y,x,l,t);else if(m)d&&(w=Qt(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};Rt(x,a)&&(w=Qt(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 Pt(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function Ft(e,t,n){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!Pt(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 It(e,t,n){let r=!t||n.route.id!==t.route.id,i=!e.hasOwnProperty(n.route.id);return r||i}function Lt(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith(`*`)&&e.params[`*`]!==t.params[`*`]}function Rt(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n==`boolean`)return n}return t.defaultShouldRevalidate}function zt(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=>Bt(e,t));t?c.push({existingRoute:t,newRoute:e}):s.push(e)}),s.length>0){let t=ve(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]=ve([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 Bt(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=>Bt(e,t)))??!1:!1}var Vt=new WeakMap,Ht=({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=Vt.get(i);o||(o={},Vt.set(i,o));let s=o[e];if(s)return s;let c=(async()=>{let t=me(e),n=i[e]!==void 0&&e!==`hasErrorBoundary`;if(t)H(!t,`Route property `+e+` is not a supported lazy route property. This property will be ignored.`),o[e]=Promise.resolve();else if(n)H(!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},Ut=new WeakMap;function Wt(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=Ut.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=ge(e),o=a[e]!==void 0&&e!==`hasErrorBoundary`;i?H(!i,`Route property `+e+` is not a supported property to be returned from a lazy route function. This property will be ignored.`):o?H(!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 Ut.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=Ht({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 Gt(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 Kt(e){return e.matches.some(e=>e.route.middleware)?qt(e,()=>Gt(e)):Gt(e)}function qt(e,t){return Jt(e,t,e=>{if(An(e))throw e;return e},Sn,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=hn(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 Jt(e,t,n,r,i){let{matches:a,...o}=e;return await Yt(o,a.flatMap(e=>e.route.middleware?e.route.middleware.map(t=>[e.route.id,t]):[]),t,n,r,i)}async function Yt(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 Yt(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 Xt(e,t,n,r,i){let a=Ht({key:`middleware`,route:r.route,manifest:t,mapRouteProperties:e}),o=Wt(r.route,Mn(n.method)?`action`:`loader`,t,e,i);return{middleware:a,route:o.lazyRoutePromise,handler:o.lazyHandlerPromise}}function Zt(e,t,n,r,i,a,o,s,c,l=null,u){let d=!1,f=Xt(e,t,n,a,o);return{...a,_lazyPromises:f,shouldLoad:c,shouldRevalidateArgs:l,shouldCallHandler(e){return d=!0,l?typeof u==`boolean`?Rt(a,{...l,defaultShouldRevalidate:u}):typeof e==`boolean`?Rt(a,{...l,defaultShouldRevalidate:e}):Rt(a,l):c},resolve(e){let{lazy:t,loader:o,middleware:l}=a.route,u=d||c||e&&!Mn(n.method)&&(t||o),p=l&&l.length>0&&!o&&!t;return u&&(Mn(n.method)||!p)?en({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 Qt(e,t,n,r,i,a,o,s,c=null){return i.map(l=>l.route.id===a.route.id?Zt(e,t,n,r,rt(i),l,o,s,!0,c):{...l,shouldLoad:!1,shouldRevalidateArgs:c,shouldCallHandler:()=>!1,_lazyPromises:Xt(e,t,n,l,o),resolve:()=>Promise.resolve({type:`data`,result:void 0})})}async function $t(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:cn(t,n),unstable_pattern:rt(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 qt(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 en({request:e,path:t,unstable_pattern:n,match:r,lazyHandlerPromise:i,lazyRoutePromise:a,handlerOverride:o,scopedContext:s}){let c,l,u=Mn(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:cn(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 _n(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 _n(404,{pathname:t.pathname+t.search})}}catch(e){return{type:`error`,result:e}}finally{l&&e.signal.removeEventListener(`abort`,l)}return c}async function tn(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 nn(e){let{result:t,type:n}=e;if(On(t)){let e;try{e=await tn(t)}catch(e){return{type:`error`,error:e}}return n===`error`?{type:`error`,error:new tt(t.status,t.statusText,e),statusCode:t.status,headers:t.headers}:{type:`data`,data:e,statusCode:t.status,headers:t.headers}}return n===`error`?Dn(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:xn(t),statusCode:nt(t)?t.status:void 0,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`error`,error:t,statusCode:nt(t)?t.status:void 0}:Dn(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 rn(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`),!He(a)){let o=r.slice(0,r.findIndex(e=>e.route.id===n)+1);a=jt(new URL(t.url),o,i,a),e.headers.set(`Location`,a)}return e}var an=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function on(e,t,n,r){if(He(e)){let r=e,i=r.startsWith(`//`)?new URL(t.protocol+r):new URL(r);if(an.includes(i.protocol))throw Error(`Invalid redirect location`);let a=ze(i.pathname,n)!=null;if(i.origin===t.origin&&a)return Ye(i.pathname)+i.search+i.hash}try{let t=r.createURL(e);if(an.includes(t.protocol))throw Error(`Invalid redirect location`)}catch{}return e}function sn(e,t,n,r){let i=e.createURL(yn(t)).toString(),a={signal:n};if(r&&Mn(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=ln(r.formData):a.body=r.formData}return new Request(i,a)}function cn(e,t){let n=new URL(e.url),r=typeof t==`string`?ce(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 ln(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r==`string`?r:r.name);return t}function un(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function dn(e,t,n,r=!1,i=!1){let a={},o=null,s,c=!1,l={},u=n&&Tn(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(!En(f),`Cannot handle redirect results in processLoaderData`),Tn(f)){let t=f.error;if(u!==void 0&&(t=u,u=void 0),o||={},i)o[d]=t;else{let n=hn(e,d);o[n.route.id]??(o[n.route.id]=t)}r||(a[d]=Ot),c||(c=!0,s=nt(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 fn(e,t,n,r,i,a){let{loaderData:o,errors:s}=dn(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`),Tn(o)){let t=hn(e.matches,r?.route.id);s&&s[t.route.id]||(s={...s,[t.route.id]:o.error}),e.fetchers.delete(n)}else if(En(o))V(!1,`Unhandled fetcher revalidation redirect`);else{let t=Bn(o.data);e.fetchers.set(n,t)}}),{loaderData:o,errors:s}}function pn(e,t,n,r){let i=Object.entries(t).filter(([,e])=>e!==Ot).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 mn(e){return e?Tn(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function hn(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 gn(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 _n(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 tt(e||500,o,Error(s),!0)}function vn(e){let t=Object.entries(e);for(let e=t.length-1;e>=0;e--){let[n,r]=t[e];if(En(r))return{key:n,result:r}}}function yn(e){return se({...typeof e==`string`?ce(e):e,hash:``})}function bn(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===``?t.hash!==``:e.hash===t.hash?!0:t.hash!==``}function xn(e){return new tt(e.init?.status??500,e.init?.statusText??`Internal Server Error`,e.data)}function Sn(e){return typeof e==`object`&&!!e&&Object.entries(e).every(([e,t])=>typeof e==`string`&&Cn(t))}function Cn(e){return typeof e==`object`&&!!e&&`type`in e&&`result`in e&&(e.type===`data`||e.type===`error`)}function wn(e){return On(e.result)&&xt.has(e.result.status)}function Tn(e){return e.type===`error`}function En(e){return(e&&e.type)===`redirect`}function Dn(e){return typeof e==`object`&&!!e&&`type`in e&&`data`in e&&`init`in e&&e.type===`DataWithResponseInit`}function On(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.headers==`object`&&e.body!==void 0}function kn(e){return xt.has(e)}function An(e){return On(e)&&kn(e.status)&&e.headers.has(`Location`)}function jn(e){return bt.has(e.toUpperCase())}function Mn(e){return vt.has(e.toUpperCase())}function Nn(e){return new URLSearchParams(e).getAll(`index`).some(e=>e===``)}function Pn(e,t){let n=typeof t==`string`?ce(t).search:t.search;if(e[e.length-1].route.index&&Nn(n||``))return e[e.length-1];let r=Ke(e);return r[r.length-1]}function Fn(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 In(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 Ln(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 Rn(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 zn(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 Bn(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 Vn(e,t){try{let n=e.sessionStorage.getItem(Dt);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 Hn(e,t){if(t.size>0){let n={};for(let[e,r]of t)n[e]=[...r];try{e.sessionStorage.setItem(Dt,JSON.stringify(n))}catch(e){H(!1,`Failed to save applied view transitions in sessionStorage (${e}).`)}}}function Un(){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 Wn=v.createContext(null);Wn.displayName=`DataRouter`;var Gn=v.createContext(null);Gn.displayName=`DataRouterState`;var Kn=v.createContext(!1);function qn(){return v.useContext(Kn)}var Jn=v.createContext({isTransitioning:!1});Jn.displayName=`ViewTransition`;var Yn=v.createContext(new Map);Yn.displayName=`Fetchers`;var Xn=v.createContext(null);Xn.displayName=`Await`;var Zn=v.createContext(null);Zn.displayName=`Navigation`;var Qn=v.createContext(null);Qn.displayName=`Location`;var $n=v.createContext({outlet:null,matches:[],isDataRoute:!1});$n.displayName=`Route`;var er=v.createContext(null);er.displayName=`RouteError`;var tr=`REACT_ROUTER_ERROR`,nr=`REDIRECT`,rr=`ROUTE_ERROR_RESPONSE`;function ir(e){if(e.startsWith(`${tr}:${nr}:{`))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 ar(e){if(e.startsWith(`${tr}:${rr}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new tt(t.status,t.statusText,t.data)}catch{}}function or(e,{relative:t}={}){V(sr(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=v.useContext(Zn),{hash:i,pathname:a,search:o}=gr(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:Xe([n,a])),r.createHref({pathname:s,search:o,hash:i})}function sr(){return v.useContext(Qn)!=null}function cr(){return V(sr(),`useLocation() may be used only in the context of a <Router> component.`),v.useContext(Qn).location}var lr=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function ur(e){v.useContext(Zn).static||v.useLayoutEffect(e)}function dr(){let{isDataRoute:e}=v.useContext($n);return e?Ir():fr()}function fr(){V(sr(),`useNavigate() may be used only in the context of a <Router> component.`);let e=v.useContext(Wn),{basename:t,navigator:n}=v.useContext(Zn),{matches:r}=v.useContext($n),{pathname:i}=cr(),a=JSON.stringify(qe(r)),o=v.useRef(!1);return ur(()=>{o.current=!0}),v.useCallback((r,s={})=>{if(H(o.current,lr),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=Je(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:Xe([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}var pr=v.createContext(null);function mr(e){let t=v.useContext($n).outlet;return v.useMemo(()=>t&&v.createElement(pr.Provider,{value:e},t),[t,e])}function hr(){let{matches:e}=v.useContext($n),t=e[e.length-1];return t?t.params:{}}function gr(e,{relative:t}={}){let{matches:n}=v.useContext($n),{pathname:r}=cr(),i=JSON.stringify(qe(n));return v.useMemo(()=>Je(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function _r(e,t,n){V(sr(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=v.useContext(Zn),{matches:i}=v.useContext($n),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||``;Rr(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=cr(),d;if(t){let e=typeof t==`string`?ce(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=be(e,{pathname:p});H(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),H(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=wr(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:Xe([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:Xe([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(Qn.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,unstable_mask:void 0,...d},navigationType:`POP`}},h):h}function vr(){let e=Nr(),t=nt(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 yr=v.createElement(vr,null),br=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=ar(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:v.createElement($n.Provider,{value:this.props.routeContext},v.createElement(er.Provider,{value:e,children:this.props.component}));return this.context?v.createElement(Sr,{error:e},t):t}};br.contextType=Kn;var xr=new WeakMap;function Sr({children:e,error:t}){let{basename:n}=v.useContext(Zn);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=ir(t.digest);if(e){let r=xr.get(t);if(r)throw r;let i=at(e.location,n);if(it&&!xr.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 xr.set(t,n),n}return v.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${i.absoluteURL||i.to}`})}}return e}function Cr({routeContext:e,match:t,children:n}){let r=v.useContext(Wn);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),v.createElement($n.Provider,{value:e},n)}function wr(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:rt(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||yr,o&&(s<0&&c===0?(Rr(`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(Cr,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?v.createElement(br,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function Tr(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Er(e){let t=v.useContext(Wn);return V(t,Tr(e)),t}function Dr(e){let t=v.useContext(Gn);return V(t,Tr(e)),t}function Or(e){let t=v.useContext($n);return V(t,Tr(e)),t}function kr(e){let t=Or(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 Ar(){return kr(`useRouteId`)}function jr(){return Dr(`useNavigation`).navigation}function Mr(){let{matches:e,loaderData:t}=Dr(`useMatches`);return v.useMemo(()=>e.map(e=>Se(e,t)),[e,t])}function Nr(){let e=v.useContext(er),t=Dr(`useRouteError`),n=kr(`useRouteError`);return e===void 0?t.errors?.[n]:e}var Pr=0;function Fr(e){let{router:t,basename:n}=Er(`useBlocker`),r=Dr(`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:ze(r.pathname,n)||r.pathname},nextLocation:{...i,pathname:ze(i.pathname,n)||i.pathname},historyAction:a})},[n,e]);return v.useEffect(()=>{let e=String(++Pr);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):Tt}function Ir(){let{router:e}=Er(`useNavigate`),t=kr(`useNavigate`),n=v.useRef(!1);return ur(()=>{n.current=!0}),v.useCallback(async(r,i={})=>{H(n.current,lr),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var Lr={};function Rr(e,t,n){!t&&!Lr[e]&&(Lr[e]=!0,H(!1,n))}var zr={};function Br(e,t){!e&&!zr[t]&&(zr[t]=!0,console.warn(t))}var Vr=v.useOptimistic,Hr=()=>void 0;function Ur(e){return Vr?Vr(e):[e,Hr]}function Wr(e){let t={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(e.element&&H(!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&&H(!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&&H(!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 Gr=[`HydrateFallback`,`hydrateFallbackElement`],Kr=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 qr({router:e,flushSync:t,onError:n,unstable_useTransitions:r}){r=qn()||r;let[i,a]=v.useState(e.state),[o,s]=Ur(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:rt(i.matches)})),i.fetchers.forEach((e,t)=>{e.data!==void 0&&y.current.set(t,e.data)}),o.forEach(e=>y.current.delete(e)),Br(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(Br(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=>Jr(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 Kr)},[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=>Jr(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(Wn.Provider,{value:w},v.createElement(Gn.Provider,{value:o},v.createElement(Yn.Provider,{value:y.current},v.createElement(Jn.Provider,{value:u},v.createElement($r,{basename:C,location:o.location,navigationType:o.historyAction,navigator:S,unstable_useTransitions:r},v.createElement(Yr,{routes:e.routes,future:e.future,state:o,isStatic:!1,onError:n})))))),null)}function Jr(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 Yr=v.memo(Xr);function Xr({routes:e,future:t,state:n,isStatic:r,onError:i}){return _r(e,void 0,{state:n,isStatic:r,onError:i,future:t})}function Zr({to:e,replace:t,state:n,relative:r}){V(sr(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i}=v.useContext(Zn);H(!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($n),{pathname:o}=cr(),s=dr(),c=Je(e,qe(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 Qr(e){return mr(e.context)}function $r({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,unstable_useTransitions:o}){V(!sr(),`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=ce(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,unstable_mask:m}=n,h=v.useMemo(()=>{let e=ze(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 H(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(Zn.Provider,{value:c},v.createElement(Qn.Provider,{children:t,value:h}))}v.Component;var ei=`get`,ti=`application/x-www-form-urlencoded`;function ni(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function ri(e){return ni(e)&&e.tagName.toLowerCase()===`button`}function ii(e){return ni(e)&&e.tagName.toLowerCase()===`form`}function ai(e){return ni(e)&&e.tagName.toLowerCase()===`input`}function oi(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function si(e,t){return e.button===0&&(!t||t===`_self`)&&!oi(e)}function ci(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 li(e,t){let n=ci(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var ui=null;function di(){if(ui===null)try{new FormData(document.createElement(`form`),0),ui=!1}catch{ui=!0}return ui}var fi=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function pi(e){return e!=null&&!fi.has(e)?(H(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${ti}"`),null):e}function mi(e,t){let n,r,i,a,o;if(ii(e)){let o=e.getAttribute(`action`);r=o?ze(o,t):null,n=e.getAttribute(`method`)||ei,i=pi(e.getAttribute(`enctype`))||ti,a=new FormData(e)}else if(ri(e)||ai(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?ze(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||ei,i=pi(e.getAttribute(`formenctype`))||pi(o.getAttribute(`enctype`))||ti,a=new FormData(o,e),!di()){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(ni(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=ei,r=null,i=ti,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 hi={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},gi=/[&><\u2028\u2029]/g;function _i(e){return e.replace(gi,e=>hi[e])}function vi(e,t){if(e===!1||e==null)throw Error(t)}function yi(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&&ze(i.pathname,t)===`/`?i.pathname=`${Ze(t)}/_root.${r}`:i.pathname=`${Ze(i.pathname)}.${r}`,i}async function bi(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 xi(e){return e!=null&&typeof e.page==`string`}function Si(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 Ci(e,t,n){return Oi((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await bi(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(Si).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function wi(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 Ti(e,t,{includeHydrateFallback:n}={}){return Ei(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 Ei(e){return[...new Set(e)]}function Di(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Oi(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!xi(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(Di(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function ki(){let e=v.useContext(Wn);return vi(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function Ai(){let e=v.useContext(Gn);return vi(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var ji=v.createContext(void 0);ji.displayName=`FrameworkContext`;function Mi(){let e=v.useContext(ji);return vi(e,`You must render this element inside a <HydratedRouter> element`),e}function Ni(e,t){let n=v.useContext(ji),[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:Pi(s,p),onBlur:Pi(c,m),onMouseEnter:Pi(l,p),onMouseLeave:Pi(u,m),onTouchStart:Pi(d,p)}]:[a,f,{}]:[!1,f,{}]}function Pi(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Fi({page:e,...t}){let n=qn(),{router:r}=ki(),i=v.useMemo(()=>be(r.routes,e,r.basename),[r.routes,e,r.basename]);return i?n?v.createElement(Li,{page:e,matches:i,...t}):v.createElement(Ri,{page:e,matches:i,...t}):null}function Ii(e){let{manifest:t,routeModules:n}=Mi(),[r,i]=v.useState([]);return v.useEffect(()=>{let r=!1;return Ci(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function Li({page:e,matches:t,...n}){let r=cr(),{future:i}=Mi(),{basename:a}=ki(),o=v.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=yi(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 Ri({page:e,matches:t,...n}){let r=cr(),{future:i,manifest:a,routeModules:o}=Mi(),{basename:s}=ki(),{loaderData:c,matches:l}=Ai(),u=v.useMemo(()=>wi(e,t,l,a,r,`data`),[e,t,l,a,r]),d=v.useMemo(()=>wi(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=yi(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(()=>Ti(d,a),[d,a]),m=Ii(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 zi(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}v.Component;var Bi=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{Bi&&(window.__reactRouterVersion=`7.14.1`)}catch{}function Vi(e,t){return kt({basename:t?.basename,getContext:t?.getContext,future:t?.future,history:re({window:t?.window}),hydrationData:t?.hydrationData||Hi(),routes:e,mapRouteProperties:Wr,hydrationRouteProperties:Gr,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window,unstable_instrumentations:t?.unstable_instrumentations}).initialize()}function Hi(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:Ui(e.errors)}),e}function Ui(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 tt(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 Wi({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($r,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,unstable_useTransitions:r})}Wi.displayName=`unstable_HistoryRouter`;var Gi=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ki=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(Zn),y=typeof l==`string`&&Gi.test(l),b=at(l,h);l=b.to;let x=or(l,{relative:r}),S=cr(),C=null;if(o){let e=Je(o,[],S.unstable_mask?S.unstable_mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:Xe([h,e.pathname])),C=g.createHref(e)}let[w,T,E]=Ni(n,p),D=$i(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:zi(m,T),target:c,"data-discover":!y&&t===`render`?`true`:void 0});return w&&!y?v.createElement(v.Fragment,null,A,v.createElement(Fi,{page:x})):A});Ki.displayName=`Link`;var qi=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=gr(a,{relative:c.relative}),d=cr(),f=v.useContext(Gn),{navigator:p,basename:m}=v.useContext(Zn),h=f!=null&&ua(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=ze(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(Ki,{...c,"aria-current":w,className:T,ref:l,style:E,to:a,viewTransition:o},typeof s==`function`?s(C):s)});qi.displayName=`NavLink`;var Ji=v.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=ei,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f,...p},m)=>{let{unstable_useTransitions:h}=v.useContext(Zn),g=ra(),_=ia(s,{relative:l}),y=o.toLowerCase()===`get`?`get`:`post`,b=typeof s==`string`&&Gi.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})});Ji.displayName=`Form`;function Yi({getKey:e,storageKey:t,...n}){let r=v.useContext(ji),{basename:i}=v.useContext(Zn),a=cr(),o=Mr();ca({getKey:e,storageKey:t});let s=v.useMemo(()=>{if(!r||!e)return null;let t=sa(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})(${_i(JSON.stringify(t||aa))}, ${_i(JSON.stringify(s))})`}})}Yi.displayName=`ScrollRestoration`;function Xi(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Zi(e){let t=v.useContext(Wn);return V(t,Xi(e)),t}function Qi(e){let t=v.useContext(Gn);return V(t,Xi(e)),t}function $i(e,{target:t,replace:n,unstable_mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,unstable_defaultShouldRevalidate:c,unstable_useTransitions:l}={}){let u=dr(),d=cr(),f=gr(e,{relative:o});return v.useCallback(p=>{if(si(p,t)){p.preventDefault();let t=n===void 0?se(d)===se(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 ea(e){H(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(ci(e)),n=v.useRef(!1),r=cr(),i=v.useMemo(()=>li(r.search,n.current?null:t.current),[r.search]),a=dr();return[i,v.useCallback((e,t)=>{let r=ci(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var ta=0,na=()=>`__${String(++ta)}__`;function ra(){let{router:e}=Zi(`useSubmit`),{basename:t}=v.useContext(Zn),n=Ar(),r=e.fetch,i=e.navigate;return v.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=mi(e,t);a.navigate===!1?await r(a.fetcherKey||na(),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 ia(e,{relative:t}={}){let{basename:n}=v.useContext(Zn),r=v.useContext($n);V(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...gr(e||`.`,{relative:t})},o=cr();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:Xe([n,a.pathname])),se(a)}var aa=`react-router-scroll-positions`,oa={};function sa(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:ze(e.pathname,n)||e.pathname},t)),i??=e.key,i}function ca({getKey:e,storageKey:t}={}){let{router:n}=Zi(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=Qi(`useScrollRestoration`),{basename:a}=v.useContext(Zn),o=cr(),s=Mr(),c=jr();v.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),la(v.useCallback(()=>{if(c.state===`idle`){let t=sa(o,s,a,e);oa[t]=window.scrollY}try{sessionStorage.setItem(t||aa,JSON.stringify(oa))}catch(e){H(!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||aa);e&&(oa=JSON.parse(e))}catch{}},[t]),v.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(oa,()=>window.scrollY,e?(t,n)=>sa(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{H(!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 la(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 ua(e,{relative:t}={}){let n=v.useContext(Jn);V(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Zi(`useViewTransitionState`),i=gr(e,{relative:t});if(!n.isTransitioning)return!1;let a=ze(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=ze(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Ie(i.pathname,o)!=null||Ie(i.pathname,a)!=null}function da(e){return v.createElement(qr,{flushSync:N.flushSync,...e})}var fa=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})),U=o(((e,t)=>{t.exports=fa()}))();function pa(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 ma=(0,v.createContext)(null);function ha({children:e}){let[t,n]=(0,v.useReducer)(pa,{user:null,status:`idle`});(0,v.useEffect)(()=>{localStorage.removeItem(`plank_token`),localStorage.removeItem(`plank_user`),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,U.jsx)(ma.Provider,{value:{...t,login:r,logout:i,updateUser:a},children:e})}function ga(){let e=(0,v.useContext)(ma);if(!e)throw Error(`useAuth must be used inside AuthProvider`);return e}var _a=(0,v.createContext)({timezone:`UTC`,locales:[`en`],defaultLocale:`en`,editorialMode:!1,refreshSettings:()=>{}});function va({children:e}){let{status:t,user:n}=ga(),[r,i]=(0,v.useState)(`UTC`),[a,o]=(0,v.useState)([`en`]),[s,c]=(0,v.useState)(`en`),[l,u]=(0,v.useState)(!1),d=(0,v.useCallback)(()=>{if(t!==`authenticated`)return;fetch(`/cms/admin/modes`,{credentials:`include`}).then(e=>e.ok?e.json():null).then(e=>{e&&u(!!e.editorial)}).catch(()=>{});let e=n?.permissions??[];(e.includes(`*`)||e.includes(`settings:overview:read`))&&fetch(`/cms/admin/settings/general`,{credentials:`include`}).then(e=>e.ok?e.json():null).then(e=>{e?.timezone&&i(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&&o(t)}}catch{}e?.default_locale&&c(e.default_locale)}).catch(()=>{})},[t,n?.permissions]);return(0,v.useEffect)(()=>{if(t!==`authenticated`){u(!1);return}d()},[t,d]),(0,U.jsx)(_a.Provider,{value:{timezone:r,locales:a,defaultLocale:s,editorialMode:l,refreshSettings:d},children:e})}function ya(){return(0,v.useContext)(_a)}var ba=(0,v.createContext)({shortcuts:[],register:()=>()=>{}});function xa({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,U.jsx)(ba.Provider,{value:{shortcuts:t,register:r},children:e})}function Sa(e,t){return e.includes(`*`)||e.includes(t)}function Ca({children:e,roles:t,permission:n,redirectTo:r=`/`}){let{status:i,user:a}=ga();return i===`idle`?null:i===`unauthenticated`?(0,U.jsx)(Zr,{to:`/login`,replace:!0}):t&&a&&!t.map(e=>e.toLowerCase()).includes(a.role.toLowerCase())||n&&a&&!Sa(a.permissions,n)?(0,U.jsx)(Zr,{to:r,replace:!0}):(0,U.jsx)(U.Fragment,{children:e})}function wa(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}}var Ta=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Ea=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),Da=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Oa=e=>{let t=Da(e);return t.charAt(0).toUpperCase()+t.slice(1)},ka={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`},Aa=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},ja=(0,v.createContext)({}),Ma=()=>(0,v.useContext)(ja),Na=(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=``}=Ma()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,v.createElement)(`svg`,{ref:c,...ka,width:t??l??ka.width,height:t??l??ka.height,stroke:e??f,strokeWidth:m,className:Ta(`lucide`,p,i),...!a&&!Aa(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,v.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),W=(e,t)=>{let n=(0,v.forwardRef)(({className:n,...r},i)=>(0,v.createElement)(Na,{ref:i,iconNode:t,className:Ta(`lucide-${Ea(Oa(e))}`,`lucide-${e}`,n),...r}));return n.displayName=Oa(e),n},Pa=W(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),Fa=W(`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=W(`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`}]]),La=W(`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`}]]),Ra=W(`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`}]]),za=W(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Ba=W(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Va=W(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Ha=W(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Ua=W(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Wa=W(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),Ga=W(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Ka=W(`circle-minus`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}]]),qa=W(`circle-plus`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`M12 8v8`,key:`napkw2`}]]),Ja=W(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Ya=W(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),Xa=W(`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`}]]),Za=W(`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`}]]),Qa=W(`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`}]]),$a=W(`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`}]]),eo=W(`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`}]]),to=W(`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`}]]),no=W(`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`}]]),ro=W(`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`}]]),io=W(`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`}]]),ao=W(`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`}]]),oo=W(`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`}]]),so=W(`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`}]]),co=W(`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`}]]),lo=W(`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`}]]),uo=W(`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`}]]),fo=W(`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`}]]),po=W(`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`}]]),mo=W(`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`}]]),ho=W(`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`}]]),go=W(`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`}]]),_o=W(`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`}]]),vo=W(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),yo=W(`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`}]]),bo=W(`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`}]]),xo=W(`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`}]]),So=W(`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`}]]),Co=W(`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`}]]),wo=W(`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`}]]),To=W(`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`}]]),Eo=W(`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`}]]),Do=W(`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`}]]),Oo=W(`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`}]]),ko=W(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Ao=W(`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`}]]),jo=W(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),Mo=W(`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`}]]),No=W(`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`}]]),Po=W(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Fo=W(`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`}]]),Io=W(`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`}]]),Lo=W(`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`}]]),Ro=W(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),zo=W(`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`}]]),Bo=W(`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`}]]),Vo=W(`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`}]]),Ho=W(`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`}]]),Uo=W(`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`}]]),Wo=W(`text-align-start`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M17 19H3`,key:`z6ezky`}]]),Go=W(`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`}]]),Ko=W(`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=W(`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`}]]),Jo=W(`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`}]]),Yo=W(`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`}]]),Xo=W(`underline`,[[`path`,{d:`M6 4v6a6 6 0 0 0 12 0V4`,key:`9kb039`}],[`line`,{x1:`4`,x2:`20`,y1:`20`,y2:`20`,key:`nun2al`}]]),Zo=W(`unlink-2`,[[`path`,{d:`M15 7h2a5 5 0 0 1 0 10h-2m-6 0H7A5 5 0 0 1 7 7h2`,key:`1re2ne`}]]),Qo=W(`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`}]]),$o=W(`user-round`,[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]]),es=W(`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`}]]),ts=W(`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`}]]),ns=W(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),rs=(0,v.createContext)(null);function is({children:e}){let[t,n]=(0,v.useState)(null);return(0,U.jsx)(rs.Provider,{value:{content:t,setContent:n},children:e})}function as(){let e=(0,v.useContext)(rs);if(!e)throw Error(`useSecondaryPanelContext must be used within SecondaryPanelProvider`);return e}function ss(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function cs(...e){return t=>{let n=!1,r=e.map(e=>{let r=ss(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():ss(e[t],null)}}}}function ls(...e){return v.useCallback(cs(...e),e)}var us=Symbol.for(`react.lazy`),ds=v.use;function fs(e){return typeof e==`object`&&!!e&&`then`in e}function ps(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===us&&`_payload`in e&&fs(e._payload)}function ms(e){let t=gs(e),n=v.forwardRef((e,n)=>{let{children:r,...i}=e;ps(r)&&typeof ds==`function`&&(r=ds(r._payload));let a=v.Children.toArray(r),o=a.find(vs);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,U.jsx)(t,{...i,ref:n,children:v.isValidElement(e)?v.cloneElement(e,void 0,r):null})}return(0,U.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}var hs=ms(`Slot`);function gs(e){let t=v.forwardRef((e,t)=>{let{children:n,...r}=e;if(ps(n)&&typeof ds==`function`&&(n=ds(n._payload)),v.isValidElement(n)){let e=bs(n),i=ys(r,n.props);return n.type!==v.Fragment&&(i.ref=t?cs(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 _s=Symbol(`radix.slottable`);function vs(e){return v.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===_s}function ys(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 bs(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 xs(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=xs(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function Ss(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=xs(e))&&(r&&(r+=` `),r+=t);return r}var Cs=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,ws=Ss,Ts=(e,t)=>n=>{if(t?.variants==null)return ws(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=Cs(t)||Cs(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 ws(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)},Es=(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},Ds=(e,t)=>({classGroupId:e,validator:t}),Os=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),ks=`-`,As=[],js=`arbitrary..`,Ms=e=>{let t=Fs(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return Ps(e);let n=e.split(ks);return Ns(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?Es(i,t):t:i||As}return n[e]||As}}},Ns=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=Ns(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(ks):e.slice(t).join(ks),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},Ps=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?js+r:void 0})(),Fs=e=>{let{theme:t,classGroups:n}=e;return Is(n,t)},Is=(e,t)=>{let n=Os();for(let r in e){let i=e[r];Ls(i,n,r,t)}return n},Ls=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];Rs(i,t,n,r)}},Rs=(e,t,n,r)=>{if(typeof e==`string`){zs(e,t,n);return}if(typeof e==`function`){Bs(e,t,n,r);return}Vs(e,t,n,r)},zs=(e,t,n)=>{let r=e===``?t:Hs(t,e);r.classGroupId=n},Bs=(e,t,n,r)=>{if(Us(e)){Ls(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Ds(n,e))},Vs=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];Ls(o,Hs(t,a),n,r)}},Hs=(e,t)=>{let n=e,r=t.split(ks),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=Os(),n.nextPart.set(t,i)),n=i}return n},Us=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,Ws=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)}}},Gs=`!`,Ks=`:`,qs=[],Js=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Ys=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===Ks){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(Gs)?(c=s.slice(0,-1),l=!0):s.startsWith(Gs)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return Js(t,l,c,u)};if(t){let e=t+Ks,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Js(qs,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},Xs=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}},Zs=e=>({cache:Ws(e.cacheSize),parseClassName:Ys(e),sortModifiers:Xs(e),...Ms(e)}),Qs=/\s+/,$s=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(Qs),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+Gs: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},ec=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=tc(n))&&(i&&(i+=` `),i+=r);return i},tc=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=tc(e[r]))&&(n&&(n+=` `),n+=t);return n},nc=(e,...t)=>{let n,r,i,a,o=o=>(n=Zs(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=$s(e,n);return i(e,a),a};return a=o,(...e)=>a(ec(...e))},rc=[],ic=e=>{let t=t=>t[e]||rc;return t.isThemeGetter=!0,t},ac=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,oc=/^\((?:(\w[\w-]*):)?(.+)\)$/i,sc=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,cc=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,lc=/\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$/,uc=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,dc=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,fc=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,pc=e=>sc.test(e),mc=e=>!!e&&!Number.isNaN(Number(e)),hc=e=>!!e&&Number.isInteger(Number(e)),gc=e=>e.endsWith(`%`)&&mc(e.slice(0,-1)),_c=e=>cc.test(e),vc=()=>!0,yc=e=>lc.test(e)&&!uc.test(e),bc=()=>!1,xc=e=>dc.test(e),Sc=e=>fc.test(e),Cc=e=>!G(e)&&!K(e),wc=e=>zc(e,Uc,bc),G=e=>ac.test(e),Tc=e=>zc(e,Wc,yc),Ec=e=>zc(e,Gc,mc),Dc=e=>zc(e,qc,vc),Oc=e=>zc(e,Kc,bc),kc=e=>zc(e,Vc,bc),Ac=e=>zc(e,Hc,Sc),jc=e=>zc(e,Jc,xc),K=e=>oc.test(e),Mc=e=>Bc(e,Wc),Nc=e=>Bc(e,Kc),Pc=e=>Bc(e,Vc),Fc=e=>Bc(e,Uc),Ic=e=>Bc(e,Hc),Lc=e=>Bc(e,Jc,!0),Rc=e=>Bc(e,qc,!0),zc=(e,t,n)=>{let r=ac.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Bc=(e,t,n=!1)=>{let r=oc.exec(e);return r?r[1]?t(r[1]):n:!1},Vc=e=>e===`position`||e===`percentage`,Hc=e=>e===`image`||e===`url`,Uc=e=>e===`length`||e===`size`||e===`bg-size`,Wc=e=>e===`length`,Gc=e=>e===`number`,Kc=e=>e===`family-name`,qc=e=>e===`number`||e===`weight`,Jc=e=>e===`shadow`,Yc=nc(()=>{let e=ic(`color`),t=ic(`font`),n=ic(`text`),r=ic(`font-weight`),i=ic(`tracking`),a=ic(`leading`),o=ic(`breakpoint`),s=ic(`container`),c=ic(`spacing`),l=ic(`radius`),u=ic(`shadow`),d=ic(`inset-shadow`),f=ic(`text-shadow`),p=ic(`drop-shadow`),m=ic(`blur`),h=ic(`perspective`),g=ic(`aspect`),_=ic(`ease`),v=ic(`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(),K,G],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[K,G,c],T=()=>[pc,`full`,`auto`,...w()],E=()=>[hc,`none`,`subgrid`,K,G],D=()=>[`auto`,{span:[`full`,hc,K,G]},hc,K,G],O=()=>[hc,`auto`,K,G],k=()=>[`auto`,`min`,`max`,`fr`,K,G],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=()=>[pc,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[pc,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],F=()=>[pc,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],I=()=>[e,K,G],L=()=>[...b(),Pc,kc,{position:[K,G]}],R=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ee=()=>[`auto`,`cover`,`contain`,Fc,wc,{size:[K,G]}],te=()=>[gc,Mc,Tc],ne=()=>[``,`none`,`full`,l,K,G],z=()=>[``,mc,Mc,Tc],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=()=>[mc,gc,Pc,kc],H=()=>[``,`none`,m,K,G],ie=()=>[`none`,mc,K,G],ae=()=>[`none`,mc,K,G],oe=()=>[mc,K,G],se=()=>[pc,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[_c],breakpoint:[_c],color:[vc],container:[_c],"drop-shadow":[_c],ease:[`in`,`out`,`in-out`],font:[Cc],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[_c],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[_c],shadow:[_c],spacing:[`px`,mc],text:[_c],"text-shadow":[_c],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,pc,G,K,g]}],container:[`container`],columns:[{columns:[mc,G,K,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:[hc,`auto`,K,G]}],basis:[{basis:[pc,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[mc,pc,`auto`,`initial`,`none`,G]}],grow:[{grow:[``,mc,K,G]}],shrink:[{shrink:[``,mc,K,G]}],order:[{order:[hc,`first`,`last`,`none`,K,G]}],"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,Mc,Tc]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Rc,Dc]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,gc,G]}],"font-family":[{font:[Nc,Oc,t]}],"font-features":[{"font-features":[G]}],"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,K,G]}],"line-clamp":[{"line-clamp":[mc,`none`,K,Ec]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,K,G]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,K,G]}],"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:[mc,`from-font`,`auto`,K,Tc]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[mc,`auto`,K,G]}],"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`,K,G]}],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`,K,G]}],"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`]},hc,K,G],radial:[``,K,G],conic:[hc,K,G]},Ic,Ac]}],"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":[mc,K,G]}],"outline-w":[{outline:[``,mc,Mc,Tc]}],"outline-color":[{outline:I()}],shadow:[{shadow:[``,`none`,u,Lc,jc]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":[`none`,d,Lc,jc]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:z()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[mc,Tc]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":z()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":[`none`,f,Lc,jc]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[mc,K,G]}],"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":[mc]}],"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":[K,G]}],"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":[mc]}],"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`,K,G]}],filter:[{filter:[``,`none`,K,G]}],blur:[{blur:H()}],brightness:[{brightness:[mc,K,G]}],contrast:[{contrast:[mc,K,G]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,Lc,jc]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:[``,mc,K,G]}],"hue-rotate":[{"hue-rotate":[mc,K,G]}],invert:[{invert:[``,mc,K,G]}],saturate:[{saturate:[mc,K,G]}],sepia:[{sepia:[``,mc,K,G]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,K,G]}],"backdrop-blur":[{"backdrop-blur":H()}],"backdrop-brightness":[{"backdrop-brightness":[mc,K,G]}],"backdrop-contrast":[{"backdrop-contrast":[mc,K,G]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,mc,K,G]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[mc,K,G]}],"backdrop-invert":[{"backdrop-invert":[``,mc,K,G]}],"backdrop-opacity":[{"backdrop-opacity":[mc,K,G]}],"backdrop-saturate":[{"backdrop-saturate":[mc,K,G]}],"backdrop-sepia":[{"backdrop-sepia":[``,mc,K,G]}],"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`,K,G]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[mc,`initial`,K,G]}],ease:[{ease:[`linear`,`initial`,_,K,G]}],delay:[{delay:[mc,K,G]}],animate:[{animate:[`none`,v,K,G]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,K,G]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:ie()}],"rotate-x":[{"rotate-x":ie()}],"rotate-y":[{"rotate-y":ie()}],"rotate-z":[{"rotate-z":ie()}],scale:[{scale:ae()}],"scale-x":[{"scale-x":ae()}],"scale-y":[{"scale-y":ae()}],"scale-z":[{"scale-z":ae()}],"scale-3d":[`scale-3d`],skew:[{skew:oe()}],"skew-x":[{"skew-x":oe()}],"skew-y":[{"skew-y":oe()}],transform:[{transform:[K,G,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:se()}],"translate-x":[{"translate-x":se()}],"translate-y":[{"translate-y":se()}],"translate-z":[{"translate-z":se()}],"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`,K,G]}],"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`,K,G]}],fill:[{fill:[`none`,...I()]}],"stroke-w":[{stroke:[mc,Mc,Tc,Ec]}],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 q(...e){return Yc(Ss(e))}var Xc=Ts(`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`}}),J=v.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},a)=>(0,U.jsx)(r?hs:`button`,{className:q(Xc({variant:t,size:n,className:e})),ref:a,...i}));J.displayName=`Button`;function Zc(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,U.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,Qc(i,...t)]}function Qc(...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 $c(e){let t=v.useRef(e);return v.useEffect(()=>{t.current=e}),v.useMemo(()=>(...e)=>t.current?.(...e),[])}var el=globalThis?.document?v.useLayoutEffect:()=>{},tl=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=ms(`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,U.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),nl=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})),rl=o(((e,t)=>{t.exports=nl()})),il=rl();function al(){return(0,il.useSyncExternalStore)(ol,()=>!0,()=>!1)}function ol(){return()=>{}}var sl=`Avatar`,[cl,ll]=Zc(sl),[ul,dl]=cl(sl),fl=v.forwardRef((e,t)=>{let{__scopeAvatar:n,...r}=e,[i,a]=v.useState(`idle`);return(0,U.jsx)(ul,{scope:n,imageLoadingStatus:i,onImageLoadingStatusChange:a,children:(0,U.jsx)(tl.span,{...r,ref:t})})});fl.displayName=sl;var pl=`AvatarImage`,ml=v.forwardRef((e,t)=>{let{__scopeAvatar:n,src:r,onLoadingStatusChange:i=()=>{},...a}=e,o=dl(pl,n),s=vl(r,a),c=$c(e=>{i(e),o.onImageLoadingStatusChange(e)});return el(()=>{s!==`idle`&&c(s)},[s,c]),s===`loaded`?(0,U.jsx)(tl.img,{...a,ref:t,src:r}):null});ml.displayName=pl;var hl=`AvatarFallback`,gl=v.forwardRef((e,t)=>{let{__scopeAvatar:n,delayMs:r,...i}=e,a=dl(hl,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,U.jsx)(tl.span,{...i,ref:t}):null});gl.displayName=hl;function _l(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?`loaded`:`loading`):`error`:`idle`}function vl(e,{referrerPolicy:t,crossOrigin:n}){let r=al(),i=v.useRef(null),a=r?(i.current||=new window.Image,i.current):null,[o,s]=v.useState(()=>_l(a,e));return el(()=>{s(_l(a,e))},[a,e]),el(()=>{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 yl=fl,bl=ml,xl=gl,Sl=v.forwardRef(({className:e,...t},n)=>(0,U.jsx)(yl,{ref:n,className:q(`relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full`,e),...t}));Sl.displayName=yl.displayName;var Cl=v.forwardRef(({className:e,...t},n)=>(0,U.jsx)(bl,{ref:n,className:q(`aspect-square h-full w-full`,e),...t}));Cl.displayName=bl.displayName;var wl=v.forwardRef(({className:e,...t},n)=>(0,U.jsx)(xl,{ref:n,className:q(`flex h-full w-full items-center justify-center rounded-full bg-muted text-xs font-medium`,e),...t}));wl.displayName=xl.displayName;function Tl(e,t,n){return e&&t?`${e[0]}${t[0]}`.toUpperCase():e?e.slice(0,2).toUpperCase():n?n.slice(0,2).toUpperCase():`?`}var El=(0,v.forwardRef)(({avatarUrl:e,firstName:t,lastName:n,email:r,className:i,fallbackClassName:a,...o},s)=>(0,U.jsxs)(Sl,{ref:s,className:q(`size-8`,i),...o,children:[e&&(0,U.jsx)(Cl,{src:e,alt:``,className:`object-cover`}),(0,U.jsx)(wl,{className:q(`text-[11px]`,a),children:Tl(t,n,r)})]},e??`fallback`));El.displayName=`UserAvatar`,typeof window<`u`&&window.document&&window.document.createElement;function Y(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function Dl(e,t){let n=v.createContext(t),r=e=>{let{children:t,...r}=e,i=v.useMemo(()=>r,Object.values(r));return(0,U.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 Ol(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,U.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,kl(i,...t)]}function kl(...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 Al=v.useInsertionEffect||el;function jl({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=Ml({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=Nl(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function Ml({defaultProp:e,onChange:t}){let[n,r]=v.useState(e),i=v.useRef(n),a=v.useRef(t);return Al(()=>{a.current=t},[t]),v.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function Nl(e){return typeof e==`function`}function Pl(e){let t=Il(e),n=v.forwardRef((e,n)=>{let{children:r,...i}=e,a=v.Children.toArray(r),o=a.find(zl);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,U.jsx)(t,{...i,ref:n,children:v.isValidElement(e)?v.cloneElement(e,void 0,r):null})}return(0,U.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}var Fl=Pl(`Slot`);function Il(e){let t=v.forwardRef((e,t)=>{let{children:n,...r}=e;if(v.isValidElement(n)){let e=Vl(n),i=Bl(r,n.props);return n.type!==v.Fragment&&(i.ref=t?cs(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 Ll=Symbol(`radix.slottable`);function Rl(e){let t=({children:e})=>(0,U.jsx)(U.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=Ll,t}function zl(e){return v.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Ll}function Bl(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 Vl(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=Pl(`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,U.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Ul(e,t){e&&N.flushSync(()=>e.dispatchEvent(t))}function Wl(e){let t=e+`CollectionProvider`,[n,r]=Ol(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,U.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=Pl(s),l=v.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,U.jsx)(c,{ref:ls(t,a(s,n).collectionRef),children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=Pl(u),p=v.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=v.useRef(null),s=ls(t,o),c=a(u,n);return v.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,U.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 Gl=v.createContext(void 0);function Kl(e){let t=v.useContext(Gl);return e||t||`ltr`}function ql(e,t=globalThis?.document){let n=$c(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 Jl=`DismissableLayer`,Yl=`dismissableLayer.update`,Xl=`dismissableLayer.pointerDownOutside`,Zl=`dismissableLayer.focusOutside`,Ql,$l=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),eu=v.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=v.useContext($l),[u,d]=v.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=v.useState({}),m=ls(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=ru(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!x||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),C=iu(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return ql(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&&(Ql=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),au(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Ql)}},[u,f,n,l]),v.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),au())},[u,l]),v.useEffect(()=>{let e=()=>p({});return document.addEventListener(Yl,e),()=>document.removeEventListener(Yl,e)},[]),(0,U.jsx)(Hl.div,{...c,ref:m,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:Y(e.onFocusCapture,C.onFocusCapture),onBlurCapture:Y(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:Y(e.onPointerDownCapture,S.onPointerDownCapture)})});eu.displayName=Jl;var tu=`DismissableLayerBranch`,nu=v.forwardRef((e,t)=>{let n=v.useContext($l),r=v.useRef(null),i=ls(t,r);return v.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,U.jsx)(Hl.div,{...e,ref:i})});nu.displayName=tu;function ru(e,t=globalThis?.document){let n=$c(e),r=v.useRef(!1),i=v.useRef(()=>{});return v.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){ou(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 iu(e,t=globalThis?.document){let n=$c(e),r=v.useRef(!1);return v.useEffect(()=>{let e=e=>{e.target&&!r.current&&ou(Zl,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 au(){let e=new CustomEvent(Yl);document.dispatchEvent(e)}function ou(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?Ul(i,a):i.dispatchEvent(a)}var su=0;function cu(){v.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??lu()),document.body.insertAdjacentElement(`beforeend`,e[1]??lu()),su++,()=>{su===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),su--}},[])}function lu(){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 uu=`focusScope.autoFocusOnMount`,du=`focusScope.autoFocusOnUnmount`,fu={bubbles:!1,cancelable:!0},pu=`FocusScope`,mu=v.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=v.useState(null),l=$c(i),u=$c(a),d=v.useRef(null),f=ls(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:xu(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||xu(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&xu(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){Su.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(uu,fu);s.addEventListener(uu,l),s.dispatchEvent(t),t.defaultPrevented||(hu(Tu(_u(s)),{select:!0}),document.activeElement===e&&xu(s))}return()=>{s.removeEventListener(uu,l),setTimeout(()=>{let t=new CustomEvent(du,fu);s.addEventListener(du,u),s.dispatchEvent(t),t.defaultPrevented||xu(e??document.body,{select:!0}),s.removeEventListener(du,u),Su.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]=gu(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&xu(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&xu(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,U.jsx)(Hl.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});mu.displayName=pu;function hu(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(xu(r,{select:t}),document.activeElement!==n)return}function gu(e){let t=_u(e);return[vu(t,e),vu(t.reverse(),e)]}function _u(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 vu(e,t){for(let n of e)if(!yu(n,{upTo:t}))return n}function yu(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 bu(e){return e instanceof HTMLInputElement&&`select`in e}function xu(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&bu(e)&&t&&e.select()}}var Su=Cu();function Cu(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=wu(e,t),e.unshift(t)},remove(t){e=wu(e,t),e[0]?.resume()}}}function wu(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Tu(e){return e.filter(e=>e.tagName!==`A`)}var Eu=v.useId||(()=>void 0),Du=0;function Ou(e){let[t,n]=v.useState(Eu());return el(()=>{e||n(e=>e??String(Du++))},[e]),e||(t?`radix-${t}`:``)}var ku=[`top`,`right`,`bottom`,`left`],Au=Math.min,ju=Math.max,Mu=Math.round,Nu=Math.floor,Pu=e=>({x:e,y:e}),Fu={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Iu(e,t,n){return ju(e,Au(t,n))}function Lu(e,t){return typeof e==`function`?e(t):e}function Ru(e){return e.split(`-`)[0]}function zu(e){return e.split(`-`)[1]}function Bu(e){return e===`x`?`y`:`x`}function Vu(e){return e===`y`?`height`:`width`}function Hu(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Uu(e){return Bu(Hu(e))}function Wu(e,t,n){n===void 0&&(n=!1);let r=zu(e),i=Uu(e),a=Vu(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=$u(o)),[o,$u(o)]}function Gu(e){let t=$u(e);return[Ku(e),t,Ku(t)]}function Ku(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var qu=[`left`,`right`],Ju=[`right`,`left`],Yu=[`top`,`bottom`],Xu=[`bottom`,`top`];function Zu(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Ju:qu:t?qu:Ju;case`left`:case`right`:return t?Yu:Xu;default:return[]}}function Qu(e,t,n,r){let i=zu(e),a=Zu(Ru(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Ku)))),a}function $u(e){let t=Ru(e);return Fu[t]+e.slice(t.length)}function ed(e){return{top:0,right:0,bottom:0,left:0,...e}}function td(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:ed(e)}function nd(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 rd(e,t,n){let{reference:r,floating:i}=e,a=Hu(t),o=Uu(t),s=Vu(o),c=Ru(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(zu(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 id(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}=Lu(t,e),p=td(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=nd(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=nd(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 ad=50,od=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:id},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=rd(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<ad&&(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}=rd(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},sd=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}=Lu(e,t)||{};if(l==null)return{};let d=td(u),f={x:n,y:r},p=Uu(i),m=Vu(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=Au(d[_],T),D=Au(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=Iu(O,A,k),M=!c.arrow&&zu(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}}}),cd=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}=Lu(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Ru(r),_=Hu(o),v=Ru(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[$u(o)]:Gu(o)),x=p!==`none`;!d&&x&&b.push(...Qu(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=Wu(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`&&_!==Hu(t))||T.every(e=>Hu(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=Hu(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 ld(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ud(e){return ku.some(t=>e[t]>=0)}var dd=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=Lu(e,t);switch(i){case`referenceHidden`:{let e=ld(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:ud(e)}}}case`escaped`:{let e=ld(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:ud(e)}}}default:return{}}}}},fd=new Set([`left`,`top`]);async function pd(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Ru(n),s=zu(n),c=Hu(n)===`y`,l=fd.has(o)?-1:1,u=a&&c?-1:1,d=Lu(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 md=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 pd(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}}}}},hd=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}=Lu(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Hu(Ru(i)),p=Bu(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=Iu(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=Iu(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}}}}}},gd=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}=Lu(e,t),u={x:n,y:r},d=Hu(i),f=Bu(d),p=u[f],m=u[d],h=Lu(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=fd.has(Ru(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}}}},_d=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}=Lu(e,t),u=await o.detectOverflow(t,l),d=Ru(i),f=zu(i),p=Hu(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=Au(h-u[g],v),x=Au(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=ju(u.left,0),t=ju(u.right,0),n=ju(u.top,0),r=ju(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:ju(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:ju(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 vd(){return typeof window<`u`}function yd(e){return Sd(e)?(e.nodeName||``).toLowerCase():`#document`}function bd(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function xd(e){return((Sd(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Sd(e){return vd()?e instanceof Node||e instanceof bd(e).Node:!1}function Cd(e){return vd()?e instanceof Element||e instanceof bd(e).Element:!1}function wd(e){return vd()?e instanceof HTMLElement||e instanceof bd(e).HTMLElement:!1}function Td(e){return!vd()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof bd(e).ShadowRoot}function Ed(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Ld(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Dd(e){return/^(table|td|th)$/.test(yd(e))}function Od(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var kd=/transform|translate|scale|rotate|perspective|filter/,Ad=/paint|layout|strict|content/,jd=e=>!!e&&e!==`none`,Md;function Nd(e){let t=Cd(e)?Ld(e):e;return jd(t.transform)||jd(t.translate)||jd(t.scale)||jd(t.rotate)||jd(t.perspective)||!Fd()&&(jd(t.backdropFilter)||jd(t.filter))||kd.test(t.willChange||``)||Ad.test(t.contain||``)}function Pd(e){let t=zd(e);for(;wd(t)&&!Id(t);){if(Nd(t))return t;if(Od(t))return null;t=zd(t)}return null}function Fd(){return Md??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Md}function Id(e){return/^(html|body|#document)$/.test(yd(e))}function Ld(e){return bd(e).getComputedStyle(e)}function Rd(e){return Cd(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function zd(e){if(yd(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Td(e)&&e.host||xd(e);return Td(t)?t.host:t}function Bd(e){let t=zd(e);return Id(t)?e.ownerDocument?e.ownerDocument.body:e.body:wd(t)&&Ed(t)?t:Bd(t)}function Vd(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Bd(e),i=r===e.ownerDocument?.body,a=bd(r);if(i){let e=Hd(a);return t.concat(a,a.visualViewport||[],Ed(r)?r:[],e&&n?Vd(e):[])}else return t.concat(r,Vd(r,[],n))}function Hd(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ud(e){let t=Ld(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=wd(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Mu(n)!==a||Mu(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Wd(e){return Cd(e)?e:e.contextElement}function Gd(e){let t=Wd(e);if(!wd(t))return Pu(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Ud(t),o=(a?Mu(n.width):n.width)/r,s=(a?Mu(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Kd=Pu(0);function qd(e){let t=bd(e);return!Fd()||!t.visualViewport?Kd:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Jd(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==bd(e)?!1:t}function Yd(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Wd(e),o=Pu(1);t&&(r?Cd(r)&&(o=Gd(r)):o=Gd(e));let s=Jd(a,n,r)?qd(a):Pu(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=bd(a),t=r&&Cd(r)?bd(r):r,n=e,i=Hd(n);for(;i&&r&&t!==n;){let e=Gd(i),t=i.getBoundingClientRect(),r=Ld(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=bd(i),i=Hd(n)}}return nd({width:u,height:d,x:c,y:l})}function Xd(e,t){let n=Rd(e).scrollLeft;return t?t.left+n:Yd(xd(e)).left+n}function Zd(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Xd(e,n),y:n.top+t.scrollTop}}function Qd(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=xd(r),s=t?Od(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Pu(1),u=Pu(0),d=wd(r);if((d||!d&&!a)&&((yd(r)!==`body`||Ed(o))&&(c=Rd(r)),d)){let e=Yd(r);l=Gd(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Zd(o,c):Pu(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 $d(e){return Array.from(e.getClientRects())}function ef(e){let t=xd(e),n=Rd(e),r=e.ownerDocument.body,i=ju(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=ju(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Xd(e),s=-n.scrollTop;return Ld(r).direction===`rtl`&&(o+=ju(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var tf=25;function nf(e,t){let n=bd(e),r=xd(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Fd();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=Xd(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<=tf&&(a-=o)}else l<=tf&&(a+=l);return{width:a,height:o,x:s,y:c}}function rf(e,t){let n=Yd(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=wd(e)?Gd(e):Pu(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function af(e,t,n){let r;if(t===`viewport`)r=nf(e,n);else if(t===`document`)r=ef(xd(e));else if(Cd(t))r=rf(t,n);else{let n=qd(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return nd(r)}function of(e,t){let n=zd(e);return n===t||!Cd(n)||Id(n)?!1:Ld(n).position===`fixed`||of(n,t)}function sf(e,t){let n=t.get(e);if(n)return n;let r=Vd(e,[],!1).filter(e=>Cd(e)&&yd(e)!==`body`),i=null,a=Ld(e).position===`fixed`,o=a?zd(e):e;for(;Cd(o)&&!Id(o);){let t=Ld(o),n=Nd(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||Ed(o)&&!n&&of(e,o))?r=r.filter(e=>e!==o):i=t,o=zd(o)}return t.set(e,r),r}function cf(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Od(t)?[]:sf(t,this._c):[].concat(n),r],o=af(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=af(t,a[e],i);s=ju(n.top,s),c=Au(n.right,c),l=Au(n.bottom,l),u=ju(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function lf(e){let{width:t,height:n}=Ud(e);return{width:t,height:n}}function uf(e,t,n){let r=wd(t),i=xd(t),a=n===`fixed`,o=Yd(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Pu(0);function l(){c.x=Xd(i)}if(r||!r&&!a)if((yd(t)!==`body`||Ed(i))&&(s=Rd(t)),r){let e=Yd(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?Zd(i,s):Pu(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 df(e){return Ld(e).position===`static`}function ff(e,t){if(!wd(e)||Ld(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return xd(e)===n&&(n=n.ownerDocument.body),n}function pf(e,t){let n=bd(e);if(Od(e))return n;if(!wd(e)){let t=zd(e);for(;t&&!Id(t);){if(Cd(t)&&!df(t))return t;t=zd(t)}return n}let r=ff(e,t);for(;r&&Dd(r)&&df(r);)r=ff(r,t);return r&&Id(r)&&df(r)&&!Nd(r)?n:r||Pd(e)||n}var mf=async function(e){let t=this.getOffsetParent||pf,n=this.getDimensions,r=await n(e.floating);return{reference:uf(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function hf(e){return Ld(e).direction===`rtl`}var gf={convertOffsetParentRelativeRectToViewportRelativeRect:Qd,getDocumentElement:xd,getClippingRect:cf,getOffsetParent:pf,getElementRects:mf,getClientRects:$d,getDimensions:lf,getScale:Gd,isElement:Cd,isRTL:hf};function _f(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function vf(e,t){let n=null,r,i=xd(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=Nu(d),h=Nu(i.clientWidth-(u+f)),g=Nu(i.clientHeight-(d+p)),_=Nu(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:ju(0,Au(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&&!_f(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 yf(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=Wd(e),u=i||a?[...l?Vd(l):[],...t?Vd(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?vf(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?Yd(e):null;c&&g();function g(){let t=Yd(e);h&&!_f(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 bf=md,xf=hd,Sf=cd,Cf=_d,wf=dd,Tf=sd,Ef=gd,Df=(e,t,n)=>{let r=new Map,i={platform:gf,...n},a={...i.platform,_c:r};return od(e,t,{...i,platform:a})},Of=typeof document<`u`?v.useLayoutEffect:function(){};function kf(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(!kf(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)&&!kf(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Af(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function jf(e,t){let n=Af(e);return Math.round(t*n)/n}function Mf(e){let t=v.useRef(e);return Of(()=>{t.current=e}),t}function Nf(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);kf(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=Mf(c),O=Mf(i),k=Mf(l),A=v.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),Df(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!kf(T.current,t)&&(T.current=t,N.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);Of(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=v.useRef(!1);Of(()=>(j.current=!0,()=>{j.current=!1}),[]),Of(()=>{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=jf(P.floating,u.x),r=jf(P.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Af(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 Pf=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?{}:Tf({element:r.current,padding:i}).fn(n):r?Tf({element:r,padding:i}).fn(n):{}}}},Ff=(e,t)=>{let n=bf(e);return{name:n.name,fn:n.fn,options:[e,t]}},If=(e,t)=>{let n=xf(e);return{name:n.name,fn:n.fn,options:[e,t]}},Lf=(e,t)=>({fn:Ef(e).fn,options:[e,t]}),Rf=(e,t)=>{let n=Sf(e);return{name:n.name,fn:n.fn,options:[e,t]}},zf=(e,t)=>{let n=Cf(e);return{name:n.name,fn:n.fn,options:[e,t]}},Bf=(e,t)=>{let n=wf(e);return{name:n.name,fn:n.fn,options:[e,t]}},Vf=(e,t)=>{let n=Pf(e);return{name:n.name,fn:n.fn,options:[e,t]}},Hf=`Arrow`,Uf=v.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,U.jsx)(Hl.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,U.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Uf.displayName=Hf;var Wf=Uf;function Gf(e){let[t,n]=v.useState(void 0);return el(()=>{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 Kf=`Popper`,[qf,Jf]=Ol(Kf),[Yf,Xf]=qf(Kf),Zf=e=>{let{__scopePopper:t,children:n}=e,[r,i]=v.useState(null);return(0,U.jsx)(Yf,{scope:t,anchor:r,onAnchorChange:i,children:n})};Zf.displayName=Kf;var Qf=`PopperAnchor`,$f=v.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=Xf(Qf,n),o=v.useRef(null),s=ls(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,U.jsx)(Hl.div,{...i,ref:s})});$f.displayName=Qf;var ep=`PopperContent`,[tp,np]=qf(ep),rp=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=Xf(ep,n),[_,y]=v.useState(null),b=ls(t,e=>y(e)),[x,S]=v.useState(null),C=Gf(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(sp),altBoundary:k},{refs:j,floatingStyles:M,placement:N,isPositioned:P,middlewareData:F}=Nf({strategy:`fixed`,placement:E,whileElementsMounted:(...e)=>yf(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[Ff({mainAxis:i+T,alignmentAxis:o}),c&&If({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?Lf():void 0,...A}),c&&Rf({...A}),zf({...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&&Vf({element:x,padding:s}),cp({arrowWidth:w,arrowHeight:T}),f&&Bf({strategy:`referenceHidden`,...A})]}),[I,L]=lp(N),R=$c(m);el(()=>{P&&R?.()},[P,R]);let ee=F.arrow?.x,te=F.arrow?.y,ne=F.arrow?.centerOffset!==0,[z,B]=v.useState();return el(()=>{_&&B(window.getComputedStyle(_).zIndex)},[_]),(0,U.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,U.jsx)(tp,{scope:n,placedSide:I,onArrowChange:S,arrowX:ee,arrowY:te,shouldHideArrow:ne,children:(0,U.jsx)(Hl.div,{"data-side":I,"data-align":L,...h,ref:b,style:{...h.style,animation:P?void 0:`none`}})})})});rp.displayName=ep;var ip=`PopperArrow`,ap={top:`bottom`,right:`left`,bottom:`top`,left:`right`},op=v.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=np(ip,n),a=ap[i.placedSide];return(0,U.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,U.jsx)(Wf,{...r,ref:t,style:{...r.style,display:`block`}})})});op.displayName=ip;function sp(e){return e!==null}var cp=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]=lp(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 lp(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var up=Zf,dp=$f,fp=rp,pp=op,mp=`Portal`,hp=v.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=v.useState(!1);el(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?N.createPortal((0,U.jsx)(Hl.div,{...r,ref:t}),o):null});hp.displayName=mp;function gp(e,t){return v.useReducer((e,n)=>t[e][n]??e,e)}var _p=e=>{let{present:t,children:n}=e,r=vp(t),i=typeof n==`function`?n({present:r.isPresent}):v.Children.only(n),a=ls(r.ref,bp(i));return typeof n==`function`||r.isPresent?v.cloneElement(i,{ref:a}):null};_p.displayName=`Presence`;function vp(e){let[t,n]=v.useState(),r=v.useRef(null),i=v.useRef(e),a=v.useRef(`none`),[o,s]=gp(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return v.useEffect(()=>{let e=yp(r.current);a.current=o===`mounted`?e:`none`},[o]),el(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=yp(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),el(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=yp(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=yp(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 yp(e){return e?.animationName||`none`}function bp(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 xp=`rovingFocusGroup.onEntryFocus`,Sp={bubbles:!1,cancelable:!0},Cp=`RovingFocusGroup`,[wp,Tp,Ep]=Wl(Cp),[Dp,Op]=Ol(Cp,[Ep]),[kp,Ap]=Dp(Cp),jp=v.forwardRef((e,t)=>(0,U.jsx)(wp.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,U.jsx)(wp.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,U.jsx)(Mp,{...e,ref:t})})}));jp.displayName=Cp;var Mp=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=ls(t,f),m=Kl(a),[h,g]=jl({prop:o,defaultProp:s??null,onChange:c,caller:Cp}),[_,y]=v.useState(!1),b=$c(l),x=Tp(n),S=v.useRef(!1),[C,w]=v.useState(0);return v.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(xp,b),()=>e.removeEventListener(xp,b)},[b]),(0,U.jsx)(kp,{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,U.jsx)(Hl.div,{tabIndex:_||C===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:Y(e.onMouseDown,()=>{S.current=!0}),onFocus:Y(e.onFocus,e=>{let t=!S.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(xp,Sp);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=x().filter(e=>e.focusable);Rp([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}S.current=!1}),onBlur:Y(e.onBlur,()=>y(!1))})})}),Np=`RovingFocusGroupItem`,Pp=v.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=Ou(),l=a||c,u=Ap(Np,n),d=u.currentTabStopId===l,f=Tp(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return v.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,U.jsx)(wp.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,U.jsx)(Hl.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:Y(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:Y(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:Y(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=Lp(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?zp(n,r+1):n.slice(r+1)}setTimeout(()=>Rp(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});Pp.displayName=Np;var Fp={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Ip(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function Lp(e,t,n){let r=Ip(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Fp[r]}function Rp(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function zp(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Bp=jp,Vp=Pp,Hp=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Up=new WeakMap,Wp=new WeakMap,Gp={},Kp=0,qp=function(e){return e&&(e.host||qp(e.parentNode))},Jp=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=qp(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})},Yp=function(e,t,n,r){var i=Jp(t,Array.isArray(e)?e:[e]);Gp[n]||(Gp[n]=new WeakMap);var a=Gp[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=(Up.get(e)||0)+1,l=(a.get(e)||0)+1;Up.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Wp.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(),Kp++,function(){o.forEach(function(e){var t=Up.get(e)-1,i=a.get(e)-1;Up.set(e,t),a.set(e,i),t||(Wp.has(e)||e.removeAttribute(r),Wp.delete(e)),i||e.removeAttribute(n)}),Kp--,Kp||(Up=new WeakMap,Up=new WeakMap,Wp=new WeakMap,Gp={})}},Xp=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Hp(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Yp(r,i,n,`aria-hidden`)):function(){return null}},Zp=function(){return Zp=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},Zp.apply(this,arguments)};function Qp(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 $p(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 em=`right-scroll-bar-position`,tm=`width-before-scroll-bar`,nm=`with-scroll-bars-hidden`,rm=`--removed-body-scroll-bar-size`;function im(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function am(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 om=typeof window<`u`?v.useLayoutEffect:v.useEffect,sm=new WeakMap;function cm(e,t){var n=am(t||null,function(t){return e.forEach(function(e){return im(e,t)})});return om(function(){var t=sm.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||im(e,null)}),i.forEach(function(e){r.has(e)||im(e,a)})}sm.set(n,e)},[e]),n}function lm(e){return e}function um(e,t){t===void 0&&(t=lm);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 dm(e){e===void 0&&(e={});var t=um(null);return t.options=Zp({async:!0,ssr:!1},e),t}var fm=function(e){var t=e.sideCar,n=Qp(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,Zp({},n))};fm.isSideCarExport=!0;function pm(e,t){return e.useMedium(t),fm}var mm=dm(),hm=function(){},gm=v.forwardRef(function(e,t){var n=v.useRef(null),r=v.useState({onScrollCapture:hm,onWheelCapture:hm,onTouchMoveCapture:hm}),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=Qp(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),S=f,C=cm([n,t]),w=Zp(Zp({},x),i);return v.createElement(v.Fragment,null,u&&v.createElement(S,{sideCar:mm,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),Zp(Zp({},w),{ref:C})):v.createElement(y,Zp({},w,{className:c,ref:C}),s))});gm.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},gm.classNames={fullWidth:tm,zeroRight:em};var _m,vm=function(){if(_m)return _m;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function ym(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=vm();return t&&e.setAttribute(`nonce`,t),e}function bm(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function xm(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var Sm=function(){var e=0,t=null;return{add:function(n){e==0&&(t=ym())&&(bm(t,n),xm(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Cm=function(){var e=Sm();return function(t,n){v.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},wm=function(){var e=Cm();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},Tm={left:0,top:0,right:0,gap:0},Em=function(e){return parseInt(e||``,10)||0},Dm=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[Em(n),Em(r),Em(i)]},Om=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return Tm;var t=Dm(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])}},km=wm(),Am=`data-scroll-locked`,jm=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
+ .${nm} {
14
+ overflow: hidden ${r};
15
+ padding-right: ${s}px ${r};
16
+ }
17
+ body[${Am}] {
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
+ .${em} {
31
+ right: ${s}px ${r};
32
+ }
33
+
34
+ .${tm} {
35
+ margin-right: ${s}px ${r};
36
+ }
37
+
38
+ .${em} .${em} {
39
+ right: 0 ${r};
40
+ }
41
+
42
+ .${tm} .${tm} {
43
+ margin-right: 0 ${r};
44
+ }
45
+
46
+ body[${Am}] {
47
+ ${rm}: ${s}px;
48
+ }
49
+ `},Mm=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},Nm=function(){v.useEffect(function(){return document.body.setAttribute(Am,(Mm()+1).toString()),function(){var e=Mm()-1;e<=0?document.body.removeAttribute(Am):document.body.setAttribute(Am,e.toString())}},[])},Pm=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;Nm();var a=v.useMemo(function(){return Om(i)},[i]);return v.createElement(km,{styles:jm(a,!t,i,n?``:`!important`)})},Fm=!1;if(typeof window<`u`)try{var Im=Object.defineProperty({},`passive`,{get:function(){return Fm=!0,!0}});window.addEventListener(`test`,Im,Im),window.removeEventListener(`test`,Im,Im)}catch{Fm=!1}var Lm=Fm?{passive:!1}:!1,Rm=function(e){return e.tagName===`TEXTAREA`},zm=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!Rm(e)&&n[t]===`visible`)},Bm=function(e){return zm(e,`overflowY`)},Vm=function(e){return zm(e,`overflowX`)},Hm=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),Gm(e,r)){var i=Km(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Um=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},Wm=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},Gm=function(e,t){return e===`v`?Bm(t):Vm(t)},Km=function(e,t){return e===`v`?Um(t):Wm(t)},qm=function(e,t){return e===`h`&&t===`rtl`?-1:1},Jm=function(e,t,n,r,i){var a=qm(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=Km(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&Gm(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},Ym=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Xm=function(e){return[e.deltaX,e.deltaY]},Zm=function(e){return e&&`current`in e?e.current:e},Qm=function(e,t){return e[0]===t[0]&&e[1]===t[1]},$m=function(e){return`
50
+ .block-interactivity-${e} {pointer-events: none;}
51
+ .allow-interactivity-${e} {pointer-events: all;}
52
+ `},eh=0,th=[];function nh(e){var t=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),i=v.useState(eh++)[0],a=v.useState(wm)[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=$p([e.lockRef.current],(e.shards||[]).map(Zm),!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=Ym(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=Hm(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Hm(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 Jm(h,t,e,h===`h`?s:c,!0)},[]),c=v.useCallback(function(e){var n=e;if(!(!th.length||th[th.length-1]!==a)){var r=`deltaY`in n?Xm(n):Ym(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Qm(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Zm).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:rh(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=Ym(e),r.current=void 0},[]),d=v.useCallback(function(t){l(t.type,Xm(t),t.target,s(t,e.lockRef.current))},[]),f=v.useCallback(function(t){l(t.type,Ym(t),t.target,s(t,e.lockRef.current))},[]);v.useEffect(function(){return th.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,Lm),document.addEventListener(`touchmove`,c,Lm),document.addEventListener(`touchstart`,u,Lm),function(){th=th.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,Lm),document.removeEventListener(`touchmove`,c,Lm),document.removeEventListener(`touchstart`,u,Lm)}},[]);var p=e.removeScrollBar,m=e.inert;return v.createElement(v.Fragment,null,m?v.createElement(a,{styles:$m(i)}):null,p?v.createElement(Pm,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function rh(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var ih=pm(mm,nh),ah=v.forwardRef(function(e,t){return v.createElement(gm,Zp({},e,{ref:t,sideCar:ih}))});ah.classNames=gm.classNames;var oh=[`Enter`,` `],sh=[`ArrowDown`,`PageUp`,`Home`],ch=[`ArrowUp`,`PageDown`,`End`],lh=[...sh,...ch],uh={ltr:[...oh,`ArrowRight`],rtl:[...oh,`ArrowLeft`]},dh={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},fh=`Menu`,[ph,mh,hh]=Wl(fh),[gh,_h]=Ol(fh,[hh,Jf,Op]),vh=Jf(),yh=Op(),[bh,xh]=gh(fh),[Sh,Ch]=gh(fh),wh=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=vh(t),[c,l]=v.useState(null),u=v.useRef(!1),d=$c(a),f=Kl(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,U.jsx)(up,{...s,children:(0,U.jsx)(bh,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,U.jsx)(Sh,{scope:t,onClose:v.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};wh.displayName=fh;var Th=`MenuAnchor`,Eh=v.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=vh(n);return(0,U.jsx)(dp,{...i,...r,ref:t})});Eh.displayName=Th;var Dh=`MenuPortal`,[Oh,kh]=gh(Dh,{forceMount:void 0}),Ah=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=xh(Dh,t);return(0,U.jsx)(Oh,{scope:t,forceMount:n,children:(0,U.jsx)(_p,{present:n||a.open,children:(0,U.jsx)(hp,{asChild:!0,container:i,children:r})})})};Ah.displayName=Dh;var jh=`MenuContent`,[Mh,Nh]=gh(jh),Ph=v.forwardRef((e,t)=>{let n=kh(jh,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=xh(jh,e.__scopeMenu),o=Ch(jh,e.__scopeMenu);return(0,U.jsx)(ph.Provider,{scope:e.__scopeMenu,children:(0,U.jsx)(_p,{present:r||a.open,children:(0,U.jsx)(ph.Slot,{scope:e.__scopeMenu,children:o.modal?(0,U.jsx)(Fh,{...i,ref:t}):(0,U.jsx)(Ih,{...i,ref:t})})})})}),Fh=v.forwardRef((e,t)=>{let n=xh(jh,e.__scopeMenu),r=v.useRef(null),i=ls(t,r);return v.useEffect(()=>{let e=r.current;if(e)return Xp(e)},[]),(0,U.jsx)(Rh,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Y(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Ih=v.forwardRef((e,t)=>{let n=xh(jh,e.__scopeMenu);return(0,U.jsx)(Rh,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Lh=Pl(`MenuContent.ScrollLock`),Rh=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=xh(jh,n),_=Ch(jh,n),y=vh(n),b=yh(n),x=mh(n),[S,C]=v.useState(null),w=v.useRef(null),T=ls(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?ah:v.Fragment,N=m?{as:Lh,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=Sg(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),[]),cu();let F=v.useCallback(e=>A.current===k.current?.side&&wg(e,k.current?.area),[]);return(0,U.jsx)(Mh,{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,U.jsx)(M,{...N,children:(0,U.jsx)(mu,{asChild:!0,trapped:i,onMountAutoFocus:Y(a,e=>{e.preventDefault(),w.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,U.jsx)(eu,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,U.jsx)(Bp,{asChild:!0,...b,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:S,onCurrentTabStopIdChange:C,onEntryFocus:Y(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,U.jsx)(fp,{role:`menu`,"aria-orientation":`vertical`,"data-state":_g(g.open),"data-radix-menu-content":``,dir:_.dir,...y,...h,ref:T,style:{outline:`none`,...h.style},onKeyDown:Y(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||!lh.includes(e.key))return;e.preventDefault();let a=x().filter(e=>!e.disabled).map(e=>e.ref.current);ch.includes(e.key)&&a.reverse(),bg(a)}),onBlur:Y(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(E.current),D.current=``)}),onPointerMove:Y(e.onPointerMove,Tg(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)}))})})})})})})});Ph.displayName=jh;var zh=`MenuGroup`,Bh=v.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,U.jsx)(Hl.div,{role:`group`,...r,ref:t})});Bh.displayName=zh;var Vh=`MenuLabel`,Hh=v.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,U.jsx)(Hl.div,{...r,ref:t})});Hh.displayName=Vh;var Uh=`MenuItem`,Wh=`menu.itemSelect`,Gh=v.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=v.useRef(null),o=Ch(Uh,e.__scopeMenu),s=Nh(Uh,e.__scopeMenu),c=ls(t,a),l=v.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(Wh,{bubbles:!0,cancelable:!0});e.addEventListener(Wh,e=>r?.(e),{once:!0}),Ul(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,U.jsx)(Kh,{...i,ref:c,disabled:n,onClick:Y(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:Y(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:Y(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||oh.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});Gh.displayName=Uh;var Kh=v.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=Nh(Uh,n),s=yh(n),c=v.useRef(null),l=ls(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,U.jsx)(ph.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,U.jsx)(Vp,{asChild:!0,...s,focusable:!r,children:(0,U.jsx)(Hl.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:Y(e.onPointerMove,Tg(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Y(e.onPointerLeave,Tg(e=>o.onItemLeave(e))),onFocus:Y(e.onFocus,()=>d(!0)),onBlur:Y(e.onBlur,()=>d(!1))})})})}),qh=`MenuCheckboxItem`,Jh=v.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,U.jsx)(ng,{scope:e.__scopeMenu,checked:n,children:(0,U.jsx)(Gh,{role:`menuitemcheckbox`,"aria-checked":vg(n)?`mixed`:n,...i,ref:t,"data-state":yg(n),onSelect:Y(i.onSelect,()=>r?.(vg(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Jh.displayName=qh;var Yh=`MenuRadioGroup`,[Xh,Zh]=gh(Yh,{value:void 0,onValueChange:()=>{}}),Qh=v.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=$c(r);return(0,U.jsx)(Xh,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,U.jsx)(Bh,{...i,ref:t})})});Qh.displayName=Yh;var $h=`MenuRadioItem`,eg=v.forwardRef((e,t)=>{let{value:n,...r}=e,i=Zh($h,e.__scopeMenu),a=n===i.value;return(0,U.jsx)(ng,{scope:e.__scopeMenu,checked:a,children:(0,U.jsx)(Gh,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":yg(a),onSelect:Y(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});eg.displayName=$h;var tg=`MenuItemIndicator`,[ng,rg]=gh(tg,{checked:!1}),ig=v.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=rg(tg,n);return(0,U.jsx)(_p,{present:r||vg(a.checked)||a.checked===!0,children:(0,U.jsx)(Hl.span,{...i,ref:t,"data-state":yg(a.checked)})})});ig.displayName=tg;var ag=`MenuSeparator`,og=v.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,U.jsx)(Hl.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});og.displayName=ag;var sg=`MenuArrow`,cg=v.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=vh(n);return(0,U.jsx)(pp,{...i,...r,ref:t})});cg.displayName=sg;var lg=`MenuSub`,[ug,dg]=gh(lg),fg=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=xh(lg,t),o=vh(t),[s,c]=v.useState(null),[l,u]=v.useState(null),d=$c(i);return v.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,U.jsx)(up,{...o,children:(0,U.jsx)(bh,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,U.jsx)(ug,{scope:t,contentId:Ou(),triggerId:Ou(),trigger:s,onTriggerChange:c,children:n})})})};fg.displayName=lg;var pg=`MenuSubTrigger`,mg=v.forwardRef((e,t)=>{let n=xh(pg,e.__scopeMenu),r=Ch(pg,e.__scopeMenu),i=dg(pg,e.__scopeMenu),a=Nh(pg,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,U.jsx)(Eh,{asChild:!0,...l,children:(0,U.jsx)(Kh,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":_g(n.open),...e,ref:cs(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Y(e.onPointerMove,Tg(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:Y(e.onPointerLeave,Tg(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:Y(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||uh[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});mg.displayName=pg;var hg=`MenuSubContent`,gg=v.forwardRef((e,t)=>{let n=kh(jh,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=xh(jh,e.__scopeMenu),o=Ch(jh,e.__scopeMenu),s=dg(hg,e.__scopeMenu),c=v.useRef(null),l=ls(t,c);return(0,U.jsx)(ph.Provider,{scope:e.__scopeMenu,children:(0,U.jsx)(_p,{present:r||a.open,children:(0,U.jsx)(ph.Slot,{scope:e.__scopeMenu,children:(0,U.jsx)(Rh,{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:Y(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:Y(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:Y(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=dh[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});gg.displayName=hg;function _g(e){return e?`open`:`closed`}function vg(e){return e===`indeterminate`}function yg(e){return vg(e)?`indeterminate`:e?`checked`:`unchecked`}function bg(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function xg(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Sg(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=xg(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 Cg(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 wg(e,t){return t?Cg({x:e.clientX,y:e.clientY},t):!1}function Tg(e){return t=>t.pointerType===`mouse`?e(t):void 0}var Eg=wh,Dg=Eh,Og=Ah,kg=Ph,Ag=Bh,jg=Hh,Mg=Gh,Ng=Jh,Pg=Qh,Fg=eg,Ig=ig,Lg=og,Rg=cg,zg=mg,Bg=gg,Vg=`DropdownMenu`,[Hg,Ug]=Ol(Vg,[_h]),Wg=_h(),[Gg,Kg]=Hg(Vg),qg=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=Wg(t),l=v.useRef(null),[u,d]=jl({prop:i,defaultProp:a??!1,onChange:o,caller:Vg});return(0,U.jsx)(Gg,{scope:t,triggerId:Ou(),triggerRef:l,contentId:Ou(),open:u,onOpenChange:d,onOpenToggle:v.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,U.jsx)(Eg,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};qg.displayName=Vg;var Jg=`DropdownMenuTrigger`,Yg=v.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=Kg(Jg,n),o=Wg(n);return(0,U.jsx)(Dg,{asChild:!0,...o,children:(0,U.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:cs(t,a.triggerRef),onPointerDown:Y(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:Y(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Yg.displayName=Jg;var Xg=`DropdownMenuPortal`,Zg=e=>{let{__scopeDropdownMenu:t,...n}=e,r=Wg(t);return(0,U.jsx)(Og,{...r,...n})};Zg.displayName=Xg;var Qg=`DropdownMenuContent`,$g=v.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Kg(Qg,n),a=Wg(n),o=v.useRef(!1);return(0,U.jsx)(kg,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:Y(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:Y(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)`}})});$g.displayName=Qg;var e_=`DropdownMenuGroup`,t_=v.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Wg(n);return(0,U.jsx)(Ag,{...i,...r,ref:t})});t_.displayName=e_;var n_=`DropdownMenuLabel`,r_=v.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Wg(n);return(0,U.jsx)(jg,{...i,...r,ref:t})});r_.displayName=n_;var i_=`DropdownMenuItem`,a_=v.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Wg(n);return(0,U.jsx)(Mg,{...i,...r,ref:t})});a_.displayName=i_;var o_=`DropdownMenuCheckboxItem`,s_=v.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Wg(n);return(0,U.jsx)(Ng,{...i,...r,ref:t})});s_.displayName=o_;var c_=`DropdownMenuRadioGroup`,l_=v.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Wg(n);return(0,U.jsx)(Pg,{...i,...r,ref:t})});l_.displayName=c_;var u_=`DropdownMenuRadioItem`,d_=v.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Wg(n);return(0,U.jsx)(Fg,{...i,...r,ref:t})});d_.displayName=u_;var f_=`DropdownMenuItemIndicator`,p_=v.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Wg(n);return(0,U.jsx)(Ig,{...i,...r,ref:t})});p_.displayName=f_;var m_=`DropdownMenuSeparator`,h_=v.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Wg(n);return(0,U.jsx)(Lg,{...i,...r,ref:t})});h_.displayName=m_;var g_=`DropdownMenuArrow`,__=v.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Wg(n);return(0,U.jsx)(Rg,{...i,...r,ref:t})});__.displayName=g_;var v_=`DropdownMenuSubTrigger`,y_=v.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Wg(n);return(0,U.jsx)(zg,{...i,...r,ref:t})});y_.displayName=v_;var b_=`DropdownMenuSubContent`,x_=v.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Wg(n);return(0,U.jsx)(Bg,{...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)`}})});x_.displayName=b_;var S_=qg,C_=Yg,w_=Zg,T_=$g,E_=r_,D_=a_,O_=s_,k_=d_,A_=p_,j_=h_,M_=y_,N_=x_,P_=S_,F_=C_,I_=v.forwardRef(({className:e,inset:t,children:n,...r},i)=>(0,U.jsxs)(M_,{ref:i,className:q(`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,U.jsx)(Ha,{className:`ml-auto`})]}));I_.displayName=M_.displayName;var L_=v.forwardRef(({className:e,...t},n)=>(0,U.jsx)(N_,{ref:n,className:q(`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}));L_.displayName=N_.displayName;var R_=v.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,U.jsx)(w_,{children:(0,U.jsx)(T_,{ref:r,sideOffset:t,className:q(`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})}));R_.displayName=T_.displayName;var z_=v.forwardRef(({className:e,inset:t,...n},r)=>(0,U.jsx)(D_,{ref:r,className:q(`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}));z_.displayName=D_.displayName;var B_=v.forwardRef(({className:e,...t},n)=>(0,U.jsx)(j_,{ref:n,className:q(`-mx-1 my-1 h-px bg-muted`,e),...t}));B_.displayName=j_.displayName;var V_=v.forwardRef(({className:e,inset:t,...n},r)=>(0,U.jsx)(E_,{ref:r,className:q(`px-2 py-1.5 text-sm font-semibold`,t&&`pl-8`,e),...n}));V_.displayName=E_.displayName;var H_=v.forwardRef(({className:e,children:t,checked:n,...r},i)=>(0,U.jsxs)(O_,{ref:i,className:q(`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,U.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,U.jsx)(A_,{children:(0,U.jsx)(za,{className:`h-4 w-4`})})}),t]}));H_.displayName=O_.displayName;var U_=v.forwardRef(({className:e,children:t,...n},r)=>(0,U.jsxs)(k_,{ref:r,className:q(`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,U.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,U.jsx)(A_,{children:(0,U.jsx)(Ja,{className:`h-2 w-2 fill-current`})})}),t]}));U_.displayName=k_.displayName;var W_=({className:e,...t})=>(0,U.jsx)(`span`,{className:q(`ml-auto text-xs tracking-widest opacity-60`,e),...t});W_.displayName=`DropdownMenuShortcut`;var G_=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`}),K_=`VisuallyHidden`,q_=v.forwardRef((e,t)=>(0,U.jsx)(Hl.span,{...e,ref:t,style:{...G_,...e.style}}));q_.displayName=K_;var J_=q_,[Y_,X_]=Ol(`Tooltip`,[Jf]),Z_=Jf(),Q_=`TooltipProvider`,$_=700,ev=`tooltip.open`,[tv,nv]=Y_(Q_),rv=e=>{let{__scopeTooltip:t,delayDuration:n=$_,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,U.jsx)(tv,{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})};rv.displayName=Q_;var iv=`Tooltip`,[av,ov]=Y_(iv),sv=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=nv(iv,e.__scopeTooltip),l=Z_(t),[u,d]=v.useState(null),f=Ou(),p=v.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=v.useRef(!1),[_,y]=jl({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(ev))):c.onClose(),a?.(e)},caller:iv}),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,U.jsx)(up,{...l,children:(0,U.jsx)(av,{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})})};sv.displayName=iv;var cv=`TooltipTrigger`,lv=v.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=ov(cv,n),a=nv(cv,n),o=Z_(n),s=ls(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,U.jsx)(dp,{asChild:!0,...o,children:(0,U.jsx)(Hl.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:Y(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:Y(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:Y(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:Y(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:Y(e.onBlur,i.onClose),onClick:Y(e.onClick,i.onClose)})})});lv.displayName=cv;var uv=`TooltipPortal`,[dv,fv]=Y_(uv,{forceMount:void 0}),pv=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=ov(uv,t);return(0,U.jsx)(dv,{scope:t,forceMount:n,children:(0,U.jsx)(_p,{present:n||a.open,children:(0,U.jsx)(hp,{asChild:!0,container:i,children:r})})})};pv.displayName=uv;var mv=`TooltipContent`,hv=v.forwardRef((e,t)=>{let n=fv(mv,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=ov(mv,e.__scopeTooltip);return(0,U.jsx)(_p,{present:r||o.open,children:o.disableHoverableContent?(0,U.jsx)(bv,{side:i,...a,ref:t}):(0,U.jsx)(gv,{side:i,...a,ref:t})})}),gv=v.forwardRef((e,t)=>{let n=ov(mv,e.__scopeTooltip),r=nv(mv,e.__scopeTooltip),i=v.useRef(null),a=ls(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=wv(r,Cv(r,n.getBoundingClientRect())),a=Tv(t.getBoundingClientRect());s(Dv([...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=!Ev(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,U.jsx)(bv,{...e,ref:a})}),[_v,vv]=Y_(iv,{isInside:!1}),yv=Rl(`TooltipContent`),bv=v.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=ov(mv,n),l=Z_(n),{onClose:u}=c;return v.useEffect(()=>(document.addEventListener(ev,u),()=>document.removeEventListener(ev,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,U.jsx)(eu,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,U.jsxs)(fp,{"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,U.jsx)(yv,{children:r}),(0,U.jsx)(_v,{scope:n,isInside:!0,children:(0,U.jsx)(J_,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});hv.displayName=mv;var xv=`TooltipArrow`,Sv=v.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Z_(n);return vv(xv,n).isInside?null:(0,U.jsx)(pp,{...i,...r,ref:t})});Sv.displayName=xv;function Cv(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 wv(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 Tv(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 Ev(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 Dv(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)),Ov(t)}function Ov(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 kv=rv,Av=sv,jv=lv,Mv=pv,Nv=hv,Pv=kv,Fv=Av,Iv=jv,Lv=v.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,U.jsx)(Mv,{children:(0,U.jsx)(Nv,{ref:r,sideOffset:t,className:q(`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})}));Lv.displayName=Nv.displayName;var Rv=[{to:`/`,icon:So,label:`Dashboard`,permission:null},{to:`/content`,icon:io,label:`Content`,permission:null},{to:`/media`,icon:_o,label:`Media`,permission:null},{to:`/content-types`,icon:xo,label:`Content Types`,permission:`content-types:write`},{to:`/settings`,icon:zo,label:`Settings`,permission:`settings:overview:read`}];function zv(){let{user:e,logout:t}=ga(),{pathname:n}=cr(),r=dr(),{content:i}=as(),{data:a}=wa(`/cms/admin/content-types`),o=(a??[]).filter(e=>e.kind===`collection`);function s(e){return e===`/`?n===`/`:n===e||n.startsWith(e+`/`)}let c=e?.permissions??[],l=e?.role?.toLowerCase()===`viewer`,u=Rv.filter(({to:e,permission:t})=>l?e===`/content`:!t||c.includes(`*`)||c.includes(t));return(0,U.jsx)(Pv,{delayDuration:300,children:(0,U.jsxs)(`div`,{className:`flex h-svh overflow-hidden bg-background`,children:[(0,U.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,U.jsx)(qi,{to:`/`,children:(0,U.jsx)(`img`,{src:`/admin/plank-logo-w.svg`,alt:`Plank CMS`,className:`px-3 pb-4`})}),(e?.permissions?.includes(`*`)||e?.permissions?.includes(`entries:write`))&&o.length>0&&(0,U.jsx)(`div`,{className:`mt-4 px-3`,children:(0,U.jsx)(J,{size:`icon`,onClick:()=>{let e=o.find(e=>e.isDefault)??o[0];e&&r(`/content/${e.slug}/new`)},children:(0,U.jsx)(Po,{className:`size-4`})})}),(0,U.jsx)(`nav`,{className:`flex flex-1 flex-col items-center gap-1 pt-2`,children:u.map(({to:e,icon:t,label:n})=>(0,U.jsxs)(Fv,{children:[(0,U.jsx)(Iv,{asChild:!0,children:(0,U.jsx)(J,{asChild:!0,size:`icon`,variant:s(e)?`secondary`:`ghost`,children:(0,U.jsx)(qi,{to:e,end:e===`/`,children:(0,U.jsx)(t,{className:`size-4`})})})}),(0,U.jsx)(Lv,{side:`right`,children:n})]},e))}),(0,U.jsxs)(P_,{children:[(0,U.jsx)(F_,{asChild:!0,children:(0,U.jsx)(J,{variant:`ghost`,size:`icon`,className:`rounded-full`,children:(0,U.jsx)(El,{avatarUrl:e?.avatarUrl,firstName:e?.firstName,lastName:e?.lastName,email:e?.email})})}),(0,U.jsxs)(R_,{side:`right`,align:`end`,className:`w-52`,children:[(0,U.jsxs)(V_,{className:`font-normal`,children:[(0,U.jsx)(`p`,{className:`truncate text-sm font-medium`,children:e?.email}),(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground capitalize`,children:e?.role})]}),(0,U.jsx)(B_,{}),(0,U.jsxs)(z_,{onClick:()=>r(`/profile`),children:[(0,U.jsx)($o,{}),`Profile`]}),(0,U.jsx)(B_,{}),(0,U.jsxs)(z_,{onClick:t,className:`text-destructive focus:text-destructive`,children:[(0,U.jsx)(Ao,{}),`Log out`]})]})]})]}),(0,U.jsx)(`main`,{className:`flex-1 overflow-y-auto`,children:(0,U.jsx)(`div`,{className:`w-full mx-auto px-4 mb-16 ${i?`max-w-7xl`:`max-w-9xl`}`,children:(0,U.jsx)(Qr,{})})}),i&&(0,U.jsx)(`aside`,{className:`flex h-full w-64 shrink-0 flex-col border-l border-sidebar-border bg-background`,children:i})]})})}function Bv(){return(0,U.jsx)(is,{children:(0,U.jsx)(zv,{})})}function Vv(){let[e,t]=(0,v.useState)({data:null,loading:!1,error:null});async function n(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 Hv=v.forwardRef(({className:e,type:t,...n},r)=>(0,U.jsx)(`input`,{type:t,className:q(`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}));Hv.displayName=`Input`;var Uv=`Label`,Wv=v.forwardRef((e,t)=>(0,U.jsx)(tl.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));Wv.displayName=Uv;var Gv=Wv,Kv=Ts(`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`),X=v.forwardRef(({className:e,...t},n)=>(0,U.jsx)(Gv,{ref:n,className:q(Kv(),e),...t}));X.displayName=Gv.displayName;var qv=Object.defineProperty,Jv=Object.defineProperties,Yv=Object.getOwnPropertyDescriptors,Xv=Object.getOwnPropertySymbols,Zv=Object.prototype.hasOwnProperty,Qv=Object.prototype.propertyIsEnumerable,$v=(e,t,n)=>t in e?qv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ey=(e,t)=>{for(var n in t||={})Zv.call(t,n)&&$v(e,n,t[n]);if(Xv)for(var n of Xv(t))Qv.call(t,n)&&$v(e,n,t[n]);return e},ty=(e,t)=>Jv(e,Yv(t)),ny=(e,t)=>{var n={};for(var r in e)Zv.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Xv)for(var r of Xv(e))t.indexOf(r)<0&&Qv.call(e,r)&&(n[r]=e[r]);return n};function ry(e){return[setTimeout(e,0),setTimeout(e,10),setTimeout(e,50)]}function iy(e){let t=v.useRef();return v.useEffect(()=>{t.current=e}),t.current}var ay=18,oy=40,sy=`${oy}px`,cy=[`[data-lastpass-icon-root]`,`com-1password-button`,`[data-dashlanecreated]`,`[style$="2147483647 !important;"]`].join(`,`);function ly({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-ay,f=u;document.querySelectorAll(cy).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>=oy)}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:sy}}var uy=v.createContext({}),dy=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=py,render:h,children:g}=n,_=ny(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=iy(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;`;fy(e.sheet,`[data-input-otp]::selection { background: transparent !important; color: transparent !important; }`),fy(e.sheet,`[data-input-otp]:autofill { ${t} }`),fy(e.sheet,`[data-input-otp]:-webkit-autofill { ${t} }`),fy(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; } }`),fy(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(()=>{ry(()=>{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=ly({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`,ty(ey({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]),H=v.useMemo(()=>h?h(V):v.createElement(uy.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},H,v.createElement(`div`,{style:{position:`absolute`,inset:0,pointerEvents:`none`}},re)))});dy.displayName=`Input`;function fy(e,t){try{e.insertRule(t)}catch{console.error(`input-otp could not insert CSS rule:`,t)}}var py=`
53
+ [data-input-otp] {
54
+ --nojs-bg: white !important;
55
+ --nojs-fg: black !important;
56
+
57
+ background-color: var(--nojs-bg) !important;
58
+ color: var(--nojs-fg) !important;
59
+ caret-color: var(--nojs-fg) !important;
60
+ letter-spacing: .25em !important;
61
+ text-align: center !important;
62
+ border: 1px solid var(--nojs-fg) !important;
63
+ border-radius: 4px !important;
64
+ width: 100% !important;
65
+ }
66
+ @media (prefers-color-scheme: dark) {
67
+ [data-input-otp] {
68
+ --nojs-bg: black !important;
69
+ --nojs-fg: white !important;
70
+ }
71
+ }`;function my({className:e,containerClassName:t,...n}){return(0,U.jsx)(dy,{"data-slot":`input-otp`,containerClassName:q(`flex items-center gap-2 has-disabled:opacity-50`,t),className:q(`disabled:cursor-not-allowed`,e),...n})}function hy({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`input-otp-group`,className:q(`flex items-center`,e),...t})}function gy({index:e,className:t,...n}){let{char:r,hasFakeCaret:i,isActive:a}=v.useContext(uy)?.slots[e]??{};return(0,U.jsxs)(`div`,{"data-slot":`input-otp-slot`,"data-active":a,className:q(`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,U.jsx)(`div`,{className:`pointer-events-none absolute inset-0 flex items-center justify-center`,children:(0,U.jsx)(`div`,{className:`h-4 w-px animate-caret-blink bg-foreground duration-1000`})})]})}function _y({...e}){return(0,U.jsx)(`div`,{"data-slot":`input-otp-separator`,role:`separator`,...e,children:(0,U.jsx)(jo,{})})}function vy(){let{login:e}=ga(),{loading:t,error:n,request:r}=Vv(),i=dr(),[a,o]=(0,v.useState)(null),[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)(``),[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,C]=(0,v.useState)(!1);(0,v.useEffect)(()=>{fetch(`/cms/auth/setup`).then(e=>e.json()).then(e=>o(e.needsSetup)).catch(()=>o(!0))},[]);async function w(t){if(t.preventDefault(),m(null),a&&l!==d){m(`Passwords do not match`);return}try{if(h){let t=await r(`/cms/auth/login/2fa`,`POST`,{challengeToken:h,code:S?b.trim():_});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}),i(`/`);return}a&&await r(`/cms/auth/register`,`POST`,{email:s,password:l});let t=await r(`/cms/auth/login`,`POST`,{email:s,password:l});if(t.requiresTwoFactor&&t.challengeToken){g(t.challengeToken),y(``),x(``),C(!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}),i(`/`)}catch{m(h?`Invalid verification code.`:a?n??`Could not create account.`:`Invalid email or password.`)}}if(a===null)return null;let T=p;return(0,U.jsxs)(`div`,{className:`grid min-h-svh lg:grid-cols-2`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-4 p-6 md:p-10`,children:[(0,U.jsx)(`div`,{className:`flex items-center`,children:(0,U.jsx)(`img`,{src:`/admin/plank-logo-w.svg`,alt:`Plank CMS`,className:`h-10`})}),(0,U.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,U.jsxs)(`div`,{className:`w-full max-w-xs`,children:[(0,U.jsxs)(`div`,{className:`mb-6 text-center`,children:[(0,U.jsx)(`h1`,{className:`text-2xl font-bold`,children:a?`Create your account`:`Welcome back`}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:a?`Set up your admin account to get started`:`Enter your credentials to access the panel`})]}),(0,U.jsxs)(`form`,{onSubmit:w,className:`flex flex-col gap-4`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(X,{htmlFor:`email`,children:`Email`}),(0,U.jsx)(Hv,{id:`email`,type:`email`,placeholder:`you@example.com`,value:s,onChange:e=>c(e.target.value),required:!0})]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(X,{htmlFor:`password`,children:`Password`}),(0,U.jsx)(Hv,{id:`password`,type:`password`,value:l,onChange:e=>u(e.target.value),required:!0})]}),h&&(0,U.jsx)(U.Fragment,{children:S?(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(X,{htmlFor:`backup-code`,children:`Backup code`}),(0,U.jsx)(Hv,{id:`backup-code`,placeholder:`ABCD-EFGH`,value:b,onChange:e=>x(e.target.value.toUpperCase())}),(0,U.jsx)(J,{type:`button`,variant:`ghost`,className:`w-fit px-0 text-xs text-muted-foreground hover:text-foreground`,onClick:()=>{C(!1),x(``)},children:`Use authenticator code instead`})]}):(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(X,{children:`Verification code`}),(0,U.jsxs)(my,{maxLength:6,value:_,onChange:y,children:[(0,U.jsxs)(hy,{children:[(0,U.jsx)(gy,{index:0}),(0,U.jsx)(gy,{index:1}),(0,U.jsx)(gy,{index:2})]}),(0,U.jsx)(_y,{}),(0,U.jsxs)(hy,{children:[(0,U.jsx)(gy,{index:3}),(0,U.jsx)(gy,{index:4}),(0,U.jsx)(gy,{index:5})]})]}),(0,U.jsx)(J,{type:`button`,variant:`ghost`,className:`w-fit px-0 text-xs text-muted-foreground hover:text-foreground`,onClick:()=>{C(!0),y(``)},children:`Use backup code instead`})]})}),a&&(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(X,{htmlFor:`confirm`,children:`Confirm password`}),(0,U.jsx)(Hv,{id:`confirm`,type:`password`,value:d,onChange:e=>f(e.target.value),required:!0})]}),T&&(0,U.jsx)(`p`,{className:`text-sm text-destructive`,children:T}),(0,U.jsx)(J,{type:`submit`,disabled:t,className:`w-full`,children:t?`...`:h?`Verify code`:a?`Create account`:`Login`})]})]})})]}),(0,U.jsx)(`div`,{className:`hidden lg:block bg-center bg-cover bg-no-repeat`,style:{backgroundImage:`url(/admin/particles-texture.png)`}})]})}function yy({children:e}){let{content:t}=as();return(0,U.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 by({className:e,...t}){return(0,U.jsx)(ko,{role:`status`,"aria-label":`Loading`,className:q(`size-4 animate-spin`,e),...t})}var xy={year:`numeric`,month:`short`,day:`numeric`},Sy={year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`};function Cy(e,t,n=xy){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 wy(e,t){return Cy(e,t,Sy)}function Ty(e,t){return Dy(e,t).slice(11,16)}function Ey(e,t,n){return Oy(`${Dy(e.toISOString(),n).slice(0,10)}T${t}`,n)}function Dy(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 Oy(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 ky=`Collapsible`,[Ay,jy]=Ol(ky),[My,Ny]=Ay(ky),Py=v.forwardRef((e,t)=>{let{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:o,...s}=e,[c,l]=jl({prop:r,defaultProp:i??!1,onChange:o,caller:ky});return(0,U.jsx)(My,{scope:n,disabled:a,contentId:Ou(),open:c,onOpenToggle:v.useCallback(()=>l(e=>!e),[l]),children:(0,U.jsx)(Hl.div,{"data-state":By(c),"data-disabled":a?``:void 0,...s,ref:t})})});Py.displayName=ky;var Fy=`CollapsibleTrigger`,Iy=v.forwardRef((e,t)=>{let{__scopeCollapsible:n,...r}=e,i=Ny(Fy,n);return(0,U.jsx)(Hl.button,{type:`button`,"aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":By(i.open),"data-disabled":i.disabled?``:void 0,disabled:i.disabled,...r,ref:t,onClick:Y(e.onClick,i.onOpenToggle)})});Iy.displayName=Fy;var Ly=`CollapsibleContent`,Ry=v.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=Ny(Ly,e.__scopeCollapsible);return(0,U.jsx)(_p,{present:n||i.open,children:({present:e})=>(0,U.jsx)(zy,{...r,ref:t,present:e})})});Ry.displayName=Ly;var zy=v.forwardRef((e,t)=>{let{__scopeCollapsible:n,present:r,children:i,...a}=e,o=Ny(Ly,n),[s,c]=v.useState(r),l=v.useRef(null),u=ls(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)},[]),el(()=>{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,U.jsx)(Hl.div,{"data-state":By(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 By(e){return e?`open`:`closed`}var Vy=Py,Hy=Iy,Uy=Ry,Wy=`Accordion`,Gy=[`Home`,`End`,`ArrowDown`,`ArrowUp`,`ArrowLeft`,`ArrowRight`],[Ky,qy,Jy]=Wl(Wy),[Yy,Xy]=Ol(Wy,[Jy,jy]),Zy=jy(),Qy=v.forwardRef((e,t)=>{let{type:n,...r}=e,i=r,a=r;return(0,U.jsx)(Ky.Provider,{scope:e.__scopeAccordion,children:n===`multiple`?(0,U.jsx)(ib,{...a,ref:t}):(0,U.jsx)(rb,{...i,ref:t})})});Qy.displayName=Wy;var[$y,eb]=Yy(Wy),[tb,nb]=Yy(Wy,{collapsible:!1}),rb=v.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},collapsible:a=!1,...o}=e,[s,c]=jl({prop:n,defaultProp:r??``,onChange:i,caller:Wy});return(0,U.jsx)($y,{scope:e.__scopeAccordion,value:v.useMemo(()=>s?[s]:[],[s]),onItemOpen:c,onItemClose:v.useCallback(()=>a&&c(``),[a,c]),children:(0,U.jsx)(tb,{scope:e.__scopeAccordion,collapsible:a,children:(0,U.jsx)(sb,{...o,ref:t})})})}),ib=v.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=jl({prop:n,defaultProp:r??[],onChange:i,caller:Wy}),c=v.useCallback(e=>s((t=[])=>[...t,e]),[s]),l=v.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,U.jsx)($y,{scope:e.__scopeAccordion,value:o,onItemOpen:c,onItemClose:l,children:(0,U.jsx)(tb,{scope:e.__scopeAccordion,collapsible:!0,children:(0,U.jsx)(sb,{...a,ref:t})})})}),[ab,ob]=Yy(Wy),sb=v.forwardRef((e,t)=>{let{__scopeAccordion:n,disabled:r,dir:i,orientation:a=`vertical`,...o}=e,s=ls(v.useRef(null),t),c=qy(n),l=Kl(i)===`ltr`,u=Y(e.onKeyDown,e=>{if(!Gy.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,U.jsx)(ab,{scope:n,disabled:r,direction:i,orientation:a,children:(0,U.jsx)(Ky.Slot,{scope:n,children:(0,U.jsx)(Hl.div,{...o,"data-orientation":a,ref:s,onKeyDown:r?void 0:u})})})}),cb=`AccordionItem`,[lb,ub]=Yy(cb),db=v.forwardRef((e,t)=>{let{__scopeAccordion:n,value:r,...i}=e,a=ob(cb,n),o=eb(cb,n),s=Zy(n),c=Ou(),l=r&&o.value.includes(r)||!1,u=a.disabled||e.disabled;return(0,U.jsx)(lb,{scope:n,open:l,disabled:u,triggerId:c,children:(0,U.jsx)(Vy,{"data-orientation":a.orientation,"data-state":vb(l),...s,...i,ref:t,disabled:u,open:l,onOpenChange:e=>{e?o.onItemOpen(r):o.onItemClose(r)}})})});db.displayName=cb;var fb=`AccordionHeader`,pb=v.forwardRef((e,t)=>{let{__scopeAccordion:n,...r}=e,i=ob(Wy,n),a=ub(fb,n);return(0,U.jsx)(Hl.h3,{"data-orientation":i.orientation,"data-state":vb(a.open),"data-disabled":a.disabled?``:void 0,...r,ref:t})});pb.displayName=fb;var mb=`AccordionTrigger`,hb=v.forwardRef((e,t)=>{let{__scopeAccordion:n,...r}=e,i=ob(Wy,n),a=ub(mb,n),o=nb(mb,n),s=Zy(n);return(0,U.jsx)(Ky.ItemSlot,{scope:n,children:(0,U.jsx)(Hy,{"aria-disabled":a.open&&!o.collapsible||void 0,"data-orientation":i.orientation,id:a.triggerId,...s,...r,ref:t})})});hb.displayName=mb;var gb=`AccordionContent`,_b=v.forwardRef((e,t)=>{let{__scopeAccordion:n,...r}=e,i=ob(Wy,n),a=ub(gb,n),o=Zy(n);return(0,U.jsx)(Uy,{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}})});_b.displayName=gb;function vb(e){return e?`open`:`closed`}var yb=Qy,bb=db,xb=pb,Sb=hb,Cb=_b,wb=`Dialog`,[Tb,Eb]=Ol(wb),[Db,Ob]=Tb(wb),kb=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]=jl({prop:r,defaultProp:i??!1,onChange:a,caller:wb});return(0,U.jsx)(Db,{scope:t,triggerRef:s,contentRef:c,contentId:Ou(),titleId:Ou(),descriptionId:Ou(),open:l,onOpenChange:u,onOpenToggle:v.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})};kb.displayName=wb;var Ab=`DialogTrigger`,jb=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Ob(Ab,n),a=ls(t,i.triggerRef);return(0,U.jsx)(Hl.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Zb(i.open),...r,ref:a,onClick:Y(e.onClick,i.onOpenToggle)})});jb.displayName=Ab;var Mb=`DialogPortal`,[Nb,Pb]=Tb(Mb,{forceMount:void 0}),Fb=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Ob(Mb,t);return(0,U.jsx)(Nb,{scope:t,forceMount:n,children:v.Children.map(r,e=>(0,U.jsx)(_p,{present:n||a.open,children:(0,U.jsx)(hp,{asChild:!0,container:i,children:e})}))})};Fb.displayName=Mb;var Ib=`DialogOverlay`,Lb=v.forwardRef((e,t)=>{let n=Pb(Ib,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Ob(Ib,e.__scopeDialog);return a.modal?(0,U.jsx)(_p,{present:r||a.open,children:(0,U.jsx)(zb,{...i,ref:t})}):null});Lb.displayName=Ib;var Rb=Pl(`DialogOverlay.RemoveScroll`),zb=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Ob(Ib,n);return(0,U.jsx)(ah,{as:Rb,allowPinchZoom:!0,shards:[i.contentRef],children:(0,U.jsx)(Hl.div,{"data-state":Zb(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),Bb=`DialogContent`,Vb=v.forwardRef((e,t)=>{let n=Pb(Bb,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Ob(Bb,e.__scopeDialog);return(0,U.jsx)(_p,{present:r||a.open,children:a.modal?(0,U.jsx)(Hb,{...i,ref:t}):(0,U.jsx)(Ub,{...i,ref:t})})});Vb.displayName=Bb;var Hb=v.forwardRef((e,t)=>{let n=Ob(Bb,e.__scopeDialog),r=v.useRef(null),i=ls(t,n.contentRef,r);return v.useEffect(()=>{let e=r.current;if(e)return Xp(e)},[]),(0,U.jsx)(Wb,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Y(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Y(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:Y(e.onFocusOutside,e=>e.preventDefault())})}),Ub=v.forwardRef((e,t)=>{let n=Ob(Bb,e.__scopeDialog),r=v.useRef(!1),i=v.useRef(!1);return(0,U.jsx)(Wb,{...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()}})}),Wb=v.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Ob(Bb,n),c=v.useRef(null),l=ls(t,c);return cu(),(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(mu,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,U.jsx)(eu,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":Zb(s.open),...o,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(tx,{titleId:s.titleId}),(0,U.jsx)(rx,{contentRef:c,descriptionId:s.descriptionId})]})]})}),Gb=`DialogTitle`,Kb=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Ob(Gb,n);return(0,U.jsx)(Hl.h2,{id:i.titleId,...r,ref:t})});Kb.displayName=Gb;var qb=`DialogDescription`,Jb=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Ob(qb,n);return(0,U.jsx)(Hl.p,{id:i.descriptionId,...r,ref:t})});Jb.displayName=qb;var Yb=`DialogClose`,Xb=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Ob(Yb,n);return(0,U.jsx)(Hl.button,{type:`button`,...r,ref:t,onClick:Y(e.onClick,()=>i.onOpenChange(!1))})});Xb.displayName=Yb;function Zb(e){return e?`open`:`closed`}var Qb=`DialogTitleWarning`,[$b,ex]=Dl(Qb,{contentName:Bb,titleName:Gb,docsSlug:`dialog`}),tx=({titleId:e})=>{let t=ex(Qb),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
72
+
73
+ If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
74
+
75
+ 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},nx=`DialogDescriptionWarning`,rx=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${ex(nx).contentName}}.`;return v.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},ix=kb,ax=Fb,ox=Lb,sx=Vb,cx=Kb,lx=Jb,ux=Xb;function dx(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 fx=`Checkbox`,[px,mx]=Ol(fx),[hx,gx]=px(fx);function _x(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]=jl({prop:n,defaultProp:i??!1,onChange:c,caller:fx}),[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:Ex(i)?!1:i,isFormControl:b,bubbleInput:g,setBubbleInput:_};return(0,U.jsx)(hx,{scope:t,...x,children:Tx(d)?d(x):r})}var vx=`CheckboxTrigger`,yx=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}=gx(vx,e),h=ls(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,U.jsx)(Hl.button,{type:`button`,role:`checkbox`,"aria-checked":Ex(c)?`mixed`:c,"aria-required":l,"data-state":Dx(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:h,onKeyDown:Y(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:Y(n,e=>{d(e=>Ex(e)?!0:!e),m&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});yx.displayName=vx;var bx=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,U.jsx)(_x,{__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,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(yx,{...d,ref:t,__scopeCheckbox:n}),e&&(0,U.jsx)(wx,{__scopeCheckbox:n})]})})});bx.displayName=fx;var xx=`CheckboxIndicator`,Sx=v.forwardRef((e,t)=>{let{__scopeCheckbox:n,forceMount:r,...i}=e,a=gx(xx,n);return(0,U.jsx)(_p,{present:r||Ex(a.checked)||a.checked===!0,children:(0,U.jsx)(Hl.span,{"data-state":Dx(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})});Sx.displayName=xx;var Cx=`CheckboxBubbleInput`,wx=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}=gx(Cx,e),m=ls(n,p),h=dx(a),g=Gf(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=Ex(a),n.call(e,Ex(a)?!1:a),e.dispatchEvent(t)}},[f,h,a,i]);let _=v.useRef(Ex(a)?!1:a);return(0,U.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%)`}})});wx.displayName=Cx;function Tx(e){return typeof e==`function`}function Ex(e){return e===`indeterminate`}function Dx(e){return Ex(e)?`indeterminate`:e?`checked`:`unchecked`}function Ox(e,[t,n]){return Math.min(n,Math.max(t,e))}var kx=`Popover`,[Ax,jx]=Ol(kx,[Jf]),Mx=Jf(),[Nx,Px]=Ax(kx),Fx=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=Mx(t),c=v.useRef(null),[l,u]=v.useState(!1),[d,f]=jl({prop:r,defaultProp:i??!1,onChange:a,caller:kx});return(0,U.jsx)(up,{...s,children:(0,U.jsx)(Nx,{scope:t,contentId:Ou(),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})})};Fx.displayName=kx;var Ix=`PopoverAnchor`,Lx=v.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Px(Ix,n),a=Mx(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return v.useEffect(()=>(o(),()=>s()),[o,s]),(0,U.jsx)(dp,{...a,...r,ref:t})});Lx.displayName=Ix;var Rx=`PopoverTrigger`,zx=v.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Px(Rx,n),a=Mx(n),o=ls(t,i.triggerRef),s=(0,U.jsx)(Hl.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":eS(i.open),...r,ref:o,onClick:Y(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,U.jsx)(dp,{asChild:!0,...a,children:s})});zx.displayName=Rx;var Bx=`PopoverPortal`,[Vx,Hx]=Ax(Bx,{forceMount:void 0}),Ux=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=Px(Bx,t);return(0,U.jsx)(Vx,{scope:t,forceMount:n,children:(0,U.jsx)(_p,{present:n||a.open,children:(0,U.jsx)(hp,{asChild:!0,container:i,children:r})})})};Ux.displayName=Bx;var Wx=`PopoverContent`,Gx=v.forwardRef((e,t)=>{let n=Hx(Wx,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=Px(Wx,e.__scopePopover);return(0,U.jsx)(_p,{present:r||a.open,children:a.modal?(0,U.jsx)(qx,{...i,ref:t}):(0,U.jsx)(Jx,{...i,ref:t})})});Gx.displayName=Wx;var Kx=Pl(`PopoverContent.RemoveScroll`),qx=v.forwardRef((e,t)=>{let n=Px(Wx,e.__scopePopover),r=v.useRef(null),i=ls(t,r),a=v.useRef(!1);return v.useEffect(()=>{let e=r.current;if(e)return Xp(e)},[]),(0,U.jsx)(ah,{as:Kx,allowPinchZoom:!0,children:(0,U.jsx)(Yx,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Y(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:Y(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:Y(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),Jx=v.forwardRef((e,t)=>{let n=Px(Wx,e.__scopePopover),r=v.useRef(!1),i=v.useRef(!1);return(0,U.jsx)(Yx,{...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()}})}),Yx=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=Px(Wx,n),p=Mx(n);return cu(),(0,U.jsx)(mu,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,U.jsx)(eu,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,U.jsx)(fp,{"data-state":eS(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)`}})})})}),Xx=`PopoverClose`,Zx=v.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Px(Xx,n);return(0,U.jsx)(Hl.button,{type:`button`,...r,ref:t,onClick:Y(e.onClick,()=>i.onOpenChange(!1))})});Zx.displayName=Xx;var Qx=`PopoverArrow`,$x=v.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Mx(n);return(0,U.jsx)(pp,{...i,...r,ref:t})});$x.displayName=Qx;function eS(e){return e?`open`:`closed`}var tS=Fx,nS=zx,rS=Ux,iS=Gx,aS=[` `,`Enter`,`ArrowUp`,`ArrowDown`],oS=[` `,`Enter`],sS=`Select`,[cS,lS,uS]=Wl(sS),[dS,fS]=Ol(sS,[uS,Jf]),pS=Jf(),[mS,hS]=dS(sS),[gS,_S]=dS(sS),vS=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=pS(t),[g,_]=v.useState(null),[y,b]=v.useState(null),[x,S]=v.useState(!1),C=Kl(l),[w,T]=jl({prop:r,defaultProp:i??!1,onChange:a,caller:sS}),[E,D]=jl({prop:o,defaultProp:s,onChange:c,caller:sS}),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,U.jsx)(up,{...h,children:(0,U.jsxs)(mS,{required:p,scope:t,trigger:g,onTriggerChange:_,valueNode:y,onValueNodeChange:b,valueNodeHasChildren:x,onValueNodeHasChildrenChange:S,contentId:Ou(),value:E,onValueChange:D,open:w,onOpenChange:T,dir:C,triggerPointerDownPosRef:O,disabled:f,children:[(0,U.jsx)(cS.Provider,{scope:t,children:(0,U.jsx)(gS,{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,U.jsxs)(pC,{"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,U.jsx)(`option`,{value:``}):null,Array.from(A)]},M):null]})})};vS.displayName=sS;var yS=`SelectTrigger`,bS=v.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=pS(n),o=hS(yS,n),s=o.disabled||r,c=ls(t,o.onTriggerChange),l=lS(n),u=v.useRef(`touch`),[d,f,p]=hC(e=>{let t=l().filter(e=>!e.disabled),n=gC(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,U.jsx)(dp,{asChild:!0,...a,children:(0,U.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":mC(o.value)?``:void 0,...i,ref:c,onClick:Y(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:Y(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:Y(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&aS.includes(e.key)&&(m(),e.preventDefault())})})})});bS.displayName=yS;var xS=`SelectValue`,SS=v.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=hS(xS,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=ls(t,c.onValueNodeChange);return el(()=>{l(u)},[l,u]),(0,U.jsx)(Hl.span,{...s,ref:d,style:{pointerEvents:`none`},children:mC(c.value)?(0,U.jsx)(U.Fragment,{children:o}):a})});SS.displayName=xS;var CS=`SelectIcon`,wS=v.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,U.jsx)(Hl.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});wS.displayName=CS;var TS=`SelectPortal`,ES=e=>(0,U.jsx)(hp,{asChild:!0,...e});ES.displayName=TS;var DS=`SelectContent`,OS=v.forwardRef((e,t)=>{let n=hS(DS,e.__scopeSelect),[r,i]=v.useState();if(el(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?N.createPortal((0,U.jsx)(AS,{scope:e.__scopeSelect,children:(0,U.jsx)(cS.Slot,{scope:e.__scopeSelect,children:(0,U.jsx)(`div`,{children:e.children})})}),t):null}return(0,U.jsx)(PS,{...e,ref:t})});OS.displayName=DS;var kS=10,[AS,jS]=dS(DS),MS=`SelectContentImpl`,NS=Pl(`SelectContent.RemoveScroll`),PS=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=hS(DS,n),[b,x]=v.useState(null),[S,C]=v.useState(null),w=ls(t,e=>x(e)),[T,E]=v.useState(null),[D,O]=v.useState(null),k=lS(n),[A,j]=v.useState(!1),M=v.useRef(!1);v.useEffect(()=>{if(b)return Xp(b)},[b]),cu();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]=hC(e=>{let t=k().filter(e=>!e.disabled),n=gC(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`?RS:IS,B=z===RS?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,U.jsx)(AS,{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,U.jsx)(ah,{as:NS,allowPinchZoom:!0,children:(0,U.jsx)(mu,{asChild:!0,trapped:y.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:Y(i,e=>{y.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,U.jsx)(eu,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:(0,U.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:Y(_.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()}})})})})})})});PS.displayName=MS;var FS=`SelectItemAlignedPosition`,IS=v.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=hS(DS,n),o=jS(DS,n),[s,c]=v.useState(null),[l,u]=v.useState(null),d=ls(t,e=>u(e)),f=lS(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-kS,d=Ox(a,[kS,Math.max(kS,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-kS,d=Ox(a,[kS,Math.max(kS,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-kS*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-kS,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=`${kS}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]);el(()=>b(),[b]);let[x,S]=v.useState();return el(()=>{l&&S(window.getComputedStyle(l).zIndex)},[l]),(0,U.jsx)(zS,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:v.useCallback(e=>{e&&m.current===!0&&(b(),y?.(),m.current=!1)},[b,y]),children:(0,U.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:x},children:(0,U.jsx)(Hl.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});IS.displayName=FS;var LS=`SelectPopperPosition`,RS=v.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=kS,...a}=e,o=pS(n);return(0,U.jsx)(fp,{...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)`}})});RS.displayName=LS;var[zS,BS]=dS(DS,{}),VS=`SelectViewport`,HS=v.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=jS(VS,n),o=BS(VS,n),s=ls(t,a.onViewportChange),c=v.useRef(0);return(0,U.jsxs)(U.Fragment,{children:[(0,U.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,U.jsx)(cS.Slot,{scope:n,children:(0,U.jsx)(Hl.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:Y(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-kS*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})})})]})});HS.displayName=VS;var US=`SelectGroup`,[WS,GS]=dS(US),KS=v.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Ou();return(0,U.jsx)(WS,{scope:n,id:i,children:(0,U.jsx)(Hl.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});KS.displayName=US;var qS=`SelectLabel`,JS=v.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=GS(qS,n);return(0,U.jsx)(Hl.div,{id:i.id,...r,ref:t})});JS.displayName=qS;var YS=`SelectItem`,[XS,ZS]=dS(YS),QS=v.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=hS(YS,n),c=jS(YS,n),l=s.value===r,[u,d]=v.useState(a??``),[f,p]=v.useState(!1),m=ls(t,e=>c.itemRefCallback?.(e,r,i)),h=Ou(),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,U.jsx)(XS,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:v.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,U.jsx)(cS.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,U.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:Y(o.onFocus,()=>p(!0)),onBlur:Y(o.onBlur,()=>p(!1)),onClick:Y(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:Y(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:Y(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:Y(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Y(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:Y(o.onKeyDown,e=>{c.searchRef?.current!==``&&e.key===` `||(oS.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})});QS.displayName=YS;var $S=`SelectItemText`,eC=v.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=hS($S,n),s=jS($S,n),c=ZS($S,n),l=_S($S,n),[u,d]=v.useState(null),f=ls(t,e=>d(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=u?.textContent,m=v.useMemo(()=>(0,U.jsx)(`option`,{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:g}=l;return el(()=>(h(m),()=>g(m)),[h,g,m]),(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Hl.span,{id:c.textId,...a,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?N.createPortal(a.children,o.valueNode):null]})});eC.displayName=$S;var tC=`SelectItemIndicator`,nC=v.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return ZS(tC,n).isSelected?(0,U.jsx)(Hl.span,{"aria-hidden":!0,...r,ref:t}):null});nC.displayName=tC;var rC=`SelectScrollUpButton`,iC=v.forwardRef((e,t)=>{let n=jS(rC,e.__scopeSelect),r=BS(rC,e.__scopeSelect),[i,a]=v.useState(!1),o=ls(t,r.onScrollButtonChange);return el(()=>{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,U.jsx)(sC,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});iC.displayName=rC;var aC=`SelectScrollDownButton`,oC=v.forwardRef((e,t)=>{let n=jS(aC,e.__scopeSelect),r=BS(aC,e.__scopeSelect),[i,a]=v.useState(!1),o=ls(t,r.onScrollButtonChange);return el(()=>{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,U.jsx)(sC,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});oC.displayName=aC;var sC=v.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=jS(`SelectScrollButton`,n),o=v.useRef(null),s=lS(n),c=v.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return v.useEffect(()=>()=>c(),[c]),el(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,U.jsx)(Hl.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:Y(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:Y(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:Y(i.onPointerLeave,()=>{c()})})}),cC=`SelectSeparator`,lC=v.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,U.jsx)(Hl.div,{"aria-hidden":!0,...r,ref:t})});lC.displayName=cC;var uC=`SelectArrow`,dC=v.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=pS(n),a=hS(uC,n),o=jS(uC,n);return a.open&&o.position===`popper`?(0,U.jsx)(pp,{...i,...r,ref:t}):null});dC.displayName=uC;var fC=`SelectBubbleInput`,pC=v.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=v.useRef(null),a=ls(r,i),o=dx(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,U.jsx)(Hl.select,{...n,style:{...G_,...n.style},ref:a,defaultValue:t})});pC.displayName=fC;function mC(e){return e===``||e===void 0}function hC(e){let t=$c(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 gC(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=_C(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 _C(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var vC=vS,yC=bS,bC=SS,xC=wS,SC=ES,CC=OS,wC=HS,TC=KS,EC=JS,DC=QS,OC=eC,kC=nC,AC=iC,jC=oC,MC=lC,NC=`Separator`,PC=`horizontal`,FC=[`horizontal`,`vertical`],IC=v.forwardRef((e,t)=>{let{decorative:n,orientation:r=PC,...i}=e,a=LC(r)?r:PC,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,U.jsx)(Hl.div,{"data-orientation":a,...o,...i,ref:t})});IC.displayName=NC;function LC(e){return FC.includes(e)}var RC=IC,zC=`Switch`,[BC,VC]=Ol(zC),[HC,UC]=BC(zC),WC=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=ls(t,e=>p(e)),h=v.useRef(!1),g=f?u||!!f.closest(`form`):!0,[_,y]=jl({prop:i,defaultProp:a??!1,onChange:l,caller:zC});return(0,U.jsxs)(HC,{scope:n,checked:_,disabled:s,children:[(0,U.jsx)(Hl.button,{type:`button`,role:`switch`,"aria-checked":_,"aria-required":o,"data-state":YC(_),"data-disabled":s?``:void 0,disabled:s,value:c,...d,ref:m,onClick:Y(e.onClick,e=>{y(e=>!e),g&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})}),g&&(0,U.jsx)(JC,{control:f,bubbles:!h.current,name:r,value:c,checked:_,required:o,disabled:s,form:u,style:{transform:`translateX(-100%)`}})]})});WC.displayName=zC;var GC=`SwitchThumb`,KC=v.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=UC(GC,n);return(0,U.jsx)(Hl.span,{"data-state":YC(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});KC.displayName=GC;var qC=`SwitchBubbleInput`,JC=v.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=v.useRef(null),s=ls(o,a),c=dx(n),l=Gf(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,U.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}})});JC.displayName=qC;function YC(e){return e?`checked`:`unchecked`}var XC=WC,ZC=KC,QC=`Tabs`,[$C,ew]=Ol(QC,[Op]),tw=Op(),[nw,rw]=$C(QC),iw=v.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=Kl(s),[d,f]=jl({prop:r,onChange:i,defaultProp:a??``,caller:QC});return(0,U.jsx)(nw,{scope:n,baseId:Ou(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,U.jsx)(Hl.div,{dir:u,"data-orientation":o,...l,ref:t})})});iw.displayName=QC;var aw=`TabsList`,ow=v.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=rw(aw,n),o=tw(n);return(0,U.jsx)(Bp,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,U.jsx)(Hl.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});ow.displayName=aw;var sw=`TabsTrigger`,cw=v.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=rw(sw,n),s=tw(n),c=dw(o.baseId,r),l=fw(o.baseId,r),u=r===o.value;return(0,U.jsx)(Vp,{asChild:!0,...s,focusable:!i,active:u,children:(0,U.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:Y(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:Y(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:Y(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});cw.displayName=sw;var lw=`TabsContent`,uw=v.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=rw(lw,n),c=dw(s.baseId,r),l=fw(s.baseId,r),u=r===s.value,d=v.useRef(u);return v.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,U.jsx)(_p,{present:i||u,children:({present:n})=>(0,U.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})})});uw.displayName=lw;function dw(e,t){return`${e}-trigger-${t}`}function fw(e,t){return`${e}-content-${t}`}var pw=iw,mw=ow,hw=cw,gw=uw,_w=Ts(`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 vw({className:e,variant:t=`default`,asChild:n=!1,...r}){return(0,U.jsx)(n?Fl:`span`,{"data-slot":`badge`,"data-variant":t,className:q(_w({variant:t}),e),...r})}var yw=ix,bw=ax,xw=ux,Sw=v.forwardRef(({className:e,...t},n)=>(0,U.jsx)(ox,{ref:n,className:q(`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}));Sw.displayName=ox.displayName;var Cw=v.forwardRef(({className:e,children:t,...n},r)=>(0,U.jsxs)(bw,{children:[(0,U.jsx)(Sw,{}),(0,U.jsxs)(sx,{ref:r,className:q(`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,U.jsxs)(xw,{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,U.jsx)(ns,{className:`size-4`}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Close`})]}),t]})]}));Cw.displayName=sx.displayName;var ww=({className:e,...t})=>(0,U.jsx)(`div`,{className:q(`flex flex-col space-y-1.5 text-center sm:text-left`,e),...t});ww.displayName=`DialogHeader`;var Tw=({className:e,...t})=>(0,U.jsx)(`div`,{className:q(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});Tw.displayName=`DialogFooter`;var Ew=v.forwardRef(({className:e,...t},n)=>(0,U.jsx)(cx,{ref:n,className:q(`text-lg font-semibold leading-none tracking-tight`,e),...t}));Ew.displayName=cx.displayName;var Dw=v.forwardRef(({className:e,...t},n)=>(0,U.jsx)(lx,{ref:n,className:q(`text-sm text-muted-foreground`,e),...t}));Dw.displayName=lx.displayName;var Ow=vC,kw=TC,Aw=bC,jw=v.forwardRef(({className:e,children:t,...n},r)=>(0,U.jsxs)(yC,{ref:r,className:q(`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,U.jsx)(xC,{asChild:!0,children:(0,U.jsx)(Ba,{className:`size-4 opacity-50`})})]}));jw.displayName=yC.displayName;var Mw=v.forwardRef(({className:e,...t},n)=>(0,U.jsx)(AC,{ref:n,className:q(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,U.jsx)(Ua,{className:`size-4`})}));Mw.displayName=AC.displayName;var Nw=v.forwardRef(({className:e,...t},n)=>(0,U.jsx)(jC,{ref:n,className:q(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,U.jsx)(Ba,{className:`size-4`})}));Nw.displayName=jC.displayName;var Pw=v.forwardRef(({className:e,children:t,position:n=`popper`,...r},i)=>(0,U.jsx)(SC,{children:(0,U.jsxs)(CC,{ref:i,className:q(`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,U.jsx)(Mw,{}),(0,U.jsx)(wC,{className:q(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`),children:t}),(0,U.jsx)(Nw,{})]})}));Pw.displayName=CC.displayName;var Fw=v.forwardRef(({className:e,...t},n)=>(0,U.jsx)(EC,{ref:n,className:q(`px-2 py-1.5 text-sm font-semibold`,e),...t}));Fw.displayName=EC.displayName;var Iw=v.forwardRef(({className:e,children:t,...n},r)=>(0,U.jsxs)(DC,{ref:r,className:q(`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,U.jsx)(`span`,{className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,U.jsx)(kC,{children:(0,U.jsx)(za,{className:`size-4`})})}),(0,U.jsx)(OC,{children:t})]}));Iw.displayName=DC.displayName;var Lw=v.forwardRef(({className:e,...t},n)=>(0,U.jsx)(MC,{ref:n,className:q(`-mx-1 my-1 h-px bg-muted`,e),...t}));Lw.displayName=MC.displayName;var Rw=v.forwardRef(({className:e,...t},n)=>(0,U.jsx)(`div`,{className:`relative w-full overflow-auto`,children:(0,U.jsx)(`table`,{ref:n,className:q(`w-full caption-bottom text-sm`,e),...t})}));Rw.displayName=`Table`;var zw=v.forwardRef(({className:e,...t},n)=>(0,U.jsx)(`thead`,{ref:n,className:q(`[&_tr]:border-b`,e),...t}));zw.displayName=`TableHeader`;var Bw=v.forwardRef(({className:e,...t},n)=>(0,U.jsx)(`tbody`,{ref:n,className:q(`[&_tr:last-child]:border-0`,e),...t}));Bw.displayName=`TableBody`;var Vw=v.forwardRef(({className:e,...t},n)=>(0,U.jsx)(`tr`,{ref:n,className:q(`border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted`,e),...t}));Vw.displayName=`TableRow`;var Hw=v.forwardRef(({className:e,...t},n)=>(0,U.jsx)(`th`,{ref:n,className:q(`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}));Hw.displayName=`TableHead`;var Uw=v.forwardRef(({className:e,...t},n)=>(0,U.jsx)(`td`,{ref:n,className:q(`p-4 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,e),...t}));Uw.displayName=`TableCell`;var Ww=v.forwardRef(({className:e,...t},n)=>(0,U.jsx)(`caption`,{ref:n,className:q(`mt-4 text-sm text-muted-foreground`,e),...t}));Ww.displayName=`TableCaption`;var Gw=`plank_dashboard_recent_entry_fields`;function Kw(){let e=dr(),{timezone:t}=ya(),{user:n}=ga(),{data:r}=wa(`/cms/admin/content-types`),[i,a]=(0,v.useState)([]),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)({}),f=n?.permissions??[],p=f.includes(`*`)||f.includes(`entries:write`),m=f.includes(`*`)||f.includes(`entries:read`),h=(0,v.useMemo)(()=>(r??[]).filter(e=>e.kind===`collection`),[r]);function g(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 _(e){return e==null||e===``?`Untitled`:typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):JSON.stringify(e)}(0,v.useEffect)(()=>{try{let e=localStorage.getItem(Gw);if(!e)return;d(JSON.parse(e))}catch{}},[]),(0,v.useEffect)(()=>{h.length!==0&&d(e=>{let t={...e},n=!1;for(let e of h)t[e.slug]||(t[e.slug]=g(e),n=!0);return n?t:e})},[h]),(0,v.useEffect)(()=>{localStorage.setItem(Gw,JSON.stringify(u))},[u]);function y(){!r||r.length===0||e(`/content/${(r.find(e=>e.isDefault)??r[0]).slug}/new`)}(0,v.useEffect)(()=>{if(!m||h.length===0){a([]);return}let e=new AbortController,t=localStorage.getItem(`plank_token`),n={"Content-Type":`application/json`,...t?{Authorization:`Bearer ${t}`}:{}};return s(!0),Promise.all(h.map(async t=>{let r=await fetch(`/cms/admin/content-types/${t.slug}/entries?page=1&limit=50&sort=published_at&order=desc`,{headers:n,signal:e.signal});return r.ok?((await r.json()).data??[]).filter(e=>e.status===`published`&&!!e.published_at).map(e=>({...e,slug:t.slug,contentTypeName:t.name})):[]})).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(()=>s(!1)),()=>e.abort()},[m,h]);function b({entry:e}){let t=e._author_first_name,n=e._author_last_name,r=t||n?[t,n].filter(Boolean).join(` `):null,i=(0,U.jsx)(El,{avatarUrl:e._author_avatar_url,firstName:e._author_first_name,lastName:e._author_last_name,className:`size-7`,fallbackClassName:`text-[10px]`});return r?(0,U.jsxs)(Fv,{children:[(0,U.jsx)(Iv,{asChild:!0,children:i}),(0,U.jsx)(Lv,{children:r})]}):i}return(0,U.jsxs)(`div`,{children:[(0,U.jsx)(yy,{children:(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,U.jsx)(`h1`,{className:`text-2xl font-bold -mt-2`,children:`Plank Forge`}),p&&(0,U.jsxs)(J,{onClick:y,disabled:!r||r.length===0,children:[(0,U.jsx)(Po,{className:`size-4`}),`New entry`]})]})}),(0,U.jsx)(`section`,{className:`mt-24`,children:(0,U.jsx)(Pv,{children:(0,U.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-border bg-background`,children:(0,U.jsxs)(Rw,{className:`w-full text-sm`,children:[(0,U.jsxs)(zw,{className:`border-b border-border font-bold uppercase`,children:[(0,U.jsx)(Vw,{className:`hover:bg-transparent`,children:(0,U.jsx)(Hw,{colSpan:4,className:`px-4 py-3 h-auto`,children:(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:`Recent content`}),(0,U.jsxs)(yw,{open:c,onOpenChange:l,children:[(0,U.jsx)(J,{size:`icon`,variant:`outline`,onClick:()=>l(!0),children:(0,U.jsx)(Xa,{className:`size-4`})}),(0,U.jsxs)(Cw,{className:`max-w-lg`,children:[(0,U.jsx)(ww,{children:(0,U.jsx)(Ew,{children:`Recent content fields`})}),(0,U.jsx)(`div`,{className:`space-y-4`,children:h.map(e=>(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(X,{htmlFor:`recent-field-${e.slug}`,children:e.name}),(0,U.jsxs)(Ow,{value:u[e.slug]??g(e),onValueChange:t=>d(n=>({...n,[e.slug]:t})),children:[(0,U.jsx)(jw,{id:`recent-field-${e.slug}`,children:(0,U.jsx)(Aw,{})}),(0,U.jsxs)(Pw,{children:[(0,U.jsx)(Iw,{value:`id`,children:`id`}),e.fields.map(e=>(0,U.jsx)(Iw,{value:e.name,children:e.name},e.name))]})]})]},e.slug))})]})]})]})})}),(0,U.jsxs)(Vw,{className:`border-t border-border hover:bg-transparent`,children:[(0,U.jsx)(Hw,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:`Entry`}),(0,U.jsx)(Hw,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:`Collection Type`}),(0,U.jsx)(Hw,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:`Author`}),(0,U.jsx)(Hw,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:`Published`})]})]}),(0,U.jsx)(Bw,{children:o?(0,U.jsx)(Vw,{className:`border-b`,children:(0,U.jsx)(Uw,{colSpan:4,className:`h-24`,children:(0,U.jsx)(by,{className:`mx-auto size-5`})})}):i.length===0?(0,U.jsx)(Vw,{className:`border-b`,children:(0,U.jsx)(Uw,{colSpan:4,className:`h-24 text-center text-muted-foreground`,children:`No recent entries found.`})}):i.map(n=>(0,U.jsxs)(Vw,{className:`border-b last:border-b-0 transition-colors hover:bg-muted/50`,children:[(0,U.jsx)(Uw,{className:`px-4 py-3 align-middle`,children:(0,U.jsx)(`button`,{type:`button`,onClick:()=>e(`/content/${n.slug}/${n.id}`),className:`text-left hover:underline`,children:(0,U.jsx)(`div`,{className:`font-medium`,children:_(n[u[n.slug]??g(h.find(e=>e.slug===n.slug)??{slug:n.slug,name:n.contentTypeName,kind:`collection`,isDefault:!1,fields:[]})])})})}),(0,U.jsx)(Uw,{className:`px-4 py-3 align-middle`,children:(0,U.jsx)(vw,{variant:`outline`,children:n.contentTypeName})}),(0,U.jsx)(Uw,{className:`px-4 py-3 align-middle`,children:(0,U.jsx)(b,{entry:n})}),(0,U.jsx)(Uw,{className:`px-4 py-3 align-middle`,children:n.published_at?Cy(n.published_at,t):`—`})]},`${n.slug}-${n.id}`))})]})})})})]})}function qw(e){let{setContent:t}=as();(0,v.useEffect)(()=>(t(e),()=>t(null)),[])}function Jw(){let e=dr(),{pathname:t}=cr(),{data:n,loading:r,error:i,refetch:a}=wa(`/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,U.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,U.jsx)(`div`,{className:`border-b border-sidebar-border px-4 py-3`,children:(0,U.jsx)(`p`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider`,children:`Content Types`})}),(0,U.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[r&&(0,U.jsx)(`div`,{className:`flex items-center justify-center py-6`,children:(0,U.jsx)(by,{className:`size-4`})}),i&&(0,U.jsx)(`p`,{className:`px-4 py-3 text-xs text-destructive`,children:i}),!r&&!i&&(n??[]).length===0&&(0,U.jsx)(`p`,{className:`px-4 py-3 text-xs text-muted-foreground`,children:`No content types yet.`}),!r&&!i&&(n??[]).length>0&&(0,U.jsx)(`nav`,{className:`flex flex-col gap-0.5 p-2`,children:(n??[]).map(e=>(0,U.jsxs)(qi,{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,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),e.kind===`single`&&(0,U.jsx)(ao,{className:`size-3.5 shrink-0 text-violet-500 dark:text-violet-400`})]},e.slug))})]}),(0,U.jsx)(`div`,{className:`border-t border-sidebar-border p-3`,children:(0,U.jsxs)(J,{variant:`outline`,className:`w-full justify-start gap-2`,onClick:()=>e(`/content-types/new`),children:[(0,U.jsx)(Po,{className:`size-3.5`}),`New Content Type`]})})]})}function Yw(){return qw((0,U.jsx)(Jw,{})),(0,U.jsx)(Qr,{})}function Xw({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`empty`,className:q(`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 Zw({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`empty-header`,className:q(`flex max-w-sm flex-col items-center gap-2 text-center`,e),...t})}var Qw=Ts(`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 $w({className:e,variant:t=`default`,...n}){return(0,U.jsx)(`div`,{"data-slot":`empty-icon`,"data-variant":t,className:q(Qw({variant:t,className:e})),...n})}function eT({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`empty-title`,className:q(`text-lg font-medium tracking-tight`,e),...t})}function tT({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`empty-description`,className:q(`text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,e),...t})}function nT({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`empty-content`,className:q(`flex w-full max-w-sm min-w-0 flex-col items-center gap-4 text-sm text-balance`,e),...t})}function rT(){let e=dr(),{data:t,loading:n}=wa(`/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,U.jsxs)(Xw,{className:`border`,children:[(0,U.jsxs)(Zw,{children:[(0,U.jsx)($w,{variant:`icon`,children:(0,U.jsx)(xo,{})}),(0,U.jsx)(eT,{children:`No content types yet`}),(0,U.jsx)(tT,{children:`Content types define the structure of your data. Create your first one to start managing content.`})]}),(0,U.jsx)(nT,{children:(0,U.jsx)(J,{onClick:()=>e(`/content-types/new`),children:`Create content type`})})]})}function iT(){var e=[...arguments];return(0,v.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var aT=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function oT(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function sT(e){return`nodeType`in e}function cT(e){return e?oT(e)?e:sT(e)?e.ownerDocument?.defaultView??window:window:window}function lT(e){let{Document:t}=cT(e);return e instanceof t}function uT(e){return oT(e)?!1:e instanceof cT(e).HTMLElement}function dT(e){return e instanceof cT(e).SVGElement}function fT(e){return e?oT(e)?e.document:sT(e)?lT(e)?e:uT(e)||dT(e)?e.ownerDocument:document:document:document}var pT=aT?v.useLayoutEffect:v.useEffect;function mT(e){let t=(0,v.useRef)(e);return pT(()=>{t.current=e}),(0,v.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function hT(){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 gT(e,t){t===void 0&&(t=[e]);let n=(0,v.useRef)(e);return pT(()=>{n.current!==e&&(n.current=e)},t),n}function _T(e,t){let n=(0,v.useRef)();return(0,v.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function vT(e){let t=mT(e),n=(0,v.useRef)(null);return[n,(0,v.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function yT(e){let t=(0,v.useRef)();return(0,v.useEffect)(()=>{t.current=e},[e]),t.current}var bT={};function xT(e,t){return(0,v.useMemo)(()=>{if(t)return t;let n=bT[e]==null?0:bT[e]+1;return bT[e]=n,e+`-`+n},[e,t])}function ST(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 CT=ST(1),wT=ST(-1);function TT(e){return`clientX`in e&&`clientY`in e}function ET(e){if(!e)return!1;let{KeyboardEvent:t}=cT(e.target);return t&&e instanceof t}function DT(e){if(!e)return!1;let{TouchEvent:t}=cT(e.target);return t&&e instanceof t}function OT(e){if(DT(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 TT(e)?{x:e.clientX,y:e.clientY}:null}var kT=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[kT.Translate.toString(e),kT.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),AT=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function jT(e){return e.matches(AT)?e:e.querySelector(AT)}var MT={display:`none`};function NT(e){let{id:t,value:n}=e;return v.createElement(`div`,{id:t,style:MT},n)}function PT(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 FT(){let[e,t]=(0,v.useState)(``);return{announce:(0,v.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var IT=(0,v.createContext)(null);function LT(e){let t=(0,v.useContext)(IT);(0,v.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function RT(){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 zT={draggable:`
76
+ To pick up a draggable item, press the space bar.
77
+ While dragging, use the arrow keys to move the item.
78
+ Press space again to drop the item in its new position, or press escape to cancel.
79
+ `},BT={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 VT(e){let{announcements:t=BT,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=zT}=e,{announce:a,announcement:o}=FT(),s=xT(`DndLiveRegion`),[c,l]=(0,v.useState)(!1);if((0,v.useEffect)(()=>{l(!0)},[]),LT((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(NT,{id:r,value:i.draggable}),v.createElement(PT,{id:s,announcement:o}));return n?(0,N.createPortal)(u,n):u}var HT;(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`})(HT||={});function UT(){}function WT(e,t){return(0,v.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function GT(){var e=[...arguments];return(0,v.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var KT=Object.freeze({x:0,y:0});function qT(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function JT(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function YT(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function XT(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function ZT(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 QT=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=ZT(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=qT(ZT(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(JT)};function $T(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 eE=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=$T(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(YT)};function tE(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function nE(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:KT}function rE(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 iE=rE(1);function aE(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 oE(e,t,n){let r=aE(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 sE={ignoreTransform:!1};function cE(e,t){t===void 0&&(t=sE);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=cT(e).getComputedStyle(e);t&&(n=oE(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 lE(e){return cE(e,{ignoreTransform:!0})}function uE(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function dE(e,t){return t===void 0&&(t=cT(e).getComputedStyle(e)),t.position===`fixed`}function fE(e,t){t===void 0&&(t=cT(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 pE(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(lT(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!uT(i)||dT(i)||n.includes(i))return n;let a=cT(e).getComputedStyle(i);return i!==e&&fE(i,a)&&n.push(i),dE(i,a)?n:r(i.parentNode)}return e?r(e):n}function mE(e){let[t]=pE(e,1);return t??null}function hE(e){return!aT||!e?null:oT(e)?e:sT(e)?lT(e)||e===fT(e).scrollingElement?window:uT(e)?e:null:null}function gE(e){return oT(e)?e.scrollX:e.scrollLeft}function _E(e){return oT(e)?e.scrollY:e.scrollTop}function vE(e){return{x:gE(e),y:_E(e)}}var yE;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(yE||={});function bE(e){return!aT||!e?!1:e===document.scrollingElement}function xE(e){let t={x:0,y:0},n=bE(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 SE={x:.2,y:.2};function CE(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=SE);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=xE(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=yE.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=yE.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=yE.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=yE.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function wE(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 TE(e){return e.reduce((e,t)=>CT(e,vE(t)),KT)}function EE(e){return e.reduce((e,t)=>e+gE(t),0)}function DE(e){return e.reduce((e,t)=>e+_E(t),0)}function OE(e,t){if(t===void 0&&(t=cE),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);mE(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var kE=[[`x`,[`left`,`right`],EE],[`y`,[`top`,`bottom`],DE]],AE=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=pE(t),r=TE(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of kE)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})}},jE=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 ME(e){let{EventTarget:t}=cT(e);return e instanceof t?e:fT(e)}function NE(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 PE;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(PE||={});function FE(e){e.preventDefault()}function IE(e){e.stopPropagation()}var LE;(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`})(LE||={});var RE={start:[LE.Space,LE.Enter],cancel:[LE.Esc],end:[LE.Space,LE.Enter,LE.Tab]},zE=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case LE.Right:return{...n,x:n.x+25};case LE.Left:return{...n,x:n.x-25};case LE.Down:return{...n,y:n.y+25};case LE.Up:return{...n,y:n.y-25}}},BE=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 jE(fT(t)),this.windowListeners=new jE(cT(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(PE.Resize,this.handleCancel),this.windowListeners.add(PE.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(PE.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&OE(n),t(KT)}handleKeyDown(e){if(ET(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=RE,coordinateGetter:a=zE,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}:KT;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=wT(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}=xE(n),p=wE(n),m={x:Math.min(i===LE.Right?p.right-p.width/2:p.right,Math.max(i===LE.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===LE.Down?p.bottom-p.height/2:p.bottom,Math.max(i===LE.Down?p.top:p.top+p.height/2,u.y))},h=i===LE.Right&&!s||i===LE.Left&&!c,g=i===LE.Down&&!l||i===LE.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===LE.Right&&e<=d.x||i===LE.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===LE.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===LE.Down&&e<=d.y||i===LE.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===LE.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,CT(wT(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()}};BE.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=RE,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 VE(e){return!!(e&&`distance`in e)}function HE(e){return!!(e&&`delay`in e)}var UE=class{constructor(e,t,n){n===void 0&&(n=ME(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=fT(i),this.documentListeners=new jE(this.document),this.listeners=new jE(n),this.windowListeners=new jE(cT(i)),this.initialCoordinates=OT(r)??KT,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(PE.Resize,this.handleCancel),this.windowListeners.add(PE.DragStart,FE),this.windowListeners.add(PE.VisibilityChange,this.handleCancel),this.windowListeners.add(PE.ContextMenu,FE),this.documentListeners.add(PE.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(HE(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(VE(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(PE.Click,IE,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(PE.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=OT(e)??KT,s=wT(n,o);if(!t&&a){if(VE(a)){if(a.tolerance!=null&&NE(s,a.tolerance))return this.handleCancel();if(NE(s,a.distance))return this.handleStart()}if(HE(a)&&NE(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===LE.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},WE={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},GE=class extends UE{constructor(e){let{event:t}=e,n=fT(t.target);super(e,WE,n)}};GE.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 KE={move:{name:`mousemove`},end:{name:`mouseup`}},qE;(function(e){e[e.RightClick=2]=`RightClick`})(qE||={});var JE=class extends UE{constructor(e){super(e,KE,fT(e.event.target))}};JE.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===qE.RightClick?!1:(r?.({event:n}),!0)}}];var YE={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},XE=class extends UE{constructor(e){super(e,YE)}static setup(){return window.addEventListener(YE.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(YE.move.name,e)};function e(){}}};XE.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 ZE;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(ZE||={});var QE;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(QE||={});function $E(e){let{acceleration:t,activator:n=ZE.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=QE.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=tD({delta:d,disabled:!a}),[m,h]=hT(),g=(0,v.useRef)({x:0,y:0}),_=(0,v.useRef)({x:0,y:0}),y=(0,v.useMemo)(()=>{switch(n){case ZE.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case ZE.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===QE.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}=CE(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 eD={x:{[yE.Backward]:!1,[yE.Forward]:!1},y:{[yE.Backward]:!1,[yE.Forward]:!1}};function tD(e){let{delta:t,disabled:n}=e,r=yT(t);return _T(e=>{if(n||!r||!e)return eD;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[yE.Backward]:e.x[yE.Backward]||i.x===-1,[yE.Forward]:e.x[yE.Forward]||i.x===1},y:{[yE.Backward]:e.y[yE.Backward]||i.y===-1,[yE.Forward]:e.y[yE.Forward]||i.y===1}}},[n,t,r])}function nD(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return _T(e=>t==null?null:r??e??null,[r,t])}function rD(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 iD;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(iD||={});var aD;(function(e){e.Optimized=`optimized`})(aD||={});var oD=new Map;function sD(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=gT(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=_T(t=>{if(d&&!n)return oD;if(!t||t===oD||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 AE(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 iD.Always:return!1;case iD.BeforeDragging:return n;default:return!n}}}function cD(e,t){return _T(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function lD(e,t){return cD(e,t)}function uD(e){let{callback:t,disabled:n}=e,r=mT(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 dD(e){let{callback:t,disabled:n}=e,r=mT(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 fD(e){return new AE(cE(e),e)}function pD(e,t,n){t===void 0&&(t=fD);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=uD({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=dD({callback:a});return pT(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function mD(e){return nE(e,cD(e))}var hD=[];function gD(e){let t=(0,v.useRef)(e),n=_T(n=>e?n&&n!==hD&&e&&t.current&&e.parentNode===t.current.parentNode?n:pE(e):hD,[e]);return(0,v.useEffect)(()=>{t.current=e},[e]),n}function _D(e){let[t,n]=(0,v.useState)(null),r=(0,v.useRef)(e),i=(0,v.useCallback)(e=>{let t=hE(e.target);t&&n(e=>e?(e.set(t,vE(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=hE(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,vE(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=>{hE(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,v.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>CT(e,t),KT):TE(e):KT,[e,t])}function vD(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!==KT;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?wT(e,n.current):KT}function yD(e){(0,v.useEffect)(()=>{if(!aT)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 bD(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 xD(e){return(0,v.useMemo)(()=>e?uE(e):null,[e])}var SD=[];function CD(e,t){t===void 0&&(t=cE);let[n]=e,r=xD(n?cT(n):null),[i,a]=(0,v.useState)(SD);function o(){a(()=>e.length?e.map(e=>bE(e)?r:new AE(t(e),e)):SD)}let s=dD({callback:o});return pT(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function wD(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return uT(t)?t:e}function TD(e){let{measure:t}=e,[n,r]=(0,v.useState)(null),i=dD({callback:(0,v.useCallback)(e=>{for(let{target:n}of e)if(uT(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=vT((0,v.useCallback)(e=>{let n=wD(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 ED=[{sensor:GE,options:{}},{sensor:BE,options:{}}],DD={current:{}},OD={draggable:{measure:lE},droppable:{measure:lE,strategy:iD.WhileDragging,frequency:aD.Optimized},dragOverlay:{measure:cE}},kD=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}},AD={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new kD,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:UT},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:OD,measureDroppableContainers:UT,windowRect:null,measuringScheduled:!1},jD={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:UT,draggableNodes:new Map,over:null,measureDroppableContainers:UT},MD=(0,v.createContext)(jD),ND=(0,v.createContext)(AD);function PD(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new kD}}}function FD(e,t){switch(t.type){case HT.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case HT.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 HT.DragEnd:case HT.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case HT.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new kD(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case HT.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 kD(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case HT.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new kD(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function ID(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,v.useContext)(MD),a=yT(r),o=yT(n?.id);return(0,v.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!ET(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=jT(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function LD(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function RD(e){return(0,v.useMemo)(()=>({draggable:{...OD.draggable,...e?.draggable},droppable:{...OD.droppable,...e?.droppable},dragOverlay:{...OD.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function zD(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;pT(()=>{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=nE(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=mE(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var BD=(0,v.createContext)({...KT,scaleX:1,scaleY:1}),VD;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(VD||={});var HD=(0,v.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=ED,collisionDetection:o=eE,measuring:s,modifiers:c,...l}=e,[u,d]=(0,v.useReducer)(FD,void 0,PD),[f,p]=RT(),[m,h]=(0,v.useState)(VD.Uninitialized),g=m===VD.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??DD,rect:C},[_,S]),T=(0,v.useRef)(null),[E,D]=(0,v.useState)(null),[O,k]=(0,v.useState)(null),A=gT(l,Object.values(l)),j=xT(`DndDescribedBy`,t),M=(0,v.useMemo)(()=>x.getEnabled(),[x]),P=RD(s),{droppableRects:F,measureDroppableContainers:I,measuringScheduled:L}=sD(M,{dragging:g,dependencies:[b.x,b.y],config:P.droppable}),R=nD(y,_),ee=(0,v.useMemo)(()=>O?OT(O):null,[O]),te=Oe(),ne=lD(R,P.draggable.measure);zD({activeNode:_==null?null:y.get(_),config:te.layoutShiftCompensation,initialRect:ne,measure:P.draggable.measure});let z=pD(R,P.draggable.measure,ne),B=pD(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),H=TD({measure:P.dragOverlay.measure}),ie=H.nodeRef.current??R,ae=g?H.rect??z:null,oe=!!(H.nodeRef.current&&H.rect),se=mD(oe?null:z),ce=xD(ie?cT(ie):null),le=gD(g?V??R:null),ue=CD(le),de=LD(c,{transform:{x:b.x-se.x,y:b.y-se.y,scaleX:1,scaleY:1},activatorEvent:O,active:w,activeNodeRect:z,containerNodeRect:B,draggingNodeRect:ae,over:re.current.over,overlayNodeRect:H.rect,scrollableAncestors:le,scrollableAncestorRects:ue,windowRect:ce}),fe=ee?CT(ee,b):null,pe=_D(le),me=vD(pe),he=vD(pe,[z]),ge=CT(de,me),_e=ae?iE(ae,de):null,ve=w&&_e?o({active:w,collisionRect:_e,droppableRects:F,droppableContainers:M,pointerCoordinates:fe}):null,ye=XT(ve,`id`),[be,xe]=(0,v.useState)(null),Se=tE(oe?de:CT(de,he),be?.rect??null,z),Ce=(0,v.useRef)(null),we=(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;Ce.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(VD.Initializing),d({type:HT.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),D(Ce.current),k(a)})},onMove(e){d({type:HT.DragMove,coordinates:e})},onEnd:o(HT.DragEnd),onCancel:o(HT.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===HT.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=HT.DragCancel)}T.current=null,(0,N.unstable_batchedUpdates)(()=>{d({type:e}),h(VD.Uninitialized),xe(null),D(null),k(null),Ce.current=null;let t=e===HT.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=A.current[t];e?.(o),f({type:t,event:o})}})}}},[y]),Te=rD(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,we(n,t))},[y,we]));yD(a),pT(()=>{z&&m===VD.Initializing&&h(VD.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:ge.x,y:ge.y},over:i};(0,N.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[ge.x,ge.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(ye),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)(()=>{xe(s),a?.(c),f({type:`onDragOver`,event:c})})},[ye]),pT(()=>{re.current={activatorEvent:O,active:w,activeNode:R,collisionRect:_e,collisions:ve,droppableRects:F,draggableNodes:y,draggingNode:ie,draggingNodeRect:ae,droppableContainers:x,over:be,scrollableAncestors:le,scrollAdjustedTranslate:ge},C.current={initial:ae,translated:_e}},[w,R,ve,_e,y,ie,ae,F,x,be,le,ge]),$E({...te,delta:b,draggingRect:_e,pointerCoordinates:fe,scrollableAncestors:le,scrollableAncestorRects:ue});let Ee=(0,v.useMemo)(()=>({active:w,activeNode:R,activeNodeRect:z,activatorEvent:O,collisions:ve,containerNodeRect:B,dragOverlay:H,draggableNodes:y,droppableContainers:x,droppableRects:F,over:be,measureDroppableContainers:I,scrollableAncestors:le,scrollableAncestorRects:ue,measuringConfiguration:P,measuringScheduled:L,windowRect:ce}),[w,R,z,O,ve,B,H,y,x,F,be,I,le,ue,P,L,ce]),De=(0,v.useMemo)(()=>({activatorEvent:O,activators:Te,active:w,activeNodeRect:z,ariaDescribedById:{draggable:j},dispatch:d,draggableNodes:y,over:be,measureDroppableContainers:I}),[O,Te,w,z,d,j,y,be,I]);return v.createElement(IT.Provider,{value:p},v.createElement(MD.Provider,{value:De},v.createElement(ND.Provider,{value:Ee},v.createElement(BD.Provider,{value:Se},i)),v.createElement(ID,{disabled:n?.restoreFocus===!1})),v.createElement(VT,{...n,hiddenTextDescribedById:j}));function Oe(){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}}}),UD=(0,v.createContext)(null),WD=`button`,GD=`Draggable`;function KD(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=xT(GD),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,v.useContext)(MD),{role:p=WD,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,v.useContext)(g?BD:UD),[y,b]=vT(),[x,S]=vT(),C=bD(o,t),w=gT(n);return pT(()=>(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===WD?!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 qD(){return(0,v.useContext)(ND)}var JD=`Droppable`,YD={timeout:25};function XD(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=xT(JD),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,v.useContext)(MD),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}={...YD,...i},_=gT(h??r),y=dD({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]=vT((0,v.useCallback)((e,t)=>{y&&(t&&(y.unobserve(t),d.current=!1),e&&y.observe(e))},[y])),S=gT(t);return(0,v.useEffect)(()=>{!y||!b.current||(y.disconnect(),d.current=!1,y.observe(b.current))},[b,y]),(0,v.useEffect)(()=>(s({type:HT.RegisterDroppable,element:{id:r,key:a,disabled:n,node:b,rect:f,data:S}}),()=>s({type:HT.UnregisterDroppable,key:a,id:r})),[r]),(0,v.useEffect)(()=>{n!==u.current.disabled&&(s({type:HT.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 ZD(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function QD(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function $D(e){return e!==null&&e>=0}function eO(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 tO(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var nO=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=ZD(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}},rO={scaleX:1,scaleY:1},iO=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,...rO}:null}let s=aO(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...rO}:r<t&&r>=a?{x:0,y:o.height+s,...rO}:{x:0,y:0,...rO}};function aO(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 oO=`Sortable`,sO=v.createContext({activeIndex:-1,containerId:oO,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:nO,disabled:{draggable:!1,droppable:!1}});function cO(e){let{children:t,id:n,items:r,strategy:i=nO,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=qD(),d=xT(oO,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=!eO(p,_.current),b=g!==-1&&h===-1||y,x=tO(a);pT(()=>{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:QD(p,c),strategy:i}),[h,d,x.draggable,x.droppable,b,p,g,c,f,i]);return v.createElement(sO.Provider,{value:S},t)}var lO=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return ZD(n,r,i).indexOf(t)},uO=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},dO={duration:200,easing:`ease`},fO=`transform`,pO=kT.Transition.toString({property:fO,duration:0,easing:`linear`}),mO={roleDescription:`sortable`};function hO(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,v.useState)(null),s=(0,v.useRef)(n);return pT(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=cE(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 gO(e){let{animateLayoutChanges:t=uO,attributes:n,disabled:r,data:i,getNewIndex:a=lO,id:o,strategy:s,resizeObserverConfig:c,transition:l=dO}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:y}=(0,v.useContext)(sO),b=_O(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}=XD({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}=KD({id:o,data:S,attributes:{...mO,...n},disabled:b.draggable}),R=iT(D,M),ee=!!O,te=ee&&!m&&$D(f)&&$D(g),ne=!_&&P,z=te?(ne&&te?L:null)??(s??y)({rects:h,activeNodeRect:A,activeIndex:f,overIndex:g,index:x}):null,B=$D(f)&&$D(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}),H=u!==V.current.items,ie=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}),ae=hO({disabled:!ie,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:ae??z,transition:oe()};function oe(){if(ae||H&&V.current.newIndex===x)return pO;if(!(ne&&!ET(k)||!l)&&(ee||ie))return kT.Transition.toString({...l,property:fO})}}function _O(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}LE.Down,LE.Right,LE.Up,LE.Left;function vO(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 yO(e,t,n){let r=n?.enabled??!0,{register:i}=(0,v.useContext)(ba),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){vO(t,e)&&(t.preventDefault(),r&&a.current())}return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,r])}function bO(e,t){switch(e){case`string`:return{icon:Yo,label:`Text (string)`,color:`text-blue-600`,bg:`bg-blue-50`};case`text`:return{icon:Wo,label:`Long text (string)`,color:`text-sky-600`,bg:`bg-sky-50`};case`richtext`:return{icon:io,label:`Rich text (blocks)`,color:`text-violet-600`,bg:`bg-violet-50`};case`number`:return{icon:fo,label:t===`float`?`Decimal (number)`:`Integer (number)`,color:`text-orange-600`,bg:`bg-orange-50`};case`boolean`:return{icon:Ko,label:`Boolean`,color:`text-emerald-600`,bg:`bg-emerald-50`};case`datetime`:return{icon:La,label:`Date & time`,color:`text-amber-600`,bg:`bg-amber-50`};case`media`:return{icon:_o,label:`Media`,color:`text-rose-600`,bg:`bg-rose-50`};case`mixed`:return{icon:wo,label:`Mixed value`,color:`text-fuchsia-600`,bg:`bg-fuchsia-50`};case`media-gallery`:return{icon:Co,label:`Media Gallery`,color:`text-pink-600`,bg:`bg-pink-50`};case`relation`:return{icon:To,label:`Relation`,color:`text-indigo-600`,bg:`bg-indigo-50`};case`uid`:return{icon:oo,label:`UID`,color:`text-teal-600`,bg:`bg-teal-50`};case`array`:return{icon:wo,label:`Array`,color:`text-cyan-600`,bg:`bg-cyan-50`};case`navigation`:return{icon:Do,label:`Navigation`,color:`text-cyan-600`,bg:`bg-cyan-50`}}}var xO={full:`col-span-6`,"two-thirds":`col-span-4`,half:`col-span-3`,third:`col-span-2`},SO={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 CO({width:e}){let t=`rounded-sm bg-current`;return e===`full`?(0,U.jsx)(`div`,{className:`flex w-4 gap-px`,children:(0,U.jsx)(`div`,{className:`${t} h-2 w-full`})}):e===`two-thirds`?(0,U.jsxs)(`div`,{className:`flex w-4 gap-px`,children:[(0,U.jsx)(`div`,{className:`${t} h-2 flex-1`}),(0,U.jsx)(`div`,{className:`${t} h-2 flex-1`}),(0,U.jsx)(`div`,{className:`h-2 flex-1 rounded-sm bg-current opacity-25`})]}):e===`half`?(0,U.jsxs)(`div`,{className:`flex w-4 gap-px`,children:[(0,U.jsx)(`div`,{className:`${t} h-2 flex-1`}),(0,U.jsx)(`div`,{className:`${t} h-2 flex-1`})]}):(0,U.jsxs)(`div`,{className:`flex w-4 gap-px`,children:[(0,U.jsx)(`div`,{className:`${t} h-2 flex-1`}),(0,U.jsx)(`div`,{className:`h-2 flex-1 rounded-sm bg-current opacity-25`}),(0,U.jsx)(`div`,{className:`h-2 flex-1 rounded-sm bg-current opacity-25`})]})}var wO=[{value:`full`,label:`Full width`},{value:`half`,label:`Half`},{value:`third`,label:`1/3`},{value:`two-thirds`,label:`2/3`}];function TO({field:e,onWidthChange:t,onArraySubFieldWidthChange:n,onEdit:r,onDelete:i,dragListeners:a,dragAttributes:o}){let{icon:s,label:c,color:l,bg:u}=bO(e.type,e.subtype),d=e.width??`full`,f=!!a,p=e.type===`array`;return(0,U.jsxs)(`div`,{className:`rounded-lg border border-border bg-card shadow-xs`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-3`,children:[f&&(0,U.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,U.jsx)(uo,{className:`size-4`})}),(0,U.jsx)(`div`,{className:`flex size-8 shrink-0 items-center justify-center rounded-md ${u}`,children:(0,U.jsx)(s,{className:`size-4 ${l}`})}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,U.jsxs)(`p`,{className:`truncate text-sm font-medium leading-tight`,children:[e.name,e.required&&(0,U.jsx)(`span`,{className:`ml-1 text-destructive`,children:`*`})]}),e.relationType===`one-to-many`&&(0,U.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,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.relationType===`one-to-many`?`Inverse relation · read-only`:c})]}),t&&!p&&(0,U.jsx)(`div`,{className:`flex shrink-0 items-center gap-px rounded-md border border-border p-0.5`,children:wO.map(({value:e,label:n})=>(0,U.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,U.jsx)(CO,{width:e})},e))}),(r||i)&&(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[r&&(0,U.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,U.jsx)(No,{className:`size-3.5`})}),i&&(0,U.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,U.jsx)(qo,{className:`size-3.5`})})]})]}),p&&e.arrayFields&&e.arrayFields.length>0&&(0,U.jsx)(`div`,{className:`grid grid-cols-6 gap-2 px-3 pb-3`,children:e.arrayFields.map(e=>{let t=bO(e.type,e.subtype),r=t.icon;return(0,U.jsxs)(`div`,{className:`${xO[e.width??`full`]} rounded-md border border-dashed border-border p-2`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,U.jsx)(`div`,{className:`flex size-5 shrink-0 items-center justify-center rounded ${t.bg}`,children:(0,U.jsx)(r,{className:`size-3 ${t.color}`})}),(0,U.jsxs)(`span`,{className:`truncate text-xs font-medium`,children:[e.name,e.required&&(0,U.jsx)(`span`,{className:`ml-0.5 text-destructive`,children:`*`})]})]}),(0,U.jsx)(`p`,{className:`mt-0.5 truncate pl-6 text-[10px] text-muted-foreground`,children:t.label}),n&&(0,U.jsx)(`div`,{className:`mt-1 flex items-center gap-px rounded-md border border-border p-0.5`,children:wO.map(({value:t,label:r})=>(0,U.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,U.jsx)(CO,{width:t})},t))})]},e.name)})})]})}var EO=v.forwardRef(({className:e,...t},n)=>(0,U.jsx)(bx,{ref:n,className:q(`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,U.jsx)(Sx,{className:`flex items-center justify-center text-current`,children:(0,U.jsx)(za,{className:`size-3`})})}));EO.displayName=bx.displayName;var DO=[{type:`string`,icon:Yo,label:`Text`,color:`text-blue-600`,bg:`bg-blue-50`},{type:`text`,icon:Wo,label:`Long Text`,color:`text-sky-600`,bg:`bg-sky-50`},{type:`richtext`,icon:io,label:`Rich Text`,color:`text-violet-600`,bg:`bg-violet-50`},{type:`number`,subtype:`integer`,icon:fo,label:`Integer`,color:`text-orange-600`,bg:`bg-orange-50`},{type:`number`,subtype:`float`,icon:fo,label:`Decimal`,color:`text-orange-600`,bg:`bg-orange-50`},{type:`boolean`,icon:Ko,label:`Boolean`,color:`text-emerald-600`,bg:`bg-emerald-50`},{type:`datetime`,icon:La,label:`Date & Time`,color:`text-amber-600`,bg:`bg-amber-50`},{type:`media`,icon:_o,label:`Media`,color:`text-rose-600`,bg:`bg-rose-50`},{type:`mixed`,icon:wo,label:`Mixed Value`,color:`text-fuchsia-600`,bg:`bg-fuchsia-50`}],OO={string:`half`,text:`full`,richtext:`full`,number:`third`,boolean:`third`,datetime:`half`,media:`half`,mixed:`half`},kO={type:`string`,subtype:void 0,name:``,required:!1,allowedTypes:[],width:`half`},AO=[{type:`string`,icon:Yo,label:`Text (string)`,description:`Titles, names, labels`,color:`text-blue-600`,bg:`bg-blue-50`},{type:`text`,icon:Wo,label:`Long text (string)`,description:`Plain text, paragraphs`,color:`text-sky-600`,bg:`bg-sky-50`},{type:`richtext`,icon:io,label:`Rich text (blocks)`,description:`Formatted HTML content`,color:`text-violet-600`,bg:`bg-violet-50`},{type:`uid`,icon:oo,label:`UID`,description:`Unique slug from a field`,color:`text-teal-600`,bg:`bg-teal-50`},{type:`boolean`,icon:Ko,label:`Boolean`,description:`True or false`,color:`text-emerald-600`,bg:`bg-emerald-50`},{type:`datetime`,icon:La,label:`Date & time`,description:`Timestamps and dates`,color:`text-amber-600`,bg:`bg-amber-50`},{type:`media`,icon:_o,label:`Media`,description:`Images, videos or files`,color:`text-rose-600`,bg:`bg-rose-50`},{type:`media-gallery`,icon:Co,label:`Media Gallery`,description:`Multiple images for galleries`,color:`text-pink-600`,bg:`bg-pink-50`},{type:`array`,icon:wo,label:`Array`,description:`Repeatable list of items`,color:`text-cyan-600`,bg:`bg-cyan-50`},{type:`navigation`,icon:Do,label:`Navigation`,description:`Nested navigation items`,color:`text-cyan-600`,bg:`bg-cyan-50`},{type:`number`,subtype:`integer`,icon:fo,label:`Integer (number)`,description:`Whole numbers`,color:`text-orange-600`,bg:`bg-orange-50`},{type:`number`,subtype:`float`,icon:fo,label:`Decimal (number)`,description:`Numbers with decimals`,color:`text-orange-600`,bg:`bg-orange-50`},{type:`relation`,icon:To,label:`Relation`,description:`Link to another content type`,color:`text-indigo-600`,bg:`bg-indigo-50`}],jO=[{value:`image`,label:`Images`},{value:`video`,label:`Videos`},{value:`audio`,label:`Audio`},{value:`document`,label:`Documents`}],MO=[{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`}],NO=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 PO(e){return NO.has(e.toLowerCase())}var FO={name:``,required:!1,relationType:`many-to-one`,relatedTable:``,relatedSlug:``,targetField:``,allowedTypes:[],arrayFields:[]};function IO({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)(FO),[d,f]=(0,v.useState)(``),[p,m]=(0,v.useState)(null),[h,g]=(0,v.useState)(``),[_,y]=(0,v.useState)(``),b=!!a;(0,v.useEffect)(()=>{e?a&&(c(AO.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(FO),f(``),m(null),g(``),y(``))},[e,a]);function x(e){t(e)}function S(e){c(e),u(FO),f(``),m(null),g(``),y(``)}function C(){b||(c(null),u(FO),f(``),m(null),g(``),y(``))}function w(){m({...kO}),g(``)}function T(e){m(t=>t?{...t,type:e.type,subtype:e.subtype,width:OO[e.type]}:{...kO,type:e.type,subtype:e.subtype,width:OO[e.type]})}function E(){if(!p)return;let e=p.name.trim();if(!e){g(`Name is required`);return}if(!/^[a-z][a-z0-9_]*$/.test(e)){g(`Lowercase letters, digits and underscores only`);return}if(PO(e)){g(`This name is reserved by SQL. Choose another one.`);return}if(l.arrayFields.some(t=>t.name===e)){g(`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:[...e.arrayFields,t]})),m(null),g(``)}function D(e){u(t=>({...t,arrayFields:t.arrayFields.filter(t=>t.name!==e)}))}function O(e,t){u(n=>({...n,arrayFields:n.arrayFields.map((n,r)=>r===e?{...n,name:t}:n)})),y(``)}function k(){let e=l.arrayFields.map(e=>e.name.trim());return e.some(e=>!e)?(y(`All sub-fields must have a name.`),!1):e.some(e=>!/^[a-z][a-z0-9_]*$/.test(e))?(y(`Sub-field names must use lowercase letters, digits and underscores.`),!1):e.some(e=>PO(e))?(y(`One or more sub-field names are reserved by SQL.`),!1):new Set(e).size===e.length?!0:(y(`Sub-field names must be unique.`),!1)}function A(){let e=l.name.trim();return e?/^[a-z][a-z0-9_]*$/.test(e)?PO(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 j(){!s||!A()||s.type===`array`&&!k()||(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??SO[s.type]}),x(!1))}let M=!!s,N=s?.label.replace(/\s*\(.*?\)/,``)??``,P=b?`Edit field`:M?`${N} field`:`Add a field`;return(0,U.jsx)(yw,{open:e,onOpenChange:x,children:(0,U.jsxs)(Cw,{className:M?s?.type===`array`?`max-w-lg`:`max-w-md`:`max-w-3xl`,children:[(0,U.jsx)(ww,{children:(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[M&&!b&&(0,U.jsx)(`button`,{type:`button`,onClick:C,className:`flex size-7 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-accent-foreground`,children:(0,U.jsx)(Pa,{className:`size-4`})}),(0,U.jsx)(Ew,{children:P})]})}),!M&&(0,U.jsx)(`div`,{className:`grid grid-cols-3 gap-2 pt-1`,children:AO.map(e=>{let t=e.icon,n=`${e.type}${e.subtype??``}`;return(0,U.jsxs)(`button`,{type:`button`,disabled:e.disabled,onClick:()=>!e.disabled&&S(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,U.jsx)(`div`,{className:`flex size-8 items-center justify-center rounded-md ${e.bg}`,children:(0,U.jsx)(t,{className:`size-4 ${e.color}`})}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`text-sm font-medium`,children:e.label}),(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.disabled?`Coming soon`:e.description})]})]},n)})}),M&&(0,U.jsxs)(`div`,{className:`flex flex-col gap-4 pt-1`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(X,{htmlFor:`field-name`,children:`Field name`}),(0,U.jsx)(Hv,{id:`field-name`,placeholder:`e.g. article_title`,value:l.name,autoFocus:!0,onChange:e=>{u(t=>({...t,name:e.target.value})),f(``)},onKeyDown:e=>{e.key===`Enter`&&j()}}),d&&(0,U.jsx)(`p`,{className:`text-xs text-destructive`,children:d}),(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Lowercase letters, digits and underscores. Must start with a letter.`})]}),s?.type===`media`&&(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,U.jsx)(X,{children:`Allowed file types`}),(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground -mt-1`,children:`Leave all unchecked to allow any file type.`}),(0,U.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:jO.map(({value:e,label:t})=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(EO,{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,U.jsx)(X,{htmlFor:`media-type-${e}`,className:`cursor-pointer font-normal`,children:t})]},e))})]}),s?.type===`array`&&(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsx)(X,{children:`Sub-fields`}),!p&&(0,U.jsxs)(`button`,{type:`button`,onClick:w,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,U.jsx)(Po,{className:`size-3`}),`Add sub-field`]})]}),l.arrayFields.length===0&&!p&&(0,U.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,U.jsx)(`div`,{className:`grid grid-cols-6 gap-1.5`,children:l.arrayFields.map((e,t)=>{let n=DO.find(t=>t.type===e.type&&(t.subtype??void 0)===(e.subtype??void 0)),r=n?.icon??Yo;return(0,U.jsxs)(`div`,{className:`${xO[e.width??`full`]} flex items-center gap-1.5 rounded-md border border-dashed border-border p-2`,children:[(0,U.jsx)(`div`,{className:`flex size-5 shrink-0 items-center justify-center rounded ${n?.bg??`bg-muted`}`,children:(0,U.jsx)(r,{className:`size-3 ${n?.color??`text-muted-foreground`}`})}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(Hv,{value:e.name,onChange:e=>O(t,e.target.value),className:`h-6 px-1.5 text-xs`}),(0,U.jsx)(`p`,{className:`truncate text-[10px] text-muted-foreground`,children:n?.label})]}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>D(e.name),className:`flex shrink-0 size-5 items-center justify-center rounded text-muted-foreground hover:text-destructive`,children:(0,U.jsx)(qo,{className:`size-3`})})]},`subfield-${t}`)})}),_&&(0,U.jsx)(`p`,{className:`text-xs text-destructive`,children:_}),p&&(0,U.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-lg border border-border bg-muted/30 p-3`,children:[(0,U.jsx)(`div`,{className:`grid grid-cols-4 gap-1.5`,children:DO.map(e=>{let t=e.icon,n=`${e.type}${e.subtype??``}`;return(0,U.jsxs)(`button`,{type:`button`,onClick:()=>T(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,U.jsx)(`div`,{className:`flex size-5 shrink-0 items-center justify-center rounded ${e.bg}`,children:(0,U.jsx)(t,{className:`size-3 ${e.color}`})}),(0,U.jsx)(`span`,{className:`truncate text-xs font-medium`,children:e.label})]},n)})}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(Hv,{placeholder:`sub_field_name`,autoFocus:!0,value:p.name,onChange:e=>{m(t=>t&&{...t,name:e.target.value}),g(``)},onKeyDown:e=>{e.key===`Enter`&&E()}}),h&&(0,U.jsx)(`p`,{className:`text-xs text-destructive`,children:h})]}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,U.jsx)(EO,{id:`subfield-required`,checked:p.required,onCheckedChange:e=>m(t=>t&&{...t,required:!!e})}),(0,U.jsx)(X,{htmlFor:`subfield-required`,className:`cursor-pointer font-normal text-sm`,children:`Required`})]}),(0,U.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,U.jsx)(J,{variant:`ghost`,size:`sm`,onClick:()=>{m(null),g(``)},children:`Cancel`}),(0,U.jsx)(J,{size:`sm`,onClick:E,children:`Add`})]})]})]})]}),s?.type===`uid`&&(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(X,{children:`Source field`}),(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`The slug will be auto-generated from this field's value.`}),i.length>0?(0,U.jsxs)(Ow,{value:l.targetField,onValueChange:e=>u(t=>({...t,targetField:e})),children:[(0,U.jsx)(jw,{children:(0,U.jsx)(Aw,{placeholder:`Select a text field`})}),(0,U.jsx)(Pw,{children:i.map(e=>(0,U.jsx)(Iw,{value:e.name,children:e.name},e.name))})]}):(0,U.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,U.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(X,{children:`Relation type`}),(0,U.jsx)(`div`,{className:`grid grid-cols-1 gap-1.5`,children:MO.map(e=>(0,U.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,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`text-sm font-medium leading-none`,children:e.label}),(0,U.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:e.description})]})},e.value))})]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(X,{children:`Related content type`}),r.length>0?(0,U.jsxs)(Ow,{value:l.relatedTable,onValueChange:e=>{let t=r.find(t=>t.tableName===e);u(n=>({...n,relatedTable:e,relatedSlug:t?.slug??``}))},children:[(0,U.jsx)(jw,{children:(0,U.jsx)(Aw,{placeholder:`Select a content type`})}),(0,U.jsx)(Pw,{children:r.map(e=>(0,U.jsx)(Iw,{value:e.tableName,children:e.name},e.tableName))})]}):(0,U.jsx)(Hv,{placeholder:`table_name`,value:l.relatedTable,onChange:e=>u(t=>({...t,relatedTable:e.target.value}))})]})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(EO,{id:`field-required`,checked:l.required,onCheckedChange:e=>u(t=>({...t,required:!!e}))}),(0,U.jsx)(X,{htmlFor:`field-required`,className:`cursor-pointer font-normal`,children:`Required field`})]}),(0,U.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-border pt-3`,children:[(0,U.jsx)(J,{variant:`outline`,onClick:()=>x(!1),children:`Cancel`}),(0,U.jsx)(J,{onClick:j,children:b?`Save changes`:`Add field`})]})]})]})})}function LO(e){return e.toLowerCase().replace(/\s+/g,`-`).replace(/[^a-z0-9-]/g,``).replace(/^-+|-+$/g,``)}function RO(e){return e.replace(/-/g,`_`)}function zO({field:e,onWidthChange:t,onArraySubFieldWidthChange:n,onEdit:r,onDelete:i}){let{attributes:a,listeners:o,setNodeRef:s,transform:c,transition:l,isDragging:u}=gO({id:e.name});return(0,U.jsx)(`div`,{ref:s,style:{transform:kT.Transform.toString(c),transition:l,opacity:u?.5:1},className:xO[e.width??`full`],children:(0,U.jsx)(TO,{field:e,dragListeners:o,dragAttributes:a,onWidthChange:t,onArraySubFieldWidthChange:n,onEdit:r,onDelete:i})})}function BO(){let{slug:e}=hr(),t=dr(),n=!e,{user:r}=ga(),i=r?.permissions??[],a=i.includes(`*`)||i.includes(`content-types:delete`),{data:o,loading:s}=wa(n?``:`/cms/admin/content-types/${e}`),{data:c,refetch:l}=wa(`/cms/admin/content-types`),{loading:u,request:d}=Vv(),{loading:f,request:p}=Vv(),[m,h]=(0,v.useState)(``),[g,_]=(0,v.useState)(``),[y,b]=(0,v.useState)(`collection`),[x,S]=(0,v.useState)([]),[C,w]=(0,v.useState)(!1),[T,E]=(0,v.useState)(null),[D,O]=(0,v.useState)(!1),k=(0,v.useRef)({name:``,slug:``,fields:`[]`});(0,v.useEffect)(()=>(window.addEventListener(`plank:content-types-changed`,l),()=>window.removeEventListener(`plank:content-types-changed`,l)),[l]),(0,v.useEffect)(()=>{if(n){h(``),_(``),b(`collection`),S([]),k.current={name:``,slug:``,fields:`[]`};return}o&&(h(o.name),_(o.slug),b(o.kind??`collection`),S(o.fields),k.current={name:o.name,slug:o.slug,fields:JSON.stringify(o.fields)})},[o,n]),(0,v.useEffect)(()=>{n&&m&&_(LO(m))},[n,m]);let A=m!==k.current.name||JSON.stringify(x)!==k.current.fields,j=(0,v.useRef)(!1),M=Fr((0,v.useCallback)(()=>j.current?!1:A,[A])),N=GT(WT(GE,{activationConstraint:{distance:5}}));function P(e){let{active:t,over:n}=e;!n||t.id===n.id||S(e=>ZD(e,e.findIndex(e=>e.name===t.id),e.findIndex(e=>e.name===n.id)))}function F(e){S(t=>[...t,e])}function I(e){S(t=>t.map(t=>t.name===T?.name?e:t)),E(null)}function L(e){S(t=>t.filter(t=>t.name!==e))}function R(e,t){S(n=>n.map(n=>n.name===e?{...n,width:t}:n))}function ee(e,t,n){S(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 te(){if(!m.trim()||!g.trim())return;let r=n?{name:m.trim(),slug:g,kind:y,tableName:RO(g),fields:x}:{name:m.trim(),slug:g,tableName:RO(g),fields:x};try{let i=await d(n?`/cms/admin/content-types`:`/cms/admin/content-types/${e}`,n?`POST`:`PUT`,r);h(i.name),_(i.slug),S(i.fields),k.current={name:i.name,slug:i.slug,fields:JSON.stringify(i.fields)},window.dispatchEvent(new CustomEvent(`plank:content-types-changed`)),(n||i.slug!==e)&&(j.current=!0,t(`/content-types/${i.slug}`,{replace:!0}))}catch{}}async function ne(){if(a)try{await p(`/cms/admin/content-types/${e}`,`DELETE`),window.dispatchEvent(new CustomEvent(`plank:content-types-changed`)),t(`/content-types`,{replace:!0})}catch{}}let z=(c??[]).filter(t=>t.slug!==e).map(e=>({tableName:e.tableName,slug:e.slug,name:e.name})),B=x.filter(e=>e.type===`string`),re=x.map(e=>e.name);return yO(`mod+s`,te,{enabled:A&&!u&&!!m.trim(),label:`Save content type`}),yO(`mod+k`,()=>w(!0),{label:`Add field`}),!n&&s?(0,U.jsxs)(`div`,{className:`flex items-center gap-2 py-12 text-muted-foreground`,children:[(0,U.jsx)(by,{className:`size-4`}),(0,U.jsx)(`span`,{className:`text-sm`,children:`Loading…`})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(yy,{children:(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(`input`,{value:m,onChange:e=>h(e.target.value),placeholder:`Content type name`,className:`bg-transparent text-2xl font-bold outline-none placeholder:text-muted-foreground/40 -mt-2`}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,U.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`API ID:`}),(0,U.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:g||`—`})]}),n?(0,U.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border p-0.5`,children:[(0,U.jsxs)(`button`,{type:`button`,onClick:()=>b(`collection`),className:`flex items-center gap-1.5 rounded px-2 py-0.5 text-xs font-medium transition-colors ${y===`collection`?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`}`,children:[(0,U.jsx)(Oo,{className:`size-3`}),`Collection`]}),(0,U.jsxs)(`button`,{type:`button`,onClick:()=>b(`single`),className:`flex items-center gap-1.5 rounded px-2 py-0.5 text-xs font-medium transition-colors ${y===`single`?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`}`,children:[(0,U.jsx)(ao,{className:`size-3`}),`Single`]})]}):(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border px-2 py-0.5 text-xs font-medium text-muted-foreground ${y===`single`?`border-violet-500/30 bg-violet-500/10 text-violet-600 dark:text-violet-400`:``}`,children:[y===`single`?(0,U.jsx)(ao,{className:`size-3`}):(0,U.jsx)(Oo,{className:`size-3`}),y===`single`?`Single`:`Collection`]})]})]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[!n&&a&&(0,U.jsx)(J,{variant:`ghost`,size:`icon`,className:`text-muted-foreground hover:text-destructive`,onClick:()=>O(!0),disabled:f,children:(0,U.jsx)(qo,{className:`size-4`})}),(0,U.jsxs)(J,{onClick:te,disabled:!A||u||!m.trim(),children:[u?(0,U.jsx)(by,{className:`size-4`}):null,`Save`]})]})]})}),(0,U.jsxs)(`section`,{className:`mt-24`,children:[x.length>0?(()=>{let e=x.filter(e=>e.relationType!==`one-to-many`),t=x.filter(e=>e.relationType===`one-to-many`);return(0,U.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[e.length>0&&(0,U.jsx)(HD,{sensors:N,collisionDetection:QT,onDragEnd:P,children:(0,U.jsx)(cO,{items:e.map(e=>e.name),strategy:iO,children:(0,U.jsx)(`div`,{className:`grid grid-cols-6 gap-3`,children:e.map(e=>(0,U.jsx)(zO,{field:e,onWidthChange:t=>R(e.name,t),onArraySubFieldWidthChange:(t,n)=>ee(e.name,t,n),onEdit:()=>E(e),onDelete:()=>L(e.name)},e.name))})})}),t.length>0&&(0,U.jsx)(`div`,{className:`grid grid-cols-6 gap-3`,children:t.map(e=>(0,U.jsx)(`div`,{className:`col-span-6`,children:(0,U.jsx)(TO,{field:e})},e.name))})]})})():(0,U.jsx)(Xw,{className:`border`,children:(0,U.jsxs)(Zw,{children:[(0,U.jsx)($w,{variant:`icon`,children:(0,U.jsx)(xo,{})}),(0,U.jsx)(eT,{children:`No fields yet`}),(0,U.jsx)(tT,{children:`Add your first field to define this content type's structure.`})]})}),(0,U.jsx)(`div`,{className:`mt-4`,children:(0,U.jsxs)(J,{variant:`outline`,onClick:()=>w(!0),className:`gap-2`,children:[(0,U.jsx)(Po,{className:`size-4`}),`Add field`]})}),(0,U.jsx)(IO,{open:C,onOpenChange:w,existingNames:re,availableContentTypes:z,stringFields:B,onConfirm:F}),(0,U.jsx)(IO,{open:!!T,onOpenChange:e=>{e||E(null)},existingNames:re,availableContentTypes:z,stringFields:B,initialField:T??void 0,onConfirm:I}),(0,U.jsx)(yw,{open:D,onOpenChange:O,children:(0,U.jsxs)(Cw,{className:`max-w-sm`,children:[(0,U.jsx)(ww,{children:(0,U.jsxs)(Ew,{children:[`Delete "`,m,`"?`]})}),(0,U.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,U.jsxs)(Tw,{children:[(0,U.jsx)(J,{variant:`outline`,onClick:()=>O(!1),children:`Cancel`}),(0,U.jsxs)(J,{variant:`destructive`,onClick:ne,disabled:f,children:[f?(0,U.jsx)(by,{className:`size-4`}):null,`Delete`]})]})]})}),(0,U.jsx)(yw,{open:M.state===`blocked`,onOpenChange:()=>M.reset?.(),children:(0,U.jsxs)(Cw,{className:`max-w-sm`,children:[(0,U.jsx)(ww,{children:(0,U.jsx)(Ew,{children:`Unsaved changes`})}),(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`You have unsaved changes. Leave without saving?`}),(0,U.jsxs)(Tw,{children:[(0,U.jsx)(J,{variant:`outline`,onClick:()=>M.reset?.(),children:`Stay`}),(0,U.jsx)(J,{variant:`destructive`,onClick:()=>M.proceed?.(),children:`Leave`})]})]})})]})]})}function VO(){let{pathname:e}=cr(),{user:t}=ga(),{data:n,loading:r,error:i,refetch:a}=wa(`/cms/admin/content-types`),{request:o}=Vv(),s=t?.permissions??[],c=s.includes(`*`)||s.includes(`content-types:write`);async function l(e,t){e.preventDefault(),e.stopPropagation(),await o(`/cms/admin/content-types/${t}/default`,`PUT`),a()}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,U.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,U.jsx)(`div`,{className:`shrink-0 border-b border-sidebar-border px-4 py-3`,children:(0,U.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Content`})}),r&&(0,U.jsx)(`div`,{className:`flex items-center justify-center py-6`,children:(0,U.jsx)(by,{className:`size-4`})}),i&&(0,U.jsx)(`p`,{className:`px-4 py-3 text-xs text-destructive`,children:i}),!r&&!i&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,U.jsx)(`div`,{className:`shrink-0 px-4 py-2`,children:(0,U.jsx)(`p`,{className:`text-[11px] font-medium uppercase tracking-wider text-muted-foreground/60`,children:`Collection Types`})}),(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:d.length===0?(0,U.jsx)(`p`,{className:`px-4 pb-3 text-xs text-muted-foreground`,children:`No collection types yet.`}):(0,U.jsx)(`nav`,{className:`flex flex-col gap-0.5 px-2 pb-2`,children:d.map(e=>(0,U.jsxs)(qi,{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,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),c&&(0,U.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,U.jsx)(Ho,{className:`size-3.5 ${e.isDefault?`fill-amber-400`:``}`})})]},e.slug))})})]}),(0,U.jsx)(`div`,{className:`shrink-0 border-t border-sidebar-border`}),(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,U.jsx)(`div`,{className:`shrink-0 px-4 py-2`,children:(0,U.jsx)(`p`,{className:`text-[11px] font-medium uppercase tracking-wider text-muted-foreground/60`,children:`Single Types`})}),(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:f.length===0?(0,U.jsx)(`p`,{className:`px-4 pb-3 text-xs text-muted-foreground`,children:`No single types yet.`}):(0,U.jsx)(`nav`,{className:`flex flex-col gap-0.5 px-2 pb-2`,children:f.map(e=>(0,U.jsx)(qi,{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,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name})},e.slug))})})]})]})]})}function HO(){return qw((0,U.jsx)(VO,{})),(0,U.jsx)(Qr,{})}function UO(){let e=dr(),{data:t,loading:n}=wa(`/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,U.jsxs)(Xw,{className:`border`,children:[(0,U.jsxs)(Zw,{children:[(0,U.jsx)($w,{variant:`icon`,children:(0,U.jsx)(xo,{})}),(0,U.jsx)(eT,{children:`No content types yet`}),(0,U.jsx)(tT,{children:`Create a content type in the Builder before managing content.`})]}),(0,U.jsx)(nT,{children:(0,U.jsx)(J,{onClick:()=>e(`/content-types/new`),children:`Go to Builder`})})]})}function WO({className:e,orientation:t=`horizontal`,decorative:n=!0,...r}){return(0,U.jsx)(RC,{"data-slot":`separator`,decorative:n,orientation:t,className:q(`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 GO=Ts(`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 KO({className:e,orientation:t=`vertical`,...n}){return(0,U.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":t,className:q(GO({orientation:t}),e),...n})}function qO({className:e,...t}){return(0,U.jsx)(X,{"data-slot":`field-label`,className:q(`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 JO({className:e,...t}){return(0,U.jsx)(`nav`,{role:`navigation`,"aria-label":`pagination`,"data-slot":`pagination`,className:q(`mx-auto flex w-full justify-center`,e),...t})}function YO({className:e,...t}){return(0,U.jsx)(`ul`,{"data-slot":`pagination-content`,className:q(`flex flex-row items-center gap-1`,e),...t})}function XO({...e}){return(0,U.jsx)(`li`,{"data-slot":`pagination-item`,...e})}function ZO({className:e,isActive:t,size:n=`icon`,...r}){return(0,U.jsx)(`a`,{"aria-current":t?`page`:void 0,"data-slot":`pagination-link`,"data-active":t,className:q(Xc({variant:t?`outline`:`ghost`,size:n}),e),...r})}function QO({className:e,...t}){return(0,U.jsxs)(ZO,{"aria-label":`Go to previous page`,size:`default`,className:q(`gap-1 px-2.5 sm:pl-2.5`,e),...t,children:[(0,U.jsx)(Va,{}),(0,U.jsx)(`span`,{className:`hidden sm:block`,children:`Previous`})]})}function $O({className:e,...t}){return(0,U.jsxs)(ZO,{"aria-label":`Go to next page`,size:`default`,className:q(`gap-1 px-2.5 sm:pr-2.5`,e),...t,children:[(0,U.jsx)(`span`,{className:`hidden sm:block`,children:`Next`}),(0,U.jsx)(Ha,{})]})}function ek({page:e,totalPages:t,limit:n,onPageChange:r,onLimitChange:i}){return(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,U.jsxs)(KO,{orientation:`horizontal`,className:`w-fit`,children:[(0,U.jsx)(qO,{htmlFor:`select-rows-per-page`,children:`Rows per page`}),(0,U.jsxs)(Ow,{value:String(n),onValueChange:e=>i(Number(e)),children:[(0,U.jsx)(jw,{className:`w-20`,id:`select-rows-per-page`,children:(0,U.jsx)(Aw,{})}),(0,U.jsx)(Pw,{align:`start`,children:(0,U.jsxs)(kw,{children:[(0,U.jsx)(Iw,{value:`10`,children:`10`}),(0,U.jsx)(Iw,{value:`30`,children:`30`}),(0,U.jsx)(Iw,{value:`50`,children:`50`}),(0,U.jsx)(Iw,{value:`70`,children:`70`}),(0,U.jsx)(Iw,{value:`100`,children:`100`})]})})]})]}),(0,U.jsx)(JO,{className:`mx-0 w-auto`,children:(0,U.jsxs)(YO,{children:[(0,U.jsx)(XO,{children:(0,U.jsx)(QO,{href:`#`,onClick:t=>{t.preventDefault(),e>1&&r(e-1)},"aria-disabled":e===1,className:e===1?`pointer-events-none opacity-50`:``})}),(0,U.jsx)(XO,{children:(0,U.jsx)($O,{href:`#`,onClick:n=>{n.preventDefault(),e<t&&r(e+1)},"aria-disabled":e===t,className:e===t?`pointer-events-none opacity-50`:``})})]})})]})}var tk=4,nk={field:`created_at`,dir:`desc`},rk=[{name:`created_at`,label:`Created`},{name:`updated_at`,label:`Updated`},{name:`published_at`,label:`Published`}],ik=[{name:`created_at`,label:`Created`},{name:`updated_at`,label:`Updated`},{name:`pub_sch`,label:`Pub / Sch`}];function ak(e){return e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function ok(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 sk(e){if(Array.isArray(e))return e.map(e=>String(e??``).trim()).filter(Boolean);let t=String(e??``).trim();return t?[t]:[]}function ck({relatedSlug:e,value:t,displayField:n}){let[r,i]=(0,v.useState)([]),[a,o]=(0,v.useState)(!1),s=sk(t);return(0,v.useEffect)(()=>{let r=sk(t);if(!e||r.length===0){i([]);return}let a=!1;o(!0);let s=localStorage.getItem(`plank_token`),c=s?{Authorization:`Bearer ${s}`}:{};return(n?Promise.resolve(n):fetch(`/cms/admin/content-types/${e}`,{headers:c}).then(e=>e.ok?e.json():null).then(e=>ok(e?.fields??[])).catch(()=>null)).then(t=>Promise.all(r.map(n=>fetch(`/cms/admin/entries/${e}/${n}`,{headers:c}).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,U.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):a&&r.length===0?(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:`…`}):(0,U.jsx)(`span`,{className:`font-medium truncate max-w-50 block`,children:r.join(`, `)})}function lk(e){return{visibleFields:e.slice(0,tk).map(e=>e.name),visibleSystemCols:ik.map(e=>e.name),sort:nk}}function uk(e,t){if(!e)return lk(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=>ik.some(t=>t.name===e)):ik.map(e=>e.name);return{visibleFields:n.length>0?n:t.slice(0,tk).map(e=>e.name),visibleSystemCols:r,sort:e.sort??nk}}async function dk(e){let t=localStorage.getItem(`plank_token`),n=await fetch(`/cms/admin/users/me/prefs/view_${e}`,{headers:t?{Authorization:`Bearer ${t}`}:{}});if(!n.ok)return null;let{value:r}=await n.json();return r}async function fk(e,t){let n=localStorage.getItem(`plank_token`);await fetch(`/cms/admin/users/me/prefs/view_${e}`,{method:`PUT`,headers:{"Content-Type":`application/json`,...n?{Authorization:`Bearer ${n}`}:{}},body:JSON.stringify({value:t})})}function pk({value:e}){let[t,n]=(0,v.useState)(null);return(0,v.useEffect)(()=>{if(e.startsWith(`http`)){n(e);return}let t=localStorage.getItem(`plank_token`);fetch(`/cms/admin/media/${e}/url`,{headers:t?{Authorization:`Bearer ${t}`}:{}}).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,U.jsx)(`img`,{src:t,alt:``,className:`size-8 object-cover`}):(0,U.jsxs)(`span`,{className:`flex items-center gap-1.5 text-muted-foreground text-xs`,children:[(0,U.jsx)(ao,{className:`size-3.5 shrink-0`}),(0,U.jsx)(`span`,{className:`truncate max-w-30`,children:`File`})]}):(0,U.jsx)(_o,{className:`size-4 text-muted-foreground`})}function mk({field:e,value:t,displayField:n}){let{timezone:r}=ya();if(t==null||t===``)return(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});if(e.type===`boolean`)return t?(0,U.jsx)(za,{className:`size-4 text-primary`}):(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});if(e.type===`datetime`)return(0,U.jsx)(`span`,{children:wy(String(t),r)});if(e.type===`number`)return(0,U.jsx)(`span`,{children:String(t)});if(e.type===`media`)return(0,U.jsx)(pk,{value:String(t)});if(e.type===`relation`)return(0,U.jsx)(ck,{relatedSlug:e.relatedSlug,value:t,displayField:n});if(e.type===`text`||e.type===`richtext`){let e=String(t);return(0,U.jsx)(`span`,{className:`text-muted-foreground truncate max-w-50 block`,children:e.length>60?e.slice(0,60)+`…`:e})}let i=String(t);return(0,U.jsx)(`span`,{className:e.type===`uid`?`font-mono text-xs text-muted-foreground truncate max-w-40 block`:`font-medium truncate max-w-50 block`,children:i.length>60?i.slice(0,60)+`…`:i})}function hk({entry:e}){let t=e._author_first_name,n=e._author_last_name,r=t||n?[t,n].filter(Boolean).join(` `):null,i=(0,U.jsx)(El,{avatarUrl:e._author_avatar_url,firstName:t,lastName:n,className:`size-7`,fallbackClassName:`text-[10px]`});return r?(0,U.jsxs)(Fv,{children:[(0,U.jsx)(Iv,{asChild:!0,children:i}),(0,U.jsx)(Lv,{children:r})]}):i}function gk({entry:e,fields:t}){let{timezone:n}=ya();if(e.status===`scheduled`)return(0,U.jsxs)(vw,{variant:`outline`,className:`border-blue-500 text-blue-600`,children:[(0,U.jsx)(Ia,{className:`size-3 mr-1`}),e.scheduled_for?Cy(e.scheduled_for,n):`Scheduled`]});if(e.status===`draft`)return(0,U.jsx)(vw,{variant:`outline`,children:`Draft`});if(e.status===`pending`)return e.review_rejected?(0,U.jsx)(vw,{variant:`destructive`,children:`Pending`}):(0,U.jsx)(vw,{className:`bg-amber-500 text-black hover:bg-amber-500`,children:`Pending`});if(e.status===`in_review`)return(0,U.jsx)(vw,{variant:`outline`,children:`In Review`});let r=(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(r(e[t.name],t.type))!==JSON.stringify(r(e.published_data[t.name],t.type)))?(0,U.jsx)(vw,{variant:`secondary`,children:`Published*`}):(0,U.jsx)(vw,{variant:`default`,children:`Published`})}function _k({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({fieldName:e}){let t=e.split(`.`)[0],r=n.find(e=>e.name===t)?.relatedSlug,{data:i}=wa(r?`/cms/admin/content-types/${r}`:null),s=a.find(e=>e.split(`.`)[0]===t),c=s&&s.includes(`.`)?s.split(`.`)[1]:void 0;function l(e,t){o(n=>n.map(n=>n.split(`.`)[0]===e?t?`${e}.${t}`:e:n))}return(0,v.useEffect)(()=>{if(!i?.fields||c)return;let e=[`title`,`name`],n=i.fields.find(t=>e.includes(t.name))||i.fields[0];n&&l(t,n.name)},[i,c,t]),i?.fields?(0,U.jsxs)(Ow,{value:c,onValueChange:e=>l(t,e),children:[(0,U.jsx)(jw,{className:`h-8 text-sm w-32`,children:(0,U.jsx)(Aw,{})}),(0,U.jsx)(Pw,{children:i.fields.map(e=>(0,U.jsx)(Iw,{value:e.name,children:e.name},e.name))})]}):null}function p(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 m(e){o(t=>[...t,e])}function h(e){o(t=>t.filter(t=>t!==e))}let g=[...rk,...n.filter(e=>![`media`,`text`,`richtext`,`relation`].includes(e.type)).map(e=>({name:e.name,label:ak(e.name)}))];return(0,U.jsx)(yw,{open:e,onOpenChange:t,children:(0,U.jsxs)(Cw,{className:`max-w-md h-[80vh] flex flex-col`,children:[(0,U.jsx)(ww,{className:`flex-none`,children:(0,U.jsx)(Ew,{children:`Configure the view`})}),(0,U.jsxs)(`div`,{className:`flex flex-col flex-1 min-h-0 gap-5 py-1`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col flex-1 min-h-0`,children:[(0,U.jsx)(`p`,{className:`mb-2 text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:`Displayed fields`}),a.length===0&&s.length===0?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground py-2`,children:`No fields selected.`}):(0,U.jsxs)(`ul`,{className:`space-y-1 overflow-y-auto flex-1 min-h-0`,children:[a.map((e,t)=>{let r=String(e).split(`.`)[0],i=n.find(e=>e.name===r);return(0,U.jsxs)(`li`,{className:`flex items-center gap-2 rounded-md border px-3 py-2 text-sm`,children:[(0,U.jsx)(`span`,{className:`flex-1 font-medium`,children:ak(r)}),i&&(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:i.type}),i&&i.type===`relation`&&(0,U.jsx)(`div`,{className:`ml-2`,children:(0,U.jsx)(f,{fieldName:e})}),(0,U.jsx)(J,{size:`icon`,variant:`ghost`,disabled:t===0,onClick:()=>p(e,-1),className:`flex size-6 items-center justify-center rounded text-muted-foreground hover:bg-accent disabled:opacity-30`,children:(0,U.jsx)(Ua,{className:`size-3.5`})}),(0,U.jsx)(J,{size:`icon`,variant:`ghost`,disabled:t===a.length-1,onClick:()=>p(e,1),className:`flex size-6 items-center justify-center rounded text-muted-foreground hover:bg-accent disabled:opacity-30`,children:(0,U.jsx)(Ba,{className:`size-3.5`})}),(0,U.jsx)(J,{size:`icon`,variant:`ghost`,onClick:()=>h(e),className:`flex size-6 items-center justify-center rounded text-muted-foreground hover:bg-destructive/10 hover:text-destructive`,children:(0,U.jsx)(Ka,{className:`size-3.5`})})]},e)}),s.map(e=>{let t=ik.find(t=>t.name===e);return t?(0,U.jsxs)(`li`,{className:`flex items-center gap-2 rounded-md border px-3 py-2 text-sm`,children:[(0,U.jsx)(`span`,{className:`flex-1 font-medium`,children:t.label}),(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`system`}),(0,U.jsx)(J,{size:`icon`,variant:`ghost`,disabled:!0,className:`flex size-6 items-center justify-center rounded text-muted-foreground disabled:opacity-30`,children:(0,U.jsx)(Ua,{className:`size-3.5`})}),(0,U.jsx)(J,{size:`icon`,variant:`ghost`,disabled:!0,className:`flex size-6 items-center justify-center rounded text-muted-foreground disabled:opacity-30`,children:(0,U.jsx)(Ba,{className:`size-3.5`})}),(0,U.jsx)(J,{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,U.jsx)(Ka,{className:`size-3.5`})})]},e):null})]})]}),(d.length>0||s.length<ik.length)&&(0,U.jsxs)(`div`,{className:`flex flex-col flex-1 min-h-0`,children:[(0,U.jsx)(`p`,{className:`mb-2 text-xs font-medium text-muted-foreground uppercase tracking-wide flex-none`,children:`Available fields`}),(0,U.jsxs)(`ul`,{className:`space-y-1 overflow-y-auto flex-1 min-h-0`,children:[d.map(e=>(0,U.jsxs)(`li`,{className:`flex items-center gap-2 rounded-md border border-dashed px-3 py-2 text-sm text-muted-foreground`,children:[(0,U.jsx)(`span`,{className:`flex-1`,children:ak(e.name)}),(0,U.jsx)(`span`,{className:`text-xs`,children:e.type}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>m(e.name),className:`flex size-6 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-accent-foreground`,children:(0,U.jsx)(qa,{className:`size-3.5`})})]},e.name)),ik.filter(e=>!s.includes(e.name)).map(e=>(0,U.jsxs)(`li`,{className:`flex items-center gap-2 rounded-md border border-dashed px-3 py-2 text-sm text-muted-foreground`,children:[(0,U.jsx)(`span`,{className:`flex-1`,children:e.label}),(0,U.jsx)(`span`,{className:`text-xs`,children:`system`}),(0,U.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,U.jsx)(qa,{className:`size-3.5`})})]},e.name))]})]}),(0,U.jsxs)(`div`,{className:`flex-none`,children:[(0,U.jsx)(`p`,{className:`mb-2 text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:`Sort entries`}),(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,U.jsxs)(Ow,{value:l.field,onValueChange:e=>u(t=>({...t,field:e})),children:[(0,U.jsx)(jw,{className:`h-8 text-sm`,children:(0,U.jsx)(Aw,{})}),(0,U.jsx)(Pw,{children:g.map(e=>(0,U.jsx)(Iw,{value:e.name,children:e.label},e.name))})]}),(0,U.jsxs)(Ow,{value:l.dir,onValueChange:e=>u(t=>({...t,dir:e})),children:[(0,U.jsx)(jw,{className:`h-8 text-sm`,children:(0,U.jsx)(Aw,{})}),(0,U.jsxs)(Pw,{children:[(0,U.jsx)(Iw,{value:`asc`,children:`Ascending`}),(0,U.jsx)(Iw,{value:`desc`,children:`Descending`})]})]})]})]})]}),(0,U.jsxs)(Tw,{className:`flex-none`,children:[(0,U.jsx)(J,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,U.jsx)(J,{onClick:()=>{i({visibleFields:a,visibleSystemCols:s,sort:l}),t(!1)},children:`Apply`})]})]})})}function vk(){let{slug:e}=hr(),t=dr(),{timezone:n}=ya(),{user:r}=ga(),[i,a]=ea(),o=Math.max(1,Number(i.get(`page`)??1)),s=[10,30,50,70,100].includes(Number(i.get(`limit`)))?Number(i.get(`limit`)):10;function c(e){a(t=>(t.set(`page`,String(e)),t),{replace:!0})}function l(e){a(t=>(t.set(`limit`,String(e)),t.set(`page`,`1`),t),{replace:!0})}let[u,d]=(0,v.useState)(null),[f,p]=(0,v.useState)(!1),[m,h]=(0,v.useState)(null),[g,_]=(0,v.useState)(new Set),[y,b]=(0,v.useState)(!1),[x,S]=(0,v.useState)(!1),[C,w]=(0,v.useState)(``),[T,E]=(0,v.useState)(``),{loading:D,request:O}=Vv();(0,v.useEffect)(()=>{let e=setTimeout(()=>{E(C),c(1)},300);return()=>clearTimeout(e)},[C]);let{data:k,loading:A}=wa(e?`/cms/admin/content-types/${e}`:null);(0,v.useEffect)(()=>{!k||!e||dk(e).then(e=>h(uk(e,k.fields))).catch(()=>h(lk(k.fields)))},[k?.slug]),(0,v.useEffect)(()=>{_(new Set)},[o,s]);let j=m??{visibleFields:k?.fields.slice(0,tk).map(e=>e.name)??[],visibleSystemCols:ik.map(e=>e.name),sort:nk},{sort:M}=j,N=(j.visibleFields??[]).map(e=>{let t=String(e).split(`.`),n=t[0],r=t[1],i=k?.fields.find(e=>e.name===n);return i?{field:i,displayField:r}:null}).filter(Boolean),P=(k?.fields??[]).filter(e=>[`string`,`uid`,`text`,`richtext`].includes(e.type)).map(e=>e.name),{data:F,loading:I,refetch:L}=wa(e&&m?`/cms/admin/content-types/${e}/entries?page=${o}&limit=${s}&sort=${M.field}&order=${M.dir}${T?`&search=${encodeURIComponent(T)}&searchFields=${P.join(`,`)}`:``}`:null);async function R(){!u||!e||(await O(`/cms/admin/entries/${e}/${u}`,`DELETE`),d(null),L())}let ee=r?.permissions??[],te=ee.includes(`*`)||ee.includes(`entries:write`),ne=ee.includes(`*`)||ee.includes(`entries:delete`),z=r?.role?.toLowerCase()===`viewer`,B=r?.role?.toLowerCase()===`contributor`,re=r?.role?.toLowerCase()===`editor`,V=B||re,H=e=>String(e.created_by??``)===String(r?.id??``),ie=e=>!1,ae=e=>te&&(!B||H(e))&&!ie(e),oe=e=>ne&&(!V||H(e)),se=[...g].filter(e=>{let t=(F?.data??[]).find(t=>t.id===e);return t?ae(t):!1}),ce=[...g].filter(e=>{let t=(F?.data??[]).find(t=>t.id===e);return t?oe(t):!1}),le=(F?.data??[]).map(e=>e.id),ue=le.length>0&&le.every(e=>g.has(e)),de=!ue&&le.some(e=>g.has(e));function fe(){_(e=>{let t=new Set(e);return ue?le.forEach(e=>t.delete(e)):le.forEach(e=>t.add(e)),t})}function pe(e){_(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function me(){if(!(!e||y)){b(!0);try{let t=localStorage.getItem(`plank_token`),n={"Content-Type":`application/json`,...t?{Authorization:`Bearer ${t}`}:{}};await Promise.all(se.map(t=>fetch(`/cms/admin/entries/${e}/${t}/status`,{method:`PATCH`,headers:n,body:JSON.stringify({status:`draft`})}))),_(new Set),L()}finally{b(!1)}}}async function he(){if(!(!e||y)){b(!0);try{let t=localStorage.getItem(`plank_token`),n={...t?{Authorization:`Bearer ${t}`}:{}};await Promise.all(ce.map(t=>fetch(`/cms/admin/entries/${e}/${t}`,{method:`DELETE`,headers:n}))),S(!1),_(new Set),L()}finally{b(!1)}}}function ge(t){h(t),e&&fk(e,t).catch(()=>{}),c(1)}if(A||!m)return(0,U.jsxs)(`div`,{className:`flex items-center gap-2 py-12 text-muted-foreground`,children:[(0,U.jsx)(by,{className:`size-4`}),(0,U.jsx)(`span`,{className:`text-sm`,children:`Loading…`})]});if(!k)return null;let _e=Math.ceil((F?.total??0)/(F?.limit??20));return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(yy,{children:(0,U.jsxs)(`div`,{className:`mb-6 flex items-center justify-between gap-4`,children:[(0,U.jsx)(`h1`,{className:`text-2xl font-bold -mt-6`,children:k.name}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsxs)(J,{variant:`outline`,onClick:()=>p(!0),className:`gap-1.5`,children:[(0,U.jsx)(zo,{className:`size-3.5`}),`View config`]}),te&&(0,U.jsxs)(J,{onClick:()=>t(`/content/${e}/new`),className:`gap-2`,children:[(0,U.jsx)(Po,{className:`size-4`}),`New entry`]})]})]})}),(0,U.jsxs)(`section`,{className:`mt-24`,children:[(0,U.jsxs)(`div`,{className:`mb-3 flex items-center gap-3`,children:[(0,U.jsxs)(`div`,{className:`relative max-w-72 w-full`,children:[(0,U.jsx)(Ro,{className:`absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground pointer-events-none`}),(0,U.jsx)(Hv,{className:`pl-9`,placeholder:`Search entries…`,value:C,onChange:e=>w(e.target.value)})]}),!I&&F!=null&&(0,U.jsxs)(`span`,{className:`text-muted-foreground text-sm`,children:[(F?.data??[]).length,` / `,F.total,` `,F.total===1?`entry`:`entries`]})]}),I&&(0,U.jsxs)(`div`,{className:`flex items-center gap-2 py-12 text-muted-foreground`,children:[(0,U.jsx)(by,{className:`size-4`}),(0,U.jsx)(`span`,{className:`text-sm`,children:`Loading entries…`})]}),!I&&(F?.data??[]).length===0&&!T&&(0,U.jsxs)(Xw,{className:`border`,children:[(0,U.jsxs)(Zw,{children:[(0,U.jsx)($w,{variant:`icon`,children:(0,U.jsx)(io,{})}),(0,U.jsx)(eT,{children:`No entries yet`}),(0,U.jsxs)(tT,{children:[`Create your first entry for `,k.name,`.`]})]}),(0,U.jsx)(nT,{children:te&&(0,U.jsx)(J,{onClick:()=>t(`/content/${e}/new`),children:`New entry`})})]}),!I&&(F?.data??[]).length===0&&T&&(0,U.jsx)(Xw,{className:`border`,children:(0,U.jsxs)(Zw,{children:[(0,U.jsx)($w,{variant:`icon`,children:(0,U.jsx)(Ro,{})}),(0,U.jsx)(eT,{children:`No results`}),(0,U.jsxs)(tT,{children:[`No entries match "`,T,`".`]})]})}),!I&&(F?.data??[]).length>0&&(0,U.jsxs)(Pv,{children:[!z&&g.size>0&&(0,U.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,U.jsxs)(`span`,{className:`text-sm font-medium`,children:[g.size,` selected`]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2 ml-auto`,children:[(0,U.jsxs)(J,{variant:`outline`,size:`sm`,disabled:y||se.length===0,onClick:me,children:[y?(0,U.jsx)(by,{className:`size-3.5`}):null,`Unpublish`]}),ne&&(0,U.jsxs)(J,{variant:`destructive`,size:`sm`,disabled:y||ce.length===0,onClick:()=>S(!0),children:[(0,U.jsx)(qo,{className:`size-3.5`}),`Delete`]})]})]}),(0,U.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-border`,children:(0,U.jsxs)(Rw,{className:`w-full`,children:[(0,U.jsx)(zw,{className:`border-b border-border font-bold uppercase`,children:(0,U.jsxs)(Vw,{className:`hover:bg-transparent`,children:[(0,U.jsx)(Hw,{className:`w-10 px-4 py-3`,children:!z&&(0,U.jsx)(EO,{checked:ue?!0:de?`indeterminate`:!1,onCheckedChange:fe,"aria-label":`Select all`})}),N.map(e=>(0,U.jsx)(Hw,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:ak(e.field.name)},e.field.name)),j.visibleSystemCols.includes(`created_at`)&&(0,U.jsx)(Hw,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:`Created`}),j.visibleSystemCols.includes(`updated_at`)&&(0,U.jsx)(Hw,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:`Updated`}),j.visibleSystemCols.includes(`pub_sch`)&&(0,U.jsx)(Hw,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:`Pub / Sch`}),(0,U.jsx)(Hw,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:`Status`}),(0,U.jsx)(Hw,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:`Author`}),(0,U.jsx)(Hw,{className:`px-4 py-3`})]})}),(0,U.jsx)(Bw,{className:`divide-y divide-border`,children:(F?.data??[]).map(r=>(0,U.jsxs)(Vw,{className:`group transition-colors ${g.has(r.id)?`bg-muted/40`:`hover:bg-muted/30`} ${B&&!H(r)?`opacity-60`:``} ${ie(r)?`opacity-60`:``}`,children:[(0,U.jsx)(Uw,{className:`w-10 px-4 py-3`,children:!z&&(0,U.jsx)(EO,{checked:g.has(r.id),onCheckedChange:()=>pe(r.id),"aria-label":`Select row`})}),N.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,U.jsx)(Uw,{className:`px-4 py-3`,children:(0,U.jsx)(mk,{field:e.field,value:n,displayField:e.displayField})},e.field.name)}),j.visibleSystemCols.includes(`created_at`)&&(0,U.jsx)(Uw,{className:`px-4 py-3 text-muted-foreground whitespace-nowrap`,children:Cy(r.created_at,n)}),j.visibleSystemCols.includes(`updated_at`)&&(0,U.jsx)(Uw,{className:`px-4 py-3 text-muted-foreground whitespace-nowrap`,children:Cy(r.updated_at,n)}),j.visibleSystemCols.includes(`pub_sch`)&&(0,U.jsx)(Uw,{className:`px-4 py-3 text-muted-foreground whitespace-nowrap`,children:r.status===`scheduled`&&r.scheduled_for?Cy(r.scheduled_for,n):r.published_at?Cy(r.published_at,n):`—`}),(0,U.jsx)(Uw,{className:`px-4 py-3`,children:(0,U.jsx)(gk,{entry:r,fields:k.fields})}),(0,U.jsx)(Uw,{className:`px-4 py-3`,children:(0,U.jsx)(hk,{entry:r})}),(0,U.jsx)(Uw,{className:`px-4 py-3`,children:(0,U.jsx)(`div`,{className:`flex items-center justify-end gap-1`,children:z?(0,U.jsx)(J,{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,U.jsx)(to,{className:`size-3.5`})}):(0,U.jsxs)(U.Fragment,{children:[ae(r)&&(0,U.jsx)(J,{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,U.jsx)(No,{className:`size-3.5`})}),oe(r)&&(0,U.jsx)(J,{size:`icon`,variant:`ghost`,onClick:()=>d(r.id),className:`flex size-8 items-center justify-center rounded text-destructive hover:bg-destructive/10 hover:text-destructive`,children:(0,U.jsx)(qo,{className:`size-3.5`})})]})})})]},r.id))})]})}),(0,U.jsx)(`div`,{className:`mt-4`,children:(0,U.jsx)(ek,{page:o,totalPages:_e,limit:s,onPageChange:c,onLimitChange:l})})]}),m&&(0,U.jsx)(_k,{open:f,onOpenChange:p,allFields:k.fields,config:m,onApply:ge}),(0,U.jsx)(yw,{open:!!u,onOpenChange:e=>{e||d(null)},children:(0,U.jsxs)(Cw,{className:`max-w-sm`,children:[(0,U.jsx)(ww,{children:(0,U.jsx)(Ew,{children:`Delete entry?`})}),(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This action cannot be undone.`}),(0,U.jsxs)(Tw,{children:[(0,U.jsx)(J,{variant:`outline`,onClick:()=>d(null),children:`Cancel`}),(0,U.jsxs)(J,{variant:`destructive`,onClick:R,disabled:D,children:[D?(0,U.jsx)(by,{className:`size-4`}):null,`Delete`]})]})]})}),(0,U.jsx)(yw,{open:x,onOpenChange:e=>{e||S(!1)},children:(0,U.jsxs)(Cw,{className:`max-w-sm`,children:[(0,U.jsx)(ww,{children:(0,U.jsxs)(Ew,{children:[`Delete `,g.size,` `,g.size===1?`entry`:`entries`,`?`]})}),(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This action cannot be undone.`}),(0,U.jsxs)(Tw,{children:[(0,U.jsx)(J,{variant:`outline`,onClick:()=>S(!1),children:`Cancel`}),(0,U.jsxs)(J,{variant:`destructive`,onClick:he,disabled:y,children:[y?(0,U.jsx)(by,{className:`size-4`}):null,`Delete`]})]})]})})]})]})}function yk(){let{slug:e}=hr(),t=dr(),{user:n}=ga(),{data:r,loading:i}=wa(e?`/cms/admin/content-types/${e}`:null),a=r?.kind===`single`,{data:o,loading:s,error:c}=wa(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,U.jsxs)(`div`,{className:`flex items-center gap-2 py-12 text-muted-foreground`,children:[(0,U.jsx)(by,{className:`size-4`}),(0,U.jsx)(`span`,{className:`text-sm`,children:`Loading…`})]}):a?o?null:(0,U.jsx)(`div`,{className:`py-12 text-sm text-muted-foreground`,children:`No entry is available for this Single Type.`}):(0,U.jsx)(vk,{})}var bk=365.2425,xk=6048e5,Sk=864e5,Ck=3600*24;Ck*7,Ck*bk/12*3;var wk=Symbol.for(`constructDateFrom`);function Tk(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&wk in e?e[wk](t):e instanceof Date?new e.constructor(t):new Date(t)}function Ek(e,t){return Tk(t||e,e)}function Dk(e,t,n){let r=Ek(e,n?.in);return isNaN(t)?Tk(n?.in||e,NaN):(t&&r.setDate(r.getDate()+t),r)}function Ok(e,t,n){let r=Ek(e,n?.in);if(isNaN(t))return Tk(n?.in||e,NaN);if(!t)return r;let i=r.getDate(),a=Tk(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 kk={};function Ak(){return kk}function jk(e,t){let n=Ak(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=Ek(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 Mk(e,t){return jk(e,{...t,weekStartsOn:1})}function Nk(e,t){let n=Ek(e,t?.in),r=n.getFullYear(),i=Tk(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);let a=Mk(i),o=Tk(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);let s=Mk(o);return n.getTime()>=a.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function Pk(e){let t=Ek(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 Fk(e,...t){let n=Tk.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function Ik(e,t){let n=Ek(e,t?.in);return n.setHours(0,0,0,0),n}function Lk(e,t,n){let[r,i]=Fk(n?.in,e,t),a=Ik(r),o=Ik(i),s=+a-Pk(a),c=+o-Pk(o);return Math.round((s-c)/Sk)}function Rk(e,t){let n=Nk(e,t),r=Tk(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),Mk(r)}function zk(e,t,n){return Dk(e,t*7,n)}function Bk(e,t,n){return Ok(e,t*12,n)}function Vk(e,t){let n,r=t?.in;return e.forEach(e=>{!r&&typeof e==`object`&&(r=Tk.bind(null,e));let t=Ek(e,r);(!n||n<t||isNaN(+t))&&(n=t)}),Tk(r,n||NaN)}function Hk(e,t){let n,r=t?.in;return e.forEach(e=>{!r&&typeof e==`object`&&(r=Tk.bind(null,e));let t=Ek(e,r);(!n||n>t||isNaN(+t))&&(n=t)}),Tk(r,n||NaN)}function Uk(e,t,n){let[r,i]=Fk(n?.in,e,t);return+Ik(r)==+Ik(i)}function Wk(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function Gk(e){return!(!Wk(e)&&typeof e!=`number`||isNaN(+Ek(e)))}function Kk(e,t,n){let[r,i]=Fk(n?.in,e,t),a=r.getFullYear()-i.getFullYear(),o=r.getMonth()-i.getMonth();return a*12+o}function qk(e,t){let n=Ek(e,t?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function Jk(e,t){let[n,r]=Fk(e,t.start,t.end);return{start:n,end:r}}function Yk(e,t){let{start:n,end:r}=Jk(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(Tk(n,o)),o.setMonth(o.getMonth()+s);return i?c.reverse():c}function Xk(e,t){let n=Ek(e,t?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function Zk(e,t){let n=Ek(e,t?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function Qk(e,t){let n=Ek(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function $k(e,t){let{start:n,end:r}=Jk(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(Tk(n,o)),o.setFullYear(o.getFullYear()+s);return i?c.reverse():c}function eA(e,t){let n=Ak(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=Ek(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 tA(e,t){return eA(e,{...t,weekStartsOn:1})}var nA={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`}},rA=(e,t,n)=>{let r,i=nA[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 iA(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var aA={date:iA({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:iA({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:iA({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},oA={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},sA=(e,t,n,r)=>oA[e];function cA(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 lA={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:cA({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:cA({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:cA({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:cA({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:cA({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 uA(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)?fA(s,e=>e.test(o)):dA(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 dA(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function fA(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function pA(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 mA={code:`en-US`,formatDistance:rA,formatLong:aA,formatRelative:sA,localize:lA,match:{ordinalNumber:pA({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:uA({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:uA({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:uA({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:uA({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:uA({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 hA(e,t){let n=Ek(e,t?.in);return Lk(n,Qk(n))+1}function gA(e,t){let n=Ek(e,t?.in),r=Mk(n)-+Rk(n);return Math.round(r/xk)+1}function _A(e,t){let n=Ek(e,t?.in),r=n.getFullYear(),i=Ak(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=Tk(t?.in||e,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);let s=jk(o,t),c=Tk(t?.in||e,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);let l=jk(c,t);return+n>=+s?r+1:+n>=+l?r:r-1}function vA(e,t){let n=Ak(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=_A(e,t),a=Tk(t?.in||e,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),jk(a,t)}function yA(e,t){let n=Ek(e,t?.in),r=jk(n,t)-+vA(n,t);return Math.round(r/xk)+1}function bA(e,t){return(e<0?`-`:``)+Math.abs(e).toString().padStart(t,`0`)}var xA={y(e,t){let n=e.getFullYear(),r=n>0?n:1-n;return bA(t===`yy`?r%100:r,t.length)},M(e,t){let n=e.getMonth();return t===`M`?String(n+1):bA(n+1,2)},d(e,t){return bA(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 bA(e.getHours()%12||12,t.length)},H(e,t){return bA(e.getHours(),t.length)},m(e,t){return bA(e.getMinutes(),t.length)},s(e,t){return bA(e.getSeconds(),t.length)},S(e,t){let n=t.length,r=e.getMilliseconds();return bA(Math.trunc(r*10**(n-3)),t.length)}},SA={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},CA={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 xA.y(e,t)},Y:function(e,t,n,r){let i=_A(e,r),a=i>0?i:1-i;return t===`YY`?bA(a%100,2):t===`Yo`?n.ordinalNumber(a,{unit:`year`}):bA(a,t.length)},R:function(e,t){return bA(Nk(e),t.length)},u:function(e,t){return bA(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 bA(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 bA(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 xA.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 bA(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=yA(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):bA(i,t.length)},I:function(e,t,n){let r=gA(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):bA(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getDate(),{unit:`date`}):xA.d(e,t)},D:function(e,t,n){let r=hA(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):bA(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 bA(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 bA(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 bA(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?SA.noon:r===0?SA.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?SA.evening:r>=12?SA.afternoon:r>=4?SA.morning:SA.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 xA.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getHours(),{unit:`hour`}):xA.H(e,t)},K:function(e,t,n){let r=e.getHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):bA(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):bA(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getMinutes(),{unit:`minute`}):xA.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getSeconds(),{unit:`second`}):xA.s(e,t)},S:function(e,t){return xA.S(e,t)},X:function(e,t,n){let r=e.getTimezoneOffset();if(r===0)return`Z`;switch(t){case`X`:return TA(r);case`XXXX`:case`XX`:return EA(r);default:return EA(r,`:`)}},x:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`x`:return TA(r);case`xxxx`:case`xx`:return EA(r);default:return EA(r,`:`)}},O:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+wA(r,`:`);default:return`GMT`+EA(r,`:`)}},z:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+wA(r,`:`);default:return`GMT`+EA(r,`:`)}},t:function(e,t,n){return bA(Math.trunc(e/1e3),t.length)},T:function(e,t,n){return bA(+e,t.length)}};function wA(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+bA(a,2)}function TA(e,t){return e%60==0?(e>0?`-`:`+`)+bA(Math.abs(e)/60,2):EA(e,t)}function EA(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=bA(Math.trunc(r/60),2),a=bA(r%60,2);return n+i+t+a}var DA=(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`})}},OA=(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`})}},kA={p:OA,P:(e,t)=>{let n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return DA(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}}`,DA(r,t)).replace(`{{time}}`,OA(i,t))}},AA=/^D+$/,jA=/^Y+$/,MA=[`D`,`DD`,`YY`,`YYYY`];function NA(e){return AA.test(e)}function PA(e){return jA.test(e)}function FA(e,t,n){let r=IA(e,t,n);if(console.warn(r),MA.includes(e))throw RangeError(r)}function IA(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 LA=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,RA=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,zA=/^'([^]*?)'?$/,BA=/''/g,VA=/[a-zA-Z]/;function HA(e,t,n){let r=Ak(),i=n?.locale??r.locale??mA,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=Ek(e,n?.in);if(!Gk(s))throw RangeError(`Invalid time value`);let c=t.match(RA).map(e=>{let t=e[0];if(t===`p`||t===`P`){let n=kA[t];return n(e,i.formatLong)}return e}).join(``).match(LA).map(e=>{if(e===`''`)return{isToken:!1,value:`'`};let t=e[0];if(t===`'`)return{isToken:!1,value:UA(e)};if(CA[t])return{isToken:!0,value:e};if(t.match(VA))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&&PA(a)||!n?.useAdditionalDayOfYearTokens&&NA(a))&&FA(a,t,String(e));let o=CA[a[0]];return o(s,a,i.localize,l)}).join(``)}function UA(e){let t=e.match(zA);return t?t[1].replace(BA,`'`):e}function WA(e,t){let n=Ek(e,t?.in),r=n.getFullYear(),i=n.getMonth(),a=Tk(n,0);return a.setFullYear(r,i+1,0),a.setHours(0,0,0,0),a.getDate()}function GA(e,t){return Ek(e,t?.in).getMonth()}function KA(e,t){return Ek(e,t?.in).getFullYear()}function qA(e,t){return+Ek(e)>+Ek(t)}function JA(e,t){return+Ek(e)<+Ek(t)}function YA(e,t,n){let[r,i]=Fk(n?.in,e,t);return r.getFullYear()===i.getFullYear()&&r.getMonth()===i.getMonth()}function XA(e,t,n){let[r,i]=Fk(n?.in,e,t);return r.getFullYear()===i.getFullYear()}function ZA(e,t,n){let r=Ek(e,n?.in),i=r.getFullYear(),a=r.getDate(),o=Tk(n?.in||e,0);o.setFullYear(i,t,15),o.setHours(0,0,0,0);let s=WA(o);return r.setMonth(t,Math.min(a,s)),r}function QA(e,t,n){let r=Ek(e,n?.in);return isNaN(+r)?Tk(n?.in||e,NaN):(r.setFullYear(t),r)}function $A({className:e,...t}){return(0,U.jsx)(pw,{"data-slot":`tabs`,className:q(`flex flex-col gap-2`,e),...t})}function ej({className:e,...t}){return(0,U.jsx)(mw,{"data-slot":`tabs-list`,className:q(`inline-flex h-9 items-center justify-start rounded-lg bg-muted p-1 text-muted-foreground w-full`,e),...t})}function tj({className:e,...t}){return(0,U.jsx)(hw,{"data-slot":`tabs-trigger`,className:q(`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 nj({className:e,...t}){return(0,U.jsx)(gw,{"data-slot":`tabs-content`,className:q(`flex-1 outline-none`,e),...t})}function rj({className:e,...t}){return(0,U.jsx)(XC,{"data-slot":`switch`,className:q(`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,U.jsx)(ZC,{className:q(`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 ij(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 aj={},oj={};function sj(e,t){try{let n=(aj[e]||=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`longOffset`}).format)(t).split(`GMT`)[1];return n in oj?oj[n]:lj(n,n.split(`:`))}catch{if(e in oj)return oj[e];let t=e?.match(cj);return t?lj(e,t.slice(1)):NaN}}var cj=/([+-]\d\d):?(\d\d)?/;function lj(e,t){let n=+(t[0]||0),r=+(t[1]||0),i=(t[2]||0)/60;return oj[e]=n*60+r>0?n*60+r+i:n*60-r-i}var uj=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(sj(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)),mj(this,NaN),fj(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=-sj(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),fj(this),+this}[Symbol.for(`constructDateFrom`)](t){return new e(+new Date(t),this.timeZone)}},dj=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!dj.test(e))return;let t=e.replace(dj,`$1UTC`);uj.prototype[t]&&(e.startsWith(`get`)?uj.prototype[e]=function(){return this.internal[t]()}:(uj.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),pj(this),+this},uj.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),fj(this),+this}))});function fj(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-sj(e.timeZone,e)*60))}function pj(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()),mj(e)}function mj(e){let t=sj(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(-(sj(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=sj(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=sj(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 hj=class e extends uj{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} (${ij(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)}},gj=5,_j=4;function vj(e,t){let n=t.startOfMonth(e),r=n.getDay()>0?n.getDay():7,i=t.addDays(e,-r+1),a=t.addDays(i,gj*7-1);return t.getMonth(e)===t.getMonth(a)?gj:_j}function yj(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 bj(e,t){let n=yj(e,t),r=vj(e,t);return t.addDays(n,r*7-1)}var xj={...mA,labels:{labelDayButton:(e,t,n,r)=>{let i;i=r&&typeof r.format==`function`?r.format.bind(r):(e,t)=>HA(e,t,{locale:mA,...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)=>HA(e,n,{locale:mA,...t}),r(e,`LLLL yyyy`)},labelGridcell:(e,t,n,r)=>{let i;i=r&&typeof r.format==`function`?r.format.bind(r):(e,t)=>HA(e,t,{locale:mA,...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)=>HA(e,n,{locale:mA,...t}),r(e,`cccc`)}}},Sj=class e{constructor(e,t){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?hj.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 hj(e,t,n,this.options.timeZone):new Date(e,t,n),this.addDays=(e,t)=>this.overrides?.addDays?this.overrides.addDays(e,t):Dk(e,t),this.addMonths=(e,t)=>this.overrides?.addMonths?this.overrides.addMonths(e,t):Ok(e,t),this.addWeeks=(e,t)=>this.overrides?.addWeeks?this.overrides.addWeeks(e,t):zk(e,t),this.addYears=(e,t)=>this.overrides?.addYears?this.overrides.addYears(e,t):Bk(e,t),this.differenceInCalendarDays=(e,t)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(e,t):Lk(e,t),this.differenceInCalendarMonths=(e,t)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(e,t):Kk(e,t),this.eachMonthOfInterval=e=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(e):Yk(e),this.eachYearOfInterval=e=>{let t=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(e):$k(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):bj(e,this),this.endOfISOWeek=e=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(e):tA(e),this.endOfMonth=e=>this.overrides?.endOfMonth?this.overrides.endOfMonth(e):qk(e),this.endOfWeek=(e,t)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(e,t):eA(e,this.options),this.endOfYear=e=>this.overrides?.endOfYear?this.overrides.endOfYear(e):Zk(e),this.format=(e,t,n)=>{let r=this.overrides?.format?this.overrides.format(e,t,this.options):HA(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):gA(e),this.getMonth=(e,t)=>this.overrides?.getMonth?this.overrides.getMonth(e,this.options):GA(e,this.options),this.getYear=(e,t)=>this.overrides?.getYear?this.overrides.getYear(e,this.options):KA(e,this.options),this.getWeek=(e,t)=>this.overrides?.getWeek?this.overrides.getWeek(e,this.options):yA(e,this.options),this.isAfter=(e,t)=>this.overrides?.isAfter?this.overrides.isAfter(e,t):qA(e,t),this.isBefore=(e,t)=>this.overrides?.isBefore?this.overrides.isBefore(e,t):JA(e,t),this.isDate=e=>this.overrides?.isDate?this.overrides.isDate(e):Wk(e),this.isSameDay=(e,t)=>this.overrides?.isSameDay?this.overrides.isSameDay(e,t):Uk(e,t),this.isSameMonth=(e,t)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(e,t):YA(e,t),this.isSameYear=(e,t)=>this.overrides?.isSameYear?this.overrides.isSameYear(e,t):XA(e,t),this.max=e=>this.overrides?.max?this.overrides.max(e):Vk(e),this.min=e=>this.overrides?.min?this.overrides.min(e):Hk(e),this.setMonth=(e,t)=>this.overrides?.setMonth?this.overrides.setMonth(e,t):ZA(e,t),this.setYear=(e,t)=>this.overrides?.setYear?this.overrides.setYear(e,t):QA(e,t),this.startOfBroadcastWeek=(e,t)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(e,this):yj(e,this),this.startOfDay=e=>this.overrides?.startOfDay?this.overrides.startOfDay(e):Ik(e),this.startOfISOWeek=e=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(e):Mk(e),this.startOfMonth=e=>this.overrides?.startOfMonth?this.overrides.startOfMonth(e):Xk(e),this.startOfWeek=(e,t)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(e,this.options):jk(e,this.options),this.startOfYear=e=>this.overrides?.startOfYear?this.overrides.startOfYear(e):Qk(e),this.options={locale:xj,...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)}};Sj.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 Cj=new Sj,wj=class{constructor(e,t,n=Cj){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)}},Tj=class{constructor(e,t){this.date=e,this.weeks=t}},Ej=class{constructor(e,t){this.days=t,this.weekNumber=e}};function Dj(e){return v.createElement(`button`,{...e})}function Oj(e){return v.createElement(`span`,{...e})}function kj(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 Aj(e){let{day:t,modifiers:n,...r}=e;return v.createElement(`td`,{...r})}function jj(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 Mj;(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`})(Mj||={});var Nj;(function(e){e.disabled=`disabled`,e.hidden=`hidden`,e.outside=`outside`,e.focused=`focused`,e.today=`today`})(Nj||={});var Pj;(function(e){e.range_end=`range_end`,e.range_middle=`range_middle`,e.range_start=`range_start`,e.selected=`selected`})(Pj||={});var Fj;(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`})(Fj||={});function Ij(e){let{options:t,className:n,components:r,classNames:i,...a}=e,o=[i[Mj.Dropdown],n].join(` `),s=t?.find(({value:e})=>e===a.value);return v.createElement(`span`,{"data-disabled":a.disabled,className:i[Mj.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[Mj.CaptionLabel],"aria-hidden":!0},s?.label,v.createElement(r.Chevron,{orientation:`down`,size:18,className:i[Mj.Chevron]})))}function Lj(e){return v.createElement(`div`,{...e})}function Rj(e){return v.createElement(`div`,{...e})}function zj(e){let{calendarMonth:t,displayIndex:n,...r}=e;return v.createElement(`div`,{...r},e.children)}function Bj(e){let{calendarMonth:t,displayIndex:n,...r}=e;return v.createElement(`div`,{...r})}function Vj(e){return v.createElement(`table`,{...e})}function Hj(e){return v.createElement(`div`,{...e})}var Uj=(0,v.createContext)(void 0);function Wj(){let e=(0,v.useContext)(Uj);if(e===void 0)throw Error(`useDayPicker() must be used within a custom component.`);return e}function Gj(e){let{components:t}=Wj();return v.createElement(t.Dropdown,{...e})}function Kj(e){let{onPreviousClick:t,onNextClick:n,previousMonth:r,nextMonth:i,...a}=e,{components:o,classNames:s,labels:{labelPrevious:c,labelNext:l}}=Wj(),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[Mj.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[Mj.Chevron],orientation:`left`})),v.createElement(o.NextMonthButton,{type:`button`,className:s[Mj.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[Mj.Chevron]})))}function qj(e){let{components:t}=Wj();return v.createElement(t.Button,{...e})}function Jj(e){return v.createElement(`option`,{...e})}function Yj(e){let{components:t}=Wj();return v.createElement(t.Button,{...e})}function Xj(e){let{rootRef:t,...n}=e;return v.createElement(`div`,{...n,ref:t})}function Zj(e){return v.createElement(`select`,{...e})}function Qj(e){let{week:t,...n}=e;return v.createElement(`tr`,{...n})}function $j(e){return v.createElement(`th`,{...e})}function eM(e){return v.createElement(`thead`,{"aria-hidden":!0},v.createElement(`tr`,{...e}))}function tM(e){let{week:t,...n}=e;return v.createElement(`th`,{...n})}function nM(e){return v.createElement(`th`,{...e})}function rM(e){return v.createElement(`tbody`,{...e})}function iM(e){let{components:t}=Wj();return v.createElement(t.Dropdown,{...e})}var aM=s({Button:()=>Dj,CaptionLabel:()=>Oj,Chevron:()=>kj,Day:()=>Aj,DayButton:()=>jj,Dropdown:()=>Ij,DropdownNav:()=>Lj,Footer:()=>Rj,Month:()=>zj,MonthCaption:()=>Bj,MonthGrid:()=>Vj,Months:()=>Hj,MonthsDropdown:()=>Gj,Nav:()=>Kj,NextMonthButton:()=>qj,Option:()=>Jj,PreviousMonthButton:()=>Yj,Root:()=>Xj,Select:()=>Zj,Week:()=>Qj,WeekNumber:()=>tM,WeekNumberHeader:()=>nM,Weekday:()=>$j,Weekdays:()=>eM,Weeks:()=>rM,YearsDropdown:()=>iM});function oM(e,t,n=!1,r=Cj){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 sM(e){return!!(e&&typeof e==`object`&&`before`in e&&`after`in e)}function cM(e){return!!(e&&typeof e==`object`&&`from`in e)}function lM(e){return!!(e&&typeof e==`object`&&`after`in e)}function uM(e){return!!(e&&typeof e==`object`&&`before`in e)}function dM(e){return!!(e&&typeof e==`object`&&`dayOfWeek`in e)}function fM(e,t){return Array.isArray(e)&&e.every(t.isDate)}function pM(e,t,n=Cj){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(fM(t,n))return t.some(t=>i(e,t));if(cM(t))return oM(t,e,!1,n);if(dM(t))return Array.isArray(t.dayOfWeek)?t.dayOfWeek.includes(e.getDay()):t.dayOfWeek===e.getDay();if(sM(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 lM(t)?a(e,t.after)>0:uM(t)?a(t.before,e)>0:typeof t==`function`?t(e):!1})}function mM(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={[Nj.focused]:[],[Nj.outside]:[],[Nj.disabled]:[],[Nj.hidden]:[],[Nj.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&&pM(e,a,i)),S=!!(o&&pM(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&&pM(e,r,i)&&(b[n]?b[n].push(t):b[n]=[t])})}return e=>{let t={[Nj.focused]:!1,[Nj.disabled]:!1,[Nj.hidden]:!1,[Nj.outside]:!1,[Nj.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 hM(e,t,n={}){return Object.entries(e).filter(([,e])=>e===!0).reduce((e,[r])=>(n[r]?e.push(n[r]):t[Nj[r]]?e.push(t[Nj[r]]):t[Pj[r]]&&e.push(t[Pj[r]]),e),[t[Mj.Day]])}function gM(e){return{...aM,...e}}function _M(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 vM(){let e={};for(let t in Mj)e[Mj[t]]=`rdp-${Mj[t]}`;for(let t in Nj)e[Nj[t]]=`rdp-${Nj[t]}`;for(let t in Pj)e[Pj[t]]=`rdp-${Pj[t]}`;for(let t in Fj)e[Fj[t]]=`rdp-${Fj[t]}`;return e}function yM(e,t,n){return(n??new Sj(t)).formatMonthYear(e)}var bM=yM;function xM(e,t,n){return(n??new Sj(t)).format(e,`d`)}function SM(e,t=Cj){return t.format(e,`LLLL`)}function CM(e,t,n){return(n??new Sj(t)).format(e,`cccccc`)}function wM(e,t=Cj){return e<10?t.formatNumber(`0${e.toLocaleString()}`):t.formatNumber(`${e.toLocaleString()}`)}function TM(){return``}function EM(e,t=Cj){return t.format(e,`yyyy`)}var DM=EM,OM=s({formatCaption:()=>yM,formatDay:()=>xM,formatMonthCaption:()=>bM,formatMonthDropdown:()=>SM,formatWeekNumber:()=>wM,formatWeekNumberHeader:()=>TM,formatWeekdayName:()=>CM,formatYearCaption:()=>DM,formatYearDropdown:()=>EM});function kM(e){return e?.formatMonthCaption&&!e.formatCaption&&(e.formatCaption=e.formatMonthCaption),e?.formatYearCaption&&!e.formatYearDropdown&&(e.formatYearDropdown=e.formatYearCaption),{...OM,...e}}function AM(e,t,n,r){let i=(r??new Sj(n)).format(e,`PPPP`);return t.today&&(i=`Today, ${i}`),t.selected&&(i=`${i}, selected`),i}var jM=AM;function MM(e,t,n){return(n??new Sj(t)).formatMonthYear(e)}var NM=MM;function PM(e,t,n,r){let i=(r??new Sj(n)).format(e,`PPPP`);return t?.today&&(i=`Today, ${i}`),i}function FM(e){return`Choose the Month`}function IM(){return``}var LM=`Go to the Next Month`;function RM(e,t){return LM}function zM(e){return`Go to the Previous Month`}function BM(e,t,n){return(n??new Sj(t)).format(e,`cccc`)}function VM(e,t){return`Week ${e}`}function HM(e){return`Week Number`}function UM(e){return`Choose the Year`}var WM=s({labelCaption:()=>NM,labelDay:()=>jM,labelDayButton:()=>AM,labelGrid:()=>MM,labelGridcell:()=>PM,labelMonthDropdown:()=>FM,labelNav:()=>IM,labelNext:()=>RM,labelPrevious:()=>zM,labelWeekNumber:()=>VM,labelWeekNumberHeader:()=>HM,labelWeekday:()=>BM,labelYearDropdown:()=>UM}),GM=(e,t,n)=>t||(n?typeof n==`function`?n:(...e)=>n:e);function KM(e,t){let n=t.locale?.labels??{};return{...WM,...e??{},labelDayButton:GM(AM,e?.labelDayButton,n.labelDayButton),labelMonthDropdown:GM(FM,e?.labelMonthDropdown,n.labelMonthDropdown),labelNext:GM(RM,e?.labelNext,n.labelNext),labelPrevious:GM(zM,e?.labelPrevious,n.labelPrevious),labelWeekNumber:GM(VM,e?.labelWeekNumber,n.labelWeekNumber),labelYearDropdown:GM(UM,e?.labelYearDropdown,n.labelYearDropdown),labelGrid:GM(MM,e?.labelGrid,n.labelGrid),labelGridcell:GM(PM,e?.labelGridcell,n.labelGridcell),labelNav:GM(IM,e?.labelNav,n.labelNav),labelWeekNumberHeader:GM(HM,e?.labelWeekNumberHeader,n.labelWeekNumberHeader),labelWeekday:GM(BM,e?.labelWeekday,n.labelWeekday)}}function qM(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 JM(e,t={},n={}){let r={...t?.[Mj.Day]};return Object.entries(e).filter(([,e])=>e===!0).forEach(([e])=>{r={...r,...n?.[e]}}),r}function YM(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 XM(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 ZM(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 hj(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(hj.tz(e)),newDate:(t,n,r)=>new hj(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 hj(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 hj(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 hj(n.getFullYear(),0,1,12,0,0,e);for(;o.getFullYear()<=r.getFullYear();)i.push(new hj(o,e)),o.setFullYear(o.getFullYear()+1,0,1);return i},getWeek:(e,t)=>yA(o(e),{weekStartsOn:t?.weekStartsOn??i,firstWeekContainsDate:t?.firstWeekContainsDate??r?.options?.firstWeekContainsDate??1}),getISOWeek:e=>gA(o(e)),differenceInCalendarDays:(e,t)=>Lk(o(e),o(t)),differenceInCalendarMonths:(e,t)=>Kk(o(e),o(t))}}var QM=e=>e instanceof HTMLElement?e:null,$M=e=>[...e.querySelectorAll(`[data-animated-month]`)??[]],eN=e=>QM(e.querySelector(`[data-animated-month]`)),tN=e=>QM(e.querySelector(`[data-animated-caption]`)),nN=e=>QM(e.querySelector(`[data-animated-weeks]`)),rN=e=>QM(e.querySelector(`[data-animated-nav]`)),iN=e=>QM(e.querySelector(`[data-animated-weekdays]`));function aN(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[Fj.caption_after_enter]:n[Fj.caption_before_enter],p=d?n[Fj.weeks_after_enter]:n[Fj.weeks_before_enter],m=o.current,h=e.current.cloneNode(!0);if(h instanceof HTMLElement?($M(h).forEach(e=>{if(!(e instanceof HTMLElement))return;let t=eN(e);t&&e.contains(t)&&e.removeChild(t);let n=tN(e);n&&n.classList.remove(f);let r=nN(e);r&&r.classList.remove(p)}),o.current=h):o.current=null,c.current||u||i)return;let g=m instanceof HTMLElement?$M(m):[],_=$M(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=rN(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=tN(i);s&&s.classList.add(f);let l=nN(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=iN(o);m&&(m.style.opacity=`0`);let h=tN(o);h&&(h.classList.add(d?n[Fj.caption_before_exit]:n[Fj.caption_after_exit]),h.addEventListener(`animationend`,u));let _=nN(o);_&&_.classList.add(d?n[Fj.weeks_before_exit]:n[Fj.weeks_after_exit]),i.insertBefore(o,i.firstChild)})}})}function oN(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 sN(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 cN(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 lN(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 uN(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 Tj(m,_.reduce((e,t)=>{let i=n.ISOWeek?l(t):u(t),a=e.find(e=>e.weekNumber===i),o=new wj(t,m,r);return a?a.days.push(o):e.push(new Ej(i,[o])),e},[]));return e.push(y),e},[]);return n.reverseMonths?m.reverse():m}function dN(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 fN(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 pN(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 mN(e){return e.reduce((e,t)=>e.concat(t.weeks.slice()),[].slice())}function hN(e,t){let[n,r]=(0,v.useState)(e);return[t===void 0?n:t,r]}function gN(e,t){let[n,r]=dN(e,t),{startOfMonth:i,endOfMonth:a}=t,o=lN(e,n,r,t),[s,c]=hN(o,e.month?o:void 0);(0,v.useEffect)(()=>{c(lN(e,n,r,t))},[e.timeZone]);let{months:l,weeks:u,days:d,previousMonth:f,nextMonth:p}=(0,v.useMemo)(()=>{let i=cN(s,r,{numberOfMonths:e.numberOfMonths},t),o=uN(i,oN(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:mN(o),days:sN(o),previousMonth:pN(s,n,e,t),nextMonth:fN(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 _N;(function(e){e[e.Today=0]=`Today`,e[e.Selected=1]=`Selected`,e[e.LastFocused=2]=`LastFocused`,e[e.FocusedModifier=3]=`FocusedModifier`})(_N||={});function vN(e){return!e[Nj.disabled]&&!e[Nj.hidden]&&!e[Nj.outside]}function yN(e,t,n,r){let i,a=-1;for(let o of e){let e=t(o);vN(e)&&(e[Nj.focused]&&a<_N.FocusedModifier?(i=o,a=_N.FocusedModifier):r?.isEqualTo(o)&&a<_N.LastFocused?(i=o,a=_N.LastFocused):n(o.date)&&a<_N.Selected?(i=o,a=_N.Selected):e[Nj.today]&&a<_N.Today&&(i=o,a=_N.Today))}return i||=e.find(e=>vN(t(e))),i}function bN(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 xN(e,t,n,r,i,a,o,s=0){if(s>365)return;let c=bN(e,t,n.date,r,i,a,o),l=!!(a.disabled&&pM(c,a.disabled,o)),u=!!(a.hidden&&pM(c,a.hidden,o)),d=new wj(c,c,o);return!l&&!u?d:xN(e,t,d,r,i,a,o,s+1)}function SN(e,t,n,r,i){let{autoFocus:a}=e,[o,s]=(0,v.useState)(),c=yN(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=xN(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 CN(e,t){let{selected:n,required:r,onSelect:i}=e,[a,o]=hN(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 wN(e,t,n=0,r=0,i=!1,a=Cj){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 TN(e,t,n=Cj){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 EN(e,t,n=Cj){return oM(e,t.from,!1,n)||oM(e,t.to,!1,n)||oM(t,e.from,!1,n)||oM(t,e.to,!1,n)}function DN(e,t,n=Cj){let r=Array.isArray(t)?t:[t];if(r.filter(e=>typeof e!=`function`).some(t=>typeof t==`boolean`?t:n.isDate(t)?oM(e,t,!1,n):fM(t,n)?t.some(t=>oM(e,t,!1,n)):cM(t)?t.from&&t.to?EN(e,{from:t.from,to:t.to},n):!1:dM(t)?TN(e,t.dayOfWeek,n):sM(t)?n.isAfter(t.before,t.after)?EN(e,{from:n.addDays(t.after,1),to:n.addDays(t.before,-1)},n):pM(e.from,t,n)||pM(e.to,t,n):lM(t)||uM(t)?pM(e.from,t,n)||pM(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 ON(e,t){let{disabled:n,excludeDisabled:r,resetOnSelect:i,selected:a,required:o,onSelect:s}=e,[c,l]=hN(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}:wN(a,u,f,p,o,t)}return r&&n&&m?.from&&m.to&&DN({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&&oM(u,e,!1,t)}}function kN(e,t){let{selected:n,required:r,onSelect:i}=e,[a,o]=hN(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 AN(e,t){let n=kN(e,t),r=CN(e,t),i=ON(e,t);switch(e.mode){case`single`:return n;case`multiple`:return r;case`range`:return i;default:return}}function jN(e,t){return e instanceof hj&&e.timeZone===t?e:new hj(e,t)}function MN(e,t,n){if(!n)return jN(e,t);let r=jN(e,t),i=new hj(r.getFullYear(),r.getMonth(),r.getDate(),12,0,0,t);return new Date(i.getTime())}function NN(e,t,n){return typeof e==`boolean`||typeof e==`function`?e:e instanceof Date?MN(e,t,n):Array.isArray(e)?e.map(e=>e instanceof Date?MN(e,t,n):e):cM(e)?{...e,from:e.from?jN(e.from,t):e.from,to:e.to?jN(e.to,t):e.to}:sM(e)?{before:MN(e.before,t,n),after:MN(e.after,t,n)}:lM(e)?{after:MN(e.after,t,n)}:uM(e)?{before:MN(e.before,t,n)}:e}function PN(e,t,n){return e&&(Array.isArray(e)?e.map(e=>NN(e,t,n)):NN(e,t,n))}function FN(e){let t=e,n=t.timeZone;if(n&&(t={...e,timeZone:n},t.today&&=jN(t.today,n),t.month&&=jN(t.month,n),t.defaultMonth&&=jN(t.defaultMonth,n),t.startMonth&&=jN(t.startMonth,n),t.endMonth&&=jN(t.endMonth,n),t.mode===`single`&&t.selected?t.selected=jN(t.selected,n):t.mode===`multiple`&&t.selected?t.selected=t.selected?.map(e=>jN(e,n)):t.mode===`range`&&t.selected&&(t.selected={from:t.selected.from?jN(t.selected.from,n):t.selected.from,to:t.selected.to?jN(t.selected.to,n):t.selected.to}),t.disabled!==void 0&&(t.disabled=PN(t.disabled,n)),t.hidden!==void 0&&(t.hidden=PN(t.hidden,n)),t.modifiers)){let e={};Object.keys(t.modifiers).forEach(r=>{e[r]=PN(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={...xj,...t.locale},n=t.broadcastCalendar?1:t.weekStartsOn,r=t.noonSafe&&t.timeZone?ZM(t.timeZone,{weekStartsOn:n,locale:e}):void 0,i=t.dateLib&&r?{...r,...t.dateLib}:t.dateLib??r,a=new Sj({locale:e,weekStartsOn:n,firstWeekContainsDate:t.firstWeekContainsDate,useAdditionalWeekYearTokens:t.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:t.useAdditionalDayOfYearTokens,timeZone:t.timeZone,numerals:t.numerals},i);return{dateLib:a,components:gM(t.components),formatters:kM(t.formatters),labels:KM(t.labels,a.options),locale:e,classNames:{...vM(),...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=gN(t,o),{days:M,months:N,navStart:P,navEnd:F,previousMonth:I,nextMonth:L,goToMonth:R}=j,ee=mM(M,t,P,F,o),{isSelected:te,select:ne,selected:z}=AN(t,o)??{},{blur:B,focused:re,isFocusTarget:V,moveFocus:H,setFocused:ie}=SN(t,j,ee,te??(()=>!1),o),{labelDayButton:ae,labelGridcell:oe,labelGrid:se,labelMonthDropdown:ce,labelNav:le,labelPrevious:ue,labelNext:de,labelWeekday:fe,labelWeekNumber:pe,labelWeekNumberHeader:me,labelYearDropdown:he}=a,ge=(0,v.useMemo)(()=>YM(o,t.ISOWeek,t.broadcastCalendar,t.today),[o,t.ISOWeek,t.broadcastCalendar,t.today]),_e=u!==void 0||m!==void 0,ve=(0,v.useCallback)(()=>{I&&(R(I),x?.(I))},[I,R,x]),ye=(0,v.useCallback)(()=>{L&&(R(L),b?.(L))},[R,L,b]),be=(0,v.useCallback)((e,t)=>n=>{n.preventDefault(),n.stopPropagation(),ie(e),!t.disabled&&(ne?.(e.date,t,n),m?.(e.date,t,n))},[ne,m,ie]),xe=(0,v.useCallback)((e,t)=>n=>{ie(e),h?.(e.date,t,n)},[h,ie]),Se=(0,v.useCallback)((e,t)=>n=>{B(),p?.(e.date,t,n)},[B,p]),Ce=(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];H(e,t)}g?.(e.date,n,r)},[H,g,t.dir]),we=(0,v.useCallback)((e,t)=>n=>{_?.(e.date,t,n)},[_]),Te=(0,v.useCallback)((e,t)=>n=>{y?.(e.date,t,n)},[y]),Ee=(0,v.useCallback)(e=>t=>{let n=Number(t.target.value);R(o.setMonth(o.startOfMonth(e),n))},[o,R]),De=(0,v.useCallback)(e=>t=>{let n=Number(t.target.value);R(o.setYear(o.startOfMonth(e),n))},[o,R]),{className:Oe,style:ke}=(0,v.useMemo)(()=>({className:[c[Mj.Root],t.className].filter(Boolean).join(` `),style:{...C?.[Mj.Root],...t.style}}),[c,t.className,t.style,C]),Ae=_M(t),je=(0,v.useRef)(null);aN(je,!!t.animate,{classNames:c,months:N,focused:re,dateLib:o});let Me={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(Uj.Provider,{value:Me},v.createElement(r.Root,{rootRef:t.animate?je:void 0,className:Oe,style:ke,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`],...Ae},v.createElement(r.Months,{className:c[Mj.Months],style:C?.[Mj.Months]},!t.hideNavigation&&!d&&v.createElement(r.Nav,{"data-animated-nav":t.animate?`true`:void 0,className:c[Mj.Nav],style:C?.[Mj.Nav],"aria-label":le(),onPreviousClick:ve,onNextClick:ye,previousMonth:I,nextMonth:L}),N.map((e,n)=>v.createElement(r.Month,{"data-animated-month":t.animate?`true`:void 0,className:c[Mj.Month],style:C?.[Mj.Month],key:n,displayIndex:n,calendarMonth:e},d===`around`&&!t.hideNavigation&&n===0&&v.createElement(r.PreviousMonthButton,{type:`button`,className:c[Mj.PreviousMonthButton],tabIndex:I?void 0:-1,"aria-disabled":I?void 0:!0,"aria-label":ue(I),onClick:ve,"data-animated-button":t.animate?`true`:void 0},v.createElement(r.Chevron,{disabled:I?void 0:!0,className:c[Mj.Chevron],orientation:t.dir===`rtl`?`right`:`left`})),v.createElement(r.MonthCaption,{"data-animated-caption":t.animate?`true`:void 0,className:c[Mj.MonthCaption],style:C?.[Mj.MonthCaption],calendarMonth:e,displayIndex:n},l?.startsWith(`dropdown`)?v.createElement(r.DropdownNav,{className:c[Mj.Dropdowns],style:C?.[Mj.Dropdowns]},(()=>{let n=l===`dropdown`||l===`dropdown-months`?v.createElement(r.MonthsDropdown,{key:`month`,className:c[Mj.MonthsDropdown],"aria-label":ce(),classNames:c,components:r,disabled:!!t.disableNavigation,onChange:Ee(e.date),options:qM(e.date,P,F,i,o),style:C?.[Mj.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[Mj.YearsDropdown],"aria-label":he(o.options),classNames:c,components:r,disabled:!!t.disableNavigation,onChange:De(e.date),options:XM(P,F,i,o,!!t.reverseYears),style:C?.[Mj.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[Mj.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[Mj.NextMonthButton],tabIndex:L?void 0:-1,"aria-disabled":L?void 0:!0,"aria-label":de(L),onClick:ye,"data-animated-button":t.animate?`true`:void 0},v.createElement(r.Chevron,{disabled:L?void 0:!0,className:c[Mj.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[Mj.Nav],style:C?.[Mj.Nav],"aria-label":le(),onPreviousClick:ve,onNextClick:ye,previousMonth:I,nextMonth:L}),v.createElement(r.MonthGrid,{role:`grid`,"aria-multiselectable":u===`multiple`||u===`range`,"aria-label":se(e.date,o.options,o)||void 0,className:c[Mj.MonthGrid],style:C?.[Mj.MonthGrid]},!t.hideWeekdays&&v.createElement(r.Weekdays,{"data-animated-weekdays":t.animate?`true`:void 0,className:c[Mj.Weekdays],style:C?.[Mj.Weekdays]},S&&v.createElement(r.WeekNumberHeader,{"aria-label":me(o.options),className:c[Mj.WeekNumberHeader],style:C?.[Mj.WeekNumberHeader],scope:`col`},O()),ge.map(e=>v.createElement(r.Weekday,{"aria-label":fe(e,o.options,o),className:c[Mj.Weekday],key:String(e),style:C?.[Mj.Weekday],scope:`col`},k(e,o.options,o)))),v.createElement(r.Weeks,{"data-animated-weeks":t.animate?`true`:void 0,className:c[Mj.Weeks],style:C?.[Mj.Weeks]},e.weeks.map(e=>v.createElement(r.Week,{className:c[Mj.Week],key:e.weekNumber,style:C?.[Mj.Week],week:e},S&&v.createElement(r.WeekNumber,{week:e,style:C?.[Mj.WeekNumber],"aria-label":pe(e.weekNumber,{locale:s}),className:c[Mj.WeekNumber],scope:`row`,role:`rowheader`},D(e.weekNumber,o)),e.days.map(e=>{let{date:n}=e,i=ee(e);if(i[Nj.focused]=!i.hidden&&!!re?.isEqualTo(e),i[Pj.selected]=te?.(n)||i.selected,cM(z)){let{from:e,to:t}=z;i[Pj.range_start]=!!(e&&t&&o.isSameDay(n,e)),i[Pj.range_end]=!!(e&&t&&o.isSameDay(n,t)),i[Pj.range_middle]=oM(z,n,!0,o)}let a=JM(i,C,t.modifiersStyles),s=hM(i,c,t.modifiersClassNames),l=!_e&&!i.hidden?oe(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&&_e?v.createElement(r.DayButton,{className:c[Mj.DayButton],style:C?.[Mj.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":ae(n,i,o.options,o),onClick:be(e,i),onBlur:Se(e,i),onFocus:xe(e,i),onKeyDown:Ce(e,i),onMouseEnter:we(e,i),onMouseLeave:Te(e,i)},T(n,o.options,o)):!i.hidden&&T(e.date,o.options,o))})))))))),t.footer&&v.createElement(r.Footer,{className:c[Mj.Footer],style:C?.[Mj.Footer],role:`status`,"aria-live":`polite`},t.footer)))}function IN({className:e,classNames:t,showOutsideDays:n=!0,captionLayout:r=`label`,buttonVariant:i=`ghost`,formatters:a,components:o,...s}){let c=vM();return(0,U.jsx)(FN,{showOutsideDays:n,className:q(`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:q(`w-fit`,c.root),months:q(`relative flex flex-col gap-4 md:flex-row`,c.months),month:q(`flex w-full flex-col gap-4`,c.month),nav:q(`absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1`,c.nav),button_previous:q(Xc({variant:i}),`size-(--cell-size) p-0 select-none aria-disabled:opacity-50`,c.button_previous),button_next:q(Xc({variant:i}),`size-(--cell-size) p-0 select-none aria-disabled:opacity-50`,c.button_next),month_caption:q(`flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)`,c.month_caption),dropdowns:q(`flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium`,c.dropdowns),dropdown_root:q(`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:q(`absolute inset-0 bg-popover opacity-0`,c.dropdown),caption_label:q(`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:q(`flex`,c.weekdays),weekday:q(`flex-1 rounded-md text-[0.8rem] font-normal text-muted-foreground select-none`,c.weekday),week:q(`mt-2 flex w-full`,c.week),week_number_header:q(`w-(--cell-size) select-none`,c.week_number_header),week_number:q(`text-[0.8rem] text-muted-foreground select-none`,c.week_number),day:q(`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:q(`rounded-l-md bg-accent`,c.range_start),range_middle:q(`rounded-none`,c.range_middle),range_end:q(`rounded-r-md bg-accent`,c.range_end),today:q(`rounded-md bg-accent text-accent-foreground data-[selected=true]:rounded-none`,c.today),outside:q(`text-muted-foreground aria-selected:text-muted-foreground`,c.outside),disabled:q(`text-muted-foreground opacity-50`,c.disabled),hidden:q(`invisible`,c.hidden),...t},components:{Root:({className:e,rootRef:t,...n})=>(0,U.jsx)(`div`,{"data-slot":`calendar`,ref:t,className:q(e),...n}),Chevron:({className:e,orientation:t,...n})=>t===`left`?(0,U.jsx)(Va,{className:q(`size-4`,e),...n}):t===`right`?(0,U.jsx)(Ha,{className:q(`size-4`,e),...n}):(0,U.jsx)(Ba,{className:q(`size-4`,e),...n}),DayButton:LN,WeekNumber:({children:e,...t})=>(0,U.jsx)(`td`,{...t,children:(0,U.jsx)(`div`,{className:`flex size-(--cell-size) items-center justify-center text-center`,children:e})}),...o},...s})}function LN({className:e,day:t,modifiers:n,...r}){let i=vM(),a=v.useRef(null);return v.useEffect(()=>{n.focused&&a.current?.focus()},[n.focused]),(0,U.jsx)(J,{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:q(`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 RN({...e}){return(0,U.jsx)(tS,{"data-slot":`popover`,...e})}function zN({...e}){return(0,U.jsx)(nS,{"data-slot":`popover-trigger`,...e})}function BN({className:e,align:t=`center`,sideOffset:n=4,...r}){return(0,U.jsx)(rS,{children:(0,U.jsx)(iS,{"data-slot":`popover-content`,align:t,sideOffset:n,className:q(`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})})}var VN=v.forwardRef(({className:e,...t},n)=>(0,U.jsx)(`textarea`,{className:q(`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}));VN.displayName=`Textarea`;function HN({...e}){return(0,U.jsx)(yb,{"data-slot":`accordion`,...e})}function UN({className:e,...t}){return(0,U.jsx)(bb,{"data-slot":`accordion-item`,className:q(`border-b last:border-b-0`,e),...t})}function WN({className:e,children:t,...n}){return(0,U.jsx)(xb,{className:`flex`,children:(0,U.jsxs)(Sb,{"data-slot":`accordion-trigger`,className:q(`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,U.jsx)(Ba,{className:`pointer-events-none size-4 shrink-0 translate-y-0.5 text-muted-foreground transition-transform duration-200`})]})})}function GN({className:e,children:t,...n}){return(0,U.jsx)(Cb,{"data-slot":`accordion-content`,className:`overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down`,...n,children:(0,U.jsx)(`div`,{className:q(`pt-0 pb-4`,e),children:t})})}function KN(e){this.content=e}KN.prototype={constructor:KN,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 KN(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 KN(n)},addToStart:function(e,t){return new KN([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new KN(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 KN(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=KN.from(e),e.size?new KN(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=KN.from(e),e.size?new KN(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=KN.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}},KN.from=function(e){if(e instanceof KN)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new KN(t)};function qN(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=qN(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function JN(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=JN(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}var Z=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 qN(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return JN(this,e,t,n)}findIndex(e){if(e==0)return XN(0,e);if(e==this.size)return XN(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?XN(t+1,i):XN(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)`:``))}};Z.empty=new Z([],0);var YN={index:0,offset:0};function XN(e,t){return YN.index=e,YN.offset=t,YN}function ZN(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(!ZN(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!ZN(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var QN=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&&ZN(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}};QN.none=[];var $N=class extends Error{},Q=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=tP(this.content,t+this.openStart,n);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(eP(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(Z.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)}};Q.empty=new Q(Z.empty,0,0);function eP(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(eP(a.content,t-i-1,n-i-1)))}function tP(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=tP(o.content,t-a-1,n,o);return s&&e.replaceChild(i,o.copy(s))}function nP(e,t,n){if(n.openStart>e.depth)throw new $N(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new $N(`Inconsistent open depths`);return rP(e,t,n,0)}function rP(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=rP(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return cP(a,uP(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return cP(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=dP(n,e);return cP(a,lP(e,i,o,t,r))}}function iP(e,t){if(!t.type.compatibleContent(e.type))throw new $N(`Cannot join `+t.type.name+` onto `+e.type.name)}function aP(e,t,n){let r=e.node(n);return iP(r,t.node(n)),r}function oP(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 sP(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&&(oP(e.nodeAfter,r),a++));for(let e=a;e<o;e++)oP(i.child(e),r);t&&t.depth==n&&t.textOffset&&oP(t.nodeBefore,r)}function cP(e,t){return e.type.checkContent(t),e.copy(t)}function lP(e,t,n,r,i){let a=e.depth>i&&aP(e,t,i+1),o=r.depth>i&&aP(n,r,i+1),s=[];return sP(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(iP(a,o),oP(cP(a,lP(e,t,n,r,i+1)),s)):(a&&oP(cP(a,uP(e,t,i+1)),s),sP(t,n,i,s),o&&oP(cP(o,uP(n,r,i+1)),s)),sP(r,null,i,s),new Z(s)}function uP(e,t,n){let r=[];return sP(null,e,n,r),e.depth>n&&oP(cP(aP(e,t,n+1),uP(e,t,n+1)),r),sP(t,null,n,r),new Z(r)}function dP(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(Z.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var fP=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 QN.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 gP(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=hP.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 hP.set(t,r=new pP);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%mP,i}},pP=class{constructor(){this.elts=[],this.i=0}},mP=12,hP=new WeakMap,gP=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)}},_P=Object.create(null),vP=class e{constructor(e,t,n,r=QN.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||Z.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&&ZN(this.attrs,t||e.defaultAttrs||_P)&&QN.sameSet(this.marks,n||QN.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 Q.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new Q(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return nP(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 fP.resolveCached(this,e)}resolveNoCache(e){return fP.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()+`)`),bP(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=Z.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=QN.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(!QN.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=Z.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};vP.prototype.text=void 0;var yP=class e extends vP{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):bP(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 bP(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var xP=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new SP(t,n);if(r.next==null)return e.empty;let i=CP(r);r.next&&r.err(`Unexpected trailing text`);let a=NP(AP(i));return PP(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 Z.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(`
80
+ `)}};xP.empty=new xP(!0);var SP=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 CP(e){let t=[];do t.push(wP(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function wP(e){let t=[];do t.push(TP(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function TP(e){let t=kP(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=DP(e,t);else break;return t}function EP(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function DP(e,t){let n=EP(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:EP(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function OP(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 kP(e){if(e.eat(`(`)){let t=CP(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=OP(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 AP(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 jP(e,t){return t-e}function MP(e,t){let n=[];return r(t),n.sort(jP);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 NP(e){let t=Object.create(null);return n(MP(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]);MP(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new xP(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(jP);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function PP(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 FP(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 IP(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 LP(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 RP(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new VP(e,r,t[r]);return n}var zP=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=RP(e,n.attrs),this.defaultAttrs=FP(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==xP.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:IP(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new vP(this,this.computeAttrs(e),Z.from(t),QN.setFrom(n))}createChecked(e=null,t,n){return t=Z.from(t),this.checkContent(t),new vP(this,this.computeAttrs(e),t,QN.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=Z.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(Z.empty,!0);return i?new vP(this,e,t.append(i),QN.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){LP(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:QN.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 BP(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 VP=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?BP(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},HP=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=RP(e,r.attrs),this.excluded=null;let i=FP(this.attrs);this.instance=i?new QN(this,i):null}create(e=null){return!e&&this.instance?this.instance:new QN(this,IP(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){LP(this.attrs,e,`mark`,this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},UP=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=KN.from(e.nodes),t.marks=KN.from(e.marks||{}),this.nodes=zP.compile(this.spec.nodes,this),this.marks=HP.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]=xP.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?WP(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==``?[]:WP(this,n.split(` `))}this.nodeFromJSON=e=>vP.fromJSON(this,e),this.markFromJSON=e=>QN.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 zP))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 yP(n,n.defaultAttrs,e,QN.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 WP(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 GP(e){return e.tag!=null}function KP(e){return e.style!=null}var qP=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(GP(e))this.tags.push(e);else if(KP(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 nF(this,t,!1);return n.addAll(e,QN.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new nF(this,t,!0);return n.addAll(e,QN.none,t.from,t.to),Q.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(iF(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=aF(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=aF(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)))}},JP={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},YP={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},XP={ol:!0,ul:!0},ZP=1,QP=2,$P=4;function eF(e,t,n){return t==null?e&&e.whitespace==`pre`?ZP|QP:n&~$P:(t?ZP:0)|(t===`full`?QP:0)}var tF=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=QN.none,this.match=i||(a&$P?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(Z.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&ZP)){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=Z.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(Z.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&&!JP.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},nF=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=eF(null,t.preserveWhitespace,0)|(n?$P:0);i=r?new tF(r.type,r.attrs,QN.none,!0,t.topMatch||r.type.contentMatch,a):n?new tF(null,null,QN.none,!0,null,a):new tF(e.schema.topNodeType,null,QN.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&QP?`full`:this.localPreserveWS||(r.options&ZP)>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,`
81
+ `);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;XP.hasOwnProperty(a)&&this.parser.normalizeLists&&rF(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));out:if(s?s.ignore:YP.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(JP.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(`
82
+ `),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=QN.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):oF(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=eF(e,i,a.options);a.options&$P&&a.content.length==0&&(o|=$P);let s=QN.none;return n=n.filter(t=>(a.type?a.type.allowsMarkType(t.type):oF(t.type,e))?(s=t.addToSet(s),!1):!0),this.nodes.push(new tF(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|=ZP);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 rF(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=t.nodeType==1?t.nodeName.toLowerCase():null;e&&XP.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):e==`li`?n=t:e&&(n=null)}}function iF(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function aF(e){let t={};for(let n in e)t[n]=e[n];return t}function oF(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 sF=class e{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||=lF(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}=pF(lF(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&&pF(lF(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return pF(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=cF(e.nodes);return t.text||=e=>e.text,t}static marksFromSchema(e){return cF(e.marks)}};function cF(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function lF(e){return e.document||window.document}var uF=new WeakMap;function dF(e){let t=uF.get(e);return t===void 0&&uF.set(e,t=fF(e)),t}function fF(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 pF(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=dF(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}=pF(e,a,n,r);if(c.appendChild(t),i){if(s)throw RangeError(`Multiple content holes`);s=i}}}return{dom:c,contentDOM:s}}var mF=65535,hF=2**16;function gF(e,t){return e+t*hF}function _F(e){return e&mF}function vF(e){return(e-(e&mF))/hF}var yF=1,bF=2,xF=4,SF=8,CF=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&SF)>0}get deletedBefore(){return(this.delInfo&(yF|xF))>0}get deletedAfter(){return(this.delInfo&(bF|xF))>0}get deletedAcross(){return(this.delInfo&xF)>0}},wF=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=_F(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+vF(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:gF(o/3,e-s),f=e==s?bF:e==u?yF:xF;return(t<0?e!=s:e!=u)&&(f|=SF),new CF(a,f,d)}r+=l-c}return n?e+r:new CF(e+r,0,null)}touches(e,t){let n=0,r=_F(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])}};wF.empty=new wF([]);var TF=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 CF(e,r,null)}},EF=Object.create(null),DF=class{getMap(){return wF.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError(`Invalid input for Step.fromJSON`);let n=EF[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in EF)throw RangeError(`Duplicate use of step JSON ID `+e);return EF[e]=t,t.prototype.jsonID=e,t}},OF=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 $N)return e.fail(t.message);throw t}}};function kF(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let a=e.child(i);a.content.size&&(a=a.copy(kF(a.content,t,a))),a.isInline&&(a=t(a,n,i)),r.push(a)}return Z.fromArray(r)}var AF=class e extends DF{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 Q(kF(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 OF.fromReplace(e,this.from,this.to,i)}invert(){return new jF(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))}};DF.jsonID(`addMark`,AF);var jF=class e extends DF{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 Q(kF(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return OF.fromReplace(e,this.from,this.to,n)}invert(){return new AF(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))}};DF.jsonID(`removeMark`,jF);var MF=class e extends DF{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return OF.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return OF.fromReplace(e,this.pos,this.pos+1,new Q(Z.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 NF(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))}};DF.jsonID(`addNodeMark`,MF);var NF=class e extends DF{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return OF.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return OF.fromReplace(e,this.pos,this.pos+1,new Q(Z.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new MF(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))}};DF.jsonID(`removeNodeMark`,NF);var PF=class e extends DF{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&IF(e,this.from,this.to)?OF.fail(`Structure replace would overwrite content`):OF.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new wF([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?Q.empty:new Q(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?Q.empty:new Q(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,Q.fromJSON(t,n.slice),!!n.structure)}};PF.MAP_BIAS=1,DF.jsonID(`replace`,PF);var FF=class e extends DF{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&&(IF(e,this.from,this.gapFrom)||IF(e,this.gapTo,this.to)))return OF.fail(`Structure gap-replace would overwrite content`);let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return OF.fail(`Gap is not a flat range`);let n=this.slice.insertAt(this.insert,t.content);return n?OF.fromReplace(e,this.from,this.to,n):OF.fail(`Content does not fit in gap`)}getMap(){return new wF([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,Q.fromJSON(t,n.slice),n.insert,!!n.structure)}};DF.jsonID(`replaceAround`,FF);function IF(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 LF(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 jF(l,d,u[e])));s&&s.to==l?s.to=d:a.push(s=new AF(l,d,r))}}),i.forEach(t=>e.step(t)),a.forEach(t=>e.step(t))}function RF(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 HP){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 jF(t.from,t.to,t.style)))}function zF(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 PF(s,l,Q.empty));else{r=u;for(let t=0;t<c.marks.length;t++)n.allowsMarkType(c.marks[t].type)||e.step(new jF(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 Q(Z.from(n.schema.text(` `,n.allowedMarks(c.marks))),0,0),o.push(new PF(s+e.index,s+e.index+e[0].length,r))}}s=l}if(!r.validEnd){let t=r.fillBefore(Z.empty,!0);e.replace(s,s,new Q(t,0,0))}for(let t=o.length-1;t>=0;t--)e.step(o[t])}function BF(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function VF(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||!BF(a,o,s))break;o&&(r=1),s<a.childCount&&(i=1)}return null}function HF(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=Z.empty,d=0;for(let e=a,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,u=Z.from(r.node(e).copy(u)),d++):c--;let f=Z.empty,p=0;for(let e=a,t=!1;e>n;e--)t||i.after(e+1)<i.end(e)?(t=!0,f=Z.from(i.node(e).copy(f)),p++):l++;e.step(new FF(c,l,o,s,new Q(u.append(f),d,p),u.size-d,!0))}function UF(e,t,n=null,r=e){let i=GF(e,t),a=i&&KF(r,t);return a?i.map(WF).concat({type:t,attrs:n}).concat(a.map(WF)):null}function WF(e){return{type:e,attrs:null}}function GF(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 KF(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 qF(e,t,n){let r=Z.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=Z.from(n[e].type.create(n[e].attrs,r))}let i=t.start,a=t.end;e.step(new FF(i,a,i,a,new Q(r,0,0),n.length,!0))}function JF(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)&&ZF(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&&XF(e,t,n,a),zF(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 FF(c,l,c+1,l-1,new Q(Z.from(r.create(o,null,t.marks)),0,0),1,!0)),i===!0&&YF(e,t,n,a),!1}})}function YF(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 XF(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(`
83
+ `))}})}function ZF(e,t,n){let r=e.resolve(t),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function QF(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 FF(t,t+a.nodeSize,t+1,t+a.nodeSize-1,new Q(Z.from(o),0,0),1,!0))}function $F(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 eI(e,t,n=1,r){let i=e.doc.resolve(t),a=Z.empty,o=Z.empty;for(let e=i.depth,t=i.depth-n,s=n-1;e>t;e--,s--){a=Z.from(i.node(e).copy(a));let t=r&&r[s];o=Z.from(t?t.type.create(t.attrs,o):i.node(e).copy(o))}e.step(new PF(t,t,new Q(a.append(o),n,n),!0))}function tI(e,t){let n=e.resolve(t),r=n.index();return rI(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function nI(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 rI(e,t){return!!(e&&t&&!e.isLeaf&&nI(e,t))}function iI(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&&rI(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 aI(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);XF(e,r.node(),r.before(),s)}o.inlineContent&&zF(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 PF(l,c.map(t+n,-1),Q.empty,!0)),r===!0){let t=e.doc.resolve(l);YF(e,t.node(),t.before(),e.steps.length)}return e}function oI(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 sI(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 cI(e,t,n=t,r=Q.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),a=e.resolve(n);return lI(i,a,r)?new PF(t,n,r):new uI(i,a,r).fit()}function lI(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}var uI=class{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=Z.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=Z.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 Q(i,a,o);return e>-1?new FF(n.pos,e,this.$to.pos,this.$to.end(),s,t):s.size||n.pos!=this.$to.pos?new PF(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=pI(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(Z.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=pI(e,t);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new Q(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=pI(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new Q(dI(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new Q(dI(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(mI(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=fI(this.placed,t,Z.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?Q.empty:new Q(dI(a.content,e-1,1),e-1,f<0?a.openEnd:e-1):new Q(dI(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||!hI(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=hI(e,t,r,n,i);if(a){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],i=hI(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=fI(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=fI(this.placed,this.depth,Z.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(Z.empty,!0);e.childCount&&(this.placed=fI(this.placed,this.frontier.length,e))}};function dI(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(dI(e.firstChild.content,t-1,n)))}function fI(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(fI(e.lastChild.content,t-1,n)))}function pI(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function mI(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,mI(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(Z.empty,!0)))),e.copy(r)}function hI(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&&!gI(n,a.content,o)?s:null}function gI(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}function _I(e){return e.spec.defining||e.spec.definingForContent}function vI(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let i=e.doc.resolve(t),a=e.doc.resolve(n);if(lI(i,a,r))return e.step(new PF(t,n,r));let o=SI(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=_I(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 Q(yI(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 yI(e,t,n,r,i){if(t<n){let i=e.firstChild;e=e.replaceChild(0,i.copy(yI(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(Z.empty,!0))}return e}function bI(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let i=oI(e.doc,t,r.type);i!=null&&(t=n=i)}e.replaceRange(t,n,new Q(Z.from(r),0,0))}function xI(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=SI(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 SI(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 CI=class e extends DF{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 OF.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 OF.fromReplace(e,this.pos,this.pos+1,new Q(Z.from(r),0,+!t.isLeaf))}getMap(){return wF.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)}};DF.jsonID(`attr`,CI);var wI=class e extends DF{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 OF.ok(n)}getMap(){return wF.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)}};DF.jsonID(`docAttr`,wI);var TI=class extends Error{};TI=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},TI.prototype=Object.create(Error.prototype),TI.prototype.constructor=TI,TI.prototype.name=`TransformError`;var EI=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new TF}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new TI(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=Q.empty){let r=cI(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new Q(Z.from(n),0,0))}delete(e,t){return this.replace(e,t,Q.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return vI(this,e,t,n),this}replaceRangeWith(e,t,n){return bI(this,e,t,n),this}deleteRange(e,t){return xI(this,e,t),this}lift(e,t){return HF(this,e,t),this}join(e,t=1){return aI(this,e,t),this}wrap(e,t){return qF(this,e,t),this}setBlockType(e,t=e,n,r=null){return JF(this,e,t,n,r),this}setNodeMarkup(e,t,n=null,r){return QF(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new CI(e,t,n)),this}setDocAttribute(e,t){return this.step(new wI(e,t)),this}addNodeMark(e,t){return this.step(new MF(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw RangeError(`No node at position `+e);if(t instanceof QN)t.isInSet(n.marks)&&this.step(new NF(e,t));else{let r=n.marks,i,a=[];for(;i=t.isInSet(r);)a.push(new NF(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 eI(this,e,t,n),this}addMark(e,t,n){return LF(this,e,t,n),this}removeMark(e,t,n){return RF(this,e,t,n),this}clearIncompatible(e,t,n){return zF(this,e,t,n),this}},DI=Object.create(null),OI=class{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new kI(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=Q.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?Q.empty:t),o==0&&zI(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),zI(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new MI(e):RI(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?RI(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):RI(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 II(e.node(0))}static atStart(e){return RI(e,e,0,0,1)||new II(e)}static atEnd(e){return RI(e,e,e.content.size,e.childCount,-1)||new II(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError(`Invalid input for Selection.fromJSON`);let n=DI[t.type];if(!n)throw RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in DI)throw RangeError(`Duplicate use of selection JSON ID `+e);return DI[e]=t,t.prototype.jsonID=e,t}getBookmark(){return MI.between(this.$anchor,this.$head).getBookmark()}};OI.prototype.visible=!0;var kI=class{constructor(e,t){this.$from=e,this.$to=t}},AI=!1;function jI(e){!AI&&!e.parent.inlineContent&&(AI=!0,console.warn(`TextSelection endpoint not pointing into a node with inline content (`+e.parent.type.name+`)`))}var MI=class e extends OI{constructor(e,t=e){jI(e),jI(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 OI.near(r);let i=t.resolve(n.map(this.anchor));return new e(i.parent.inlineContent?i:r,r)}replace(e,t=Q.empty){if(super.replace(e,t),t==Q.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 NI(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=OI.findFrom(n,r,!0)||OI.findFrom(n,-r,!0);if(e)n=e.$head;else return OI.near(n,r)}return t.parent.inlineContent||(i==0?t=n:(t=(OI.findFrom(t,-r,!0)||OI.findFrom(t,r,!0)).$anchor,t.pos<n.pos!=i<0&&(t=n))),new e(t,n)}};OI.jsonID(`text`,MI);var NI=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 MI.between(e.resolve(this.anchor),e.resolve(this.head))}},PI=class e extends OI{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?OI.near(a):new e(a)}content(){return new Q(Z.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 FI(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}};PI.prototype.visible=!1,OI.jsonID(`node`,PI);var FI=class e{constructor(e){this.anchor=e}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new NI(r,r):new e(r)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&PI.isSelectable(n)?new PI(t):OI.near(t)}},II=class e extends OI{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=Q.empty){if(t==Q.empty){e.delete(0,e.doc.content.size);let t=OI.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 LI}};OI.jsonID(`all`,II);var LI={map(){return this},resolve(e){return new II(e)}};function RI(e,t,n,r,i,a=!1){if(t.inlineContent)return MI.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=RI(e,r,n+i,i<0?r.childCount:0,i,a);if(t)return t}else if(!a&&PI.isSelectable(r))return PI.create(e,n-(i<0?r.nodeSize:0));n+=r.nodeSize*i}return null}function zI(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof PF||i instanceof FF))return;let a=e.mapping.maps[r],o;a.forEach((e,t,n,r)=>{o??=r}),e.setSelection(OI.near(e.doc.resolve(o),n))}var BI=1,VI=2,HI=4,UI=class extends EI{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|BI)&~VI,this.storedMarks=null,this}get selectionSet(){return(this.updated&BI)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=VI,this}ensureMarks(e){return QN.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&VI)>0}addStep(e,t){super.addStep(e,t),this.updated&=~VI,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)||QN.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(OI.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|=HI,this}get scrolledIntoView(){return(this.updated&HI)>0}};function WI(e,t){return!t||!e?e:e.bind(t)}var GI=class{constructor(e,t,n){this.name=e,this.init=WI(t.init,n),this.apply=WI(t.apply,n)}},KI=[new GI(`doc`,{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new GI(`selection`,{init(e,t){return e.selection||OI.atStart(t.doc)},apply(e){return e.selection}}),new GI(`storedMarks`,{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new GI(`scrollToSelection`,{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})],qI=class{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=KI.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 GI(e.key,e.spec.state,e))})}},JI=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 UI(this)}static create(t){let n=new qI(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 qI(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 qI(t.schema,t.plugins),a=new e(i);return i.fields.forEach(e=>{if(e.name==`doc`)a.doc=vP.fromJSON(t.schema,n.doc);else if(e.name==`selection`)a.selection=OI.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 YI(e,t,n){for(let r in e){let i=e[r];i instanceof Function?i=i.bind(t):r==`handleDOMEvents`&&(i=YI(i,t,{})),n[r]=i}return n}var XI=class{constructor(e){this.spec=e,this.props={},e.props&&YI(e.props,this,this.props),this.key=e.key?e.key.key:QI(`plugin`)}getState(e){return e[this.key]}},ZI=Object.create(null);function QI(e){return e in ZI?e+`$`+ ++ZI[e]:(ZI[e]=0,e+`$`)}var $I=class{constructor(e=`key`){this.key=QI(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}},eL=(e,t)=>e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function tL(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`backward`,e):n.parentOffset>0)?null:n}var nL=(e,t,n)=>{let r=tL(e,n);if(!r)return!1;let i=cL(r);if(!i){let n=r.blockRange(),i=n&&VF(n);return i==null?!1:(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)}let a=i.nodeBefore;if(EL(e,i,t,-1))return!0;if(r.parent.content.size==0&&(oL(a,`end`)||PI.isSelectable(a)))for(let n=r.depth;;n--){let o=cI(e.doc,r.before(n),r.after(n),Q.empty);if(o&&o.slice.size<o.to-o.from){if(t){let n=e.tr.step(o);n.setSelection(oL(a,`end`)?OI.findFrom(n.doc.resolve(n.mapping.map(i.pos,-1)),-1):PI.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},rL=(e,t,n)=>{let r=tL(e,n);if(!r)return!1;let i=cL(r);return i?aL(e,i,t):!1},iL=(e,t,n)=>{let r=lL(e,n);if(!r)return!1;let i=fL(r);return i?aL(e,i,t):!1};function aL(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=cI(e.doc,i,o,Q.empty);if(!s||s.from!=i||s instanceof PF&&s.slice.size>=o-i)return!1;if(n){let t=e.tr.step(s);t.setSelection(MI.create(t.doc,i)),n(t.scrollIntoView())}return!0}function oL(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 sL=(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=cL(r)}let o=a&&a.nodeBefore;return!o||!PI.isSelectable(o)?!1:(t&&t(e.tr.setSelection(PI.create(e.doc,a.pos-o.nodeSize)).scrollIntoView()),!0)};function cL(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 lL(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`forward`,e):n.parentOffset<n.parent.content.size)?null:n}var uL=(e,t,n)=>{let r=lL(e,n);if(!r)return!1;let i=fL(r);if(!i)return!1;let a=i.nodeAfter;if(EL(e,i,t,1))return!0;if(r.parent.content.size==0&&(oL(a,`start`)||PI.isSelectable(a))){let n=cI(e.doc,r.before(),r.after(),Q.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(oL(a,`start`)?OI.findFrom(r.doc.resolve(r.mapping.map(i.pos)),1):PI.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},dL=(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=fL(r)}let o=a&&a.nodeAfter;return!o||!PI.isSelectable(o)?!1:(t&&t(e.tr.setSelection(PI.create(e.doc,a.pos)).scrollIntoView()),!0)};function fL(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 pL=(e,t)=>{let n=e.selection,r=n instanceof PI,i;if(r){if(n.node.isTextblock||!tI(e.doc,n.from))return!1;i=n.from}else if(i=iI(e.doc,n.from,-1),i==null)return!1;if(t){let n=e.tr.join(i);r&&n.setSelection(PI.create(n.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(n.scrollIntoView())}return!0},mL=(e,t)=>{let n=e.selection,r;if(n instanceof PI){if(n.node.isTextblock||!tI(e.doc,n.to))return!1;r=n.to}else if(r=iI(e.doc,n.to,1),r==null)return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0},hL=(e,t)=>{let{$from:n,$to:r}=e.selection,i=n.blockRange(r),a=i&&VF(i);return a==null?!1:(t&&t(e.tr.lift(i,a).scrollIntoView()),!0)},gL=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(`
84
+ `).scrollIntoView()),!0)};function _L(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 vL=(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=_L(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(OI.near(i.doc.resolve(r),1)),t(i.scrollIntoView())}return!0},yL=(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof II||r.parent.inlineContent||i.parent.inlineContent)return!1;let a=_L(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(MI.create(o.doc,n+1)),t(o.scrollIntoView())}return!0},bL=(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($F(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),i=r&&VF(r);return i==null?!1:(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)};function xL(e){return(t,n)=>{let{$from:r,$to:i}=t.selection;if(t.selection instanceof PI&&t.selection.node.isBlock)return!r.parentOffset||!$F(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=_L(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 MI||t.selection instanceof II)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=$F(u.doc,d,a.length,a);if(f||=(a[0]=s?{type:s}:null,$F(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 SL=xL(),CL=(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(PI.create(e.doc,i))),!0)},wL=(e,t)=>(t&&t(e.tr.setSelection(new II(e.doc))),!0);function TL(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||tI(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function EL(e,t,n,r){let i=t.nodeBefore,a=t.nodeAfter,o,s,c=i.type.spec.isolating||a.type.spec.isolating;if(!c&&TL(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=Z.empty;for(let e=o.length-1;e>=0;e--)s=Z.from(o[e].create(null,s));s=Z.from(i.copy(s));let c=e.tr.step(new FF(t.pos-1,r,t.pos,r,new Q(s,1,0),o.length,!0)),l=c.doc.resolve(r+2*o.length);l.nodeAfter&&l.nodeAfter.type==i.type&&tI(c.doc,l.pos)&&c.join(l.pos),n(c.scrollIntoView())}return!0}let u=a.type.spec.isolating||r>0&&c?null:OI.findFrom(t,1),d=u&&u.$from.blockRange(u.$to),f=d&&VF(d);if(f!=null&&f>=t.depth)return n&&n(e.tr.lift(d,f).scrollIntoView()),!0;if(l&&oL(a,`start`,!0)&&oL(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=Z.empty;for(let e=o.length-1;e>=0;e--)r=Z.from(o[e].copy(r));n(e.tr.step(new FF(t.pos-o.length,t.pos+a.nodeSize,t.pos+c,t.pos+a.nodeSize-c,new Q(r,o.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function DL(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(MI.create(t.doc,e<0?i.start(a):i.end(a)))),!0):!1}}var OL=DL(-1),kL=DL(1);function AL(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a),s=o&&UF(o,e,t);return s?(r&&r(n.tr.wrap(o,s).scrollIntoView()),!0):!1}}function jL(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 ML(...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 NL=ML(eL,nL,sL),PL=ML(eL,uL,dL),FL={Enter:ML(gL,yL,bL,SL),"Mod-Enter":vL,Backspace:NL,"Mod-Backspace":NL,"Shift-Backspace":NL,Delete:PL,"Mod-Delete":PL,"Mod-a":wL},IL={"Ctrl-h":FL.Backspace,"Alt-Backspace":FL[`Mod-Backspace`],"Ctrl-d":FL.Delete,"Ctrl-Alt-Backspace":FL[`Mod-Delete`],"Alt-Delete":FL[`Mod-Delete`],"Alt-d":FL[`Mod-Delete`],"Ctrl-a":OL,"Ctrl-e":kL};for(let e in FL)IL[e]=FL[e];typeof navigator<`u`?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<`u`&&os.platform&&os.platform();function LL(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 RL(s,o,e,t)?(r&&r(s.scrollIntoView()),!0):!1}}function RL(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 gP(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new gP(t.$from,o.resolve(t.$to.end(t.depth)),t.depth)),i=!0}let s=UF(a,n,r,t);return s?(e&&zL(e,t,s,i,n),!0):!1}function zL(e,t,n,r,i){let a=Z.empty;for(let e=n.length-1;e>=0;e--)a=Z.from(n[e].type.create(n[e].attrs,a));e.step(new FF(t.start-(r?2:0),t.end,t.start,t.end,new Q(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&&$F(e.doc,c,s)&&(e.split(c,s),c+=2*s),c+=l.child(n).nodeSize;return e}function BL(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?VL(t,n,e,a):HL(t,n,a):!0:!1}}function VL(e,t,n,r){let i=e.tr,a=r.end,o=r.$to.end(r.depth);a<o&&(i.step(new FF(a-1,o,a,o,new Q(Z.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new gP(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));let s=VF(r);if(s==null)return!1;i.lift(r,s);let c=i.doc.resolve(i.mapping.map(a,-1)-1);return tI(i.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&i.join(c.pos),t(i.scrollIntoView()),!0}function HL(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?Z.empty:Z.from(i))))return!1;let d=a.pos,f=d+o.nodeSize;return r.step(new FF(d-+!!s,f+ +!!c,d+1,f-1,new Q((s?Z.empty:Z.from(i.copy(Z.empty))).append(c?Z.empty:Z.from(i.copy(Z.empty))),+!s,+!c),+!s)),t(r.scrollIntoView()),!0}function UL(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=Z.from(r?e.create():null),o=new Q(Z.from(e.create(null,Z.from(s.type.create(null,i)))),r?3:1,0),l=a.start,u=a.end;n(t.tr.step(new FF(l-(r?3:1),u,l,u,o,1,!0)).scrollIntoView())}return!0}}var WL=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},GL=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t},KL=null,qL=function(e,t,n){let r=KL||=document.createRange();return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},JL=function(){KL=null},YL=function(e,t,n,r){return n&&(ZL(e,t,n,r,-1)||ZL(e,t,n,r,1))},XL=/^(img|br|input|textarea|hr)$/i;function ZL(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:QL(e))){let n=e.parentNode;if(!n||n.nodeType!=1||nR(e)||XL.test(e.nodeName)||e.contentEditable==`false`)return!1;t=WL(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?QL(e):0}else return!1}}function QL(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function $L(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=QL(e)}else if(e.parentNode&&!nR(e))t=WL(e),e=e.parentNode;else return null}}function eR(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&&!nR(e))t=WL(e)+1,e=e.parentNode;else return null}}function tR(e,t,n){for(let r=t==0,i=t==QL(e);r||i;){if(e==n)return!0;let t=WL(e);if(e=e.parentNode,!e)return!1;r&&=t==0,i&&=t==QL(e)}}function nR(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 rR=function(e){return e.focusNode&&YL(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function iR(e,t){let n=document.createEvent(`Event`);return n.initEvent(`keydown`,!0,!0),n.keyCode=e,n.key=n.code=t,n}function aR(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function oR(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(QL(r.offsetNode),r.offset)}}catch{}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(QL(r.startContainer),r.startOffset)}}}var sR=typeof navigator<`u`?navigator:null,cR=typeof document<`u`?document:null,lR=sR&&sR.userAgent||``,uR=/Edge\/(\d+)/.exec(lR),dR=/MSIE \d/.exec(lR),fR=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(lR),pR=!!(dR||fR||uR),mR=dR?document.documentMode:fR?+fR[1]:uR?+uR[1]:0,hR=!pR&&/gecko\/(\d+)/i.test(lR);hR&&+(/Firefox\/(\d+)/.exec(lR)||[0,0])[1];var gR=!pR&&/Chrome\/(\d+)/.exec(lR),_R=!!gR,vR=gR?+gR[1]:0,yR=!pR&&!!sR&&/Apple Computer/.test(sR.vendor),bR=yR&&(/Mobile\/\w+/.test(lR)||!!sR&&sR.maxTouchPoints>2),xR=bR||(sR?/Mac/.test(sR.platform):!1),SR=sR?/Win/.test(sR.platform):!1,CR=/Android \d/.test(lR),wR=!!cR&&`webkitFontSmoothing`in cR.documentElement.style,TR=wR?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function ER(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 DR(e,t){return typeof e==`number`?e:e[t]}function OR(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 kR(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=GL(o);continue}let e=o,n=e==a.body,s=n?ER(a):OR(e),c=0,l=0;if(t.top<s.top+DR(r,`top`)?l=-(s.top-t.top+DR(i,`top`)):t.bottom>s.bottom-DR(r,`bottom`)&&(l=t.bottom-t.top>s.bottom-s.top?t.top+DR(i,`top`)-s.top:t.bottom-s.bottom+DR(i,`bottom`)),t.left<s.left+DR(r,`left`)?c=-(s.left-t.left+DR(i,`left`)):t.right>s.right-DR(r,`right`)&&(c=t.right-s.right+DR(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:GL(o)}}function AR(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:jR(e.dom)}}function jR(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=GL(r));return t}function MR({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;NR(n,r==0?0:r-t)}function NR(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 PR=null;function FR(e){if(e.setActive)return e.setActive();if(PR)return e.focus(PR);let t=jR(e);e.focus(PR==null?{get preventScroll(){return PR={preventScroll:!0},!0}}:void 0),PR||(PR=!1,NR(t,0))}function IR(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=qL(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?LR(n,i):!n||r&&n.nodeType==1?{node:e,offset:a}:IR(n,i)}function LR(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=GR(r,1);if(n.top!=n.bottom&&RR(t,n)){i={node:e,offset:a+ +(t.left>=(n.left+n.right)/2)};break}}return r.detach(),i||{node:e,offset:0}}function RR(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function zR(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function BR(e,t,n){let{node:r,offset:i}=IR(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 VR(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 HR(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(RR(t,i))return HR(n,t,i)}}if((a=(a+1)%r)==i)break}return e}function UR(e,t){let n=e.dom.ownerDocument,r,i=0,a=oR(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(!RR(t,n)||(o=HR(e.dom,t,n),!o))return null}if(yR)for(let e=o;r&&e;e=GL(e))e.draggable&&(r=void 0);if(o=zR(o,t),r){if(hR&&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;wR&&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=VR(e,r,i,t))}s??=BR(e,o,t);let c=e.docView.nearestDesc(o,!0);return{pos:s,inside:c?c.posAtStart-c.border:-1}}function WR(e){return e.top<e.bottom||e.left<e.right}function GR(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(WR(e))return e}return Array.prototype.find.call(n,WR)||e.getBoundingClientRect()}var KR=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function qR(e,t,n){let{node:r,offset:i,atom:a}=e.docView.domFromPos(t,n<0?-1:1),o=wR||hR;if(r.nodeType==3)if(o&&(KR.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let e=GR(qL(r,i,i),n);if(hR&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let t=GR(qL(r,i-1,i-1),-1);if(t.top==e.top){let n=GR(qL(r,i,i+1),-1);if(n.top!=e.top)return JR(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++,JR(GR(qL(r,e,t),a),a<0)}if(!e.state.doc.resolve(t-(a||0)).parent.inlineContent){if(a==null&&i&&(n<0||i==QL(r))){let e=r.childNodes[i-1];if(e.nodeType==1)return YR(e.getBoundingClientRect(),!1)}if(a==null&&i<QL(r)){let e=r.childNodes[i];if(e.nodeType==1)return YR(e.getBoundingClientRect(),!0)}return YR(r.getBoundingClientRect(),n>=0)}if(a==null&&i&&(n<0||i==QL(r))){let e=r.childNodes[i-1],t=e.nodeType==3?qL(e,QL(e)-+!o):e.nodeType==1&&(e.nodeName!=`BR`||!e.nextSibling)?e:null;if(t)return JR(GR(t,1),!1)}if(a==null&&i<QL(r)){let e=r.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?e.nodeType==3?qL(e,0,+!o):e.nodeType==1?e:null:null;if(t)return JR(GR(t,-1),!0)}return JR(GR(r.nodeType==3?qL(r):r,-n),n>=0)}function JR(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 YR(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 XR(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 ZR(e,t,n){let r=t.selection,i=n==`up`?r.$from:r.$to;return XR(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=qR(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=qL(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 QR=/[\u0590-\u08ac]/;function $R(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?!QR.test(r.parent.textContent)||!s.modify?n==`left`||n==`backward`?a:o:XR(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 ez=null,tz=null,nz=!1;function rz(e,t,n){return ez==t&&tz==n?nz:(ez=t,tz=n,nz=n==`up`||n==`down`?ZR(e,t,n):$R(e,t,n))}var iz=0,az=1,oz=2,sz=3,cz=class{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=iz,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>WL(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 hz){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 lz&&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?WL(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?WL(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=WL(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=WL(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((hR||yR)&&e==t){let{node:e,offset:t}=o;if(e.nodeType==3){if(u=!!(t&&e.nodeValue[t-1]==`
85
+ `),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:WL(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(hR&&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&&yR)&&YL(o.node,o.offset,l.anchorNode,l.anchorOffset)&&YL(s.node,s.offset,l.focusNode,l.focusOffset))return;let d=!1;if((c.extend||e==t)&&!(u&&hR)){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?oz:az,e==r&&t==o&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=sz:i.markDirty(e-r,t-r);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?oz:sz}n=a}this.dirty=oz}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=e==1?oz:az;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}},lz=class extends cz{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==iz&&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}},uz=class extends cz{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}},dz=class e extends cz{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=sF.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&sz||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=sz&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=iz){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=iz}}slice(t,n,r){let i=e.create(this.parent,this.mark,!0,r),a=this.children,o=this.size;n<o&&(a=Mz(a,n,o,r)),t>0&&(a=Mz(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()}},fz=class e extends cz{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=sF.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=Cz(u,r,n),l?c=new gz(t,n,r,i,u,d||null,f,l,a,o+1):n.isText?new mz(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=()=>Z.empty)}return e}matchesNode(e,t,n){return this.dirty==iz&&e.eq(this.node)&&wz(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 Ez(this,a&&a.node,e);kz(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?QN.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==oz)&&(a&&this.protectLocalComposition(e,a),_z(this.contentDOM,this.children,e),bR&&Az(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof MI)||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=jz(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 uz(this,i,t,r);e.input.compositionNodes.push(a),this.children=Mz(this.children,n,n+r.length,e,a)}update(e,t,n,r){return this.dirty==sz||!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=iz}updateOuterDeco(e){if(wz(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,n=this.dom;this.dom=xz(this.dom,this.nodeDOM,bz(this.outerDeco,this.node,t),bz(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 pz(e,t,n,r,i){Cz(r,t,e);let a=new fz(void 0,e,t,n,r,r,r,i,0);return a.contentDOM&&a.updateChildren(i,0),a}var mz=class e extends fz{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==sz||this.dirty!=iz&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=iz||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=iz,!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=sz)}get domAtom(){return!1}isText(e){return this.node.text==e}},hz=class extends cz{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==iz&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName==`IMG`}},gz=class extends fz{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==sz)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 _z(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=Tz(r),i=!0;r=r.nextSibling}else i=!0,e.insertBefore(s,r);if(o instanceof dz){let t=r?r.previousSibling:e.lastChild;_z(o.contentDOM,o.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=Tz(r),i=!0;i&&n.trackWrites==e&&(n.trackWrites=null)}var vz=function(e){e&&(this.nodeName=e)};vz.prototype=Object.create(null);var yz=[new vz];function bz(e,t,n){if(e.length==0)return yz;let r=n?yz[0]:new vz,i=[r];for(let a=0;a<e.length;a++){let o=e[a].type.attrs;if(o){o.nodeName&&i.push(r=new vz(o.nodeName));for(let e in o){let a=o[e];a!=null&&(n&&i.length==1&&i.push(r=new vz(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 xz(e,t,n,r){if(n==yz&&r==yz)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=yz[0],i=t)}Sz(i,o||yz[0],a)}return i}function Sz(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 Cz(e,t,n){return xz(e,e,yz,bz(t,n,e.nodeType!=1))}function wz(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 Tz(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}var Ez=class{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Dz(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=iz,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=dz.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==sz&&a.dom==a.contentDOM&&(a.dirty=oz),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 fz){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!=sz&&wz(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=oz,u.updateChildren(r,a+1),u.dirty=iz),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)||!wz(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let o=fz.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=fz.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 lz(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 dz;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof mz)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((yR||_R)&&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 hz(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 Dz(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 dz)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 Oz(e,t){return e.type.side-t.type.side}function kz(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(Oz);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 Az(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 jz(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 Mz(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 Nz(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(rR(n)){for(c=o;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&PI.isSelectable(e)&&i.parent&&!(e.isInline&&tR(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;l=new PI(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=Wz(e,u,s,n)}return l}function Pz(e){return e.editable?e.hasFocus():Kz(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function Fz(e,t=!1){let n=e.state.selection;if(Hz(e,n),Pz(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&_R){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&YL(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset)){e.input.mouseDown.delayedSelectionSync=!0,e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)Vz(e);else{let{anchor:r,head:i}=n,a,o;Iz&&!(n instanceof MI)&&(n.$from.parent.inlineContent||(a=Lz(e,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=Lz(e,n.to))),e.docView.setSelection(r,i,e,t),Iz&&(a&&zz(a),o&&zz(o)),n.visible?e.dom.classList.remove(`ProseMirror-hideselection`):(e.dom.classList.add(`ProseMirror-hideselection`),`onselectionchange`in document&&Bz(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}var Iz=yR||_R&&vR<63;function Lz(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(yR&&i&&i.contentEditable==`false`)return Rz(i);if((!i||i.contentEditable==`false`)&&(!a||a.contentEditable==`false`)){if(i)return Rz(i);if(a)return Rz(a)}}function Rz(e){return e.contentEditable=`true`,yR&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function zz(e){e.contentEditable=`false`,e.wasDraggable&&=(e.draggable=!0,null)}function Bz(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(()=>{(!Pz(e)||e.state.selection.visible)&&e.dom.classList.remove(`ProseMirror-hideselection`)},20))})}function Vz(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r=n.nodeName==`IMG`;r?t.collapse(n.parentNode,WL(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&pR&&mR<=11&&(n.disabled=!0,n.disabled=!1)}function Hz(e,t){if(t instanceof PI){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(Uz(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else Uz(e)}function Uz(e){e.lastSelectedViewDesc&&=(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),void 0)}function Wz(e,t,n,r){return e.someProp(`createSelectionBetween`,r=>r(e,t,n))||MI.between(t,n,r)}function Gz(e){return e.editable&&!e.hasFocus()?!1:Kz(e)}function Kz(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 qz(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return YL(t.node,t.offset,n.anchorNode,n.anchorOffset)}function Jz(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&&OI.findFrom(a,t)}function Yz(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function Xz(e,t,n){let r=e.state.selection;if(r instanceof MI){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 Yz(e,new MI(r.$anchor,a))}else if(!r.empty)return!1;else if(e.endOfTextblock(t>0?`forward`:`backward`)){let n=Jz(e.state,t);return n&&n instanceof PI?Yz(e,n):!1}else if(!(xR&&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?PI.isSelectable(i)?Yz(e,new PI(t<0?e.state.doc.resolve(n.pos-i.nodeSize):n)):wR?Yz(e,new MI(e.state.doc.resolve(t<0?o:o+i.nodeSize))):!1:!1}}else if(r instanceof PI&&r.node.isInline)return Yz(e,new MI(t>0?r.$to:r.$from));else{let n=Jz(e.state,t);return n?Yz(e,n):!1}}function Zz(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Qz(e,t){let n=e.pmViewDesc;return n&&n.size==0&&(t<0||e.nextSibling||e.nodeName!=`BR`)}function $z(e,t){return t<0?eB(e):tB(e)}function eB(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,a,o=!1;for(hR&&n.nodeType==1&&r<Zz(n)&&Qz(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let e=n.childNodes[r-1];if(Qz(e,-1))i=n,a=--r;else if(e.nodeType==3)n=e,r=n.nodeValue.length;else break}}else if(nB(n))break;else{let t=n.previousSibling;for(;t&&Qz(t,-1);)i=n.parentNode,a=WL(t),t=t.previousSibling;if(t)n=t,r=Zz(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}o?aB(e,n,r):i&&aB(e,i,a)}function tB(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i=Zz(n),a,o;for(;;)if(r<i){if(n.nodeType!=1)break;let e=n.childNodes[r];if(Qz(e,1))a=n,o=++r;else break}else if(nB(n))break;else{let t=n.nextSibling;for(;t&&Qz(t,1);)a=t.parentNode,o=WL(t)+1,t=t.nextSibling;if(t)n=t,r=0,i=Zz(n);else{if(n=n.parentNode,n==e.dom)break;r=i=0}}a&&aB(e,a,o)}function nB(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function rB(e,t){for(;e&&t==e.childNodes.length&&!nR(e);)t=WL(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 iB(e,t){for(;e&&!t&&!nR(e);)t=WL(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 aB(e,t,n){if(t.nodeType!=3){let e,r;(r=rB(t,n))?(t=r,n=0):(e=iB(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(rR(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&&Fz(e)},50)}function oB(e,t){let n=e.state.doc.resolve(t);if(!(_R||SR)&&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 sB(e,t,n){let r=e.state.selection;if(r instanceof MI&&!r.empty||n.indexOf(`s`)>-1||xR&&n.indexOf(`m`)>-1)return!1;let{$from:i,$to:a}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?`up`:`down`)){let n=Jz(e.state,t);if(n&&n instanceof PI)return Yz(e,n)}if(!i.parent.inlineContent){let n=t<0?i:a,o=r instanceof II?OI.near(n,t):OI.findFrom(n,t);return o?Yz(e,o):!1}return!1}function cB(e,t){if(!(e.state.selection instanceof MI))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 lB(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function uB(e){if(!yR||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;lB(e,n,`true`),setTimeout(()=>lB(e,n,`false`),20)}return!1}function dB(e){let t=``;return e.ctrlKey&&(t+=`c`),e.metaKey&&(t+=`m`),e.altKey&&(t+=`a`),e.shiftKey&&(t+=`s`),t}function fB(e,t){let n=t.keyCode,r=dB(t);if(n==8||xR&&n==72&&r==`c`)return cB(e,-1)||$z(e,-1);if(n==46&&!t.shiftKey||xR&&n==68&&r==`c`)return cB(e,1)||$z(e,1);if(n==13||n==27)return!0;if(n==37||xR&&n==66&&r==`c`){let t=n==37?oB(e,e.state.selection.from)==`ltr`?-1:1:-1;return Xz(e,t,r)||$z(e,t)}else if(n==39||xR&&n==70&&r==`c`){let t=n==39?oB(e,e.state.selection.from)==`ltr`?1:-1:1;return Xz(e,t,r)||$z(e,t)}else if(n==38||xR&&n==80&&r==`c`)return sB(e,-1,r)||$z(e,-1);else if(n==40||xR&&n==78&&r==`c`)return uB(e)||sB(e,1,r)||$z(e,1);else if(r==(xR?`m`:`c`)&&(n==66||n==73||n==89||n==90))return!0;return!1}function pB(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`)||sF.fromSchema(e.state.schema),s=wB(),c=s.createElement(`div`);c.appendChild(o.serializeFragment(r,{document:s}));let l=c.firstChild,u,d=0;for(;l&&l.nodeType==1&&(u=SB[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,`
86
+
87
+ `),slice:t}}function mB(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 Q(Z.from(e.state.schema.text(t.replace(/\r\n?/g,`
88
+ `))),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=sF.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=DB(n),wR&&OB(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`)||qP.fromSchema(e.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||u),context:i,ruleFromNode(e){return e.nodeName==`BR`&&!e.nextSibling&&e.parentNode&&!hB.test(e.parentNode.nodeName)?{ignore:!0}:null}}),u)s=kB(xB(s,+u[1],+u[2]),u[4]);else if(s=Q.maxOpen(gB(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=xB(s,e,t)}return e.someProp(`transformPasted`,t=>{s=t(s,e,c)}),s}var hB=/^(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 gB(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&&vB(t,i,e,a[a.length-1],0))a[a.length-1]=n;else{a.length&&(a[a.length-1]=yB(a[a.length-1],i.length));let n=_B(e,t);a.push(n),r=r.matchType(n.type),i=t}}),a)return Z.from(a)}return e}function _B(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,Z.from(e));return e}function vB(e,t,n,r,i){if(i<e.length&&i<t.length&&e[i]==t[i]){let a=vB(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(Z.from(_B(n,e,i+1))))}}function yB(e,t){if(t==0)return e;let n=e.content.replaceChild(e.childCount-1,yB(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(Z.empty,!0);return e.copy(n.append(r))}function bB(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=bB(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(Z.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,o.copy(s))}function xB(e,t,n){return t<e.openStart&&(e=new Q(bB(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new Q(bB(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}var SB={thead:[`table`],tbody:[`table`],tfoot:[`table`],caption:[`table`],colgroup:[`table`],col:[`table`,`colgroup`],tr:[`table`,`tbody`],td:[`table`,`tbody`,`tr`],th:[`table`,`tbody`,`tr`]},CB=null;function wB(){return CB||=document.implementation.createHTMLDocument(`title`)}var TB=null;function EB(e){let t=window.trustedTypes;return t?(TB||=t.defaultPolicy||t.createPolicy(`ProseMirrorClipboard`,{createHTML:e=>e}),TB.createHTML(e)):e}function DB(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=wB().createElement(`div`),r=/<([a-z][^>\s]+)/i.exec(e),i;if((i=r&&SB[r[1].toLowerCase()])&&(e=i.map(e=>`<`+e+`>`).join(``)+e+i.map(e=>`</`+e+`>`).reverse().join(``)),n.innerHTML=EB(e),i)for(let e=0;e<i.length;e++)n=n.querySelector(i[e])||n;return n}function OB(e){let t=e.querySelectorAll(_R?`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 kB(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=Z.from(t.create(r[e+1],i)),a++,o++}return new Q(i,a,o)}var AB={},jB={},MB={touchstart:!0,touchmove:!0},NB=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 PB(e){for(let t in AB){let n=AB[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{zB(e,t)&&!RB(e,t)&&(e.editable||!(t.type in jB))&&n(e,t)},MB[t]?{passive:!0}:void 0)}yR&&e.dom.addEventListener(`input`,()=>null),LB(e)}function FB(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function IB(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 LB(e){e.someProp(`handleDOMEvents`,t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>RB(e,t))})}function RB(e,t){return e.someProp(`handleDOMEvents`,n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function zB(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 BB(e,t){!RB(e,t)&&AB[t.type]&&(e.editable||!(t.type in jB))&&AB[t.type](e,t)}jB.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!eV(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(CR&&_R&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),bR&&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,iR(13,`Enter`))),e.input.lastIOSEnter=0)},200)}else e.someProp(`handleKeyDown`,t=>t(e,n))||fB(e,n)?n.preventDefault():FB(e,`key`)},jB.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)},jB.keypress=(e,t)=>{let n=t;if(eV(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||xR&&n.metaKey)return;if(e.someProp(`handleKeyPress`,t=>t(e,n))){n.preventDefault();return}let r=e.state.selection;if(!(r instanceof MI)||!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 VB(e){return{left:e.clientX,top:e.clientY}}function HB(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function UB(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 WB(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 GB(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&PI.isSelectable(r)?(WB(e,new PI(n),`pointer`),!0):!1}function KB(e,t){if(t==-1)return!1;let n=e.state.selection,r,i;n instanceof PI&&(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(PI.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:(WB(e,PI.create(e.state.doc,i),`pointer`),!0)}function qB(e,t,n,r,i){return UB(e,`handleClickOn`,t,n,r)||e.someProp(`handleClick`,n=>n(e,t,r))||(i?KB(e,n):GB(e,n))}function JB(e,t,n,r){return UB(e,`handleDoubleClickOn`,t,n,r)||e.someProp(`handleDoubleClick`,n=>n(e,t,r))}function YB(e,t,n,r){return UB(e,`handleTripleClickOn`,t,n,r)||e.someProp(`handleTripleClick`,n=>n(e,t,r))||XB(e,n,r)}function XB(e,t,n){if(n.button!=0)return!1;let r=e.state.doc;if(t==-1)return r.inlineContent?(WB(e,MI.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)WB(e,MI.create(r,a+1,a+1+n.content.size),`pointer`);else if(PI.isSelectable(n))WB(e,PI.create(r,a),`pointer`);else continue;return!0}}function ZB(e){return sV(e)}var QB=xR?`metaKey`:`ctrlKey`;AB.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=ZB(e),i=Date.now(),a=`singleClick`;i-e.input.lastClick.time<500&&HB(n,e.input.lastClick)&&!n[QB]&&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(VB(n));o&&(a==`singleClick`?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new $B(e,o,n,!!r)):(a==`doubleClick`?JB:YB)(e,o.pos,o.inside,n)?n.preventDefault():FB(e,`pointer`))};var $B=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[QB],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 PI&&c.from<=a&&c.to>a)&&(this.mightDrag={node:i,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&hR&&!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)),FB(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(()=>Fz(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(VB(e))),this.updateAllowDefault(e),this.allowDefault||!t?FB(this.view,`pointer`):qB(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||yR&&this.mightDrag&&!this.mightDrag.node.isAtom||_R&&!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)?(WB(this.view,OI.near(this.view.state.doc.resolve(t.pos)),`pointer`),e.preventDefault()):FB(this.view,`pointer`)}move(e){this.updateAllowDefault(e),FB(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)}};AB.touchstart=e=>{e.input.lastTouch=Date.now(),ZB(e),FB(e,`pointer`)},AB.touchmove=e=>{e.input.lastTouch=Date.now(),FB(e,`pointer`)},AB.contextmenu=e=>ZB(e);function eV(e,t){return e.composing?!0:yR&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}var tV=CR?5e3:-1;jB.compositionstart=jB.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof MI&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>e.type.spec.inclusive===!1)||_R&&SR&&nV(e)))e.markCursor=e.state.storedMarks||n.marks(),sV(e,!0),e.markCursor=null;else if(sV(e,!t.selection.empty),hR&&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}rV(e,tV)};function nV(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`}jB.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++,rV(e,20))};function rV(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>sV(e),t))}function iV(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=oV());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function aV(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=$L(t.focusNode,t.focusOffset),r=eR(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 oV(){let e=document.createEvent(`Event`);return e.initEvent(`event`,!0,!0),e.timeStamp}function sV(e,t=!1){if(!(CR&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),iV(e),t||e.docView&&e.docView.dirty){let n=Nz(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 cV(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 lV=pR&&mR<15||bR&&TR<604;AB.copy=jB.cut=(e,t)=>{let n=t,r=e.state.selection,i=n.type==`cut`;if(r.empty)return;let a=lV?null:n.clipboardData,{dom:o,text:s}=pB(e,r.content());a?(n.preventDefault(),a.clearData(),a.setData(`text/html`,o.innerHTML),a.setData(`text/plain`,s)):cV(e,o),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta(`uiEvent`,`cut`))};function uV(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function dV(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?fV(e,r.value,null,i,t):fV(e,r.textContent,r.innerHTML,i,t)},50)}function fV(e,t,n,r,i){let a=mB(e,t,n,r,e.state.selection.$from);if(e.someProp(`handlePaste`,t=>t(e,i,a||Q.empty)))return!0;if(!a)return!1;let o=uV(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 pV(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,` `):``}jB.paste=(e,t)=>{let n=t;if(e.composing&&!CR)return;let r=lV?null:n.clipboardData,i=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&fV(e,pV(r),r.getData(`text/html`),i,n)?n.preventDefault():dV(e,n)};var mV=class{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}},hV=xR?`altKey`:`ctrlKey`;function gV(e,t){let n;return e.someProp(`dragCopies`,e=>{n||=e(t)}),n==null?!t[hV]:!n}AB.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(VB(n)),o;if(!(a&&a.pos>=i.from&&a.pos<=(i instanceof PI?i.to-1:i.to))){if(r&&r.mightDrag)o=PI.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=PI.create(e.state.doc,t.posBefore))}}let{dom:s,text:c,slice:l}=pB(e,(o||e.state.selection).content());(!n.dataTransfer.files.length||!_R||vR>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(lV?`Text`:`text/html`,s.innerHTML),n.dataTransfer.effectAllowed=`copyMove`,lV||n.dataTransfer.setData(`text/plain`,c),e.dragging=new mV(l,gV(e,n),o)},AB.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},jB.dragover=jB.dragenter=(e,t)=>t.preventDefault(),jB.drop=(e,t)=>{try{_V(e,t,e.dragging)}finally{e.dragging=null}};function _V(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(VB(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=mB(e,pV(t.dataTransfer),lV?null:t.dataTransfer.getData(`text/html`),!1,i);let o=!!(n&&gV(e,t));if(e.someProp(`handleDrop`,n=>n(e,t,a||Q.empty,o))){t.preventDefault();return}if(!a)return;t.preventDefault();let s=a?sI(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&&PI.isSelectable(a.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(a.content.firstChild))c.setSelection(new PI(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(Wz(e,f,c.doc.resolve(t)))}e.focus(),e.dispatch(c.setMeta(`uiEvent`,`drop`))}AB.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())&&Fz(e)},20))},AB.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)},AB.beforeinput=(e,t)=>{if(_R&&CR&&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,iR(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 jB)AB[e]=jB[e];function vV(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 yV=class e{constructor(e,t){this.toDOM=e,this.spec=t||wV,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 SV(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&&vV(this.spec,t.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},bV=class e{constructor(e,t){this.attrs=e,this.spec=t||wV}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 SV(i,a,this)}valid(e,t){return t.from<t.to}eq(t){return this==t||t instanceof e&&vV(this.attrs,t.attrs)&&vV(this.spec,t.spec)}static is(t){return t.type instanceof e}destroy(){}},xV=class e{constructor(e,t){this.attrs=e,this.spec=t||wV}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 SV(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&&vV(this.attrs,t.attrs)&&vV(this.spec,t.spec)}destroy(){}},SV=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 yV(n,r))}static inline(t,n,r,i){return new e(t,n,new bV(r,i))}static node(t,n,r,i){return new e(t,n,new xV(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof bV}get widget(){return this.type instanceof yV}},CV=[],wV={},TV=class e{constructor(e,t){this.local=e.length?e:CV,this.children=t.length?t:CV}static create(e,t){return t.length?NV(t,e,0,wV):EV}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==EV||e.maps.length==0?this:this.mapInner(e,t,0,0,n||wV)}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?OV(this.children,o||[],t,n,r,i,a):o?new e(o.sort(PV),CV):EV}add(t,n){return n.length?this==EV?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=jV(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,NV(s,e,o+1,wV)),a+=3}});let o=kV(a?MV(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(PV):this.local,i||this.children)}remove(e){return e.length==0||this==EV?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==EV?(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):EV}forChild(t,n){if(this==EV)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 bV){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(PV),CV);return r?new DV([t,r]):t}return r||EV}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 FV(this.localsInner(e))}localsInner(e){if(this==EV)return CV;if(e.inlineContent||!this.local.some(bV.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof bV||t.push(this.local[e]);return t}forEachSet(e){e(this)}};TV.empty=new TV([],[]),TV.removeOverlap=FV;var EV=TV.empty,DV=class e{constructor(e){this.members=e}map(t,n){let r=this.members.map(e=>e.map(t,n,wV));return e.from(r)}forChild(t,n){if(n.isLeaf)return TV.empty;let r=[];for(let i=0;i<this.members.length;i++){let a=this.members[i].forChild(t,n);a!=EV&&(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?FV(n?t:t.sort(PV)):CV}static from(t){switch(t.length){case 0:return EV;case 1:return t[0];default:return new e(t.every(e=>e instanceof TV)?t:t.reduce((e,t)=>e.concat(t instanceof TV?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}};function OV(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==EV?(s[t+1]=-2,c=!0):(s[t]=u,s[t+1]=d,s[t+2]=r)}else c=!0}if(c){let c=NV(AV(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 TV(t.sort(PV),s)}function kV(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 SV(i.from+t,i.to+t,i.type))}return n}function AV(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 jV(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 MV(e){let t=[];for(let n=0;n<e.length;n++)e[n]!=null&&t.push(e[n]);return t}function NV(e,t,n,r){let i=[],a=!1;t.forEach((t,o)=>{let s=jV(e,t,o+n);if(s){a=!0;let e=NV(s,t,n+o+1,r);e!=EV&&i.push(o,o+t.nodeSize,e)}});let o=kV(a?MV(e):e,-n).sort(PV);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 TV(o,i):EV}function PV(e,t){return e.from-t.from||e.to-t.to}function FV(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),IV(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),IV(t,i,r.copy(a.from,r.to)));break}}}return t}function IV(e,t,n){for(;t<e.length&&PV(n,e[t])>0;)t++;e.splice(t,0,n)}function LV(e){let t=[];return e.someProp(`decorations`,n=>{let r=n(e.state);r&&r!=EV&&t.push(r)}),e.cursorWrapper&&t.push(TV.create(e.state.doc,[e.cursorWrapper.deco])),DV.from(t)}var RV={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},zV=pR&&mR<=11,BV=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}},VV=class{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new BV,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]);pR&&mR<=11&&t.some(e=>e.type==`childList`&&e.removedNodes.length||e.type==`characterData`&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():yR&&e.composing&&t.some(e=>e.type==`childList`&&e.target.nodeName==`TR`)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),zV&&(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,RV)),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(Gz(this.view)){if(this.suppressingSelectionUpdates)return Fz(this.view);if(pR&&mR<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&YL(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=GL(n))t.add(n);for(let r=e.anchorNode;r;r=GL(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)&&Gz(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(hR&&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||qV(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&&rR(n)&&(c=Nz(e))&&c.eq(OI.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Fz(e),this.currentSelection.set(n),e.scrollToSelection()):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,a),WV(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,JV(e,s)),this.handleDOMChange(i,a,o,s),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||Fz(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(pR&&mR<=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?WL(r)+1:0,o=n.localPosFromDOM(e.target,a,-1),s=i&&i.parentNode==e.target?WL(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}}},HV=new WeakMap,UV=!1;function WV(e){if(!HV.has(e)&&(HV.set(e,null),[`normal`,`nowrap`,`pre-line`].indexOf(getComputedStyle(e.dom).whiteSpace)!==-1)){if(e.requiresGeckoHackNode=hR,UV)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.`),UV=!0}}function GV(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,a=t.endOffset,o=e.domAtPos(e.state.selection.anchor);return YL(o.node,o.offset,i,a)&&([n,r,i,a]=[i,a,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}}function KV(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return GV(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?GV(e,n):null}function qV(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 JV(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 YV(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}],rR(c)||l.push({node:c.focusNode,offset:c.focusOffset})),_R&&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`)||qP.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:XV,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 XV(e){let t=e.pmViewDesc;if(t)return t.parseRule();if(e.nodeName==`BR`&&e.parentNode){if(yR&&/^(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||yR&&/^(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 ZV=/^(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 QV(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=Nz(e,t);if(n&&!e.state.selection.eq(n)){if(_R&&CR&&e.input.lastKeyCode===13&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp(`handleKeyDown`,t=>t(e,iR(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=YV(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=rH(d.content,l.doc.content,l.from,f,p);if(m&&e.input.domChangeCount++,(bR&&e.input.lastIOSEnter>Date.now()-225||CR)&&i.some(e=>e.nodeType==1&&!ZV.test(e.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp(`handleKeyDown`,t=>t(e,iR(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(!m)if(r&&c instanceof MI&&!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=$V(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 MI&&(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)),pR&&mR<=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((bR&&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,iR(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&tH(u,m.start,m.endA,h,g)&&e.someProp(`handleKeyDown`,t=>t(e,iR(8,`Backspace`)))){CR&&_R&&e.domObserver.suppressSelectionUpdates();return}_R&&m.endB==m.start&&(e.input.lastChromeDelete=Date.now()),CR&&!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,iR(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=$V(e,n.doc,l.sel);t&&!(_R&&e.composing&&t.empty&&(m.start!=m.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==y||t.head==n.mapping.map(b)-1)||pR&&t.empty&&t.head==y)&&n.setSelection(t)}return a&&n.setMeta(`composition`,a),n.scrollIntoView()},S;if(v)if(h.pos==g.pos){pR&&mR<=11&&h.parentOffset==0&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>Fz(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=eH(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 $V(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:Wz(e,t.resolve(n.anchor),t.resolve(n.head))}function eH(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(Z.from(l).eq(e))return{mark:s,type:o}}function tH(e,t,n,r,i){if(n-t<=i.pos-r.pos||nH(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(nH(a,!0,!0));return!o.parent.isTextblock||o.pos>n||nH(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function nH(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 rH(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&&iH(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&&iH(e.textBetween(a-1,a+1))&&(a+=t?1:-1),o=a+(o-s),s=a}return{start:a,endA:o,endB:s}}function iH(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 aH=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 NB,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(fH),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=cH(this),sH(this),this.nodeViews=uH(this),this.docView=pz(this.state.doc,oH(this),LV(this),this.dom,this),this.domObserver=new VV(this,(e,t,n,r)=>QV(this,e,t,n,r)),this.domObserver.start(),PB(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&&LB(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(fH),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&&(iV(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=uH(this);dH(e,this.nodeViews)&&(this.nodeViews=e,r=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&LB(this),this.editable=cH(this),sH(this);let o=LV(this),s=oH(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&&AR(this);if(i){this.domObserver.stop();let t=l&&(pR||_R)&&!this.composing&&!n.selection.empty&&!e.selection.empty&&lH(n.selection,e.selection);if(l){let n=_R?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=aV(this)),(r||!this.docView.update(e.doc,s,o,this))&&(this.docView.updateOuterDeco(s),this.docView.destroy(),this.docView=pz(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())&&qz(this))?Fz(this,t):(Hz(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&&MR(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 PI){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&kR(this,t.getBoundingClientRect(),e)}else kR(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 mV(e.slice,e.move,r<0?void 0:PI.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(pR){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&&FR(this.dom),Fz(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 UR(this,e)}coordsAtPos(e,t=1){return qR(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 rz(this,t||this.state,e)}pasteHTML(e,t){return fV(this,``,e,!1,t||new ClipboardEvent(`paste`))}pasteText(e,t){return fV(this,e,null,!0,t||new ClipboardEvent(`paste`))}serializeForClipboard(e){return pB(this,e)}destroy(){this.docView&&(IB(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],LV(this),this),this.dom.textContent=``):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,JL())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return BB(this,e)}domSelectionRange(){let e=this.domSelection();return e?yR&&this.root.nodeType===11&&aR(this.dom.ownerDocument)==this.dom&&KV(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};aH.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};function oH(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`,[SV.node(0,e.state.doc.content.size,t)]}function sH(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:SV.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function cH(e){return!e.someProp(`editable`,t=>t(e.state)===!1)}function lH(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 uH(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 dH(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 fH(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 pH={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:`'`},mH={48:`)`,49:`!`,50:`@`,51:`#`,52:`$`,53:`%`,54:`^`,55:`&`,56:`*`,57:`(`,59:`:`,61:`+`,173:`_`,186:`:`,187:`+`,188:`<`,189:`_`,190:`>`,191:`?`,192:`~`,219:`{`,220:`|`,221:`}`,222:`"`},hH=typeof navigator<`u`&&/Mac/.test(navigator.platform),gH=typeof navigator<`u`&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),_H=0;_H<10;_H++)pH[48+_H]=pH[96+_H]=String(_H);for(var _H=1;_H<=24;_H++)pH[_H+111]=`F`+_H;for(var _H=65;_H<=90;_H++)pH[_H]=String.fromCharCode(_H+32),mH[_H]=String.fromCharCode(_H);for(var vH in pH)mH.hasOwnProperty(vH)||(mH[vH]=pH[vH]);function yH(e){var t=!(hH&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||gH&&e.shiftKey&&e.key&&e.key.length==1||e.key==`Unidentified`)&&e.key||(e.shiftKey?mH:pH)[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 bH=typeof navigator<`u`&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),xH=typeof navigator<`u`&&/Win/.test(navigator.platform);function SH(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))bH?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 CH(e){let t=Object.create(null);for(let n in e)t[SH(n)]=e[n];return t}function wH(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 TH(e){return new XI({props:{handleKeyDown:EH(e)}})}function EH(e){let t=CH(e);return function(e,n){let r=yH(n),i,a=t[wH(r,n)];if(a&&a(e.state,e.dispatch,e))return!0;if(r.length==1&&r!=` `){if(n.shiftKey){let i=t[wH(r,n,!1)];if(i&&i(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(xH&&n.ctrlKey&&n.altKey)&&(i=pH[n.keyCode])&&i!=r){let r=t[wH(i,n)];if(r&&r(e.state,e.dispatch,e))return!0}}return!1}}var DH=Object.defineProperty,OH=(e,t)=>{for(var n in t)DH(e,n,{get:t[n],enumerable:!0})};function kH(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 AH=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:kH({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}},jH={};OH(jH,{blur:()=>MH,clearContent:()=>NH,clearNodes:()=>PH,command:()=>FH,createParagraphNear:()=>IH,cut:()=>LH,deleteCurrentNode:()=>RH,deleteNode:()=>BH,deleteRange:()=>VH,deleteSelection:()=>HH,enter:()=>UH,exitCode:()=>WH,extendMarkRange:()=>ZH,first:()=>QH,focus:()=>aU,forEach:()=>oU,insertContent:()=>sU,insertContentAt:()=>pU,joinBackward:()=>gU,joinDown:()=>hU,joinForward:()=>_U,joinItemBackward:()=>vU,joinItemForward:()=>yU,joinTextblockBackward:()=>bU,joinTextblockForward:()=>xU,joinUp:()=>mU,keyboardShortcut:()=>wU,lift:()=>EU,liftEmptyBlock:()=>DU,liftListItem:()=>OU,newlineInCode:()=>kU,resetAttributes:()=>MU,scrollIntoView:()=>NU,selectAll:()=>PU,selectNodeBackward:()=>FU,selectNodeForward:()=>IU,selectParentNode:()=>LU,selectTextblockEnd:()=>RU,selectTextblockStart:()=>zU,setContent:()=>VU,setMark:()=>zW,setMeta:()=>BW,setNode:()=>VW,setNodeSelection:()=>HW,setTextDirection:()=>UW,setTextSelection:()=>WW,sinkListItem:()=>GW,splitBlock:()=>qW,splitListItem:()=>JW,toggleList:()=>QW,toggleMark:()=>$W,toggleNode:()=>eG,toggleWrap:()=>tG,undoInputRule:()=>nG,unsetAllMarks:()=>rG,unsetMark:()=>iG,unsetTextDirection:()=>aG,updateAttributes:()=>oG,wrapIn:()=>sG,wrapInList:()=>cG});var MH=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),NH=(e=!0)=>({commands:t})=>t.setContent(``,{emitUpdate:e}),PH=()=>({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=VF(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},FH=e=>t=>e(t),IH=()=>({state:e,dispatch:t})=>yL(e,t),LH=(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 MI(r.doc.resolve(Math.max(o-1,0)))),!0},RH=()=>({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 zH(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 BH=e=>({tr:t,state:n,dispatch:r})=>{let i=zH(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},VH=e=>({tr:t,dispatch:n})=>{let{from:r,to:i}=e;return n&&t.delete(r,i),!0},HH=()=>({state:e,dispatch:t})=>eL(e,t),UH=()=>({commands:e})=>e.keyboardShortcut(`Enter`),WH=()=>({state:e,dispatch:t})=>vL(e,t);function GH(e){return Object.prototype.toString.call(e)===`[object RegExp]`}function KH(e,t,n={strict:!0}){let r=Object.keys(t);return r.length?r.every(r=>n.strict?t[r]===e[r]:GH(t[r])?t[r].test(e[r]):t[r]===e[r]):!0}function qH(e,t,n={}){return e.find(e=>e.type===t&&KH(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function JH(e,t,n={}){return!!qH(e,t,n)}function YH(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(!qH([...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&&JH([...e.parent.child(i-1).marks],t,n);)--i,a-=e.parent.child(i).nodeSize;for(;o<e.parent.childCount&&JH([...e.parent.child(o).marks],t,n);)s+=e.parent.child(o).nodeSize,o+=1;return{from:a,to:s}}function XH(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 ZH=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=XH(e,r.schema),{doc:o,selection:s}=n,{$from:c,from:l,to:u}=s;if(i){let e=YH(c,a,t);if(e&&e.from<=l&&e.to>=u){let t=MI.create(o,e.from,e.to);n.setSelection(t)}}return!0},QH=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 $H(e){return e instanceof MI}function eU(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function tU(e,t=null){if(!t)return null;let n=OI.atStart(e),r=OI.atEnd(e);if(t===`start`||t===!0)return n;if(t===`end`)return r;let i=n.from,a=r.to;return t===`all`?MI.create(e,eU(0,i,a),eU(e.content.size,i,a)):MI.create(e,eU(t,i,a),eU(t,i,a))}function nU(){return navigator.platform===`Android`||/android/i.test(navigator.userAgent)}function rU(){return[`iPad Simulator`,`iPhone Simulator`,`iPod Simulator`,`iPad`,`iPhone`,`iPod`].includes(navigator.platform)||navigator.userAgent.includes(`Mac`)&&`ontouchend`in document}function iU(){return typeof navigator<`u`?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var aU=(e=null,t={})=>({editor:n,view:r,tr:i,dispatch:a})=>{t={scrollIntoView:!0,...t};let o=()=>{(rU()||nU())&&r.dom.focus(),iU()&&!rU()&&!nU()&&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&&!$H(n.state.selection))return o(),!0;let s=tU(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},oU=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),sU=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),cU=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&&cU(r)}return e};function lU(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 cU(n)}function uU(e,t,n){if(e instanceof vP||e instanceof Z)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 Z.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),uU(``,t,n)}if(i){if(n.errorOnInvalidContent){let r=!1,i=``,a=new UP({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?qP.fromSchema(a).parseSlice(lU(e),n.parseOptions):qP.fromSchema(a).parse(lU(e),n.parseOptions),n.errorOnInvalidContent&&r)throw Error(`[tiptap error]: Invalid HTML content`,{cause:Error(`Invalid element found: ${i}`)})}let r=qP.fromSchema(t);return n.slice?r.parseSlice(lU(e),n.parseOptions).content:r.parse(lU(e),n.parseOptions)}return uU(``,t,n)}function dU(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof PF||i instanceof FF))return;let a=e.mapping.maps[r],o=0;a.forEach((e,t,n,r)=>{o===0&&(o=r)}),e.setSelection(OI.near(e.doc.resolve(o),n))}var fU=e=>!(`type`in e),pU=(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{uU(t,a.schema,{parseOptions:s,errorOnInvalidContent:!0})}catch(e){o(e)}try{i=uU(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((fU(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 Z){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&&dU(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},mU=()=>({state:e,dispatch:t})=>pL(e,t),hU=()=>({state:e,dispatch:t})=>mL(e,t),gU=()=>({state:e,dispatch:t})=>nL(e,t),_U=()=>({state:e,dispatch:t})=>uL(e,t),vU=()=>({state:e,dispatch:t,tr:n})=>{try{let r=iI(e.doc,e.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},yU=()=>({state:e,dispatch:t,tr:n})=>{try{let r=iI(e.doc,e.selection.$from.pos,1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},bU=()=>({state:e,dispatch:t})=>rL(e,t),xU=()=>({state:e,dispatch:t})=>iL(e,t);function SU(){return typeof navigator<`u`?/Mac/.test(navigator.platform):!1}function CU(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))rU()||SU()?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 wU=e=>({editor:t,view:n,tr:r,dispatch:i})=>{let a=CU(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 TU(e,t,n={}){let{from:r,to:i,empty:a}=e.selection,o=t?zH(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=>KH(e.node.attrs,n,{strict:!1}));return a?!!l.length:l.reduce((e,t)=>e+t.to-t.from,0)>=c}var EU=(e,t={})=>({state:n,dispatch:r})=>TU(n,zH(e,n.schema),t)?hL(n,r):!1,DU=()=>({state:e,dispatch:t})=>bL(e,t),OU=e=>({state:t,dispatch:n})=>BL(zH(e,t.schema))(t,n),kU=()=>({state:e,dispatch:t})=>gL(e,t);function AU(e,t){return t.nodes[e]?`node`:t.marks[e]?`mark`:null}function jU(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 MU=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=AU(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=zH(e,r.schema)),s===`mark`&&(o=XH(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,jU(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(jU(a.attrs,t))))})})}),c},NU=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),PU=()=>({tr:e,dispatch:t})=>{if(t){let t=new II(e.doc);e.setSelection(t)}return!0},FU=()=>({state:e,dispatch:t})=>sL(e,t),IU=()=>({state:e,dispatch:t})=>dL(e,t),LU=()=>({state:e,dispatch:t})=>CL(e,t),RU=()=>({state:e,dispatch:t})=>kL(e,t),zU=()=>({state:e,dispatch:t})=>OL(e,t);function BU(e,t,n={},r={}){return uU(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var VU=(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=BU(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 HU(e,t){let n=XH(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 UU(e,t){let n=new EI(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function WU(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 GU(e,t,n){let r=[];return e.nodesBetween(t.from,t.to,(e,t)=>{n(e)&&r.push({node:e,pos:t})}),r}function KU(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 qU(e){return t=>KU(t.$from,e)}function JU(e,t,n){return e.config[t]===void 0&&e.parent?JU(e.parent,t,n):typeof e.config[t]==`function`?e.config[t].bind({...n,parent:e.parent?JU(e.parent,t,n):null}):e.config[t]}function YU(e){return e.map(e=>{let t=JU(e,`addExtensions`,{name:e.name,options:e.options,storage:e.storage});return t?[e,...YU(t())]:e}).flat(10)}function XU(e,t){let n=sF.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement(`div`);return r.appendChild(n),r.innerHTML}function ZU(e){return typeof e==`function`}function QU(e,t=void 0,...n){return ZU(e)?t?e.bind(t)(...n):e(...n):e}function $U(e={}){return Object.keys(e).length===0&&e.constructor===Object}function eW(e){return{baseExtensions:e.filter(e=>e.type===`extension`),nodeExtensions:e.filter(e=>e.type===`node`),markExtensions:e.filter(e=>e.type===`mark`)}}function tW(e){let t=[],{nodeExtensions:n,markExtensions:r}=eW(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=JU(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=JU(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 nW(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 rW(e){let t=[],n=nW(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 iW(...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([...rW(n[e]),...rW(t)]);n[e]=Array.from(r.entries()).map(([e,t])=>`${e}: ${t}`).join(`; `)}else n[e]=t}),n},{})}function aW(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)=>iW(e,t),{})}function oW(e){return typeof e==`string`?e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e===`true`?!0:e===`false`?!1:e:e}function sW(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):oW(n.getAttribute(t.name));return r==null?e:{...e,[t.name]:r}},{});return{...r,...i}}}}function cW(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>e===`attrs`&&$U(t)?!1:t!=null))}function lW(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 uW(e,t){let n=tW(e),{nodeExtensions:r,markExtensions:i}=eW(e);return new UP({topNode:r.find(e=>JU(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=cW({...e.reduce((e,t)=>{let n=JU(t,`extendNodeSchema`,a);return{...e,...n?n(r):{}}},{}),content:QU(JU(r,`content`,a)),marks:QU(JU(r,`marks`,a)),group:QU(JU(r,`group`,a)),inline:QU(JU(r,`inline`,a)),atom:QU(JU(r,`atom`,a)),selectable:QU(JU(r,`selectable`,a)),draggable:QU(JU(r,`draggable`,a)),code:QU(JU(r,`code`,a)),whitespace:QU(JU(r,`whitespace`,a)),linebreakReplacement:QU(JU(r,`linebreakReplacement`,a)),defining:QU(JU(r,`defining`,a)),isolating:QU(JU(r,`isolating`,a)),attrs:Object.fromEntries(i.map(lW))}),s=QU(JU(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>sW(e,i)));let c=JU(r,`renderHTML`,a);c&&(o.toDOM=e=>c({node:e,HTMLAttributes:aW(e,i)}));let l=JU(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=cW({...e.reduce((e,t)=>{let n=JU(t,`extendMarkSchema`,a);return{...e,...n?n(r):{}}},{}),inclusive:QU(JU(r,`inclusive`,a)),excludes:QU(JU(r,`excludes`,a)),group:QU(JU(r,`group`,a)),spanning:QU(JU(r,`spanning`,a)),code:QU(JU(r,`code`,a)),attrs:Object.fromEntries(i.map(lW))}),s=QU(JU(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>sW(e,i)));let c=JU(r,`renderHTML`,a);return c&&(o.toDOM=e=>c({mark:e,HTMLAttributes:aW(e,i)})),[r.name,o]}))})}function dW(e){let t=e.filter((t,n)=>e.indexOf(t)!==n);return Array.from(new Set(t))}function fW(e){return e.sort((e,t)=>{let n=JU(e,`priority`)||100,r=JU(t,`priority`)||100;return n>r?-1:+(n<r)})}function pW(e){let t=fW(YU(e)),n=dW(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 mW(e,t,n){let{from:r,to:i}=t,{blockSeparator:a=`
89
+
90
+ `,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 hW(e,t){return mW(e,{from:0,to:e.content.size},t)}function gW(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function _W(e,t){let n=zH(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 vW(e,t){let n=AU(typeof t==`string`?t:t.name,e.schema);return n===`node`?_W(e,t):n===`mark`?HU(e,t):{}}function yW(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 bW(e){let t=yW(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 xW(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}})})}),bW(r)}function SW(e,t,n){let r=[];return e===t?n.resolve(e).marks().forEach(t=>{let i=YH(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 CW=(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 wW(e,t){return t.nodes[e]||t.marks[e]||null}function TW(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 EW=(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 DW(e,t,n={}){let{empty:r,ranges:i}=e.selection,a=t?XH(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>a?a.name===e.type.name:!0).find(e=>KH(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=>KH(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 OW(e,t,n={}){if(!t)return TU(e,null,n)||DW(e,null,n);let r=AU(t,e.schema);return r===`node`?TU(e,t,n):r===`mark`?DW(e,t,n):!1}var kW=(e,t)=>{let{$from:n,$to:r,$anchor:i}=e.selection;if(t){let n=qU(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)},AW=e=>{let{$from:t,$to:n}=e.selection;return!(t.parentOffset>0||t.pos!==n.pos)};function jW(e,t){return Array.isArray(t)?t.some(t=>(typeof t==`string`?t:t.name)===e.name):t}function MW(e,t){let{nodeExtensions:n}=eW(t),r=n.find(t=>t.name===e);if(!r)return!1;let i=QU(JU(r,`group`,{name:r.name,options:r.options,storage:r.storage}));return typeof i==`string`?i.split(` `).includes(`list`):!1}function NW(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&&(NW(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}function PW(e){return e instanceof PI}var FW=class e{constructor(e){this.position=e}static fromJSON(t){return new e(t.position)}toJSON(){return{position:this.position}}};function IW(e,t){let n=t.mapping.mapResult(e.position);return{position:new FW(n.pos),mapResult:n}}function LW(e){return new FW(e)}function RW(e,t,n){let{selection:r}=t,i=null;if($H(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 zW=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=n,{empty:o,ranges:s}=a,c=XH(e,r.schema);if(i)if(o){let e=HU(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 RW(r,n,c)},BW=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),VW=(e,t={})=>({state:n,dispatch:r,chain:i})=>{let a=zH(e,n.schema),o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),a.isTextblock?i().command(({commands:e})=>jL(a,{...o,...t})(n)?!0:e.clearNodes()).command(({state:e})=>jL(a,{...o,...t})(e,r)).run():(console.warn(`[tiptap warn]: Currently "setNode()" only supports text block nodes.`),!1)},HW=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,r=eU(e,0,n.content.size),i=PI.create(n,r);t.setSelection(i)}return!0},UW=(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},WW=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,{from:r,to:i}=typeof e==`number`?{from:e,to:e}:e,a=MI.atStart(n).from,o=MI.atEnd(n).to,s=eU(r,a,o),c=eU(i,a,o),l=MI.create(n,s,c);t.setSelection(l)}return!0},GW=e=>({state:t,dispatch:n})=>UL(zH(e,t.schema))(t,n);function KW(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 qW=({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=TW(l,s.node().type.name,s.node().attrs);if(a instanceof PI&&a.node.isBlock)return!s.parentOffset||!$F(o,s.pos)?!1:(r&&(e&&KW(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:WU(s.node(-1).contentMatchAt(s.indexAfter(-1))),p=d&&f?[{type:f,attrs:u}]:void 0,m=$F(t.doc,t.mapping.map(s.pos),1,p);if(!p&&!m&&$F(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 MI&&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&&KW(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return m},JW=(e,t={})=>({tr:n,state:r,dispatch:i,editor:a})=>{let o=zH(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=Z.empty,r=s.index(-1)?1:s.index(-2)?2:3;for(let t=s.depth-r;t>=s.depth-3;--t)e=Z.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={...TW(d,s.node().type.name,s.node().attrs),...t},c=o.contentMatch.defaultType?.createAndFill(a)||void 0;e=e.append(Z.from(o.createAndFill(null,c)||void 0));let l=s.before(s.depth-(r-1));n.replace(l,s.after(-i),new Q(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(MI.near(n.doc.resolve(u))),n.scrollIntoView()}return!0}let f=c.pos===s.end()?u.contentMatchAt(0).defaultType:null,p={...TW(d,u.type.name,u.attrs),...t},m={...TW(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(!$F(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},YW=(e,t)=>{let n=qU(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&&tI(e.doc,n.pos)&&e.join(n.pos),!0},XW=(e,t)=>{let n=qU(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&&tI(e.doc,r)&&e.join(r),!0};function ZW(e){let t=e.doc,n=t.firstChild;if(!n)return null;let r=t.resolve(1),i=t.resolve(n.nodeSize-1);return MI.between(r,i)}var QW=(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=zH(e,o.schema),m=zH(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=qU(e=>MW(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&&MW(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=ZW(e);return n?(e.setSelection(n),t&&t(e),!0):!1}).liftListItem(m).run():l.liftListItem(m);if(MW(E.node.type.name,d)&&p.validContent(E.node.content))return c().command(()=>(a.setNodeMarkup(E.pos,p),!0)).command(()=>YW(a,p)).command(()=>XW(a,p)).run()}return!n||!b||!s?c().command(()=>u().wrapInList(p,r)?!0:l.clearNodes()).wrapInList(p,r).command(()=>YW(a,p)).command(()=>XW(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(()=>YW(a,p)).command(()=>XW(a,p)).run()},$W=(e,t={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:a=!1}=n,o=XH(e,r.schema);return DW(r,o,t)?i.unsetMark(o,{extendEmptyMarkRange:a}):i.setMark(o,t)},eG=(e,t,n={})=>({state:r,commands:i})=>{let a=zH(e,r.schema),o=zH(t,r.schema),s=TU(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})},tG=(e,t={})=>({state:n,commands:r})=>{let i=zH(e,n.schema);return TU(n,i,t)?r.lift(i):r.wrapIn(i,t)},nG=()=>({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},rG=()=>({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},iG=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{extendEmptyMarkRange:a=!1}=t,{selection:o}=n,s=XH(e,r.schema),{$from:c,empty:l,ranges:u}=o;if(!i)return!0;if(l&&a){let{from:e,to:t}=o,r=YH(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},aG=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},oG=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=AU(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=zH(e,r.schema)),s===`mark`&&(o=XH(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},sG=(e,t={})=>({state:n,dispatch:r})=>AL(zH(e,n.schema),t)(n,r),cG=(e,t={})=>({state:n,dispatch:r})=>LL(zH(e,n.schema),t)(n,r),lG=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={}}},uG=class{constructor(e){this.find=e.find,this.handler=e.handler,this.undoable=e.undoable??!0}},dG=(e,t)=>{if(GH(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 fG(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=EW(c)+i;return a.forEach(e=>{if(l)return;let a=dG(u,e.find);if(!a)return;let c=s.state.tr,d=kH({state:s.state,transaction:c}),f={from:n-(a[0].length-i.length),to:r},{commands:p,chain:m,can:h}=new AH({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 pG(e){let{editor:t,rules:n}=e,r=new XI({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:XU(Z.from(e),a.schema);let{from:i}=s;fG({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 fG({editor:t,from:i,to:a,text:o,rules:n,plugin:r})},handleDOMEvents:{compositionend:e=>(setTimeout(()=>{let{$cursor:i}=e.state.selection;i&&fG({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?fG({editor:t,from:a.pos,to:a.pos,text:`
91
+ `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function mG(e){return Object.prototype.toString.call(e).slice(8,-1)}function hG(e){return mG(e)===`Object`?e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype:!1}function gG(e,t){let n={...e};return hG(e)&&hG(t)&&Object.keys(t).forEach(r=>{hG(t[r])&&hG(e[r])?n[r]=gG(e[r],t[r]):n[r]=t[r]}),n}var _G=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{...QU(JU(this,`addOptions`,{name:this.name}))||{}}}get storage(){return{...QU(JU(this,`addStorage`,{name:this.name,options:this.options}))||{}}}configure(e={}){let t=this.extend({...this.config,addOptions:()=>gG(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}},vG=class e extends _G{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 yG(e){return typeof e==`number`}var bG=class{constructor(e){this.find=e.find,this.handler=e.handler}},xG=(e,t,n)=>{if(GH(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 SG(e){let{editor:t,state:n,from:r,to:i,rule:a,pasteEvent:o,dropEvent:s}=e,{commands:c,chain:l,can:u}=new AH({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||xG(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 CG=null,wG=e=>{var t;let n=new ClipboardEvent(`paste`,{clipboardData:new DataTransfer});return(t=n.clipboardData)==null||t.setData(`text/html`,e),n};function TG(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(!(!SG({editor:t,state:kH({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 XI({view(e){let n=n=>{r=e.dom.parentElement?.contains(n.target)?e.dom.parentElement:null,r&&(CG=t)},i=()=>{CG&&=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=CG;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:XU(Z.from(t),r.schema);let{from:n}=d,i=n+t.length,a=wG(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(!(!yG(p)||!m||p===m.b))return c({rule:e,state:r,from:p,to:m,pasteEvt:o})}}))}var EG=class{constructor(e,t){this.splittableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=pW(e),this.schema=uW(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{let n=JU(t,`addCommands`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:wW(t.name,this.schema)});return n?{...e,...n()}:e},{})}get plugins(){let{editor:e}=this;return fW([...this.extensions].reverse()).flatMap(t=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:wW(t.name,this.schema)},r=[],i=JU(t,`addKeyboardShortcuts`,n),a={};if(t.type===`mark`&&JU(t,`exitable`,n)&&(a.ArrowRight=()=>vG.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=TH(a);r.push(o);let s=JU(t,`addInputRules`,n);if(jW(t,e.options.enableInputRules)&&s){let t=s();if(t&&t.length){let n=pG({editor:e,rules:t}),i=Array.isArray(n)?n:[n];r.push(...i)}}let c=JU(t,`addPasteRules`,n);if(jW(t,e.options.enablePasteRules)&&c){let t=c();if(t&&t.length){let n=TG({editor:e,rules:t});r.push(...n)}}let l=JU(t,`addProseMirrorPlugins`,n);if(l){let e=l();r.push(...e)}return r})}get attributes(){return tW(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=eW(this.extensions);return Object.fromEntries(t.filter(e=>!!JU(e,`addNodeView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=JU(t,`addNodeView`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:zH(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:aW(r,n)})]:[]}))}dispatchTransaction(e){let{editor:t}=this;return fW([...this.extensions].reverse()).reduceRight((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:wW(n.name,this.schema)},i=JU(n,`dispatchTransaction`,r);return i?t=>{i.call(r,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){let{editor:t}=this;return fW([...this.extensions]).reduce((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:wW(n.name,this.schema)},i=JU(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}=eW(this.extensions);return Object.fromEntries(t.filter(e=>!!JU(e,`addMarkView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=JU(t,`addMarkView`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:XH(t.name,this.schema)});return r?[t.name,(i,a,o)=>{let s=aW(i,n);return r()({mark:i,view:a,inline:o,editor:e,extension:t,HTMLAttributes:s,updateAttributes:t=>{cK(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:wW(e.name,this.schema)};e.type===`mark`&&(QU(JU(e,`keepOnSplit`,t))??!0)&&this.splittableMarks.push(e.name);let n=JU(e,`onBeforeCreate`,t),r=JU(e,`onCreate`,t),i=JU(e,`onUpdate`,t),a=JU(e,`onSelectionUpdate`,t),o=JU(e,`onTransaction`,t),s=JU(e,`onFocus`,t),c=JU(e,`onBlur`,t),l=JU(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)})}};EG.resolve=pW,EG.sort=fW,EG.flatten=YU,OH({},{ClipboardTextSerializer:()=>OG,Commands:()=>kG,Delete:()=>AG,Drop:()=>jG,Editable:()=>MG,FocusEvents:()=>PG,Keymap:()=>FG,Paste:()=>IG,Tabindex:()=>LG,TextDirection:()=>RG,focusEventsPluginKey:()=>NG});var DG=class e extends _G{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)}},OG=DG.create({name:`clipboardTextSerializer`,addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new XI({key:new $I(`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=gW(n);return mW(r,{from:o,to:s},{...this.options.blockSeparator===void 0?{}:{blockSeparator:this.options.blockSeparator},textSerializers:c})}}})]}}),kG=DG.create({name:`commands`,addCommands(){return{...jH}}}),AG=DG.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=UU(e.before,[e,...t]);xW(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 jF){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()}}),jG=DG.create({name:`drop`,addProseMirrorPlugins(){return[new XI({key:new $I(`tiptapDrop`),props:{handleDrop:(e,t,n,r)=>{this.editor.emit(`drop`,{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),MG=DG.create({name:`editable`,addProseMirrorPlugins(){return[new XI({key:new $I(`editable`),props:{editable:()=>this.editor.options.editable}})]}}),NG=new $I(`focusEvents`),PG=DG.create({name:`focusEvents`,addProseMirrorPlugins(){let{editor:e}=this;return[new XI({key:NG,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}}}})]}}),FG=DG.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:OI.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 rU()||SU()?i:r},addProseMirrorPlugins(){return[new XI({key:new $I(`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=OI.atStart(t.doc).from,l=OI.atEnd(t.doc).to;if(a||!(o===c&&s===l)||!NW(n.doc))return;let u=n.tr,d=kH({state:n,transaction:u}),{commands:f}=new AH({editor:this.editor,state:d});if(f.clearNodes(),u.steps.length)return u}})]}}),IG=DG.create({name:`paste`,addProseMirrorPlugins(){return[new XI({key:new $I(`tiptapPaste`),props:{handlePaste:(e,t,n)=>{this.editor.emit(`paste`,{editor:this.editor,event:t,slice:n})}}})]}}),LG=DG.create({name:`tabindex`,addProseMirrorPlugins(){return[new XI({key:new $I(`tabindex`),props:{attributes:()=>this.editor.isEditable?{tabindex:`0`}:{}}})]}}),RG=DG.create({name:`textDirection`,addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:e}=eW(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 XI({key:new $I(`textDirection`),props:{attributes:()=>{let e=this.options.direction;return e?{dir:e}:{}}}})]}}),zG=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)}},BG=`.ProseMirror {
92
+ position: relative;
93
+ }
94
+
95
+ .ProseMirror {
96
+ word-wrap: break-word;
97
+ white-space: pre-wrap;
98
+ white-space: break-spaces;
99
+ -webkit-font-variant-ligatures: none;
100
+ font-variant-ligatures: none;
101
+ font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
102
+ }
103
+
104
+ .ProseMirror [contenteditable="false"] {
105
+ white-space: normal;
106
+ }
107
+
108
+ .ProseMirror [contenteditable="false"] [contenteditable="true"] {
109
+ white-space: pre-wrap;
110
+ }
111
+
112
+ .ProseMirror pre {
113
+ white-space: pre-wrap;
114
+ }
115
+
116
+ img.ProseMirror-separator {
117
+ display: inline !important;
118
+ border: none !important;
119
+ margin: 0 !important;
120
+ width: 0 !important;
121
+ height: 0 !important;
122
+ }
123
+
124
+ .ProseMirror-gapcursor {
125
+ display: none;
126
+ pointer-events: none;
127
+ position: absolute;
128
+ margin: 0;
129
+ }
130
+
131
+ .ProseMirror-gapcursor:after {
132
+ content: "";
133
+ display: block;
134
+ position: absolute;
135
+ top: -2px;
136
+ width: 20px;
137
+ border-top: 1px solid black;
138
+ animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
139
+ }
140
+
141
+ @keyframes ProseMirror-cursor-blink {
142
+ to {
143
+ visibility: hidden;
144
+ }
145
+ }
146
+
147
+ .ProseMirror-hideselection *::selection {
148
+ background: transparent;
149
+ }
150
+
151
+ .ProseMirror-hideselection *::-moz-selection {
152
+ background: transparent;
153
+ }
154
+
155
+ .ProseMirror-hideselection * {
156
+ caret-color: transparent;
157
+ }
158
+
159
+ .ProseMirror-focused .ProseMirror-gapcursor {
160
+ display: block;
161
+ }`;function VG(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 HG=class extends lG{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:IW,createMappablePosition:LW},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=tU(t,this.options.autofocus);this.editorState=JI.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=VG(BG,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=ZU(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?[MG,OG.configure({blockSeparator:this.options.coreExtensionOptions?.clipboardTextSerializer?.blockSeparator}),kG,PG,FG,LG,jG,IG,AG,RG.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 EG(e,this)}createCommandManager(){this.commandManager=new AH({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=BU(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=BU(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 aH(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 vW(this.state,e)}isActive(e,t){let n=typeof e==`string`?e:null,r=typeof e==`string`?t:e;return OW(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return XU(this.state.doc.content,this.schema)}getText(e){let{blockSeparator:t=`
162
+
163
+ `,textSerializers:n={}}=e||{};return hW(this.state.doc,{blockSeparator:t,textSerializers:{...gW(this.schema),...n}})}get isEmpty(){return NW(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 zG(this.state.doc.resolve(e),this)}get $doc(){return this.$pos(0)}};function UG(e){return new uG({find:e.find,handler:({state:t,range:n,match:r})=>{let i=QU(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(SW(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 WG(e){return new uG({find:e.find,handler:({state:t,range:n,match:r})=>{let i=QU(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 GG(e){return new uG({find:e.find,handler:({state:t,range:n,match:r})=>{let i=t.doc.resolve(n.from),a=QU(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 KG(e){return new uG({find:e.find,handler:({state:t,range:n,match:r,chain:i})=>{let a=QU(e.getAttributes,void 0,r)||{},o=t.tr.delete(n.from,n.to),s=o.doc.resolve(n.from).blockRange(),c=s&&UF(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&&tI(o.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,l))&&o.join(n.from-1)},undoable:e.undoable})}var qG=e=>`touches`in e,JG=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,qG(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 YG(e,t){let{selection:n}=e,{$from:r}=n;if(n instanceof PI){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}OH({},{createAtomBlockMarkdownSpec:()=>QG,createBlockMarkdownSpec:()=>$G,createInlineMarkdownSpec:()=>nK,parseAttributes:()=>XG,parseIndentedBlocks:()=>rK,renderNestedMarkdownContent:()=>iK,serializeAttributes:()=>ZG});function XG(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 ZG(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 QG(e){let{nodeName:t,name:n,parseAttributes:r=XG,serializeAttributes:i=ZG,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 $G(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=XG,serializeAttributes:a=ZG,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}}`:``}
164
+
165
+ ${t.renderChildren(e.content||[],`
166
+
167
+ `)}
168
+
169
+ :::`}}}function eK(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 tK(e){return Object.entries(e).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(` `)}function nK(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=eK,serializeAttributes:a=tK,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 rK(e,t,n){let r=e.split(`
170
+ `),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}
171
+ `;continue}else return}let l=t.extractItemData(c),{indentLevel:u,mainContent:d}=l;a=`${a}${e}
172
+ `;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}
173
+ `,o+=1;continue}else break}if((e.match(/^(\s*)/)?.[1]?.length||0)>u)f.push(e),a=`${a}${e}
174
+ `,o+=1;else break}let p,m=f.slice(1);if(m.length>0){let e=m.map(e=>e.slice(u+s)).join(`
175
+ `);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 iK(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(`
176
+ `).map(e=>e?t.indent(e):t.indent(``)).join(`
177
+ `);s+=e.type===`paragraph`?`
178
+
179
+ ${n}`:`
180
+ ${n}`}}),s}var aK=new WeakMap;function oK(e,t){let n=aK.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())})}};aK.set(e,t),e.on(`update`,t.handler),n=t}n.callbacks.add(t)}function sK(e,t){let n=aK.get(e);n&&(n.callbacks.delete(t),n.callbacks.size===0&&(n.rafId!==null&&cancelAnimationFrame(n.rafId),e.off(`update`,n.handler),aK.delete(e)))}function cK(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 lK=class e extends _G{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)}},uK=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=PI.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=PI.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`&&(rU()||nU())&&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 dK(e){return new bG({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:i})=>{let a=QU(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(SW(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:fK,getOwnPropertySymbols:pK}=Object,{hasOwnProperty:mK}=Object.prototype;function hK(e,t){return function(n,r,i){return e(n,r,i)&&t(n,r,i)}}function gK(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 _K(e){return e?.[Symbol.toStringTag]}function vK(e){return fK(e).concat(pK(e))}var yK=Object.hasOwn||((e,t)=>mK.call(e,t));function bK(e,t){return e===t||!e&&!t&&e!==e&&t!==t}var xK=`__v`,SK=`__o`,CK=`_owner`,{getOwnPropertyDescriptor:wK,keys:TK}=Object;function EK(e,t){return e.byteLength===t.byteLength&&zK(new Uint8Array(e),new Uint8Array(t))}function DK(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 OK(e,t){return e.byteLength===t.byteLength&&zK(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function kK(e,t){return bK(e.getTime(),t.getTime())}function AK(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function jK(e,t){return e===t}function MK(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 NK=bK;function PK(e,t,n){let r=TK(e),i=r.length;if(TK(t).length!==i)return!1;for(;i-- >0;)if(!VK(e,t,n,r[i]))return!1;return!0}function FK(e,t,n){let r=vK(e),i=r.length;if(vK(t).length!==i)return!1;let a,o,s;for(;i-- >0;)if(a=r[i],!VK(e,t,n,a)||(o=wK(e,a),s=wK(t,a),(o||s)&&(!o||!s||o.configurable!==s.configurable||o.enumerable!==s.enumerable||o.writable!==s.writable)))return!1;return!0}function IK(e,t){return bK(e.valueOf(),t.valueOf())}function LK(e,t){return e.source===t.source&&e.flags===t.flags}function RK(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 zK(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 BK(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 VK(e,t,n,r){return(r===CK||r===SK||r===xK)&&(e.$$typeof||t.$$typeof)?!0:yK(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}var HK=`[object ArrayBuffer]`,UK=`[object Arguments]`,WK=`[object Boolean]`,GK=`[object DataView]`,KK=`[object Date]`,qK=`[object Error]`,JK=`[object Map]`,YK=`[object Number]`,XK=`[object Object]`,ZK=`[object RegExp]`,QK=`[object Set]`,$K=`[object String]`,eq={"[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},tq=`[object URL]`,nq=Object.prototype.toString;function rq({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=nq.call(h);if(b===KK)return r(h,g,_);if(b===ZK)return u(h,g,_);if(b===JK)return o(h,g,_);if(b===QK)return d(h,g,_);if(b===XK)return typeof h.then!=`function`&&typeof g.then!=`function`&&c(h,g,_);if(b===tq)return p(h,g,_);if(b===qK)return i(h,g,_);if(b===UK)return c(h,g,_);if(eq[b])return f(h,g,_);if(b===HK)return e(h,g,_);if(b===GK)return n(h,g,_);if(b===WK||b===YK||b===$K)return l(h,g,_);if(m){let e=m[b];if(!e){let t=_K(h);t&&(e=m[t])}if(e)return e(h,g,_)}return!1}}function iq({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:EK,areArraysEqual:n?FK:DK,areDataViewsEqual:OK,areDatesEqual:kK,areErrorsEqual:AK,areFunctionsEqual:jK,areMapsEqual:n?hK(MK,FK):MK,areNumbersEqual:NK,areObjectsEqual:n?FK:PK,arePrimitiveWrappersEqual:IK,areRegExpsEqual:LK,areSetsEqual:n?hK(RK,FK):RK,areTypedArraysEqual:n?hK(zK,FK):zK,areUrlsEqual:BK,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){let e=gK(r.areArraysEqual),t=gK(r.areMapsEqual),n=gK(r.areObjectsEqual),i=gK(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:i})}return r}function aq(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function oq({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 sq=cq();cq({strict:!0}),cq({circular:!0}),cq({circular:!0,strict:!0}),cq({createInternalComparator:()=>bK}),cq({strict:!0,createInternalComparator:()=>bK}),cq({circular:!0,createInternalComparator:()=>bK}),cq({circular:!0,createInternalComparator:()=>bK,strict:!0});function cq(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,a=rq(iq(e));return oq({circular:t,comparator:a,createState:r,equals:n?n(a):aq(a),strict:i})}var lq=o((e=>{var t=d(),n=rl();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}})),uq=o(((e,t)=>{t.exports=lq()}))(),dq=(...e)=>t=>{e.forEach(e=>{typeof e==`function`?e(t):e&&(e.current=t)})},fq=({contentComponent:e})=>{let t=(0,il.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getServerSnapshot);return(0,U.jsx)(U.Fragment,{children:Object.values(t)})};function pq(){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 mq=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=pq(),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,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{ref:dq(t,this.editorContentRef),...n}),e?.contentComponent&&(0,U.jsx)(fq,{contentComponent:e.contentComponent})]})}},hq=(0,v.forwardRef)((e,t)=>{let n=v.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return v.createElement(mq,{key:n,innerRef:t,...e})}),gq=v.memo(hq),_q=typeof window<`u`?v.useLayoutEffect:v.useEffect,vq=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 yq(e){let[t]=(0,v.useState)(()=>new vq(e.editor)),n=(0,uq.useSyncExternalStoreWithSelector)(t.subscribe,t.getSnapshot,t.getServerSnapshot,e.selector,e.equalityFn??sq);return _q(()=>t.watch(e.editor),[e.editor,t]),(0,v.useDebugValue)(n),n}var bq=!1,xq=typeof window>`u`,Sq=xq||!!(typeof window<`u`&&window.next),Cq=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(xq||Sq){if(bq)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&&xq&&bq)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 HG({...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 wq(e={},t=[]){let n=(0,v.useRef)(e);n.current=e;let[r]=(0,v.useState)(()=>new Cq(n)),i=(0,il.useSyncExternalStore)(r.subscribe,r.getEditor,r.getServerSnapshot);return(0,v.useDebugValue)(i),(0,v.useEffect)(r.onRender(t)),yq({editor:i,selector:({transactionNumber:t})=>e.shouldRerenderOnTransaction===!1||e.shouldRerenderOnTransaction===void 0?null:e.immediatelyRender&&t===0?0:t+1}),i}var Tq=(0,v.createContext)({editor:null});Tq.Consumer;var Eq=(0,v.createContext)({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),Dq=()=>(0,v.useContext)(Eq),Oq=v.forwardRef((e,t)=>{let{onDragStart:n}=Dq();return(0,U.jsx)(e.as||`div`,{...e,ref:t,"data-node-view-wrapper":``,onDragStart:n,style:{whiteSpace:`normal`,...e.style}})});function kq(e){return!!(typeof e==`function`&&e.prototype&&e.prototype.isReactComponent)}function Aq(e){return!!(typeof e==`object`&&e.$$typeof&&(e.$$typeof.toString()===`Symbol(react.forward_ref)`||e.$$typeof.description===`react.forward_ref`))}function jq(e){return!!(typeof e==`object`&&e.$$typeof&&(e.$$typeof.toString()===`Symbol(react.memo)`||e.$$typeof.description===`react.memo`))}function Mq(e){if(kq(e)||Aq(e))return!0;if(jq(e)){let t=e.type;if(t)return kq(t)||Aq(t)}return!1}function Nq(){try{if(v.version)return parseInt(v.version.split(`.`)[0],10)>=19}catch{}return!1}var Pq=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=Nq(),a=Mq(t),o={...n};o.ref&&!(i||a)&&delete o.ref,!o.ref&&(i||a)&&(o.ref=e=>{this.ref=e}),this.reactElement=(0,U.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 Fq=class extends uK{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,U.jsx)(Eq.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 Pq(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())},oK(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&&=(sK(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=aW(this.node,t);e=this.options.attrs({node:this.node,HTMLAttributes:n})}else e=this.options.attrs;this.renderer.updateAttributes(e)}}};function Iq(e,t){return n=>n.editor.contentComponent?new Fq(e,n,t):{}}var Lq=(0,v.createContext)({get editor(){throw Error(`useTiptap must be used within a <Tiptap> provider`)}});Lq.displayName=`TiptapContext`;var Rq=()=>(0,v.useContext)(Lq);function zq({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,U.jsx)(Tq.Provider,{value:a,children:(0,U.jsx)(Lq.Provider,{value:i,children:n})})}zq.displayName=`Tiptap`;function Bq({...e}){let{editor:t}=Rq();return(0,U.jsx)(gq,{editor:t,...e})}Bq.displayName=`Tiptap.Content`,Object.assign(zq,{Content:Bq});var Vq=(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]},Hq=/^\s*>\s$/,Uq=lK.create({name:`blockquote`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,group:`block`,defining:!0,parseHTML(){return[{tag:`blockquote`}]},renderHTML({HTMLAttributes:e}){return Vq(`blockquote`,{...iW(this.options.HTMLAttributes,e),children:Vq(`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(`
181
+ `).map(e=>e.trim()===``?`>`:`> ${e}`);n.push(i.join(`
182
+ `))}),n.join(`
183
+ >
184
+ `)},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[KG({find:Hq,type:this.type})]}}),Wq=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Gq=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,Kq=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,qq=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Jq=vG.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 Vq(`strong`,{...iW(this.options.HTMLAttributes,e),children:Vq(`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[UG({find:Wq,type:this.type}),UG({find:Kq,type:this.type})]},addPasteRules(){return[dK({find:Gq,type:this.type}),dK({find:qq,type:this.type})]}}),Yq=/(^|[^`])`([^`]+)`(?!`)$/,Xq=/(^|[^`])`([^`]+)`(?!`)/g,Zq=vG.create({name:`code`,addOptions(){return{HTMLAttributes:{}}},excludes:`_`,code:!0,exitable:!0,parseHTML(){return[{tag:`code`}]},renderHTML({HTMLAttributes:e}){return[`code`,iW(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[UG({find:Yq,type:this.type})]},addPasteRules(){return[dK({find:Xq,type:this.type})]}}),Qq=4,$q=/^```([a-z]+)?[\s\n]$/,eJ=/^~~~([a-z]+)?[\s\n]$/,tJ=lK.create({name:`codeBlock`,addOptions(){return{languageClassPrefix:`language-`,exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Qq,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`,iW(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(`
185
+ `):`\`\`\`${r}
186
+
187
+ \`\`\``,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??Qq,{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,`
188
+ `,`
189
+ `).split(`
190
+ `).map(e=>o+e).join(`
191
+ `);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??Qq,{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,`
192
+ `,`
193
+ `).split(`
194
+ `),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(MI.create(e.doc,p)),!0}):e.commands.command(({tr:e})=>{let{from:i,to:a}=r,o=n.doc.textBetween(i,a,`
195
+ `,`
196
+ `).split(`
197
+ `).map(e=>{let n=e.match(/^ */)?.[0]||``,r=Math.min(n.length,t);return e.slice(r)}).join(`
198
+ `);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(`
199
+
200
+ `);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(OI.near(r.resolve(o))),!0)):e.commands.exitCode()}}},addInputRules(){return[GG({find:$q,type:this.type,getAttributes:e=>({language:e[1]})}),GG({find:eJ,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new XI({key:new $I(`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,`
201
+ `));return a.replaceSelectionWith(this.type.create({language:i},s)),a.selection.$from.parent.type!==this.type&&a.setSelection(MI.near(a.doc.resolve(Math.max(0,a.selection.from-2)))),a.setMeta(`paste`,!0),e.dispatch(a),!0}}})]}}),nJ=lK.create({name:`doc`,topNode:!0,content:`block+`,renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
202
+
203
+ `):``}),rJ=lK.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`,iW(this.options.HTMLAttributes,e)]},renderText(){return`
204
+ `},renderMarkdown:()=>`
205
+ `,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()}}}),iJ=lK.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]}`,iW(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=>GG({find:RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),aJ=lK.create({name:`horizontalRule`,addOptions(){return{HTMLAttributes:{},nextNodeType:`paragraph`}},group:`block`,parseHTML(){return[{tag:`hr`}]},renderHTML({HTMLAttributes:e}){return[`hr`,iW(this.options.HTMLAttributes,e)]},markdownTokenName:`hr`,parseMarkdown:(e,t)=>t.createNode(`horizontalRule`),renderMarkdown:()=>`---`,addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!YG(t,t.schema.nodes[this.name]))return!1;let{selection:n}=t,{$to:r}=n,i=e();return PW(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(MI.create(t.doc,n.pos+1)):n.nodeAfter.isBlock?t.setSelection(PI.create(t.doc,n.pos)):t.setSelection(MI.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(MI.create(t.doc,r+1)))}t.scrollIntoView()}return!0}).run()}}},addInputRules(){return[WG({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),oJ=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,sJ=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,cJ=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,lJ=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,uJ=vG.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`,iW(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[UG({find:oJ,type:this.type}),UG({find:cJ,type:this.type})]},addPasteRules(){return[dK({find:sJ,type:this.type}),dK({find:lJ,type:this.type})]}}),dJ=`aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2`,fJ=`ελ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`,pJ=`numeric`,mJ=`ascii`,hJ=`alpha`,gJ=`asciinumeric`,_J=`alphanumeric`,vJ=`domain`,yJ=`emoji`,bJ=`scheme`,xJ=`slashscheme`,SJ=`whitespace`;function CJ(e,t){return e in t||(t[e]=[]),t[e]}function wJ(e,t,n){t[pJ]&&(t[gJ]=!0,t[_J]=!0),t[mJ]&&(t[gJ]=!0,t[hJ]=!0),t[gJ]&&(t[_J]=!0),t[hJ]&&(t[_J]=!0),t[_J]&&(t[vJ]=!0),t[yJ]&&(t[vJ]=!0);for(let r in t){let t=CJ(r,n);t.indexOf(e)<0&&t.push(e)}}function TJ(e,t){let n={};for(let r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}function EJ(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}EJ.groups={},EJ.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||=EJ.groups;let i;return t&&t.j?i=t:(i=new EJ(t),n&&r&&wJ(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||=EJ.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 EJ,Object.assign(o.j,s.j),o.jr.push.apply(o.jr,s.jr),o.jd=s.jd,o.t=s.t):o=new EJ,a&&(r&&(o.t&&typeof o.t==`string`?wJ(a,Object.assign(TJ(o.t,r),n),r):n&&wJ(a,n,r)),o.t=a),i.j[e]=o,o}};var DJ=(e,t,n,r,i)=>e.ta(t,n,r,i),OJ=(e,t,n,r,i)=>e.tr(t,n,r,i),kJ=(e,t,n,r,i)=>e.ts(t,n,r,i),$=(e,t,n,r,i)=>e.tt(t,n,r,i),AJ=`WORD`,jJ=`UWORD`,MJ=`ASCIINUMERICAL`,NJ=`ALPHANUMERICAL`,PJ=`LOCALHOST`,FJ=`TLD`,IJ=`UTLD`,LJ=`SCHEME`,RJ=`SLASH_SCHEME`,zJ=`NUM`,BJ=`WS`,VJ=`NL`,HJ=`OPENBRACE`,UJ=`CLOSEBRACE`,WJ=`OPENBRACKET`,GJ=`CLOSEBRACKET`,KJ=`OPENPAREN`,qJ=`CLOSEPAREN`,JJ=`OPENANGLEBRACKET`,YJ=`CLOSEANGLEBRACKET`,XJ=`FULLWIDTHLEFTPAREN`,ZJ=`FULLWIDTHRIGHTPAREN`,QJ=`LEFTCORNERBRACKET`,$J=`RIGHTCORNERBRACKET`,eY=`LEFTWHITECORNERBRACKET`,tY=`RIGHTWHITECORNERBRACKET`,nY=`FULLWIDTHLESSTHAN`,rY=`FULLWIDTHGREATERTHAN`,iY=`AMPERSAND`,aY=`APOSTROPHE`,oY=`ASTERISK`,sY=`AT`,cY=`BACKSLASH`,lY=`BACKTICK`,uY=`CARET`,dY=`COLON`,fY=`COMMA`,pY=`DOLLAR`,mY=`DOT`,hY=`EQUALS`,gY=`EXCLAMATION`,_Y=`HYPHEN`,vY=`PERCENT`,yY=`PIPE`,bY=`PLUS`,xY=`POUND`,SY=`QUERY`,CY=`QUOTE`,wY=`FULLWIDTHMIDDLEDOT`,TY=`SEMI`,EY=`SLASH`,DY=`TILDE`,OY=`UNDERSCORE`,kY=`EMOJI`,AY=`SYM`,jY=Object.freeze({__proto__:null,ALPHANUMERICAL:NJ,AMPERSAND:iY,APOSTROPHE:aY,ASCIINUMERICAL:MJ,ASTERISK:oY,AT:sY,BACKSLASH:cY,BACKTICK:lY,CARET:uY,CLOSEANGLEBRACKET:YJ,CLOSEBRACE:UJ,CLOSEBRACKET:GJ,CLOSEPAREN:qJ,COLON:dY,COMMA:fY,DOLLAR:pY,DOT:mY,EMOJI:kY,EQUALS:hY,EXCLAMATION:gY,FULLWIDTHGREATERTHAN:rY,FULLWIDTHLEFTPAREN:XJ,FULLWIDTHLESSTHAN:nY,FULLWIDTHMIDDLEDOT:wY,FULLWIDTHRIGHTPAREN:ZJ,HYPHEN:_Y,LEFTCORNERBRACKET:QJ,LEFTWHITECORNERBRACKET:eY,LOCALHOST:PJ,NL:VJ,NUM:zJ,OPENANGLEBRACKET:JJ,OPENBRACE:HJ,OPENBRACKET:WJ,OPENPAREN:KJ,PERCENT:vY,PIPE:yY,PLUS:bY,POUND:xY,QUERY:SY,QUOTE:CY,RIGHTCORNERBRACKET:$J,RIGHTWHITECORNERBRACKET:tY,SCHEME:LJ,SEMI:TY,SLASH:EY,SLASH_SCHEME:RJ,SYM:AY,TILDE:DY,TLD:FJ,UNDERSCORE:OY,UTLD:IJ,UWORD:jJ,WORD:AJ,WS:BJ}),MY=/[a-z]/,NY=/\p{L}/u,PY=/\p{Emoji}/u,FY=/\d/,IY=/\s/,LY=`\r`,RY=`
206
+ `,zY=`️`,BY=`‍`,VY=``,HY=null,UY=null;function WY(e=[]){let t={};EJ.groups=t;let n=new EJ;HY??=JY(dJ),UY??=JY(fJ),$(n,`'`,aY),$(n,`{`,HJ),$(n,`}`,UJ),$(n,`[`,WJ),$(n,`]`,GJ),$(n,`(`,KJ),$(n,`)`,qJ),$(n,`<`,JJ),$(n,`>`,YJ),$(n,`(`,XJ),$(n,`)`,ZJ),$(n,`「`,QJ),$(n,`」`,$J),$(n,`『`,eY),$(n,`』`,tY),$(n,`<`,nY),$(n,`>`,rY),$(n,`&`,iY),$(n,`*`,oY),$(n,`@`,sY),$(n,"`",lY),$(n,`^`,uY),$(n,`:`,dY),$(n,`,`,fY),$(n,`$`,pY),$(n,`.`,mY),$(n,`=`,hY),$(n,`!`,gY),$(n,`-`,_Y),$(n,`%`,vY),$(n,`|`,yY),$(n,`+`,bY),$(n,`#`,xY),$(n,`?`,SY),$(n,`"`,CY),$(n,`/`,EY),$(n,`;`,TY),$(n,`~`,DY),$(n,`_`,OY),$(n,`\\`,cY),$(n,`・`,wY);let r=OJ(n,FY,zJ,{[pJ]:!0});OJ(r,FY,r);let i=OJ(r,MY,MJ,{[gJ]:!0}),a=OJ(r,NY,NJ,{[_J]:!0}),o=OJ(n,MY,AJ,{[mJ]:!0});OJ(o,FY,i),OJ(o,MY,o),OJ(i,FY,i),OJ(i,MY,i);let s=OJ(n,NY,jJ,{[hJ]:!0});OJ(s,MY),OJ(s,FY,a),OJ(s,NY,s),OJ(a,FY,a),OJ(a,MY),OJ(a,NY,a);let c=$(n,RY,VJ,{[SJ]:!0}),l=$(n,LY,BJ,{[SJ]:!0}),u=OJ(n,IY,BJ,{[SJ]:!0});$(n,VY,u),$(l,RY,c),$(l,VY,u),OJ(l,IY,u),$(u,LY),$(u,RY),OJ(u,IY,u),$(u,VY,u);let d=OJ(n,PY,kY,{[yJ]:!0});$(d,`#`),OJ(d,PY,d),$(d,zY,d);let f=$(d,BY);$(f,`#`),OJ(f,PY,d);let p=[[MY,o],[FY,i]],m=[[MY,null],[NY,s],[FY,a]];for(let e=0;e<HY.length;e++)qY(n,HY[e],FJ,AJ,p);for(let e=0;e<UY.length;e++)qY(n,UY[e],IJ,jJ,m);wJ(FJ,{tld:!0,ascii:!0},t),wJ(IJ,{utld:!0,alpha:!0},t),qY(n,`file`,LJ,AJ,p),qY(n,`mailto`,LJ,AJ,p),qY(n,`http`,RJ,AJ,p),qY(n,`https`,RJ,AJ,p),qY(n,`ftp`,RJ,AJ,p),qY(n,`ftps`,RJ,AJ,p),wJ(LJ,{scheme:!0,ascii:!0},t),wJ(RJ,{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]?{[bJ]:!0}:{[xJ]:!0};r.indexOf(`-`)>=0?i[vJ]=!0:MY.test(r)?FY.test(r)?i[gJ]=!0:i[mJ]=!0:i[pJ]=!0,kJ(n,r,r,i)}return kJ(n,`localhost`,PJ,{ascii:!0}),n.jd=new EJ(AY),{start:n,tokens:Object.assign({groups:t},jY)}}function GY(e,t){let n=KY(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 KY(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 qY(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 EJ(r),a.jr=i.slice(),e.j[o]=a),e=a}return a=new EJ(n),a.jr=i.slice(),e.j[t[o-1]]=a,a}function JY(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 YY={defaultProtocol:`http`,events:null,format:ZY,formatHref:ZY,nl2br:!1,tagName:`a`,target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function XY(e,t=null){let n=Object.assign({},YY);e&&(n=Object.assign(n,e instanceof XY?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}XY.prototype={o:YY,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]:YY[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 ZY(e){return e}function QY(e,t){this.t=`token`,this.v=e,this.tk=t}QY.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=YY.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 $Y(e,t){class n extends QY{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 eX=$Y(`email`,{isLink:!0,toHref(){return`mailto:`+this.toString()}}),tX=$Y(`text`),nX=$Y(`nl`),rX=$Y(`url`,{isLink:!0,toHref(e=YY.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){let e=this.tk;return e.length>=2&&e[0].t!==PJ&&e[1].t===dY}}),iX=e=>new EJ(e);function aX({groups:e}){let t=e.domain.concat([iY,oY,sY,cY,lY,uY,pY,hY,_Y,zJ,vY,yY,bY,xY,EY,AY,DY,OY]),n=[aY,dY,fY,mY,gY,vY,SY,CY,TY,JJ,YJ,HJ,UJ,GJ,WJ,KJ,qJ,XJ,ZJ,QJ,$J,eY,tY,nY,rY],r=[iY,aY,oY,cY,lY,uY,pY,hY,_Y,HJ,UJ,vY,yY,bY,xY,SY,EY,AY,DY,OY],i=iX(),a=$(i,DY);DJ(a,r,a),DJ(a,e.domain,a);let o=iX(),s=iX(),c=iX();DJ(i,e.domain,o),DJ(i,e.scheme,s),DJ(i,e.slashscheme,c),DJ(o,r,a),DJ(o,e.domain,o);let l=$(o,sY);$(a,sY,l),$(s,sY,l),$(c,sY,l);let u=$(a,mY);DJ(u,r,a),DJ(u,e.domain,a);let d=iX();DJ(l,e.domain,d),DJ(d,e.domain,d);let f=$(d,mY);DJ(f,e.domain,d);let p=iX(eX);DJ(f,e.tld,p),DJ(f,e.utld,p),$(l,PJ,p);let m=$(d,_Y);$(m,_Y,m),DJ(m,e.domain,d),DJ(p,e.domain,d),$(p,mY,f),$(p,_Y,m),DJ($(p,dY),e.numeric,eX);let h=$(o,_Y),g=$(o,mY);$(h,_Y,h),DJ(h,e.domain,o),DJ(g,r,a),DJ(g,e.domain,o);let _=iX(rX);DJ(g,e.tld,_),DJ(g,e.utld,_),DJ(_,e.domain,o),DJ(_,r,a),$(_,mY,g),$(_,_Y,h),$(_,sY,l);let v=$(_,dY),y=iX(rX);DJ(v,e.numeric,y);let b=iX(rX),x=iX();DJ(b,t,b),DJ(b,n,x),DJ(x,t,b),DJ(x,n,x),$(_,EY,b),$(y,EY,b);let S=$(s,dY),C=$($($(c,dY),EY),EY);DJ(s,e.domain,o),$(s,mY,g),$(s,_Y,h),DJ(c,e.domain,o),$(c,mY,g),$(c,_Y,h),DJ(S,e.domain,b),$(S,EY,b),$(S,SY,b),DJ(C,e.domain,b),DJ(C,t,b),$(C,EY,b);let w=[[HJ,UJ],[WJ,GJ],[KJ,qJ],[JJ,YJ],[XJ,ZJ],[QJ,$J],[eY,tY],[nY,rY]];for(let e=0;e<w.length;e++){let[r,i]=w[e],a=$(b,r);$(x,r,a),$(a,i,b);let o=iX(rX);DJ(a,t,o);let s=iX();DJ(a,n),DJ(o,t,o),DJ(o,n,s),DJ(s,t,o),DJ(s,n,s),$(o,i,b),$(s,i,b)}return $(i,PJ,_),$(i,VJ,nX),{start:i,tokens:jY}}function oX(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(sX(tX,t,o)),o=[]),i-=f,u-=f;let e=d.t,r=n.slice(i-u,i);a.push(sX(e,t,r))}}return o.length>0&&a.push(sX(tX,t,o)),a}function sX(e,t,n){let r=n[0].s,i=n[n.length-1].e;return new e(t.slice(r,i),n)}var cX=typeof console<`u`&&console&&console.warn||(()=>{}),lX=`until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`,uX={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function dX(){return EJ.groups={},uX.scanner=null,uX.parser=null,uX.tokenQueue=[],uX.pluginQueue=[],uX.customSchemes=[],uX.initialized=!1,uX}function fX(e,t=!1){if(uX.initialized&&cX(`linkifyjs: already initialized - will not register custom scheme "${e}" ${lX}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw Error(`linkifyjs: incorrect scheme format.
207
+ 1. Must only contain digits, lowercase ASCII letters or "-"
208
+ 2. Cannot start or end with "-"
209
+ 3. "-" cannot repeat`);uX.customSchemes.push([e,t])}function pX(){uX.scanner=WY(uX.customSchemes);for(let e=0;e<uX.tokenQueue.length;e++)uX.tokenQueue[e][1]({scanner:uX.scanner});uX.parser=aX(uX.scanner.tokens);for(let e=0;e<uX.pluginQueue.length;e++)uX.pluginQueue[e][1]({scanner:uX.scanner,parser:uX.parser});return uX.initialized=!0,uX}function mX(e){return uX.initialized||pX(),oX(uX.parser.start,e,GY(uX.scanner.start,e))}mX.scan=GY;function hX(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 XY(n),i=mX(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 gX=`[\0- \xA0 ᠎ -\u2029  ]`,_X=new RegExp(gX),vX=RegExp(`${gX}$`),yX=new RegExp(gX,`g`);function bX(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?[`()`,`[]`].includes(e[0].value+e[2].value):!1}function xX(e){return new XI({key:new $I(`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(xW(UU(n.doc,[...t])).forEach(({newRange:t})=>{let n=GU(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(!vX.test(e))return;i=n[0],a=r.doc.textBetween(i.pos,t.to,void 0,` `)}if(i&&a){let t=a.split(_X).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=mX(n).map(t=>t.toObject(e.defaultProtocol));if(!bX(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=>{SW(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 SX(e){return new XI({key:new $I(`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=vW(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 CX(e){return new XI({key:new $I(`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=hX(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 wX(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(yX,``).match(RegExp(`^(?:(?:${n.join(`|`)}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,`i`))}var TX=vG.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`){fX(e);return}fX(e.scheme,e.optionalSlashes)})},onDestroy(){dX()},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)=>!!wX(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=>!!wX(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=>!!wX(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?[`a`,iW(this.options.HTMLAttributes,e),0]:[`a`,iW(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=>!!wX(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=>!!wX(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[dK({find:e=>{let t=[];if(e){let{protocols:n,defaultProtocol:r}=this.options,i=hX(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!wX(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(xX({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!wX(e,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),e.push(SX({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick===`whenNotEditable`?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(CX({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}}),EX=Object.defineProperty,DX=(e,t)=>{for(var n in t)EX(e,n,{get:t[n],enumerable:!0})},OX=`listItem`,kX=`textStyle`,AX=/^\s*([-+*])\s$/,jX=lK.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`,iW(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,`
210
+ `):``,markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(OX,this.editor.getAttributes(kX)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=KG({find:AX,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=KG({find:AX,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(kX),editor:this.editor})),[e]}}),MX=lK.create({name:`listItem`,addOptions(){return{HTMLAttributes:{},bulletListTypeName:`bulletList`,orderedListTypeName:`orderedList`}},content:`paragraph block*`,defining:!0,parseHTML(){return[{tag:`li`}]},renderHTML({HTMLAttributes:e}){return[`li`,iW(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)=>iK(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)}}});DX({},{findListItemPos:()=>NX,getNextListDepth:()=>PX,handleBackspace:()=>RX,handleDelete:()=>VX,hasListBefore:()=>FX,hasListItemAfter:()=>HX,hasListItemBefore:()=>IX,listItemHasSubList:()=>LX,nextListIsDeeper:()=>zX,nextListIsHigher:()=>BX});var NX=(e,t)=>{let{$from:n}=t.selection,r=zH(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}},PX=(e,t)=>{let n=NX(e,t);if(!n)return!1;let[,r]=CW(t,e,n.$pos.pos+4);return r},FX=(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))},IX=(e,t)=>{let{$anchor:n}=t.selection,r=t.doc.resolve(n.pos-2);return!(r.index()===0||r.nodeBefore?.type.name!==e)},LX=(e,t,n)=>{if(!n)return!1;let r=zH(e,t.schema),i=!1;return n.descendants(e=>{e.type===r&&(i=!0)}),i},RX=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!TU(e.state,t)&&FX(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(!TU(e.state,t)||!AW(e.state))return!1;let r=NX(t,e.state);if(!r)return!1;let i=e.state.doc.resolve(r.$pos.pos-2).node(r.depth),a=LX(t,e.state,i);return IX(t,e.state)&&!a?e.commands.joinItemBackward():e.chain().liftListItem(t).run()},zX=(e,t)=>{let n=PX(e,t),r=NX(e,t);return!r||!n?!1:n>r.depth},BX=(e,t)=>{let n=PX(e,t),r=NX(e,t);return!r||!n?!1:n<r.depth},VX=(e,t)=>{if(!TU(e.state,t)||!kW(e.state,t))return!1;let{selection:n}=e.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:zX(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():BX(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward()},HX=(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)},UX=DG.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&&VX(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&&VX(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&&RX(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&&RX(e,n,r)&&(t=!0)}),t}}}}),WX=/^(\s*)(\d+)\.\s+(.*)$/,GX=/^\s/;function KX(e){let t=e.trimStart();return/^[-+*]\s+/.test(t)||/^\d+\.\s+/.test(t)||/^>\s?/.test(t)||/^```/.test(t)||/^~~~/.test(t)}function qX(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&&KX(e)){r=!0,n.push(e);return}t.push(e)}),{paragraphLines:t,blockLines:n}}function JX(e){let t=[],n=0,r=0;for(;n<e.length;){let i=e[n],a=i.match(WX);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(WX))break;if(t.trim()===``)f.push(t),u.push(``),p=!0,d+=1;else if(t.match(GX))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(`
211
+ `).trim(),contentLines:u,raw:f.join(`
212
+ `)}),r=d,n=d}return[t,r]}function YX(e,t,n){let r=[],i=0;for(;i<e.length;){let a=e[i];if(a.indent===t){let{paragraphLines:o,blockLines:s}=qX(a.contentLines),c=o.join(`
213
+ `).trim(),l=[];c&&l.push({type:`paragraph`,raw:c,tokens:n.inlineTokens(c)});let u=s.join(`
214
+ `).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=YX(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(`
215
+ `)})}r.push({type:`list_item`,raw:a.raw,tokens:l}),i=d}else i+=1}return r}function XX(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 ZX=`listItem`,QX=`textStyle`,$X=/^(\d+)\.\s$/,eZ=lK.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`,iW(this.options.HTMLAttributes,n),0]:[`ol`,iW(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?XX(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,`
216
+ `):``,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(`
217
+ `),[i,a]=JX(r);if(i.length===0)return;let o=YX(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(`
218
+ `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(ZX,this.editor.getAttributes(QX)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=KG({find:$X,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=KG({find:$X,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(QX)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[e]}}),tZ=/^\s*(\[([( |x])?\])\s$/,nZ=lK.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`,iW(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)=>iK(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=aW(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[KG({find:tZ,type:this.type,getAttributes:e=>({checked:e[e.length-1]===`x`})})]}}),rZ=lK.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`,iW(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,`
219
+ `):``,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=rK(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=rK(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()}}});DG.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(jX.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(MX.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(UX.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(eZ.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(nZ.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(rZ.configure(this.options.taskList)),e}});var iZ=`&nbsp;`,aZ=`\xA0`,oZ=lK.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,iW(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===iZ||n[0].text===iZ||n[0].raw===aZ||n[0].text===aZ)&&r.length===1&&r[0].type===`text`&&(r[0].text===iZ||r[0].text===aZ)?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?iZ:``}return t.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),sZ=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,cZ=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,lZ=vG.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`,iW(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[UG({find:sZ,type:this.type})]},addPasteRules(){return[dK({find:cZ,type:this.type})]}}),uZ=lK.create({name:`text`,group:`inline`,parseMarkdown:e=>({type:`text`,text:e.text||``}),renderMarkdown:e=>e.text||``}),dZ=vG.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`,iW(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 fZ(e={}){return new XI({view(t){return new pZ(t,e)}})}var pZ=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=sI(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)}},mZ=class e extends OI{constructor(e){super(e,e)}map(t,n){let r=t.resolve(n.map(this.head));return e.valid(r)?new e(r):OI.near(r)}content(){return Q.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 hZ(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!_Z(e)||!vZ(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&&!PI.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}}};mZ.prototype.visible=!1,mZ.findFrom=mZ.findGapCursorFrom,OI.jsonID(`gapcursor`,mZ);var hZ=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 mZ.valid(t)?new mZ(t):OI.near(t)}};function gZ(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function _Z(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||gZ(e.type))return!0;if(e.inlineContent)return!1}}return!0}function vZ(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||gZ(e.type))return!0;if(e.inlineContent)return!1}}return!0}function yZ(){return new XI({props:{decorations:wZ,createSelectionBetween(e,t,n){return t.pos==n.pos&&mZ.valid(n)?new mZ(n):null},handleClick:SZ,handleKeyDown:bZ,handleDOMEvents:{beforeinput:CZ}}})}var bZ=EH({ArrowLeft:xZ(`horiz`,-1),ArrowRight:xZ(`horiz`,1),ArrowUp:xZ(`vert`,-1),ArrowDown:xZ(`vert`,1)});function xZ(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 MI){if(!i.endOfTextblock(n)||o.depth==0)return!1;s=!1,o=e.doc.resolve(t>0?o.after():o.before())}let c=mZ.findGapCursorFrom(o,t,s);return c?(r&&r(e.tr.setSelection(new mZ(c))),!0):!1}}function SZ(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!mZ.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&PI.isSelectable(e.state.doc.nodeAt(i.inside))?!1:(e.dispatch(e.state.tr.setSelection(new mZ(r))),!0)}function CZ(e,t){if(t.inputType!=`insertCompositionText`||!(e.state.selection instanceof mZ))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=Z.empty;for(let e=r.length-1;e>=0;e--)i=Z.from(r[e].createAndFill(null,i));let a=e.state.tr.replace(n.pos,n.pos,new Q(i,0,0));return a.setSelection(MI.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function wZ(e){if(!(e.selection instanceof mZ))return null;let t=document.createElement(`div`);return t.className=`ProseMirror-gapcursor`,TV.create(e.doc,[SV.widget(e.selection.head,t,{key:`gapcursor`})])}var TZ=200,EZ=function(){};EZ.prototype.append=function(e){return e.length?(e=EZ.from(e),!this.length&&e||e.length<TZ&&this.leafAppend(e)||this.length<TZ&&e.leafPrepend(this)||this.appendInner(e)):this},EZ.prototype.prepend=function(e){return e.length?EZ.from(e).append(this):this},EZ.prototype.appendInner=function(e){return new OZ(this,e)},EZ.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?EZ.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},EZ.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},EZ.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)},EZ.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},EZ.from=function(e){return e instanceof EZ?e:e&&e.length?new DZ(e):EZ.empty};var DZ=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<=TZ)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=TZ)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}(EZ);EZ.empty=new DZ([]);var OZ=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}(EZ),kZ=500,AZ=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 MZ(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 MZ(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 MZ(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>PZ&&(s=jZ(s,l),o-=l),new e(s.append(a),o)}remapping(e,t){let n=new TF;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 MZ(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 MZ(i,o,l))}else r.push(new MZ(i))},i);let l=[];for(let e=n;e<o;e++)l.push(new MZ(a.maps[e]));let u=new e(this.items.slice(0,i).append(l).append(r),s);return u.emptyItemCount()>kZ&&(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 MZ(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(EZ.from(i.reverse()),a)}};AZ.empty=new AZ(EZ.empty,0);function jZ(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&t--==0)return n=r,!1}),e.slice(n)}var MZ=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)}}},NZ=class{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}},PZ=20;function FZ(e,t,n,r){let i=n.getMeta(UZ),a;if(i)return i.historyState;n.getMeta(WZ)&&(e=new NZ(e.done,e.undone,null,0,-1));let o=n.getMeta(`appendedTransaction`);if(n.steps.length==0)return e;if(o&&o.getMeta(UZ))return o.getMeta(UZ).redo?new NZ(e.done.addTransform(n,void 0,r,HZ(t)),e.undone,LZ(n.mapping.maps),e.prevTime,e.prevComposition):new NZ(e.done,e.undone.addTransform(n,void 0,r,HZ(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||!IZ(n,e.prevRanges)),s=o?RZ(e.prevRanges,n.mapping):LZ(n.mapping.maps);return new NZ(e.done.addTransform(n,a?t.selection.getBookmark():void 0,r,HZ(t)),AZ.empty,s,n.time,i??e.prevComposition)}else if(a=n.getMeta(`rebased`))return new NZ(e.done.rebased(n,a),e.undone.rebased(n,a),RZ(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);else return new NZ(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),RZ(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function IZ(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 LZ(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 RZ(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 zZ(e,t,n){let r=HZ(t),i=UZ.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 NZ(n?s:a.remaining,n?a.remaining:s,null,0,-1);return a.transform.setSelection(o).setMeta(UZ,{redo:n,historyState:c})}var BZ=!1,VZ=null;function HZ(e){let t=e.plugins;if(VZ!=t){BZ=!1,VZ=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){BZ=!0;break}}return BZ}var UZ=new $I(`history`),WZ=new $I(`closeHistory`);function GZ(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new XI({key:UZ,state:{init(){return new NZ(AZ.empty,AZ.empty,null,0,-1)},apply(t,n,r){return FZ(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r=n==`historyUndo`?qZ:n==`historyRedo`?JZ:null;return!r||!e.editable?!1:(t.preventDefault(),r(e.state,e.dispatch))}}}})}function KZ(e,t){return(n,r)=>{let i=UZ.getState(n);if(!i||(e?i.undone:i.done).eventCount==0)return!1;if(r){let a=zZ(i,n,e);a&&r(t?a.scrollIntoView():a)}return!0}}var qZ=KZ(!1,!0),JZ=KZ(!0,!0);DG.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 XI({key:new $I(`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 YZ=DG.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[fZ(this.options)]}});DG.create({name:`focus`,addOptions(){return{className:`has-focus`,mode:`all`}},addProseMirrorPlugins(){return[new XI({key:new $I(`focus`),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,a=[];if(!n||!r)return TV.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(SV.node(t,t+e.nodeSize,{class:this.options.className}))}),TV.create(e,a)}}})]}});var XZ=DG.create({name:`gapCursor`,addProseMirrorPlugins(){return[yZ()]},extendNodeSchema(e){return{allowGapCursor:QU(JU(e,`allowGapCursor`,{name:e.name,options:e.options,storage:e.storage}))??null}}}),ZZ=`placeholder`;function QZ(e){return e.replace(/\s+/g,`-`).replace(/[^a-zA-Z0-9-]/g,``).replace(/^[0-9-]+/,``).replace(/^-+/,``).toLowerCase()}DG.create({name:`placeholder`,addOptions(){return{emptyEditorClass:`is-editor-empty`,emptyNodeClass:`is-empty`,dataAttribute:ZZ,placeholder:`Write something …`,showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){let e=this.options.dataAttribute?`data-${QZ(this.options.dataAttribute)}`:`data-${ZZ}`;return[new XI({key:new $I(`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&&NW(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=SV.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}),TV.create(t,a)}}})]}}),DG.create({name:`selection`,addOptions(){return{className:`selection`}},addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new XI({key:new $I(`selection`),props:{decorations(n){return n.selection.empty||e.isFocused||!e.isEditable||PW(n.selection)||e.view.dragging?null:TV.create(n.doc,[SV.inline(n.selection.from,n.selection.to,{class:t.className})])}}})]}});function $Z({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var eQ=DG.create({name:`trailingNode`,addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){let e=new $I(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 XI({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!$Z({node:r,types:n})},apply:(e,t)=>{if(!e.docChanged||e.getMeta(`__uniqueIDTransaction`))return t;let r=e.doc.lastChild;return!$Z({node:r,types:n})}}})]}}),tQ=DG.create({name:`undoRedo`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>qZ(e,t),redo:()=>({state:e,dispatch:t})=>JZ(e,t)}},addProseMirrorPlugins(){return[GZ(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()}}}),nQ=DG.create({name:`starterKit`,addExtensions(){let e=[];return this.options.bold!==!1&&e.push(Jq.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(Uq.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(jX.configure(this.options.bulletList)),this.options.code!==!1&&e.push(Zq.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(tJ.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(nJ.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(YZ.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(XZ.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(rJ.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(iJ.configure(this.options.heading)),this.options.undoRedo!==!1&&e.push(tQ.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&e.push(aJ.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(uJ.configure(this.options.italic)),this.options.listItem!==!1&&e.push(MX.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(UX.configure(this.options?.listKeymap)),this.options.link!==!1&&e.push(TX.configure(this.options?.link)),this.options.orderedList!==!1&&e.push(eZ.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(oZ.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(lZ.configure(this.options.strike)),this.options.text!==!1&&e.push(uZ.configure(this.options.text)),this.options.underline!==!1&&e.push(dZ.configure(this.options?.underline)),this.options.trailingNode!==!1&&e.push(eQ.configure(this.options?.trailingNode)),e}}),rQ=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,iQ=lK.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`,iW(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 JG({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[WG({find:rQ,type:this.type,getAttributes:e=>{let[,,t,n,r]=e;return{src:n,alt:t,title:r}}})]}});function aQ({onClick:e,active:t,disabled:n,title:r,children:i}){return(0,U.jsx)(`button`,{type:`button`,title:r,disabled:n,onMouseDown:t=>{t.preventDefault(),e()},className:q(`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 oQ(){return(0,U.jsx)(`div`,{className:`mx-0.5 h-4 w-px bg-border`})}function sQ(e,t){return!e||!t?null:`${e} × ${t}`}function cQ(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`}}function lQ({node:e,deleteNode:t,selected:n}){let r=String(e.attrs.src??``),i=typeof e.attrs.filename==`string`?e.attrs.filename:null,a=typeof e.attrs.alt==`string`?e.attrs.alt:null,o=typeof e.attrs.title==`string`?e.attrs.title:null,s=typeof e.attrs.width==`number`?e.attrs.width:null,c=typeof e.attrs.height==`number`?e.attrs.height:null,l=i||cQ(r),u=sQ(s,c);return(0,U.jsx)(Oq,{className:q(`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,U.jsxs)(`div`,{className:`flex items-start gap-3 p-3`,children:[(0,U.jsx)(`div`,{className:`size-18 shrink-0 overflow-hidden rounded-lg border bg-muted`,children:(0,U.jsx)(`img`,{src:r,alt:a??l,className:`h-full w-full object-cover`})}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,U.jsx)(`p`,{className:`truncate text-sm font-medium text-foreground`,title:l,children:l}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground`,children:[u&&(0,U.jsx)(`span`,{children:u}),a&&(0,U.jsxs)(`span`,{className:`truncate`,title:a,children:[`Alt: `,a]})]}),o&&(0,U.jsx)(`p`,{className:`line-clamp-2 text-xs text-muted-foreground`,title:o,children:o})]}),(0,U.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,U.jsx)(qo,{className:`size-4`})})]})})}function uQ({value:e,onChange:t,placeholder:n,onInsertImage:r}){let[i,a]=(0,v.useState)(!e),o=wq({extensions:[nQ.configure({link:{openOnClick:!1,HTMLAttributes:{class:`text-primary underline`}}}),iQ.extend({addAttributes(){return{...this.parent?.(),filename:{default:null},width:{default:null},height:{default:null}}},addNodeView(){return Iq(lQ)}}).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();e&&o.chain().focus().setImage({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}).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,U.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,U.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,U.jsx)(aQ,{title:`Bold`,active:o.isActive(`bold`),onClick:()=>o.chain().focus().toggleBold().run(),children:(0,U.jsx)(Fa,{className:`size-3.5`})}),(0,U.jsx)(aQ,{title:`Italic`,active:o.isActive(`italic`),onClick:()=>o.chain().focus().toggleItalic().run(),children:(0,U.jsx)(yo,{className:`size-3.5`})}),(0,U.jsx)(aQ,{title:`Underline`,active:o.isActive(`underline`),onClick:()=>o.chain().focus().toggleUnderline().run(),children:(0,U.jsx)(Xo,{className:`size-3.5`})}),(0,U.jsx)(aQ,{title:`Strikethrough`,active:o.isActive(`strike`),onClick:()=>o.chain().focus().toggleStrike().run(),children:(0,U.jsx)(Uo,{className:`size-3.5`})}),(0,U.jsx)(oQ,{}),(0,U.jsx)(aQ,{title:`Heading 1`,active:o.isActive(`heading`,{level:1}),onClick:()=>o.chain().focus().toggleHeading({level:1}).run(),children:(0,U.jsx)(po,{className:`size-3.5`})}),(0,U.jsx)(aQ,{title:`Heading 2`,active:o.isActive(`heading`,{level:2}),onClick:()=>o.chain().focus().toggleHeading({level:2}).run(),children:(0,U.jsx)(mo,{className:`size-3.5`})}),(0,U.jsx)(aQ,{title:`Heading 3`,active:o.isActive(`heading`,{level:3}),onClick:()=>o.chain().focus().toggleHeading({level:3}).run(),children:(0,U.jsx)(ho,{className:`size-3.5`})}),(0,U.jsx)(oQ,{}),(0,U.jsx)(aQ,{title:`Bullet list`,active:o.isActive(`bulletList`),onClick:()=>o.chain().focus().toggleBulletList().run(),children:(0,U.jsx)(Oo,{className:`size-3.5`})}),(0,U.jsx)(aQ,{title:`Ordered list`,active:o.isActive(`orderedList`),onClick:()=>o.chain().focus().toggleOrderedList().run(),children:(0,U.jsx)(Eo,{className:`size-3.5`})}),(0,U.jsx)(oQ,{}),(0,U.jsx)(aQ,{title:`Blockquote`,active:o.isActive(`blockquote`),onClick:()=>o.chain().focus().toggleBlockquote().run(),children:(0,U.jsx)(Fo,{className:`size-3.5`})}),(0,U.jsx)(aQ,{title:`Inline code`,active:o.isActive(`code`),onClick:()=>o.chain().focus().toggleCode().run(),children:(0,U.jsx)(Ya,{className:`size-3.5`})}),(0,U.jsx)(aQ,{title:`Code block`,active:o.isActive(`codeBlock`),onClick:()=>o.chain().focus().toggleCodeBlock().run(),children:(0,U.jsx)(Vo,{className:`size-3.5`})}),(0,U.jsx)(oQ,{}),(0,U.jsx)(aQ,{title:`Add link`,active:o.isActive(`link`),onClick:c,children:(0,U.jsx)(To,{className:`size-3.5`})}),(0,U.jsx)(aQ,{title:`Remove link`,disabled:!o.isActive(`link`),onClick:()=>o.chain().focus().unsetLink().run(),children:(0,U.jsx)(Zo,{className:`size-3.5`})}),(0,U.jsx)(oQ,{}),r&&(0,U.jsx)(aQ,{title:`Insert image`,onClick:s,children:(0,U.jsx)(_o,{className:`size-3.5`})}),(0,U.jsx)(aQ,{title:`Hard break (Shift + Enter)`,onClick:()=>o.chain().focus().setHardBreak().run(),children:(0,U.jsx)(Go,{className:`size-3.5`})})]}),(0,U.jsxs)(`div`,{className:`relative overflow-y-auto`,children:[i&&n&&(0,U.jsx)(`p`,{className:`pointer-events-none absolute left-3 top-2.5 text-muted-foreground select-none`,children:n}),(0,U.jsx)(gq,{editor:o})]})]}):null}function dQ(e){return{...e}}function fQ(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 pQ(e,t){let n=await fQ(e),r=await fetch(`/cms/admin/media/presign`,{method:`POST`,credentials:`include`,headers:dQ({"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:dQ({"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:dQ(),body:a});if(!o.ok)throw Error(`Upload failed.`);return o.json()}async function mQ(e){let t=await fetch(`/cms/admin/users/me/avatar/presign`,{method:`POST`,credentials:`include`,headers:dQ({"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:dQ({"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:dQ(),body:r});if(!i.ok)throw Error(`Upload failed.`);return(await i.json()).avatarUrl}var hQ=1,gQ=.9,_Q=.8,vQ=.17,yQ=.1,bQ=.999,xQ=.9999,SQ=.99,CQ=/[\\\/_+.#"@\[\(\{&]/,wQ=/[\\\/_+.#"@\[\(\{&]/g,TQ=/[\s-]/,EQ=/[\s-]/g;function DQ(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?hQ:SQ;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=DQ(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=hQ:CQ.test(e.charAt(l-1))?(d*=_Q,p=e.slice(i,l-1).match(wQ),p&&i>0&&(d*=bQ**+p.length)):TQ.test(e.charAt(l-1))?(d*=gQ,m=e.slice(i,l-1).match(EQ),m&&i>0&&(d*=bQ**+m.length)):(d*=vQ,i>0&&(d*=bQ**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=xQ)),(d<yQ&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=DQ(e,t,n,r,l+1,a+2,o),f*yQ>d&&(d=f*yQ)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function OQ(e){return e.toLowerCase().replace(EQ,` `)}function kQ(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,DQ(e,t,OQ(e),OQ(t),0,0,{})}var AQ=`[cmdk-group=""]`,jQ=`[cmdk-group-items=""]`,MQ=`[cmdk-group-heading=""]`,NQ=`[cmdk-item=""]`,PQ=`${NQ}:not([aria-disabled="true"])`,FQ=`cmdk-item-select`,IQ=`data-value`,LQ=(e,t,n)=>kQ(e,t,n),RQ=v.createContext(void 0),zQ=()=>v.useContext(RQ),BQ=v.createContext(void 0),VQ=()=>v.useContext(BQ),HQ=v.createContext(void 0),UQ=v.forwardRef((e,t)=>{let n=r$(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=r$(()=>new Set),i=r$(()=>new Map),a=r$(()=>new Map),o=r$(()=>new Set),s=t$(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,y=Ou(),b=Ou(),x=Ou(),S=v.useRef(null),C=o$();n$(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,w.emit()}},[u]),n$(()=>{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??LQ;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(jQ);t?t.appendChild(e.parentElement===t?e:e.closest(`${jQ} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${jQ} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=S.current?.querySelector(`${AQ}[${IQ}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function O(){let e=M().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(IQ);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(AQ)?.querySelector(MQ))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function j(){return S.current?.querySelector(`${NQ}[aria-selected="true"]`)}function M(){return Array.from(S.current?.querySelectorAll(PQ)||[])}function N(e){let t=M()[e];t&&w.setState(`value`,t.getAttribute(IQ))}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(IQ))}function F(e){let t=j()?.closest(AQ),n;for(;t&&!n;)t=e>0?$Q(t,AQ):e$(t,AQ),n=t?.querySelector(PQ);n?w.setState(`value`,n.getAttribute(IQ)):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(tl.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(FQ);t.dispatchEvent(e)}}}}},v.createElement(`label`,{"cmdk-label":``,htmlFor:T.inputId,id:T.labelId,style:l$},c),c$(e,e=>v.createElement(BQ.Provider,{value:w},v.createElement(RQ.Provider,{value:T},e))))}),WQ=v.forwardRef((e,t)=>{let n=Ou(),r=v.useRef(null),i=v.useContext(HQ),a=zQ(),o=t$(e),s=o.current?.forceMount??i?.forceMount;n$(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=a$(n,r,[e.value,e.children,r],e.keywords),l=VQ(),u=i$(e=>e.value&&e.value===c.current),d=i$(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(FQ,f),()=>t.removeEventListener(FQ,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(tl.div,{ref:cs(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)}),GQ=v.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=Ou(),s=v.useRef(null),c=v.useRef(null),l=Ou(),u=zQ(),d=i$(e=>i||u.filter()===!1?!0:e.search?e.filtered.groups.has(o):!0);n$(()=>u.group(o),[]),a$(o,s,[e.value,e.heading,c]);let f=v.useMemo(()=>({id:o,forceMount:i}),[i]);return v.createElement(tl.div,{ref:cs(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),c$(e,e=>v.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},v.createElement(HQ.Provider,{value:f},e))))}),KQ=v.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=v.useRef(null),a=i$(e=>!e.search);return!n&&!a?null:v.createElement(tl.div,{ref:cs(i,t),...r,"cmdk-separator":``,role:`separator`})}),qQ=v.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=VQ(),o=i$(e=>e.search),s=i$(e=>e.selectedItemId),c=zQ();return v.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),v.createElement(tl.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)}})}),JQ=v.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=v.useRef(null),o=v.useRef(null),s=i$(e=>e.selectedItemId),c=zQ();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(tl.div,{ref:cs(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},c$(e,e=>v.createElement(`div`,{ref:cs(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),YQ=v.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return v.createElement(ix,{open:n,onOpenChange:r},v.createElement(ax,{container:o},v.createElement(ox,{"cmdk-overlay":``,className:i}),v.createElement(sx,{"aria-label":e.label,"cmdk-dialog":``,className:a},v.createElement(UQ,{ref:t,...s}))))}),XQ=v.forwardRef((e,t)=>i$(e=>e.filtered.count===0)?v.createElement(tl.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),ZQ=v.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return v.createElement(tl.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},c$(e,e=>v.createElement(`div`,{"aria-hidden":!0},e)))}),QQ=Object.assign(UQ,{List:JQ,Item:WQ,Input:qQ,Group:GQ,Separator:KQ,Dialog:YQ,Empty:XQ,Loading:ZQ});function $Q(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function e$(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function t$(e){let t=v.useRef(e);return n$(()=>{t.current=e}),t}var n$=typeof window>`u`?v.useEffect:v.useLayoutEffect;function r$(e){let t=v.useRef();return t.current===void 0&&(t.current=e()),t}function i$(e){let t=VQ(),n=()=>e(t.snapshot());return v.useSyncExternalStore(t.subscribe,n,n)}function a$(e,t,n,r=[]){let i=v.useRef(),a=zQ();return n$(()=>{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(IQ,s),i.current=s}),i}var o$=()=>{let[e,t]=v.useState(),n=r$(()=>new Map);return n$(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function s$(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function c$({asChild:e,children:t},n){return e&&v.isValidElement(t)?v.cloneElement(s$(t),{ref:t.ref},n(t.props.children)):n(t)}var l$={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},u$=v.forwardRef(({className:e,...t},n)=>(0,U.jsx)(QQ,{ref:n,className:q(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,e),...t}));u$.displayName=QQ.displayName;var d$=v.forwardRef(({className:e,...t},n)=>(0,U.jsxs)(`div`,{className:`flex items-center border-b px-3`,"cmdk-input-wrapper":``,children:[(0,U.jsx)(Ro,{className:`mr-2 h-4 w-4 shrink-0 opacity-50`}),(0,U.jsx)(QQ.Input,{ref:n,className:q(`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})]}));d$.displayName=QQ.Input.displayName;var f$=v.forwardRef(({className:e,...t},n)=>(0,U.jsx)(QQ.List,{ref:n,className:q(`max-h-[300px] overflow-y-auto overflow-x-hidden`,e),...t}));f$.displayName=QQ.List.displayName;var p$=v.forwardRef((e,t)=>(0,U.jsx)(QQ.Empty,{ref:t,className:`py-6 text-center text-sm`,...e}));p$.displayName=QQ.Empty.displayName;var m$=v.forwardRef(({className:e,...t},n)=>(0,U.jsx)(QQ.Group,{ref:n,className:q(`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}));m$.displayName=QQ.Group.displayName;var h$=v.forwardRef(({className:e,...t},n)=>(0,U.jsx)(QQ.Separator,{ref:n,className:q(`-mx-1 h-px bg-border`,e),...t}));h$.displayName=QQ.Separator.displayName;var g$=v.forwardRef(({className:e,...t},n)=>(0,U.jsx)(QQ.Item,{ref:n,className:q(`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}));g$.displayName=QQ.Item.displayName;var _$=({className:e,...t})=>(0,U.jsx)(`span`,{className:q(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...t});_$.displayName=`CommandShortcut`;var v$={image:`image/*`,video:`video/*`,audio:`audio/*`,document:`.pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.txt,.csv`};function y$(e){return!e||e.length===0?`*/*`:e.map(e=>v$[e]).join(`,`)}function b$(e){let t=e.replace(/_/g,` `).trim();return t?t.charAt(0).toUpperCase()+t.slice(1):`Value`}function x$(e){return e?e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`:`—`}function S$(e){return e?.startsWith(`image/`)??!1}async function C$(e,t){return pQ(e,{folderId:t})}function w$(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)}function T$({open:e,onOpenChange:t,allowedTypes:n,onSelect:r}){let[i,a]=(0,v.useState)([{id:null,name:`Media`}]),o=i[i.length-1].id,[s,c]=(0,v.useState)([]),[l,u]=(0,v.useState)([]),[d,f]=(0,v.useState)(!1);(0,v.useEffect)(()=>{if(!e)return;f(!0);let t=localStorage.getItem(`plank_token`),n=t?{Authorization:`Bearer ${t}`}:{},r=o??``;Promise.all([fetch(`/cms/admin/folders?parent_id=${r}`,{headers:n}).then(e=>e.ok?e.json():{folders:[]}).then(e=>e.folders),fetch(`/cms/admin/media?folder_id=${r}`,{headers:n}).then(e=>e.ok?e.json():{items:[]}).then(e=>e.items)]).then(([e,t])=>{c(e),u(t)}).catch(()=>{c([]),u([])}).finally(()=>f(!1))},[e,o]),(0,v.useEffect)(()=>{e||a([{id:null,name:`Media`}])},[e]);function p(e){a(t=>[...t,{id:e.id,name:e.name}])}function m(e){a(t=>t.slice(0,e+1))}let h=l.filter(e=>w$(e.mime_type,n)),g=s.length===0&&h.length===0;return(0,U.jsx)(yw,{open:e,onOpenChange:t,children:(0,U.jsxs)(Cw,{className:`max-w-3xl`,children:[(0,U.jsx)(ww,{children:(0,U.jsx)(Ew,{children:`Media Library`})}),i.length>1&&(0,U.jsx)(`div`,{className:`flex items-center gap-1 text-sm -mt-1`,children:i.map((e,t)=>(0,U.jsxs)(`span`,{className:`flex items-center gap-1 text-muted-foreground`,children:[t>0&&(0,U.jsx)(`span`,{children:`/`}),t===i.length-1?(0,U.jsx)(`span`,{className:`font-medium text-foreground`,children:t===0?(0,U.jsx)(go,{className:`size-3.5`}):e.name}):(0,U.jsx)(`button`,{onClick:()=>m(t),className:`hover:text-foreground transition-colors`,children:t===0?(0,U.jsx)(go,{className:`size-3.5`}):e.name})]},t))}),d?(0,U.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,U.jsx)(by,{className:`size-5`})}):g?(0,U.jsx)(`p`,{className:`py-16 text-center text-sm text-muted-foreground`,children:l.length===0&&s.length===0?`No media found.`:`No matching files in this folder.`}):(0,U.jsxs)(`div`,{className:`flex flex-col gap-4 max-h-[60vh] overflow-y-auto pr-1`,children:[s.length>0&&(0,U.jsx)(`div`,{className:`grid grid-cols-1 gap-1.5 sm:grid-cols-2`,children:s.map(e=>(0,U.jsxs)(`button`,{type:`button`,onClick:()=>p(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,U.jsx)(lo,{className:`size-7 shrink-0 text-muted-foreground`}),(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`p`,{className:`truncate text-xs font-bold leading-tight`,title:e.name,children:e.name}),(0,U.jsxs)(`p`,{className:`text-[10px] text-muted-foreground`,children:[e.item_count,` `,e.item_count===1?`item`:`items`]})]})]},e.id))}),h.length>0&&(0,U.jsx)(`div`,{className:`grid grid-cols-3 gap-2 sm:grid-cols-4 md:grid-cols-5`,children:h.map(e=>(0,U.jsxs)(`button`,{type:`button`,onClick:()=>{r(e),t(!1)},className:`group relative overflow-hidden rounded-md border bg-card text-left transition-colors hover:border-primary`,children:[(0,U.jsx)(`div`,{className:`aspect-square bg-muted`,children:S$(e.mime_type)?(0,U.jsx)(`img`,{src:e.url,alt:e.filename,className:`h-full w-full object-cover`}):(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,U.jsx)(ao,{className:`size-6 text-muted-foreground`})})}),(0,U.jsxs)(`div`,{className:`p-1.5`,children:[(0,U.jsx)(`p`,{className:`truncate text-[11px] font-medium leading-tight`,title:e.filename,children:e.filename}),(0,U.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:x$(e.size)})]}),(0,U.jsx)(`div`,{className:`absolute inset-0 rounded-md ring-2 ring-primary ring-offset-1 opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none`})]},e.id))})]})]})})}function E$({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}let t=localStorage.getItem(`plank_token`);fetch(`/cms/admin/media/${e}/url`,{headers:t?{Authorization:`Bearer ${t}`}:{}}).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 C$(e);u(n.url),t(n.id)}catch(e){c(e instanceof Error?e.message:`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,U.jsxs)(`div`,{className:`relative w-full rounded-md border bg-muted/30 overflow-hidden`,children:[l?h?(0,U.jsx)(`img`,{src:l,alt:`Media`,className:`max-h-72 w-full object-contain`}):(0,U.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2`,children:[(0,U.jsx)(_o,{className:`size-4 text-muted-foreground shrink-0`}),(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground truncate`,children:l})]}):(0,U.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-muted-foreground`,children:[(0,U.jsx)(_o,{className:`size-4 shrink-0`}),(0,U.jsx)(`span`,{className:`text-xs`,children:`Loading…`})]}),(0,U.jsx)(J,{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,U.jsx)(ns,{className:`size-3.5`})})]}):(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`input`,{ref:i,type:`file`,accept:y$(n),className:`hidden`,onChange:e=>{let t=e.target.files?.[0];t&&m(t)}}),(0,U.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,U.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,U.jsx)(Qo,{className:`size-4`}),a?`Uploading…`:`Upload`]}),(0,U.jsx)(`div`,{className:`w-px bg-border`}),(0,U.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,U.jsx)(so,{className:`size-4`}),`Library`]})]}),s&&(0,U.jsx)(`p`,{className:`mt-1 text-xs text-destructive`,children:s}),(0,U.jsx)(T$,{open:d,onOpenChange:f,allowedTypes:n,onSelect:e=>{u(e.url),t(e.id)}})]})}function D$({id:e,previewUrl:t,filename:n,onRemove:r,disabled:i=!1}){let{attributes:a,listeners:o,setNodeRef:s,transform:c,transition:l,isDragging:u}=gO({id:e});return(0,U.jsxs)(`div`,{ref:s,style:{transform:kT.Transform.toString(c),transition:l,opacity:u?.4:1},className:`relative aspect-square overflow-hidden rounded-md border bg-muted`,children:[t?(0,U.jsx)(`img`,{src:t,alt:n,className:`h-full w-full object-cover`}):(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,U.jsx)(_o,{className:`size-5 text-muted-foreground`})}),n&&(0,U.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,U.jsx)(`p`,{className:`truncate text-[10px] leading-none text-foreground`,children:n})}),(0,U.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,U.jsx)(ns,{className:`size-3`})}),!i&&(0,U.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,U.jsx)(uo,{className:`size-3`})})]})}function O$({value:e,onChange:t,disabled:n=!1}){let r=Array.isArray(e)?e:[],[i,a]=(0,v.useState)({}),[o,s]=(0,v.useState)({}),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(null),[f,p]=(0,v.useState)(!1),m=(0,v.useRef)(null),h=GT(WT(GE,{activationConstraint:{distance:5}}));(0,v.useEffect)(()=>{let e=r.filter(e=>!e.startsWith(`http`)&&!(e in i));if(e.length===0)return;let t=localStorage.getItem(`plank_token`);Promise.all(e.map(e=>fetch(`/cms/admin/media/${e}/url`,{headers:t?{Authorization:`Bearer ${t}`}:{}}).then(e=>e.ok?e.json():null).then(t=>t?[e,t.url]:null).catch(()=>null))).then(e=>{let t={};for(let n of e)n&&(t[n[0]]=n[1]);Object.keys(t).length>0&&a(e=>({...e,...t}))})},[r.join(`,`)]),(0,v.useEffect)(()=>{let e=r.filter(e=>!e.startsWith(`http`)&&!(e in o));if(e.length===0)return;let t=localStorage.getItem(`plank_token`);fetch(`/cms/admin/media`,{headers:t?{Authorization:`Bearer ${t}`}:{}}).then(e=>e.ok?e.json():{items:[]}).then(t=>{let n={};for(let r of t.items)e.includes(r.id)&&(n[r.id]=r.filename);Object.keys(n).length>0&&s(e=>({...e,...n}))}).catch(()=>{})},[r.join(`,`)]);function g(e){return e.startsWith(`http`)?e:i[e]??null}function _(e){return o[e]??``}function y(e){if(n)return;let{active:i,over:a}=e;!a||i.id===a.id||t(ZD(r,r.indexOf(i.id),r.indexOf(a.id)))}async function b(e){if(e.length===0)return;l(!0),d(null);let n=r;try{for(let r of e){let e=await C$(r);a(t=>({...t,[e.id]:e.url})),s(t=>({...t,[e.id]:r.name})),n=[...n,e.id],t(n)}}catch(e){d(e instanceof Error?e.message:`Upload failed.`)}finally{l(!1),m.current&&(m.current.value=``)}}return(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,U.jsx)(`input`,{ref:m,type:`file`,accept:`image/*`,multiple:!0,className:`hidden`,onChange:e=>{b(Array.from(e.target.files??[]))}}),r.length>0&&(0,U.jsx)(HD,{sensors:h,collisionDetection:QT,onDragEnd:y,children:(0,U.jsx)(cO,{items:r,strategy:nO,children:(0,U.jsx)(`div`,{className:`grid grid-cols-3 gap-2 sm:grid-cols-4`,children:r.map(e=>(0,U.jsx)(D$,{id:e,previewUrl:g(e),filename:_(e),onRemove:()=>t(r.filter(t=>t!==e)),disabled:n},e))})})}),(0,U.jsxs)(`div`,{className:`flex w-full gap-2 rounded-md border border-dashed p-3`,children:[(0,U.jsxs)(`button`,{type:`button`,disabled:c||n,onClick:()=>m.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,U.jsx)(Qo,{className:`size-4`}),c?`Uploading…`:`Upload`]}),(0,U.jsx)(`div`,{className:`w-px bg-border`}),(0,U.jsxs)(`button`,{type:`button`,disabled:c||n,onClick:()=>p(!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,U.jsx)(so,{className:`size-4`}),`Library`]})]}),u&&(0,U.jsx)(`p`,{className:`text-xs text-destructive`,children:u}),(0,U.jsx)(T$,{open:f,onOpenChange:p,allowedTypes:[`image`],onSelect:e=>{r.includes(e.id)||(a(t=>({...t,[e.id]:e.url})),s(t=>({...t,[e.id]:e.filename})),t([...r,e.id]))}})]})}function k$({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,U.jsx)(Hv,{type:`text`,inputMode:`decimal`,className:q(`w-full`,`text-base!`),value:r,placeholder:`0.00`,onChange:a,disabled:n})}function A$(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 j$({value:e,onChange:t,inputId:n,disabled:r=!1}){let i=A$(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,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,U.jsx)(`div`,{className:`inline-flex items-center gap-1 rounded-md border border-border p-1`,children:[`string`,`number`,`boolean`].map(e=>(0,U.jsx)(`button`,{type:`button`,disabled:r,onClick:()=>a(e),className:q(`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,U.jsx)(Hv,{className:q(`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,U.jsx)(k$,{value:i.value,onChange:e=>t({kind:`number`,value:typeof e==`number`&&!isNaN(e)?e:0}),disabled:r}),i.kind===`boolean`&&(0,U.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,U.jsx)(EO,{id:n,checked:!!i.value,onCheckedChange:e=>t({kind:`boolean`,value:!!e}),disabled:r}),(0,U.jsx)(X,{htmlFor:n,className:`cursor-pointer font-normal text-base`,children:i.value?`True`:`False`})]})]})}function M$({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(Ty(e,n)))},[e,n]);function u(e){s(e),a(!1),e&&t(Ey(e,c,n))}function d(e){l(e),o&&t(Ey(o,e,n))}return(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsxs)(RN,{open:i&&!r,onOpenChange:a,children:[(0,U.jsx)(zN,{asChild:!0,children:(0,U.jsxs)(J,{variant:`outline`,className:`w-40 justify-between font-normal text-base`,disabled:r,children:[o?HA(o,`MMM d, yyyy`):`Select date`,(0,U.jsx)(Ba,{className:`size-4 opacity-50`})]})}),(0,U.jsx)(BN,{className:`w-auto overflow-hidden p-0`,align:`start`,children:(0,U.jsx)(IN,{mode:`single`,selected:o,captionLayout:`dropdown`,defaultMonth:o??new Date,onSelect:u})})]}),(0,U.jsx)(Hv,{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,U.jsx)(J,{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,U.jsx)(ns,{className:`size-3.5`})})]})}function N$(e){return e.find(e=>e.type===`uid`)?.name??e.find(e=>e.type===`string`)?.name??null}var P$={data:null,promise:null};function F$(e){return P$.data?Promise.resolve(P$.data):(P$.promise||=fetch(`/cms/admin/content-types`,{headers:e}).then(e=>e.ok?e.json():[]).then(e=>(P$.data=e,e)).catch(()=>[]),P$.promise)}function I$(e,t){return e.find(e=>e.tableName===t)??null}function L$(e,t){return fetch(`/cms/admin/content-types/${e}/entries?limit=200`,{headers:t}).then(e=>e.ok?e.json():{data:[]}).catch(()=>({data:[]}))}function R$(e){let[t,n]=(0,v.useState)([]),[r,i]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{if(!e)return;i(!0);let t=localStorage.getItem(`plank_token`),r=t?{Authorization:`Bearer ${t}`}:{};F$(r).then(t=>{let n=I$(t,e);return n?L$(n.slug,r).then(e=>({ctDef:n,res:e})):Promise.resolve({ctDef:null,res:{data:[]}})}).then(({ctDef:e,res:t})=>{let r=e?N$(e.fields??[]):null;n(t.data.map(e=>({id:String(e.id),label:String(r?e[r]??e.id:e.id)})))}).catch(()=>n([])).finally(()=>i(!1))},[e]),{entries:t,loading:r}}function z$(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);let r=localStorage.getItem(`plank_token`),a=r?{Authorization:`Bearer ${r}`}:{};F$(a).then(t=>{let n=I$(t,e);return n?L$(n.slug,a).then(e=>({ctDef:n,res:e})):Promise.resolve({ctDef:null,res:{data:[]}})}).then(({ctDef:e,res:r})=>{let a=e?N$(e.fields??[]):null;i(r.data.filter(e=>String(e[t]??``)===n).map(e=>({id:String(e.id),label:String(a?e[a]??e.id:e.id)})))}).catch(()=>i([])).finally(()=>o(!1))},[e,t,n]),{entries:r,loading:a}}function B$({relatedTable:e,relatedField:t,currentId:n}){let{entries:r,loading:i}=z$(e,t,n);return n?i?(0,U.jsxs)(`div`,{className:`flex items-center gap-2 py-1`,children:[(0,U.jsx)(by,{className:`size-3.5`}),(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Loading…`})]}):r.length===0?(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No linked entries.`}):(0,U.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:r.map(e=>(0,U.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,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Save this entry first to see linked items.`})}function V$({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),{entries:u,loading:d}=R$(t);if(e===`one-to-many`)return(0,U.jsx)(B$,{relatedTable:t,relatedField:n,currentId:r});let f=s?Array.isArray(i)?i:[]:i&&!Array.isArray(i)?[i]:[];function p(e){return u.find(t=>t.id===e)?.label??e}function m(e){if(s){let t=f.includes(e)?f.filter(t=>t!==e):[...f,e];a(t.length>0?t:null)}else a(f[0]===e?null:e),l(!1)}function h(e){if(s){let t=f.filter(t=>t!==e);a(t.length>0?t:null)}else a(null)}let g=s?f.length>0?`${f.length} selected`:`Select entries…`:f.length>0?p(f[0]):`Select entry…`;return(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsxs)(RN,{open:c&&!o,onOpenChange:l,children:[(0,U.jsx)(zN,{asChild:!0,children:(0,U.jsxs)(J,{variant:`outline`,role:`combobox`,"aria-expanded":c,className:`w-full justify-between font-normal text-base`,disabled:o,children:[(0,U.jsx)(`span`,{className:`truncate text-left`,children:g}),(0,U.jsx)(Wa,{className:`ml-2 size-4 shrink-0 opacity-50`})]})}),(0,U.jsx)(BN,{className:`w-(--radix-popover-trigger-width) p-0`,align:`start`,children:(0,U.jsxs)(u$,{children:[(0,U.jsx)(d$,{placeholder:`Search…`}),(0,U.jsx)(f$,{children:d?(0,U.jsx)(`div`,{className:`flex items-center justify-center py-6`,children:(0,U.jsx)(by,{className:`size-4`})}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(p$,{children:`No entries found.`}),(0,U.jsx)(m$,{children:u.map(e=>{let t=f.includes(e.id);return(0,U.jsxs)(g$,{value:e.label,onSelect:()=>{o||m(e.id)},children:[(0,U.jsx)(za,{className:`mr-2 size-4 ${t?`opacity-100`:`opacity-0`}`}),(0,U.jsx)(`span`,{className:`truncate`,children:e.label}),(0,U.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground opacity-60 shrink-0`,children:e.id.slice(0,8)})]},e.id)})})]})})]})})]}),f.length>0&&(0,U.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:f.map(e=>(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border bg-muted px-2 py-0.5 text-xs`,children:[p(e),(0,U.jsx)(`button`,{type:`button`,onClick:()=>h(e),disabled:o,className:`text-muted-foreground hover:text-foreground`,children:(0,U.jsx)(ns,{className:`size-3`})})]},e))})]})}var H$={full:`col-span-6`,"two-thirds":`col-span-4`,half:`col-span-3`,third:`col-span-2`};function U$({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,U.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,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,U.jsx)(HN,{type:`single`,collapsible:!0,className:`w-full`,children:i.map((e,t)=>(0,U.jsxs)(UN,{value:`item-${t}`,className:`mb-2 rounded-md border border-dashed last:border-b transition-colors hover:bg-accent/50`,children:[(0,U.jsxs)(`div`,{className:`relative data-[state=open]:border-b data-[state=open]:border-border/50`,children:[(0,U.jsxs)(WN,{className:`w-full py-2 pl-3 pr-24 text-muted-foreground [&>svg]:hidden`,children:[`Item `,t+1]}),(0,U.jsxs)(`div`,{className:`absolute right-2 top-1/2 flex -translate-y-1/2 items-center gap-0.5`,children:[(0,U.jsx)(J,{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,U.jsx)(Ua,{className:`size-3.5`})}),(0,U.jsx)(J,{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,U.jsx)(Ba,{className:`size-3.5`})}),(0,U.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,U.jsx)(qo,{className:`size-3.5`})})]})]}),(0,U.jsx)(GN,{className:`px-3 pt-3`,children:(0,U.jsx)(`div`,{className:`grid grid-cols-6 gap-3`,children:a.map(n=>(0,U.jsxs)(`div`,{className:H$[n.width??`full`]??`col-span-6`,children:[(0,U.jsx)(`div`,{className:`mb-1 flex items-center gap-1`,children:(0,U.jsxs)(X,{className:`text-xs font-medium`,children:[n.name,n.required&&(0,U.jsx)(`span`,{className:`ml-0.5 text-destructive`,children:`*`})]})}),(0,U.jsx)(Y$,{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,U.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,U.jsx)(Po,{className:`size-3.5`}),`Add item`]})]})}var W$=3,G$=20;function K$({value:e,onChange:t,disabled:n=!1,depth:r=0}){let i=Array.isArray(e)?e:[],a=r+1<W$,o=i.length<G$;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,U.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,U.jsx)(Po,{className:`size-3.5`}),`Add item`]}):(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,U.jsx)(HN,{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,U.jsxs)(UN,{value:`navigation-item-${r}-${t}`,className:`mb-2 rounded-md border border-dashed last:border-b transition-colors hover:bg-accent/50`,children:[(0,U.jsxs)(`div`,{className:`relative data-[state=open]:border-b data-[state=open]:border-border/50`,children:[(0,U.jsx)(WN,{className:`w-full py-2 pl-3 pr-24 text-muted-foreground [&>svg]:hidden`,children:s}),(0,U.jsxs)(`div`,{className:`absolute right-2 top-1/2 flex -translate-y-1/2 items-center gap-0.5`,children:[(0,U.jsx)(J,{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,U.jsx)(Ua,{className:`size-3.5`})}),(0,U.jsx)(J,{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,U.jsx)(Ba,{className:`size-3.5`})}),(0,U.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,U.jsx)(qo,{className:`size-3.5`})})]})]}),(0,U.jsxs)(GN,{className:`px-3 pt-3`,children:[(0,U.jsxs)(`div`,{className:`grid grid-cols-6 gap-3`,children:[(0,U.jsxs)(`div`,{className:`col-span-3`,children:[(0,U.jsx)(X,{className:`mb-1 block text-xs font-medium`,children:`label`}),(0,U.jsx)(Hv,{className:`text-base`,value:e.label??``,onChange:e=>c(o,t=>({...t,label:e.target.value})),disabled:n})]}),(0,U.jsxs)(`div`,{className:`col-span-3`,children:[(0,U.jsx)(X,{className:`mb-1 block text-xs font-medium`,children:`href`}),(0,U.jsx)(Hv,{className:`text-base`,value:e.href??``,onChange:e=>c(o,t=>({...t,href:e.target.value})),disabled:n})]})]}),a?(0,U.jsxs)(`div`,{className:`mt-3 border-l border-border pl-3`,children:[(0,U.jsx)(`p`,{className:`mb-2 text-[11px] uppercase tracking-wide text-muted-foreground`,children:`Child items`}),(0,U.jsx)(K$,{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,U.jsxs)(`p`,{className:`mt-3 text-[11px] text-muted-foreground`,children:[`Maximum depth reached (`,W$,` levels).`]})]})]},t)})}),(0,U.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,U.jsx)(Po,{className:`size-3.5`}),`Add item`]}),!o&&(0,U.jsxs)(`p`,{className:`text-[11px] text-muted-foreground`,children:[`Maximum `,G$,` items allowed per level.`]})]})}function q$(e){return e.normalize(`NFD`).replace(/[\u0300-\u036f]/g,``).toLowerCase().replace(/\s+/g,`-`).replace(/[^a-z0-9-]/g,``).replace(/^-+|-+$/g,``)}function J$({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 pQ(e);m({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,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{className:n?`pointer-events-none opacity-70`:``,children:(0,U.jsx)(uQ,{value:String(e??``),onChange:t,placeholder:`Type or add your content here...`,onInsertImage:p})}),(0,U.jsx)(yw,{open:a,onOpenChange:h,children:(0,U.jsxs)(Cw,{className:`max-w-sm`,children:[(0,U.jsx)(ww,{children:(0,U.jsx)(Ew,{children:`Insert Image`})}),(0,U.jsx)(`input`,{ref:r,type:`file`,accept:`image/*`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];t&&g(t)}}),(0,U.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,U.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,U.jsx)(Qo,{className:`size-4`}),l?`Uploading…`:`Upload`]}),(0,U.jsx)(`div`,{className:`w-px bg-border`}),(0,U.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,U.jsx)(so,{className:`size-4`}),`Library`]})]}),d&&(0,U.jsx)(`p`,{className:`mt-1 text-xs text-destructive`,children:d})]})}),(0,U.jsx)(T$,{open:s,onOpenChange:e=>{!e&&!a&&m(null),c(e)},allowedTypes:[`image`],onSelect:e=>{m({src:e.url,filename:e.filename,alt:e.alt,title:e.caption,width:e.width,height:e.height}),c(!1),o(!1)}})]})}function Y$({field:e,value:t,onChange:n,allValues:r,disabled:i,errorMessage:a}){let o=(0,v.useRef)(null),{timezone:s}=ya();(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=q$(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=q$(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=q$(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,U.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,U.jsx)(EO,{id:`field-${e.name}`,checked:!!t,onCheckedChange:e=>n(!!e),disabled:!!i}),(0,U.jsx)(X,{htmlFor:`field-${e.name}`,className:`cursor-pointer font-normal text-base`,children:t?`Yes`:`No`})]}):e.type===`richtext`?(0,U.jsx)(J$,{value:t,onChange:n,disabled:!!i}):e.type===`text`?(0,U.jsx)(VN,{className:q(c,`text-base`),value:String(t??``),placeholder:b$(e.name),onChange:e=>n(e.target.value),disabled:!!i}):e.type===`number`?e.subtype===`float`?(0,U.jsx)(k$,{value:t,onChange:n,disabled:!!i}):(0,U.jsx)(Hv,{type:`number`,className:q(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,U.jsx)(M$,{value:t,onChange:n,timezone:s,disabled:!!i}):e.type===`uid`?(0,U.jsxs)(`div`,{children:[(0,U.jsx)(Hv,{className:q(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,U.jsx)(`p`,{className:`mt-1 text-xs text-destructive`,children:a})]}):e.type===`media`?(0,U.jsx)(E$,{value:t,onChange:n,allowedTypes:e.allowedTypes,disabled:!!i}):e.type===`media-gallery`?(0,U.jsx)(O$,{value:t,onChange:n,disabled:!!i}):e.type===`relation`?(0,U.jsx)(V$,{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,U.jsx)(U$,{field:e,value:t,onChange:n,disabled:!!i}):e.type===`mixed`?(0,U.jsx)(j$,{value:t,onChange:n,inputId:`field-${e.name}-mixed-boolean`,disabled:!!i}):e.type===`navigation`?(0,U.jsx)(K$,{value:t,onChange:n,disabled:!!i}):(0,U.jsx)(Hv,{className:q(c,`text-base md:text-base`),value:String(t??``),placeholder:b$(e.name),onChange:e=>n(e.target.value),disabled:!!i})}function X$(e){return Array.isArray(e)?e.map(X$):e&&typeof e==`object`?Object.fromEntries(Object.entries(e).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>[e,X$(t)])):e}function Z$(e){return JSON.stringify(X$(e))}function Q$(e){let t=e.match(/Field "([^"]+)" already exists\.?/);return t?t[1]??null:null}function $$(){let{slug:e,id:t}=hr(),n=dr(),r=!t,{timezone:i,locales:a,defaultLocale:o,editorialMode:s}=ya(),{user:c,status:l}=ga(),u=c?.role?.toLowerCase()??``,{data:d,loading:f}=wa(e?`/cms/admin/content-types/${e}`:null),{data:p,loading:m}=wa(e&&t?`/cms/admin/entries/${e}/${t}`:null),{data:h}=wa(s&&[`editor`,`admin`,`super admin`].includes(c?.role?.toLowerCase()??``)?`/cms/admin/users`:null),{loading:g,request:_}=Vv(),{loading:y,request:b}=Vv(),{loading:x,request:S}=Vv(),[C,w]=(0,v.useState)({}),[T,E]=(0,v.useState)([]),[D,O]=(0,v.useState)(``),[k,A]=(0,v.useState)(!1),[j,M]=(0,v.useState)(`draft`),[N,P]=(0,v.useState)(``),[F,I]=(0,v.useState)(!1),[L,R]=(0,v.useState)(!1),[ee,te]=(0,v.useState)(!1),[ne,z]=(0,v.useState)(null),[B,re]=(0,v.useState)(null),[V,H]=(0,v.useState)(null),[ie,ae]=(0,v.useState)(null),[oe,se]=(0,v.useState)(!1),[ce,le]=(0,v.useState)(null),[ue,de]=(0,v.useState)(!1),[fe,pe]=(0,v.useState)(!1),[me,he]=(0,v.useState)(),[ge,_e]=(0,v.useState)(`09:00`),ve=(0,v.useRef)(`{}`),ye=(0,v.useRef)(!1);(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`];E(t),O(o??t[0]),A(!1),w(e),M(`draft`),P(``),I(!1),te(!1),z(null),re(null),H(null),ae(null),se(!1),le(null),ve.current=Z$(e);return}if(!p||!d)return;let e={};d.fields.forEach(t=>{e[t.name]=p[t.name]??(t.type===`boolean`?!1:``)});let t=p.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)E(s),O(s[0]);else{let e=a&&a.length>0?a:[`en`];E(e),O(o??e[0])}if(A(!!c),w(e),M(p.status??`draft`),te(!!p.review_rejected),z(p.editor_id??null),re(p._editor_first_name??null),H(p._editor_last_name??null),ae(p._editor_avatar_url??null),se(!1),le(null),ve.current=Z$(e),p.scheduled_for?(P(p.scheduled_for),he(new Date(p.scheduled_for)),_e(Ty(p.scheduled_for,i))):P(``),p.status===`published`&&p.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 p.published_data&&(n[i.name]=t(p.published_data[i.name]??(i.type===`boolean`?!1:``),i.type),r[i.name]=t(e[i.name],i.type))}),I(Z$(r)!==Z$(n))}else I(!1)},[p,d,r]);let be=Z$(C)!==ve.current,xe=Fr((0,v.useCallback)(()=>ye.current?!1:be,[be]));function Se(e,t){w(n=>({...n,[e]:t}))}function Ce(e,t,n){w(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 we(e){A(e),w(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 Te(){if(N)he(new Date(N)),_e(Ty(N,i));else{let e=new Date;e.setDate(e.getDate()+1),he(e),_e(`09:00`)}de(!0)}async function Ee(){if(!e||!d)return null;le(null);let n={},i=k&&C.localized&&typeof C.localized==`object`&&C.localized[o]&&typeof C.localized[o]==`object`?C.localized[o]:null;if(d.fields.forEach(e=>{let t=C[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!==``&&t!=null&&(n[e.name]=t)}),C.localized&&Object.keys(C.localized).length>0){let e=C.localized;e._meta||={},e._meta.enabled=k,e._meta.primary=o,n.localized=e}try{let i=await _(r?`/cms/admin/content-types/${e}/entries`:`/cms/admin/entries/${e}/${t}`,r?`POST`:`PUT`,n);return ve.current=Z$(C),i}catch(e){let t=Q$(e instanceof Error?e.message:``);return t&&d.fields.some(e=>e.type===`uid`&&e.name===t)&&le(t),null}}async function De(){let i=await Ee();if(i){if(j===`scheduled`){let n=r?i.id:t;try{await b(`/cms/admin/entries/${e}/${n}/status`,`PATCH`,{status:`draft`}),M(`draft`),P(``),de(!1)}catch{}}else j===`published`&&I(!0);r&&(ye.current=!0,n(`/content/${e}/${i.id}`,{replace:!0}))}}async function Oe(){if(!e)return;let i=t;if(be||r){let e=await Ee();if(!e)return;i=r?e.id:t,r&&(ye.current=!0)}let a=s&&(u===`contributor`||u===``||l!==`authenticated`);try{let t=await b(`/cms/admin/entries/${e}/${i}/status`,`PATCH`,{status:a?`pending`:`published`,review_rejected:!1});M(t?.status??(a?`pending`:`published`)),te(!!t?.review_rejected),z(t?.editor_id??ne),re(t?._editor_first_name??B),H(t?._editor_last_name??V),ae(t?._editor_avatar_url??ie),P(``),I(!1),de(!1),se(!1),r&&n(`/content/${e}/${i}`,{replace:!0})}catch{r&&i&&n(`/content/${e}/${i}`,{replace:!0})}}async function ke(){if(!e||!me||!ge)return;let a=Ey(me,ge,i);if(new Date(a)<=new Date)return;let o=t;if(be||r){let e=await Ee();if(!e)return;o=r?e.id:t,r&&(ye.current=!0)}try{await b(`/cms/admin/entries/${e}/${o}/status`,`PATCH`,{status:`scheduled`,scheduled_for:a}),M(`scheduled`),P(a),de(!1),r&&n(`/content/${e}/${o}`,{replace:!0})}catch{r&&o&&n(`/content/${e}/${o}`,{replace:!0})}}async function Ae(){if(!(!e||!t))try{await b(`/cms/admin/entries/${e}/${t}/status`,`PATCH`,{status:`draft`}),M(`draft`),P(``),I(!1)}catch{}}async function je(){if(!(!e||!t))try{await S(`/cms/admin/entries/${e}/${t}`,`DELETE`),ye.current=!0,n(`/content/${e}`,{replace:!0})}catch{}}async function Me(n){if(!e||!t)return;let r=n===`none`?null:n,i=await b(`/cms/admin/entries/${e}/${t}/status`,`PATCH`,{status:`in_review`,editor_id:r,review_locked_by_editor:p?.review_locked_by_editor??!1});M(i?.status??`in_review`),te(!!i?.review_rejected),z(i?.editor_id??r),re(i?._editor_first_name??null),H(i?._editor_last_name??null),ae(i?._editor_avatar_url??null),se(!1)}async function Ne(){se(e=>!e)}async function Pe(){if(!e||!t)return;let n=await b(`/cms/admin/entries/${e}/${t}/status`,`PATCH`,{status:`pending`,review_rejected:!0});M(n?.status??`pending`),te(!!n?.review_rejected),se(!1)}let Fe=f||!r&&m,Ie=g||y,Le=c?.permissions??[],Re=Le.includes(`*`)||Le.includes(`entries:write`),ze=Le.includes(`*`)||Le.includes(`entries:delete`),Be=u===`contributor`,Ve=u===`editor`,He=[`admin`,`super admin`].includes(u),Ue=u===`viewer`,We=Be||Ve,Ge=Be&&d?.kind===`single`,Ke=r||String(p?.created_by??``)===String(c?.id??``),qe=s&&Be&&j===`in_review`,Je=s&&(Ve||He)&&!!ne&&ne===c?.id,Ye=Je&&(j===`pending`||j===`in_review`)&&!ee,Xe=Ue||!Re||Ge||Be&&!Ke||s&&Be&&j===`pending`&&!ee||qe||s&&(Ve||He)&&(j===`pending`||j===`in_review`)&&(!Je||!oe),Ze=ze&&(!We||Ke),Qe=s&&Be&&j===`pending`&&(ee?!0:be)||be||j===`draft`||j===`scheduled`||!s&&j===`pending`||s&&j===`pending`&&!Be||s&&j===`in_review`&&!Be||F,$e=!!(me&&ge),et=s&&Be?`Review`:`Publish`;if(yO(`mod+s`,De,{enabled:!Xe&&!Ie&&(j===`scheduled`?!0:be),label:`Save draft`}),yO(`mod+shift+p`,Oe,{enabled:Qe&&!Ie&&!Xe,label:`Publish`}),Fe)return(0,U.jsxs)(`div`,{className:`flex items-center gap-2 py-12 text-muted-foreground`,children:[(0,U.jsx)(by,{className:`size-4`}),(0,U.jsx)(`span`,{className:`text-sm`,children:`Loading…`})]});if(!d)return null;let tt;tt=j===`scheduled`?(0,U.jsxs)(vw,{variant:`outline`,className:`border-blue-500 text-blue-600`,children:[(0,U.jsx)(Ia,{className:`size-3 mr-1`}),N?`Scheduled · ${wy(N,i)}`:`Scheduled`]}):j===`pending`?ee?(0,U.jsx)(vw,{variant:`destructive`,children:`Pending`}):(0,U.jsx)(vw,{className:`bg-amber-500 text-black hover:bg-amber-500`,children:`Pending`}):j===`in_review`?(0,U.jsx)(vw,{variant:`outline`,children:`In Review`}):j===`published`?(0,U.jsx)(vw,{variant:F?`secondary`:`default`,children:F?`Published (pending changes)`:`Published`}):(0,U.jsx)(vw,{variant:`secondary`,children:`Draft`});let nt=(h??[]).filter(e=>Ve?e.id===c?.id:He?e.id===c?.id||(e.role_name??``).toLowerCase()===`editor`:!1),rt=!r&&s&&(Ve||He)&&(j===`pending`||j===`in_review`),it=s&&!r&&rt,at=s&&!r&&!!ne,ot=Ye,st=Ye,ct=B||V;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(yy,{children:(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`h1`,{className:`text-2xl font-bold -mt-2`,children:r?`New entry`:`Edit entry`}),tt]}),(0,U.jsx)(`p`,{className:`text-muted-foreground text-xs mt-1`,children:d.name})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!r&&Ze&&!Ge&&(0,U.jsx)(J,{variant:`ghost`,size:`icon`,className:`text-muted-foreground hover:text-destructive`,onClick:()=>R(!0),disabled:x,children:(0,U.jsx)(qo,{className:`size-4`})}),!r&&j===`published`&&!Xe&&(0,U.jsxs)(J,{variant:`outline`,onClick:Ae,disabled:Ie,children:[y?(0,U.jsx)(by,{className:`size-4`}):null,`Revert to draft`]}),!r&&j===`scheduled`&&!Xe&&(0,U.jsxs)(J,{variant:`outline`,onClick:Ae,disabled:Ie,children:[y?(0,U.jsx)(by,{className:`size-4`}):null,`Cancel schedule`]}),it&&(0,U.jsxs)(Ow,{value:ne??`none`,onValueChange:Me,disabled:!rt||Ie,children:[(0,U.jsx)(jw,{className:`h-10 min-h-10 max-h-10 w-42 py-0`,children:(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(El,{avatarUrl:ie??null,firstName:B??null,lastName:V??null,className:`size-5`,fallbackClassName:`text-[9px]`}),(0,U.jsx)(Aw,{placeholder:ct||`Assign editor`})]})}),(0,U.jsxs)(Pw,{children:[!Ve&&(0,U.jsx)(Iw,{value:`none`,children:`Unassign`}),nt.map(e=>(0,U.jsx)(Iw,{value:e.id,children:e.first_name||e.last_name||e.id},e.id))]})]}),!rt&&at&&(0,U.jsxs)(`div`,{className:`inline-flex h-10 items-center gap-2 rounded-md border border-input px-3 text-sm`,children:[(0,U.jsx)(El,{avatarUrl:ie??null,firstName:B??null,lastName:V??null,className:`size-5`,fallbackClassName:`text-[9px]`}),(0,U.jsx)(`span`,{children:ct||`Assigned editor`})]}),ot&&(0,U.jsx)(J,{variant:`outline`,size:`icon`,onClick:Ne,disabled:Ie,children:(0,U.jsx)(No,{className:`size-4`})}),st&&(0,U.jsx)(J,{variant:`outline`,size:`icon`,onClick:Pe,disabled:Ie,children:(0,U.jsx)(ns,{className:`size-4`})}),(0,U.jsxs)(J,{variant:`outline`,onClick:De,size:s?`icon`:`default`,disabled:Xe||(j===`scheduled`?Ie:!be||Ie),children:[g?(0,U.jsx)(by,{className:`size-4`}):s?(0,U.jsx)(Lo,{className:`size-4`}):null,!s&&(j===`scheduled`?`Save draft (cancel schedule)`:`Save draft`)]}),j!==`scheduled`&&!(s&&Be)&&(0,U.jsxs)(J,{variant:`outline`,onClick:Te,size:s?`icon`:`default`,disabled:Xe||Ie,children:[(0,U.jsx)(Ia,{className:`size-4`}),!s&&`Schedule`]}),(0,U.jsxs)(J,{onClick:Oe,disabled:Xe||!Qe||Ie,children:[y?(0,U.jsx)(by,{className:`size-4`}):null,j===`scheduled`?s&&Be?`Review`:`Publish now`:j===`published`&&!F?`Republish`:et]})]})]})}),(0,U.jsxs)(`section`,{className:`mt-24`,children:[ue&&!Xe&&(0,U.jsxs)(`div`,{className:`mb-6 flex items-end gap-2 rounded-lg border p-4 bg-muted/30`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(X,{children:`Date`}),(0,U.jsxs)(RN,{open:fe,onOpenChange:pe,children:[(0,U.jsx)(zN,{asChild:!0,children:(0,U.jsxs)(J,{variant:`outline`,className:`w-40 justify-between font-normal`,children:[me?HA(me,`MMM d, yyyy`):`Select date`,(0,U.jsx)(Ba,{className:`size-4 opacity-50`})]})}),(0,U.jsx)(BN,{className:`w-auto overflow-hidden p-0`,align:`start`,children:(0,U.jsx)(IN,{mode:`single`,selected:me,captionLayout:`dropdown`,defaultMonth:me??new Date,disabled:{before:new Date},onSelect:e=>{he(e),pe(!1)}})})]})]}),(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsxs)(X,{children:[`Time `,(0,U.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(24h)`})]}),(0,U.jsx)(Hv,{type:`time`,className:`w-32 appearance-none bg-background [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:appearance-none`,value:ge,onChange:e=>_e(e.target.value)})]}),(0,U.jsxs)(J,{onClick:ke,disabled:!$e||Ie,children:[y?(0,U.jsx)(by,{className:`size-4`}):null,`Confirm`]}),(0,U.jsx)(J,{variant:`ghost`,onClick:()=>de(!1),children:`Cancel`})]}),(0,U.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(rj,{checked:k,onCheckedChange:we,disabled:Xe}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`text-sm font-medium`,children:`Localization`}),(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Enable per-entry localization`})]})]}),(0,U.jsx)(`div`,{})]}),(0,U.jsx)(`div`,{children:k&&(0,U.jsx)($A,{value:D,onValueChange:e=>O(e),children:(0,U.jsx)(ej,{children:T.map(e=>(0,U.jsx)(tj,{value:e,disabled:Xe,children:e.toUpperCase()},e))})})})]}),(0,U.jsx)(`div`,{className:`grid grid-cols-6 gap-4`,children:d.fields.map(e=>{let n=[`string`,`text`,`richtext`].includes(e.type),r=C.localized&&C.localized[D]?C.localized[D][e.name]:void 0,i=n&&k?r:C[e.name],a=e.type===`uid`&&e.targetField&&k&&[`string`,`text`,`richtext`].includes(d.fields.find(t=>t.name===e.targetField)?.type??``);return(0,U.jsx)(`div`,{className:xO[e.width??`full`],children:(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsxs)(X,{htmlFor:`entry-${e.name}`,className:`capitalize`,children:[e.name.replace(/_/g,` `),e.required&&(0,U.jsx)(`span`,{className:`ml-1 text-destructive`,children:`*`})]}),(0,U.jsx)(Y$,{field:e,value:i,onChange:t=>{e.type===`uid`&&ce===e.name&&le(null),n&&k?Ce(D,e.name,t):Se(e.name,t)},allValues:{...C,id:t,__activeLocale:D,__localizationEnabled:k,__defaultLocale:o},disabled:!!a||Xe,errorMessage:e.type===`uid`&&ce===e.name?`${e.name} already exists.`:void 0})]})},e.name)})}),(0,U.jsx)(yw,{open:L,onOpenChange:R,children:(0,U.jsxs)(Cw,{className:`max-w-sm`,children:[(0,U.jsx)(ww,{children:(0,U.jsx)(Ew,{children:`Delete this entry?`})}),(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This action cannot be undone.`}),(0,U.jsxs)(Tw,{children:[(0,U.jsx)(J,{variant:`outline`,onClick:()=>R(!1),children:`Cancel`}),(0,U.jsxs)(J,{variant:`destructive`,onClick:je,disabled:x,children:[x?(0,U.jsx)(by,{className:`size-4`}):null,`Delete`]})]})]})}),(0,U.jsx)(yw,{open:xe.state===`blocked`,onOpenChange:()=>xe.reset?.(),children:(0,U.jsxs)(Cw,{className:`max-w-sm`,children:[(0,U.jsx)(ww,{children:(0,U.jsx)(Ew,{children:`Unsaved changes`})}),(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Leave without saving?`}),(0,U.jsxs)(Tw,{children:[(0,U.jsx)(J,{variant:`outline`,onClick:()=>xe.reset?.(),children:`Stay`}),(0,U.jsx)(J,{variant:`destructive`,onClick:()=>xe.proceed?.(),children:`Leave`})]})]})})]})]})}function e1({...e}){return(0,U.jsx)(`nav`,{"aria-label":`breadcrumb`,"data-slot":`breadcrumb`,...e})}function t1({className:e,...t}){return(0,U.jsx)(`ol`,{"data-slot":`breadcrumb-list`,className:q(`flex flex-wrap items-center gap-1.5 text-sm break-words text-muted-foreground sm:gap-2.5`,e),...t})}function n1({className:e,...t}){return(0,U.jsx)(`li`,{"data-slot":`breadcrumb-item`,className:q(`inline-flex items-center gap-1.5`,e),...t})}function r1({asChild:e,className:t,...n}){return(0,U.jsx)(e?Fl:`a`,{"data-slot":`breadcrumb-link`,className:q(`transition-colors hover:text-foreground`,t),...n})}function i1({className:e,...t}){return(0,U.jsx)(`span`,{"data-slot":`breadcrumb-page`,role:`link`,"aria-disabled":`true`,"aria-current":`page`,className:q(`font-normal text-foreground`,e),...t})}function a1({children:e,className:t,...n}){return(0,U.jsx)(`li`,{"data-slot":`breadcrumb-separator`,role:`presentation`,"aria-hidden":`true`,className:q(`[&>svg]:size-3.5`,t),...n,children:e??(0,U.jsx)(Ha,{})})}function o1(e){return e?e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`:`—`}function s1(e){let t=e.split(`/`).pop()??e;return t.replace(/\.[^.]+$/,``).trim()||t.trim()}function c1(e){return!!e?.startsWith(`image/`)}function l1(e){return!!e?.startsWith(`video/`)}function u1(e){return!!e?.startsWith(`audio/`)}function d1(e){return e===`application/pdf`}function f1(e,t){return e.split(`?`)[0].endsWith(`.m3u8`)||t===`application/x-mpegurl`||t===`application/vnd.apple.mpegurl`}async function p1(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(p1));n.push(...i.flat()),r()})};r()}),n}return[]}function m1({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,U.jsx)(`video`,{ref:t,controls:!0,className:`max-h-[70vh] w-full rounded-md bg-black`})}function h1({item:e}){let t=e.mime_type?.toLowerCase()??null;return c1(t)?(0,U.jsx)(`img`,{src:e.url,alt:e.alt??e.filename,className:`max-h-full max-w-full rounded-md object-contain`}):f1(e.url,t)?(0,U.jsx)(m1,{url:e.url}):l1(t)?(0,U.jsx)(`video`,{src:e.url,controls:!0,preload:`none`,className:`max-h-[70vh] w-full rounded-md bg-black`}):u1(t)?(0,U.jsxs)(`div`,{className:`flex flex-col items-center gap-4 py-6`,children:[(0,U.jsx)(no,{className:`size-14 text-muted-foreground`}),(0,U.jsx)(`audio`,{src:e.url,controls:!0,className:`w-full`})]}):d1(t)?(0,U.jsx)(`iframe`,{src:e.url,title:e.filename,className:`h-[70vh] w-full rounded-md border`}):(0,U.jsxs)(`div`,{className:`flex flex-col items-center gap-4 py-8 text-center`,children:[(0,U.jsx)(io,{className:`size-14 text-muted-foreground`}),(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.mime_type??`Unknown type`}),(0,U.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,download:e.filename,children:(0,U.jsxs)(J,{variant:`outline`,size:`sm`,children:[(0,U.jsx)(Qa,{className:`size-4`}),`Download`]})})]})}function g1({folder:e,onOpen:t,onDelete:n,onRename:r,canDelete:i,canRename:a,selected:o,onToggle:s}){return(0,U.jsxs)(`div`,{className:`group relative flex items-center gap-3 rounded-lg border bg-card px-3 py-2.5 transition-colors cursor-pointer hover:bg-muted/50 ${o?`ring-2 ring-primary`:``}`,onClick:()=>{o||t(e)},children:[(0,U.jsxs)(`div`,{className:`relative shrink-0 size-7 flex items-center justify-center`,children:[(0,U.jsx)(lo,{className:`size-7 text-muted-foreground transition-opacity ${o?`opacity-0`:`group-hover:opacity-0`}`}),(0,U.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center transition-opacity ${o?`opacity-100`:`opacity-0 group-hover:opacity-100`}`,onClick:e=>e.stopPropagation(),children:(0,U.jsx)(EO,{checked:o,onCheckedChange:()=>s(`folder:${e.id}`),"aria-label":`Select folder`})})]}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`p`,{className:`text-sm font-bold truncate`,title:e.name,children:e.name}),(0,U.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.item_count,` `,e.item_count===1?`item`:`items`]})]}),!o&&(a||i)&&(0,U.jsxs)(P_,{children:[(0,U.jsx)(F_,{asChild:!0,children:(0,U.jsx)(`button`,{className:`shrink-0 opacity-0 group-hover:opacity-100 transition-opacity flex size-6 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,onClick:e=>e.stopPropagation(),children:(0,U.jsx)($a,{className:`size-4`})})}),(0,U.jsxs)(R_,{align:`end`,onClick:e=>e.stopPropagation(),children:[a&&(0,U.jsxs)(z_,{onSelect:()=>r(e),children:[(0,U.jsx)(No,{className:`size-4`}),`Rename`]}),i&&(0,U.jsxs)(z_,{onSelect:()=>n(e),className:`text-destructive focus:text-destructive`,children:[(0,U.jsx)(qo,{className:`size-4`}),`Delete`]})]})]})]})}function _1({item:e,onDelete:t,onPreview:n,canDelete:r,selected:i,onToggle:a}){let o=e.mime_type?.toLowerCase()??null;return(0,U.jsxs)(`div`,{className:`group relative rounded-lg border bg-card overflow-hidden transition-colors ${i?`ring-2 ring-primary`:``}`,children:[(0,U.jsx)(`div`,{className:`aspect-square bg-muted flex items-center justify-center cursor-pointer`,onClick:()=>{i||n(e)},children:c1(o)?(0,U.jsx)(`img`,{src:e.url,alt:e.alt??e.filename,className:`h-full w-full object-cover`}):l1(o)||f1(e.url,o)?(0,U.jsx)(ro,{className:`size-10 text-muted-foreground`}):u1(o)?(0,U.jsx)(no,{className:`size-10 text-muted-foreground`}):d1(o)?(0,U.jsx)(io,{className:`size-10 text-muted-foreground`}):(0,U.jsx)(ao,{className:`size-10 text-muted-foreground`})}),(0,U.jsx)(`div`,{className:`absolute top-1.5 left-1.5 transition-opacity ${i?`opacity-100`:`opacity-0 group-hover:opacity-100`}`,children:(0,U.jsx)(EO,{checked:i,onCheckedChange:()=>a(e.id),"aria-label":`Select file`,className:`bg-background/80 backdrop-blur-sm`})}),!i&&r&&(0,U.jsx)(`button`,{onClick:()=>t(e),className:`absolute top-1.5 right-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,U.jsx)(qo,{className:`size-3.5`})}),(0,U.jsxs)(`div`,{className:`p-2`,children:[(0,U.jsx)(`p`,{className:`text-xs font-medium truncate`,title:e.filename,children:e.filename}),(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:o1(e.size)})]})]})}function v1(){let e=(0,v.useRef)(null),{user:t}=ga(),n=t?.permissions??[],r=n.includes(`*`)||n.includes(`media:write`),i=n.includes(`*`)||n.includes(`media:delete`),[a,o]=(0,v.useState)([{id:null,name:`Media`}]),s=a[a.length-1].id,[c,l]=(0,v.useState)(1),[u,d]=(0,v.useState)(``),[f,p]=(0,v.useState)(``);(0,v.useEffect)(()=>{let e=setTimeout(()=>{p(u),l(1)},300);return()=>clearTimeout(e)},[u]),(0,v.useEffect)(()=>{l(1),d(``),p(``)},[s]);let{data:m,loading:h,refetch:g}=wa(`/cms/admin/folders?parent_id=${s??``}`),{data:_,loading:y,refetch:b}=wa(`/cms/admin/media?folder_id=${s??``}&page=${c}&limit=48${f?`&search=${encodeURIComponent(f)}`:``}`),x=(0,v.useCallback)(()=>{g(),b()},[g,b]),[S,C]=(0,v.useState)(!1),[w,T]=(0,v.useState)(null),[E,D]=(0,v.useState)(new Set),[O,k]=(0,v.useState)(null),[A,j]=(0,v.useState)(``),[M,N]=(0,v.useState)(``),[P,F]=(0,v.useState)(``),[I,L]=(0,v.useState)(!1),[R,ee]=(0,v.useState)(null),[te,ne]=(0,v.useState)(null),[z,B]=(0,v.useState)(null),[re,V]=(0,v.useState)(null),[H,ie]=(0,v.useState)(``),[ae,oe]=(0,v.useState)(!1),[se,ce]=(0,v.useState)(``),[le,ue]=(0,v.useState)(!1),[de,fe]=(0,v.useState)(!1),{loading:pe,error:me,request:he}=Vv(),{loading:ge,error:_e,request:ve}=Vv();async function ye(e){if(e.some(({relativePath:e})=>e.endsWith(`.m3u8`))){let t=localStorage.getItem(`plank_token`),n=t?{Authorization:`Bearer ${t}`}:{},r=new FormData;for(let{file:t,relativePath:n}of e)r.append(`files`,t,n);s&&r.append(`folder_id`,s),r.append(`bundle`,`true`);let i=await fetch(`/cms/admin/media`,{method:`POST`,headers:n,body:r});if(!i.ok){let e=await i.text(),t=`Upload failed.`;try{t=JSON.parse(e).error??t}catch{}throw Error(t)}}else await Promise.all(e.map(({file:e})=>pQ(e,{folderId:s})))}async function be(t){if(r&&!(!t||t.length===0)){C(!0),T(null);try{await ye(Array.from(t).map(e=>({file:e,relativePath:e.webkitRelativePath||e.name}))),x()}catch(e){T(e instanceof Error?e.message:`Upload failed.`)}finally{C(!1),e.current&&(e.current.value=``)}}}async function xe(e){if(!r)return;e.preventDefault();let t=Array.from(e.dataTransfer.items);if(!t.some(e=>typeof e.webkitGetAsEntry==`function`)){be(e.dataTransfer.files);return}C(!0),T(null);try{let e=t.map(e=>e.webkitGetAsEntry()).filter(e=>e!==null);await ye((await Promise.all(e.map(p1))).flat()),x()}catch(e){T(e instanceof Error?e.message:`Upload failed.`)}finally{C(!1)}}function Se(e){o(t=>[...t,{id:e.id,name:e.name}]),D(new Set)}function Ce(e){o(t=>t.slice(0,e+1)),D(new Set)}async function we(){if(r&&se.trim())try{await ve(`/cms/admin/folders`,`POST`,{name:se.trim(),parent_id:s}),oe(!1),ce(``),g()}catch{}}async function Te(){if(r&&!(!re||!H.trim()))try{await ve(`/cms/admin/folders/${re.id}`,`PATCH`,{name:H.trim()}),V(null),g()}catch{}}async function Ee(){if(i&&z)try{await he(`/cms/admin/folders/${z.id}`,`DELETE`),B(null),g()}catch{}}async function De(){if(i&&te)try{await he(`/cms/admin/media/${te.id}`,`DELETE`),ne(null),b()}catch{}}function Oe(e){D(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}function ke(e){k(e),j(e.filename),N(e.alt??s1(e.filename)),F(e.caption??``),ee(null)}function Ae(e){j(e);let t=s1(A),n=s1(e);(!M.trim()||M===t)&&N(n)}let je=m?.folders??[],Me=_?.items??[],Ne=[...je.map(e=>`folder:${e.id}`),...Me.map(e=>e.id)];!(Ne.length>0&&Ne.every(e=>E.has(e)))&&Ne.some(e=>E.has(e));async function Pe(){if(!i||de)return;fe(!0);let e=localStorage.getItem(`plank_token`),t=e?{Authorization:`Bearer ${e}`}:{};try{await Promise.all([...[...E].filter(e=>e.startsWith(`folder:`)).map(e=>fetch(`/cms/admin/folders/${e.slice(7)}`,{method:`DELETE`,headers:t})),...[...E].filter(e=>!e.startsWith(`folder:`)).map(e=>fetch(`/cms/admin/media/${e}`,{method:`DELETE`,headers:t}))]),ue(!1),D(new Set),x()}finally{fe(!1)}}let Fe=h||y,Ie=je.length===0&&Me.length===0;return(0,U.jsxs)(`div`,{children:[(0,U.jsx)(yy,{children:(0,U.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,U.jsx)(`h1`,{className:`text-2xl font-bold -mt-2`,children:`Media Library`}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsxs)(J,{variant:`outline`,onClick:()=>{ce(``),oe(!0)},disabled:!r,children:[(0,U.jsx)(co,{className:`size-4`}),`New folder`]}),(0,U.jsxs)(J,{onClick:()=>e.current?.click(),disabled:S||!r,children:[S?(0,U.jsx)(by,{className:`size-4`}):(0,U.jsx)(Qo,{className:`size-4`}),S?`Uploading…`:`Upload`]})]})]})}),(0,U.jsxs)(`section`,{className:`mt-24`,children:[a.length>1&&(0,U.jsx)(e1,{className:`mb-4`,children:(0,U.jsx)(t1,{children:a.map((e,t)=>(0,U.jsxs)(v.Fragment,{children:[t>0&&(0,U.jsx)(a1,{}),(0,U.jsx)(n1,{children:t===a.length-1?(0,U.jsx)(i1,{children:t===0?(0,U.jsx)(go,{className:`size-3.5`}):e.name}):(0,U.jsx)(r1,{asChild:!0,children:(0,U.jsx)(`button`,{onClick:()=>Ce(t),children:t===0?(0,U.jsx)(go,{className:`size-3.5`}):e.name})})})]},t))})}),(0,U.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 rounded-lg border border-border bg-muted/50 p-2`,children:[(0,U.jsxs)(`div`,{className:`relative max-w-72 w-full`,children:[(0,U.jsx)(Ro,{className:`absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground pointer-events-none`}),(0,U.jsx)(Hv,{className:`pl-9 h-8 bg-background`,placeholder:`Search media…`,value:u,onChange:e=>d(e.target.value)})]}),!y&&_!=null&&(0,U.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[Me.length,` / `,_.total,` `,_.total===1?`file`:`files`]}),(0,U.jsx)(`div`,{className:`ml-auto flex h-8 items-center gap-2`,children:E.size>0?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`span`,{className:`text-sm font-medium`,children:[E.size,` selected`]}),(0,U.jsx)(J,{variant:`outline`,size:`sm`,onClick:()=>D(new Set),children:`Clear`}),i&&(0,U.jsxs)(J,{variant:`destructive`,size:`sm`,disabled:de,onClick:()=>ue(!0),children:[(0,U.jsx)(qo,{className:`size-3.5`}),`Delete`]})]}):!Ie&&!Fe?(0,U.jsxs)(`button`,{className:`flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors`,onClick:()=>D(new Set(Ne)),children:[(0,U.jsx)(EO,{checked:!1,"aria-hidden":!0,className:`pointer-events-none`}),`Select all`]}):null})]}),(0,U.jsx)(`input`,{ref:e,type:`file`,multiple:!0,className:`hidden`,onChange:e=>be(e.target.files)}),w&&(0,U.jsx)(`p`,{className:`mb-4 text-sm text-destructive`,children:w}),Fe?(0,U.jsx)(`div`,{className:`flex items-center gap-2 py-16 justify-center text-muted-foreground`,children:(0,U.jsx)(by,{className:`size-5`})}):Ie?(0,U.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:()=>r&&e.current?.click(),onDragOver:e=>e.preventDefault(),onDrop:xe,children:[(0,U.jsx)(Qo,{className:`size-8 text-muted-foreground mb-3`}),(0,U.jsx)(`p`,{className:`text-sm font-medium`,children:`Drop files or folders here, or click to upload`}),(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:`Images, videos, audio, documents and more`})]}):(0,U.jsxs)(`div`,{className:`flex flex-col gap-6`,onDragOver:e=>e.preventDefault(),onDrop:xe,children:[je.length>0&&(0,U.jsx)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4`,children:je.map(e=>(0,U.jsx)(g1,{folder:e,onOpen:Se,onDelete:B,onRename:e=>{V(e),ie(e.name)},canDelete:i,canRename:r,selected:E.has(`folder:${e.id}`),onToggle:Oe},e.id))}),Me.length>0&&(0,U.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6`,children:Me.map(e=>(0,U.jsx)(_1,{item:e,onDelete:ne,onPreview:ke,canDelete:i,selected:E.has(e.id),onToggle:Oe},e.id))})]}),(_?.pages??0)>1&&(0,U.jsx)(`div`,{className:`mt-4`,children:(0,U.jsx)(JO,{className:`mx-0 w-auto justify-end`,children:(0,U.jsxs)(YO,{children:[(0,U.jsx)(XO,{children:(0,U.jsx)(QO,{href:`#`,onClick:e=>{e.preventDefault(),c>1&&l(c-1)},"aria-disabled":c===1,className:c===1?`pointer-events-none opacity-50`:``})}),(0,U.jsx)(XO,{children:(0,U.jsx)($O,{href:`#`,onClick:e=>{e.preventDefault(),c<(_?.pages??1)&&l(c+1)},"aria-disabled":c===(_?.pages??1),className:c===(_?.pages??1)?`pointer-events-none opacity-50`:``})})]})})}),(0,U.jsx)(yw,{open:!!O,onOpenChange:e=>{e||(k(null),ee(null),F(``))},children:(0,U.jsxs)(Cw,{className:`sm:max-w-5xl max-h-[85vh] overflow-hidden p-0`,children:[(0,U.jsx)(ww,{children:(0,U.jsx)(Ew,{className:`truncate px-6 pt-6 pr-12`,title:O?.filename,children:O?.filename})}),O&&(0,U.jsxs)(`form`,{className:`grid max-h-[calc(85vh-4rem)] min-h-0 gap-0 lg:grid-cols-[minmax(0,1fr)_320px]`,onSubmit:async e=>{e.preventDefault(),L(!0),ee(null);let t=localStorage.getItem(`plank_token`);try{let e=await fetch(`/cms/admin/media/${O.id}`,{method:`PATCH`,headers:{"Content-Type":`application/json`,...t?{Authorization:`Bearer ${t}`}:{}},body:JSON.stringify({filename:A||O.filename,alt:M.trim()||null,caption:P.trim()||null})});if(!e.ok)throw Error(`Save failed.`);ke(await e.json()),b()}catch(e){ee(e instanceof Error?e.message:`Save failed.`)}finally{L(!1)}},children:[(0,U.jsx)(`div`,{className:`flex min-h-0 items-center justify-center overflow-hidden bg-muted/30 px-6 py-4`,children:(0,U.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,U.jsx)(h1,{item:O})})}),(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-col border-t lg:border-l lg:border-t-0`,children:[(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 border-b px-6 py-4 text-xs text-muted-foreground`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`mb-1 font-medium text-foreground`,children:`Type`}),(0,U.jsx)(`p`,{className:`break-all`,children:O.mime_type??`—`})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`mb-1 font-medium text-foreground`,children:`Size`}),(0,U.jsx)(`p`,{children:o1(O.size??null)})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`mb-1 font-medium text-foreground`,children:`Dimensions`}),(0,U.jsx)(`p`,{children:O.width&&O.height?`${O.width} × ${O.height}`:`—`})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`mb-1 font-medium text-foreground`,children:`Created`}),(0,U.jsx)(`p`,{children:new Date(O.created_at).toLocaleString()})]})]}),(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-6 py-4`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(X,{className:`text-xs`,children:`Filename`}),(0,U.jsx)(Hv,{value:A,onChange:e=>Ae(e.target.value),placeholder:O.filename,className:`text-sm`,disabled:!r})]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(X,{className:`text-xs`,children:`Alt text`}),(0,U.jsx)(Hv,{value:M,onChange:e=>N(e.target.value),placeholder:s1(A||O.filename),className:`text-sm`,disabled:!r}),(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Defaulted from the filename without extension. You can override it.`})]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(X,{className:`text-xs`,children:`Subtitle`}),(0,U.jsx)(VN,{value:P,onChange:e=>F(e.target.value),placeholder:`Used as figcaption in the frontend…`,className:`min-h-28 resize-none text-sm`,disabled:!r})]}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3 pt-2`,children:[(0,U.jsx)(`a`,{href:O.url,target:`_blank`,rel:`noreferrer`,download:O.filename,children:(0,U.jsxs)(J,{variant:`outline`,size:`sm`,type:`button`,children:[(0,U.jsx)(Qa,{className:`size-3.5`}),`Download`]})}),(0,U.jsx)(J,{type:`submit`,size:`sm`,disabled:I||!r,children:I?`Saving…`:`Save`})]}),R&&(0,U.jsx)(`p`,{className:`text-xs text-destructive`,children:R})]})]})]})]})}),(0,U.jsx)(yw,{open:ae,onOpenChange:e=>{e||oe(!1)},children:(0,U.jsxs)(Cw,{className:`sm:max-w-sm`,children:[(0,U.jsx)(ww,{children:(0,U.jsx)(Ew,{children:`New folder`})}),(0,U.jsx)(Hv,{placeholder:`Folder name`,value:se,onChange:e=>ce(e.target.value),onKeyDown:e=>{e.key===`Enter`&&we()},autoFocus:!0}),_e&&(0,U.jsx)(`p`,{className:`text-sm text-destructive`,children:_e}),(0,U.jsxs)(Tw,{children:[(0,U.jsx)(J,{variant:`outline`,onClick:()=>oe(!1),children:`Cancel`}),(0,U.jsx)(J,{onClick:we,disabled:ge||!se.trim()||!r,children:ge?`Creating…`:`Create`})]})]})}),(0,U.jsx)(yw,{open:!!re,onOpenChange:e=>{e||V(null)},children:(0,U.jsxs)(Cw,{className:`sm:max-w-sm`,children:[(0,U.jsx)(ww,{children:(0,U.jsx)(Ew,{children:`Rename folder`})}),(0,U.jsx)(Hv,{value:H,onChange:e=>ie(e.target.value),onKeyDown:e=>{e.key===`Enter`&&Te()},autoFocus:!0}),_e&&(0,U.jsx)(`p`,{className:`text-sm text-destructive`,children:_e}),(0,U.jsxs)(Tw,{children:[(0,U.jsx)(J,{variant:`outline`,onClick:()=>V(null),children:`Cancel`}),(0,U.jsx)(J,{onClick:Te,disabled:ge||!H.trim()||!r,children:ge?`Saving…`:`Save`})]})]})}),(0,U.jsx)(yw,{open:!!te,onOpenChange:e=>{e||ne(null)},children:(0,U.jsxs)(Cw,{className:`sm:max-w-sm`,children:[(0,U.jsx)(ww,{children:(0,U.jsx)(Ew,{children:`Delete file`})}),(0,U.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Are you sure you want to delete`,` `,(0,U.jsx)(`span`,{className:`font-medium text-foreground`,children:te?.filename}),`? This action cannot be undone.`]}),me&&(0,U.jsx)(`p`,{className:`text-sm text-destructive`,children:me}),(0,U.jsxs)(Tw,{children:[(0,U.jsx)(J,{variant:`outline`,onClick:()=>ne(null),children:`Cancel`}),(0,U.jsx)(J,{variant:`destructive`,onClick:De,disabled:pe||!i,children:pe?`Deleting…`:`Delete`})]})]})}),(0,U.jsx)(yw,{open:!!z,onOpenChange:e=>{e||B(null)},children:(0,U.jsxs)(Cw,{className:`sm:max-w-sm`,children:[(0,U.jsx)(ww,{children:(0,U.jsx)(Ew,{children:`Delete folder`})}),(0,U.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Are you sure you want to delete`,` `,(0,U.jsx)(`span`,{className:`font-medium text-foreground`,children:z?.name}),`? The folder must be empty.`]}),me&&(0,U.jsx)(`p`,{className:`text-sm text-destructive`,children:me}),(0,U.jsxs)(Tw,{children:[(0,U.jsx)(J,{variant:`outline`,onClick:()=>B(null),children:`Cancel`}),(0,U.jsx)(J,{variant:`destructive`,onClick:Ee,disabled:pe||!i,children:pe?`Deleting…`:`Delete`})]})]})}),(0,U.jsx)(yw,{open:le,onOpenChange:e=>{e||ue(!1)},children:(0,U.jsxs)(Cw,{className:`sm:max-w-sm`,children:[(0,U.jsx)(ww,{children:(0,U.jsxs)(Ew,{children:[`Delete `,E.size,` `,E.size===1?`item`:`items`,`?`]})}),(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This action cannot be undone. Non-empty folders will be skipped.`}),(0,U.jsxs)(Tw,{children:[(0,U.jsx)(J,{variant:`outline`,onClick:()=>ue(!1),children:`Cancel`}),(0,U.jsxs)(J,{variant:`destructive`,onClick:Pe,disabled:de,children:[de?(0,U.jsx)(by,{className:`size-4`}):null,`Delete`]})]})]})})]})]})}function y1({items:e}){let{pathname:t}=cr();function n(e){return t===e||t.startsWith(e+`/`)}return(0,U.jsx)(`nav`,{className:`flex flex-col gap-0.5 p-2`,children:e.map(({label:e,to:t,icon:r})=>(0,U.jsxs)(qi,{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,U.jsx)(r,{className:`size-3.5 shrink-0`}),(0,U.jsx)(`span`,{className:`truncate`,children:e})]},t))})}function b1(e,t){return e?.permissions.includes(`*`)||e?.permissions.includes(t)||!1}function x1(){let{user:e}=ga(),t=[{label:`Overview`,to:`/settings/overview`,icon:zo,permission:`settings:overview:read`},{label:`Users`,to:`/settings/users`,icon:es,permission:`settings:users:read`},{label:`Roles`,to:`/settings/roles`,icon:Bo,permission:`settings:roles:read`},{label:`API Tokens`,to:`/settings/api-tokens`,icon:bo,permission:`settings:api-tokens:read`},{label:`Webhooks`,to:`/settings/webhooks`,icon:ts,permission:`settings:webhooks:read`}].filter(({permission:t})=>b1(e,t));return(0,U.jsxs)(`div`,{className:`flex flex-col`,children:[(0,U.jsx)(`div`,{className:`border-b border-sidebar-border px-4 py-3`,children:(0,U.jsx)(`p`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider`,children:`Settings`})}),(0,U.jsx)(y1,{items:t})]})}function S1(){return qw((0,U.jsx)(x1,{})),(0,U.jsx)(Qr,{})}var C1=`••••••••`;function w1({values:e,onChange:t,disabled:n=!1}){return(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(X,{htmlFor:`local-uploads-dir`,children:`Upload directory`}),(0,U.jsx)(Hv,{id:`local-uploads-dir`,placeholder:`public/uploads`,value:e[`local.uploads_dir`]??``,onChange:e=>t(`local.uploads_dir`,e.target.value),disabled:n}),(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Path on disk where files are stored. Relative to the server working directory.`})]}),(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(X,{htmlFor:`local-public-url`,children:`Public URL`}),(0,U.jsx)(Hv,{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,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Base URL used to build file URLs. Should match the server's public address.`})]})]})}function T1({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]===C1,u=r[n]??``;return(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(X,{htmlFor:e,children:t}),(0,U.jsxs)(`div`,{className:`relative`,children:[(0,U.jsx)(Hv,{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,U.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,U.jsx)(eo,{className:`size-4`}):(0,U.jsx)(to,{className:`size-4`})})]}),l&&(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`A value is already saved. Enter a new one to replace it.`})]})}function E1({values:e,onChange:t,disabled:n=!1}){return(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(X,{htmlFor:`s3-access-key`,children:`Access key ID`}),(0,U.jsx)(Hv,{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,U.jsx)(T1,{id:`s3-secret-key`,label:`Secret access key`,fieldKey:`s3.secret_access_key`,values:e,onChange:t,disabled:n})]}),(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(X,{htmlFor:`s3-region`,children:`Region`}),(0,U.jsx)(Hv,{id:`s3-region`,placeholder:`us-east-1`,value:e[`s3.region`]??``,onChange:e=>t(`s3.region`,e.target.value),disabled:n})]}),(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(X,{htmlFor:`s3-bucket`,children:`Bucket`}),(0,U.jsx)(Hv,{id:`s3-bucket`,placeholder:`my-bucket`,value:e[`s3.bucket`]??``,onChange:e=>t(`s3.bucket`,e.target.value),disabled:n})]}),(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(X,{htmlFor:`s3-path-prefix`,children:`Path prefix`}),(0,U.jsx)(Hv,{id:`s3-path-prefix`,placeholder:`cms/media`,value:e[`s3.path_prefix`]??``,onChange:e=>t(`s3.path_prefix`,e.target.value),disabled:n}),(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Optional. Shared bucket subfolder.`})]})]}),(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(X,{htmlFor:`s3-public-url`,children:`Public URL`}),(0,U.jsx)(Hv,{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,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Optional. Leave blank to use the default S3 URL.`})]})]})}function D1({values:e,onChange:t,disabled:n=!1}){return(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(X,{htmlFor:`r2-access-key`,children:`Access key ID`}),(0,U.jsx)(Hv,{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,U.jsx)(T1,{id:`r2-secret-key`,label:`Secret access key`,fieldKey:`r2.secret_access_key`,values:e,onChange:t,disabled:n})]}),(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(X,{htmlFor:`r2-bucket`,children:`Bucket`}),(0,U.jsx)(Hv,{id:`r2-bucket`,placeholder:`my-bucket`,value:e[`r2.bucket`]??``,onChange:e=>t(`r2.bucket`,e.target.value),disabled:n})]}),(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(X,{htmlFor:`r2-path-prefix`,children:`Path prefix`}),(0,U.jsx)(Hv,{id:`r2-path-prefix`,placeholder:`cms/media`,value:e[`r2.path_prefix`]??``,onChange:e=>t(`r2.path_prefix`,e.target.value),disabled:n}),(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Optional. Shared bucket subfolder.`})]})]}),(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsxs)(X,{htmlFor:`r2-public-url`,children:[`Public URL `,(0,U.jsx)(`span`,{className:`text-destructive`,children:`*`})]}),(0,U.jsx)(Hv,{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,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Required. R2 does not generate public URLs automatically.`})]})]})}function O1(){let{user:e}=ga(),{data:t,loading:n}=wa(`/cms/admin/settings/media`),{loading:r,error:i,request:a}=Vv(),[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)}catch{}}return n?(0,U.jsxs)(`div`,{className:`flex items-center gap-2 py-8 text-muted-foreground`,children:[(0,U.jsx)(by,{className:`size-4`}),(0,U.jsx)(`span`,{className:`text-sm`,children:`Loading settings…`})]}):(0,U.jsxs)(`form`,{onSubmit:g,className:`space-y-8`,children:[(0,U.jsxs)(`div`,{className:`border-b pb-4`,children:[(0,U.jsx)(`h2`,{className:`text-2xl font-semibold`,children:`Storage`}),(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Configure where uploaded files are stored.`})]}),(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(X,{htmlFor:`provider`,children:`Storage provider`}),(0,U.jsxs)(Ow,{value:d,onValueChange:e=>h(e),children:[(0,U.jsx)(jw,{id:`provider`,disabled:!p,children:(0,U.jsx)(Aw,{})}),(0,U.jsxs)(Pw,{children:[(0,U.jsx)(Iw,{value:`local`,children:`Local`}),(0,U.jsx)(Iw,{value:`s3`,children:`Amazon S3`}),(0,U.jsx)(Iw,{value:`r2`,children:`Cloudflare R2`})]})]})]}),d===`r2`&&(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(X,{htmlFor:`r2-account-id`,children:`Account ID`}),(0,U.jsx)(Hv,{id:`r2-account-id`,placeholder:`023e105f4ecef8ad9ca31a8372d0c353`,value:u[`r2.account_id`]??``,onChange:e=>m(`r2.account_id`,e.target.value),disabled:!p}),(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Found in the Cloudflare dashboard under R2 > Overview.`})]})]}),(0,U.jsxs)(`div`,{className:`border-t pt-6`,children:[d===`local`&&(0,U.jsx)(w1,{values:u,onChange:m,disabled:!p}),d===`s3`&&(0,U.jsx)(E1,{values:u,onChange:m,disabled:!p}),d===`r2`&&(0,U.jsx)(D1,{values:u,onChange:m,disabled:!p})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,U.jsx)(J,{type:`submit`,disabled:r||!p,children:r?`Saving…`:`Save`}),c&&(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Changes saved.`}),i&&(0,U.jsx)(`p`,{className:`text-sm text-destructive`,children:i})]})]})}function k1({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`card`,className:q(`flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm`,e),...t})}function A1({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`card-header`,className:q(`@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 j1({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`card-title`,className:q(`leading-none font-semibold`,e),...t})}function M1({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`card-action`,className:q(`col-start-2 row-span-2 row-start-1 self-start justify-self-end`,e),...t})}function N1({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`card-content`,className:q(`px-6`,e),...t})}function P1(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 F1=e=>{switch(e){case`success`:return R1;case`info`:return B1;case`warning`:return z1;case`error`:return V1;default:return null}},I1=Array(12).fill(0),L1=({visible:e,className:t})=>v.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},v.createElement(`div`,{className:`sonner-spinner`},I1.map((e,t)=>v.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),R1=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`})),z1=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`})),B1=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`})),V1=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`})),H1=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`})),U1=()=>{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},W1=1,G1=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:W1++,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(q1(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||W1++;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}},K1=(e,t)=>{let n=t?.id||W1++;return G1.addToast({title:e,...t,id:n}),n},q1=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,J1=Object.assign(K1,{success:G1.success,info:G1.info,warning:G1.warning,error:G1.error,custom:G1.custom,message:G1.message,promise:G1.promise,dismiss:G1.dismiss,loading:G1.loading},{getHistory:()=>G1.toasts,getToasts:()=>G1.getActiveToasts()});P1(`[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 Y1(e){return e.label!==void 0}var X1=3,Z1=`24px`,Q1=`16px`,$1=4e3,e0=356,t0=14,n0=45,r0=200;function i0(...e){return e.filter(Boolean).join(` `)}function a0(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var o0=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||$1),H=v.useRef(null),ie=v.useRef(null),ae=c===0,oe=c+1<=o,se=n.type,ce=n.dismissible!==!1,le=n.className||``,ue=n.descriptionClassName||``,de=v.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),fe=v.useMemo(()=>n.closeButton??p,[n.closeButton,p]),pe=v.useMemo(()=>n.duration||b||$1,[n.duration,b]),me=v.useRef(0),he=v.useRef(0),ge=v.useRef(0),_e=v.useRef(null),[ve,ye]=x.split(`-`),be=v.useMemo(()=>s.reduce((e,t,n)=>n>=de?e:e+t.height,0),[s,de]),xe=U1(),Se=n.invert||t,Ce=se===`loading`;he.current=v.useMemo(()=>de*S+be,[de,be]),v.useEffect(()=>{V.current=pe},[pe]),v.useEffect(()=>{M(!0)},[]),v.useEffect(()=>{let e=ie.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=ie.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 we=v.useCallback(()=>{P(!0),z(he.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{d(n)},r0)},[n,d,a,he]);v.useEffect(()=>{if(n.promise&&se===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return u||i||xe?(()=>{if(ge.current<me.current){let e=new Date().getTime()-me.current;V.current-=e}ge.current=new Date().getTime()})():V.current!==1/0&&(me.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),we()},V.current)),()=>clearTimeout(e)},[u,i,n,se,xe,we]),v.useEffect(()=>{n.delete&&(we(),n.onDismiss==null||n.onDismiss.call(n,n))},[we,n.delete]);function Te(){return T?.loading?v.createElement(`div`,{className:i0(w?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":se===`loading`},T.loading):v.createElement(L1,{className:i0(w?.loader,n?.classNames?.loader),visible:se===`loading`})}let Ee=n.icon||T?.[se]||F1(se);return v.createElement(`li`,{tabIndex:0,ref:ie,className:i0(_,le,w?.toast,n?.classNames?.toast,w?.default,w?.[se],n?.classNames?.[se]),"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":oe,"data-y-position":ve,"data-x-position":ye,"data-index":c,"data-front":ae,"data-swiping":F,"data-dismissible":ce,"data-type":se,"data-invert":Se,"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:he.current}px`,"--initial-height":C?`auto`:`${B}px`,...m,...n.style},onDragEnd:()=>{I(!1),O(null),_e.current=null},onPointerDown:e=>{e.button!==2&&(Ce||!ce||(H.current=new Date,z(he.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(I(!0),_e.current={x:e.clientX,y:e.clientY})))},onPointerUp:()=>{if(L||!ce)return;_e.current=null;let e=Number(ie.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(ie.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-H.current?.getTime(),i=D===`x`?e:t,a=Math.abs(i)/r;if(Math.abs(i)>=n0||a>.11){z(he.current),n.onDismiss==null||n.onDismiss.call(n,n),A(D===`x`?e>0?`right`:`left`:t>0?`down`:`up`),we(),R(!0);return}else{var o,s;(o=ie.current)==null||o.style.setProperty(`--swipe-amount-x`,`0px`),(s=ie.current)==null||s.style.setProperty(`--swipe-amount-y`,`0px`)}te(!1),I(!1),O(null)},onPointerMove:t=>{var n,r;if(!_e.current||!ce||window.getSelection()?.toString().length>0)return;let i=t.clientY-_e.current.y,a=t.clientX-_e.current.x,o=e.swipeDirections??a0(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=ie.current)==null||n.style.setProperty(`--swipe-amount-x`,`${s.x}px`),(r=ie.current)==null||r.style.setProperty(`--swipe-amount-y`,`${s.y}px`)}},fe&&!n.jsx&&se!==`loading`?v.createElement(`button`,{"aria-label":E,"data-disabled":Ce,"data-close-button":!0,onClick:Ce||!ce?()=>{}:()=>{we(),n.onDismiss==null||n.onDismiss.call(n,n)},className:i0(w?.closeButton,n?.classNames?.closeButton)},T?.close??H1):null,(se||n.icon||n.promise)&&n.icon!==null&&(T?.[se]!==null||n.icon)?v.createElement(`div`,{"data-icon":``,className:i0(w?.icon,n?.classNames?.icon)},n.promise||n.type===`loading`&&!n.icon?n.icon||Te():null,n.type===`loading`?null:Ee):null,v.createElement(`div`,{"data-content":``,className:i0(w?.content,n?.classNames?.content)},v.createElement(`div`,{"data-title":``,className:i0(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:i0(y,ue,w?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),v.isValidElement(n.cancel)?n.cancel:n.cancel&&Y1(n.cancel)?v.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||h,onClick:e=>{Y1(n.cancel)&&ce&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),we())},className:i0(w?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,v.isValidElement(n.action)?n.action:n.action&&Y1(n.action)?v.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||g,onClick:e=>{Y1(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&we())},className:i0(w?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function s0(){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 c0(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?Q1:Z1;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 l0=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=X1,toastOptions:g,dir:_=s0(),gap:y=t0,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||G1.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return v.useEffect(()=>G1.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`?s0():_,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":`${e0}px`,"--gap":`${y}px`,...m,...c0(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(o0,{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}))}),u0={name:`@plank-cms/admin`,version:`0.20.1`,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`}},d0=[{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 f0(){let{user:e}=ga(),{data:t,loading:n}=wa(`/cms/admin/settings/general`),{request:r,loading:i}=Vv(),{request:a,loading:o}=Vv(),{request:s,loading:c}=Vv(),{refreshSettings:l}=ya(),[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(),J1.success(`Locales saved`)}catch{J1.error(`Could not save locales`)}}return n?(0,U.jsx)(by,{}):(0,U.jsxs)(`div`,{className:`space-y-6`,children:[(0,U.jsx)(k1,{children:(0,U.jsxs)(N1,{className:`flex items-center gap-4 py-2`,children:[(0,U.jsx)(`img`,{src:`/admin/plank-logo-w.svg`,alt:`Plank CMS`,className:`h-10 w-auto`}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`font-bold`,children:`Plank CMS by AM25`}),(0,U.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Version `,u0.version]})]})]})}),(0,U.jsxs)(`div`,{className:`border-b pb-4`,children:[(0,U.jsx)(`h2`,{className:`text-2xl font-semibold`,children:`Commons`}),(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`General settings that apply across the CMS.`})]}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(X,{htmlFor:`timezone`,children:`Timezone`}),(0,U.jsxs)(Ow,{value:u,onValueChange:e=>{d(e),(async()=>{try{await r(`/cms/admin/settings/general`,`PUT`,{timezone:e}),l(),J1.success(`Timezone saved`)}catch{J1.error(`Could not save timezone`)}})()},children:[(0,U.jsx)(jw,{id:`timezone`,className:`w-full`,disabled:!S,children:(0,U.jsx)(Aw,{})}),(0,U.jsx)(Pw,{className:`max-h-72`,children:d0.map(e=>(0,U.jsx)(Iw,{value:e.value,children:e.label},e.value))})]}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Used to display dates and times across the admin panel.`}),i&&(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Saving…`})]})]}),(0,U.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 md:grid-cols-2`,children:[(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(X,{children:`Locales`}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(Hv,{placeholder:`E.g. "en"`,value:g,onChange:e=>_(e.target.value),className:`h-9 w-full`,disabled:!S}),(0,U.jsx)(J,{variant:`outline`,className:`h-9`,disabled:!S,onClick:()=>{let e=g.trim().toLowerCase();e&&(f.includes(e)||p(t=>[...t,e]),_(``))},children:`Add`})]}),(0,U.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:f.map(e=>(0,U.jsx)(J,{variant:`ghost`,size:`sm`,onClick:()=>p(t=>t.filter(t=>t!==e)),disabled:!S,children:e.toUpperCase()},e))})]}),(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(X,{htmlFor:`default-locale`,children:`Default locale`}),(0,U.jsxs)(Ow,{value:m,onValueChange:h,children:[(0,U.jsx)(jw,{id:`default-locale`,className:`w-full`,disabled:!S,children:(0,U.jsx)(Aw,{})}),(0,U.jsx)(Pw,{className:`max-h-72`,children:f.length===0?(0,U.jsx)(Iw,{value:m,children:m}):f.map(e=>(0,U.jsx)(Iw,{value:e,children:e.toUpperCase()},e))})]}),(0,U.jsx)(`div`,{className:`pt-2 flex justify-end`,children:(0,U.jsx)(J,{variant:`outline`,onClick:C,disabled:o||!S,children:o?`Saving…`:`Save`})})]})]}),(0,U.jsx)(WO,{}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between rounded-md border p-3`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(X,{htmlFor:`editorial-mode`,children:`Editorial Mode`}),(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Enables Editor and Viewer workflows for editorial review.`})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,U.jsx)(rj,{id:`editorial-mode`,checked:y,onCheckedChange:e=>{b(e),(async()=>{try{await s(`/cms/admin/settings/general`,`PUT`,{editorial_mode:String(e)}),l(),J1.success(`Editorial Mode saved`)}catch{J1.error(`Could not save Editorial Mode`)}})()},disabled:!S}),c&&(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Saving…`})]})]})]})}function p0(){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(yy,{children:[(0,U.jsx)(`h1`,{className:`text-2xl font-bold -mt-2`,children:`Overview`}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`General configuration for your CMS instance.`})]}),(0,U.jsxs)($A,{defaultValue:`general`,className:`mt-24`,children:[(0,U.jsxs)(ej,{className:`mb-6`,children:[(0,U.jsx)(tj,{value:`general`,children:`General`}),(0,U.jsx)(tj,{value:`media`,children:`Media Library`})]}),(0,U.jsx)(nj,{value:`general`,children:(0,U.jsx)(f0,{})}),(0,U.jsx)(nj,{value:`media`,children:(0,U.jsx)(O1,{})})]})]})}function m0(e,t){return typeof e==`function`?e(t):e}function h0(e,t){return n=>{t.setState(t=>({...t,[e]:m0(n,t[e])}))}}function g0(e){return e instanceof Function}function _0(e){return Array.isArray(e)&&e.every(e=>typeof e==`number`)}function v0(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 y0(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`,`
220
+ font-size: .6rem;
221
+ font-weight: bold;
222
+ color: hsl(${Math.max(0,Math.min(120-120*r,120))}deg 100% 31%);`,n?.key)}return i}}function b0(e,t,n,r){return{debug:()=>e?.debugAll??e[t],key:!1,onChange:r}}function x0(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:y0(()=>[e,n,t,i],(e,t,n,r)=>({table:e,column:t,row:n,cell:r,getValue:r.getValue,renderValue:r.renderValue}),b0(e.options,`debugCells`,`cell.getContext`))};return e._features.forEach(r=>{r.createCell==null||r.createCell(i,n,t,e)},{}),i}function S0(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:y0(()=>[!0],()=>[c,...c.columns?.flatMap(e=>e.getFlatColumns())],b0(e.options,`debugColumns`,`column.getFlatColumns`)),getLeafColumns:y0(()=>[e._getOrderColumnsFn()],e=>{var t;return(t=c.columns)!=null&&t.length?e(c.columns.flatMap(e=>e.getLeafColumns())):[c]},b0(e.options,`debugColumns`,`column.getLeafColumns`))};for(let t of e._features)t.createColumn==null||t.createColumn(c,e);return c}var C0=`debugHeaders`;function w0(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 T0={createTable:e=>{e.getHeaderGroups=y0(()=>[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 E0(t,[...a,...s,...o],e)},b0(e.options,C0,`getHeaderGroups`)),e.getCenterHeaderGroups=y0(()=>[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))),E0(t,n,e,`center`)),b0(e.options,C0,`getCenterHeaderGroups`)),e.getLeftHeaderGroups=y0(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,r)=>E0(t,r?.map(e=>n.find(t=>t.id===e)).filter(Boolean)??[],e,`left`),b0(e.options,C0,`getLeftHeaderGroups`)),e.getRightHeaderGroups=y0(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,r)=>E0(t,r?.map(e=>n.find(t=>t.id===e)).filter(Boolean)??[],e,`right`),b0(e.options,C0,`getRightHeaderGroups`)),e.getFooterGroups=y0(()=>[e.getHeaderGroups()],e=>[...e].reverse(),b0(e.options,C0,`getFooterGroups`)),e.getLeftFooterGroups=y0(()=>[e.getLeftHeaderGroups()],e=>[...e].reverse(),b0(e.options,C0,`getLeftFooterGroups`)),e.getCenterFooterGroups=y0(()=>[e.getCenterHeaderGroups()],e=>[...e].reverse(),b0(e.options,C0,`getCenterFooterGroups`)),e.getRightFooterGroups=y0(()=>[e.getRightHeaderGroups()],e=>[...e].reverse(),b0(e.options,C0,`getRightFooterGroups`)),e.getFlatHeaders=y0(()=>[e.getHeaderGroups()],e=>e.map(e=>e.headers).flat(),b0(e.options,C0,`getFlatHeaders`)),e.getLeftFlatHeaders=y0(()=>[e.getLeftHeaderGroups()],e=>e.map(e=>e.headers).flat(),b0(e.options,C0,`getLeftFlatHeaders`)),e.getCenterFlatHeaders=y0(()=>[e.getCenterHeaderGroups()],e=>e.map(e=>e.headers).flat(),b0(e.options,C0,`getCenterFlatHeaders`)),e.getRightFlatHeaders=y0(()=>[e.getRightHeaderGroups()],e=>e.map(e=>e.headers).flat(),b0(e.options,C0,`getRightFlatHeaders`)),e.getCenterLeafHeaders=y0(()=>[e.getCenterFlatHeaders()],e=>e.filter(e=>{var t;return!((t=e.subHeaders)!=null&&t.length)}),b0(e.options,C0,`getCenterLeafHeaders`)),e.getLeftLeafHeaders=y0(()=>[e.getLeftFlatHeaders()],e=>e.filter(e=>{var t;return!((t=e.subHeaders)!=null&&t.length)}),b0(e.options,C0,`getLeftLeafHeaders`)),e.getRightLeafHeaders=y0(()=>[e.getRightFlatHeaders()],e=>e.filter(e=>{var t;return!((t=e.subHeaders)!=null&&t.length)}),b0(e.options,C0,`getRightLeafHeaders`)),e.getLeafHeaders=y0(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(e,t,n)=>[...e[0]?.headers??[],...t[0]?.headers??[],...n[0]?.headers??[]].map(e=>e.getLeafHeaders()).flat(),b0(e.options,C0,`getLeafHeaders`))}};function E0(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=w0(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)=>w0(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 D0=(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:()=>v0(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:y0(()=>[e.getAllLeafColumns()],t=>t.map(t=>x0(e,s,t,t.id)),b0(e.options,`debugRows`,`getAllCells`)),_getAllCellsByColumnId:y0(()=>[s.getAllCells()],e=>e.reduce((e,t)=>(e[t.column.id]=t,e),{}),b0(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},O0={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()}}},k0=(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))};k0.autoRemove=e=>z0(e);var A0=(e,t,n)=>{var r;return!!(!((r=e.getValue(t))==null||(r=r.toString())==null)&&r.includes(n))};A0.autoRemove=e=>z0(e);var j0=(e,t,n)=>{var r;return((r=e.getValue(t))==null||(r=r.toString())==null?void 0:r.toLowerCase())===n?.toLowerCase()};j0.autoRemove=e=>z0(e);var M0=(e,t,n)=>e.getValue(t)?.includes(n);M0.autoRemove=e=>z0(e);var N0=(e,t,n)=>!n.some(n=>{var r;return!((r=e.getValue(t))!=null&&r.includes(n))});N0.autoRemove=e=>z0(e)||!(e!=null&&e.length);var P0=(e,t,n)=>n.some(n=>e.getValue(t)?.includes(n));P0.autoRemove=e=>z0(e)||!(e!=null&&e.length);var F0=(e,t,n)=>e.getValue(t)===n;F0.autoRemove=e=>z0(e);var I0=(e,t,n)=>e.getValue(t)==n;I0.autoRemove=e=>z0(e);var L0=(e,t,n)=>{let[r,i]=n,a=e.getValue(t);return a>=r&&a<=i};L0.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]},L0.autoRemove=e=>z0(e)||z0(e[0])&&z0(e[1]);var R0={includesString:k0,includesStringSensitive:A0,equalsString:j0,arrIncludes:M0,arrIncludesAll:N0,arrIncludesSome:P0,equals:F0,weakEquals:I0,inNumberRange:L0};function z0(e){return e==null||e===``}var B0={getDefaultColumnDef:()=>({filterFn:`auto`}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:h0(`columnFilters`,e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{let n=t.getCoreRowModel().flatRows[0]?.getValue(e.id);return typeof n==`string`?R0.includesString:typeof n==`number`?R0.inNumberRange:typeof n==`boolean`||typeof n==`object`&&n?R0.equals:Array.isArray(n)?R0.arrIncludes:R0.weakEquals},e.getFilterFn=()=>g0(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn===`auto`?e.getAutoFilterFn():t.options.filterFns?.[e.columnDef.filterFn]??R0[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=m0(n,i?i.value:void 0);if(V0(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=>m0(t,e)?.filter(e=>{let t=n.find(t=>t.id===e.id);return!(t&&V0(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 V0(e,t,n){return(e&&e.autoRemove?e.autoRemove(t,n):!1)||t===void 0||typeof t==`string`&&!t}var H0={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(!_0(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},U0={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:h0(`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 H0.sum;if(Object.prototype.toString.call(n)===`[object Date]`)return H0.extent},e.getAggregationFn=()=>{if(!e)throw Error();return g0(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn===`auto`?e.getAutoAggregationFn():t.options.aggregationFns?.[e.columnDef.aggregationFn]??H0[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 W0(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 G0={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:h0(`columnOrder`,e)}),createColumn:(e,t)=>{e.getIndex=y0(e=>[n2(t,e)],t=>t.findIndex(t=>t.id===e.id),b0(t.options,`debugColumns`,`getIndex`)),e.getIsFirstColumn=n=>n2(t,n)[0]?.id===e.id,e.getIsLastColumn=n=>{let r=n2(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=y0(()=>[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 W0(i,t,n)},b0(e.options,`debugTable`,`_getOrderColumnsFn`))}},K0=()=>({left:[],right:[]}),q0={getInitialState:e=>({columnPinning:K0(),...e}),getDefaultOptions:e=>({onColumnPinningChange:h0(`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=y0(()=>[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))},b0(t.options,`debugRows`,`getCenterVisibleCells`)),e.getLeftVisibleCells=y0(()=>[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`})),b0(t.options,`debugRows`,`getLeftVisibleCells`)),e.getRightVisibleCells=y0(()=>[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`})),b0(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?K0():e.initialState?.columnPinning??K0()),e.getIsSomeColumnsPinned=t=>{let n=e.getState().columnPinning;return t?!!n[t]?.length:!!(n.left?.length||n.right?.length)},e.getLeftLeafColumns=y0(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(e,t)=>(t??[]).map(t=>e.find(e=>e.id===t)).filter(Boolean),b0(e.options,`debugColumns`,`getLeftLeafColumns`)),e.getRightLeafColumns=y0(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(e,t)=>(t??[]).map(t=>e.find(e=>e.id===t)).filter(Boolean),b0(e.options,`debugColumns`,`getRightLeafColumns`)),e.getCenterLeafColumns=y0(()=>[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))},b0(e.options,`debugColumns`,`getCenterLeafColumns`))}};function J0(e){return e||(typeof document<`u`?document:null)}var Y0={size:150,minSize:20,maxSize:2**53-1},X0=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),Z0={getDefaultColumnDef:()=>Y0,getInitialState:e=>({columnSizing:{},columnSizingInfo:X0(),...e}),getDefaultOptions:e=>({columnResizeMode:`onEnd`,columnResizeDirection:`ltr`,onColumnSizingChange:h0(`columnSizing`,e),onColumnSizingInfoChange:h0(`columnSizingInfo`,e)}),createColumn:(e,t)=>{e.getSize=()=>{let n=t.getState().columnSizing[e.id];return Math.min(Math.max(e.columnDef.minSize??Y0.minSize,n??e.columnDef.size??Y0.size),e.columnDef.maxSize??Y0.maxSize)},e.getStart=y0(e=>[e,n2(t,e),t.getState().columnSizing],(t,n)=>n.slice(0,e.getIndex(t)).reduce((e,t)=>e+t.getSize(),0),b0(t.options,`debugColumns`,`getStart`)),e.getAfter=y0(e=>[e,n2(t,e),t.getState().columnSizing],(t,n)=>n.slice(e.getIndex(t)+1).reduce((e,t)=>e+t.getSize(),0),b0(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(),e2(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=e2(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=J0(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=$0()?{passive:!1}:!1;e2(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?X0():e.initialState.columnSizingInfo??X0())},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}},Q0=null;function $0(){if(typeof Q0==`boolean`)return Q0;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 Q0=e,Q0}function e2(e){return e.type===`touchstart`}var t2={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:h0(`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=y0(()=>[e.getAllCells(),t.getState().columnVisibility],e=>e.filter(e=>e.column.getIsVisible()),b0(t.options,`debugRows`,`_getAllVisibleCells`)),e.getVisibleCells=y0(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(e,t,n)=>[...e,...t,...n],b0(t.options,`debugRows`,`getVisibleCells`))},createTable:e=>{let t=(t,n)=>y0(()=>[n(),n().filter(e=>e.getIsVisible()).map(e=>e.id).join(`_`)],e=>e.filter(e=>e.getIsVisible==null?void 0:e.getIsVisible()),b0(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 n2(e,t){return t?t===`center`?e.getCenterVisibleLeafColumns():t===`left`?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}var r2={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()}}},i2={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:h0(`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=()=>R0.includesString,e.getGlobalFilterFn=()=>{let{globalFilterFn:t}=e.options;return g0(t)?t:t===`auto`?e.getGlobalAutoFilterFn():e.options.filterFns?.[t]??R0[t]},e.setGlobalFilter=t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},a2={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:h0(`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()}}}},o2=0,s2=10,c2=()=>({pageIndex:o2,pageSize:s2}),l2={getInitialState:e=>({...e,pagination:{...c2(),...e?.pagination}}),getDefaultOptions:e=>({onPaginationChange:h0(`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=>m0(t,e)),e.resetPagination=t=>{e.setPagination(t?c2():e.initialState.pagination??c2())},e.setPageIndex=t=>{e.setPagination(n=>{let r=m0(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?o2:((n=e.initialState)==null||(n=n.pagination)==null?void 0:n.pageIndex)??o2)},e.resetPageSize=t=>{var n;e.setPageSize(t?s2:((n=e.initialState)==null||(n=n.pagination)==null?void 0:n.pageSize)??s2)},e.setPageSize=t=>{e.setPagination(e=>{let n=Math.max(1,m0(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=m0(t,e.options.pageCount??-1);return typeof r==`number`&&(r=Math.max(-1,r)),{...n,pageCount:r}}),e.getPageOptions=y0(()=>[e.getPageCount()],e=>{let t=[];return e&&e>0&&(t=[...Array(e)].fill(null).map((e,t)=>t)),t},b0(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}},u2=()=>({top:[],bottom:[]}),d2={getInitialState:e=>({rowPinning:u2(),...e}),getDefaultOptions:e=>({onRowPinningChange:h0(`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?u2():e.initialState?.rowPinning??u2()),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=y0(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,n)=>e._getPinnedRows(t,n,`top`),b0(e.options,`debugRows`,`getTopRows`)),e.getBottomRows=y0(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,n)=>e._getPinnedRows(t,n,`bottom`),b0(e.options,`debugRows`,`getBottomRows`)),e.getCenterRows=y0(()=>[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))},b0(e.options,`debugRows`,`getCenterRows`))}},f2={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:h0(`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=>{p2(i,t.id,r,!0,e)}),i}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=y0(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?m2(e,n):{rows:[],flatRows:[],rowsById:{}},b0(e.options,`debugTable`,`getSelectedRowModel`)),e.getFilteredSelectedRowModel=y0(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?m2(e,n):{rows:[],flatRows:[],rowsById:{}},b0(e.options,`debugTable`,`getFilteredSelectedRowModel`)),e.getGroupedSelectedRowModel=y0(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?m2(e,n):{rows:[],flatRows:[],rowsById:{}},b0(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 p2(o,e.id,n,r?.selectChildren??!0,t),o})},e.getIsSelected=()=>{let{rowSelection:n}=t.getState();return h2(e,n)},e.getIsSomeSelected=()=>{let{rowSelection:n}=t.getState();return g2(e,n)===`some`},e.getIsAllSubRowsSelected=()=>{let{rowSelection:n}=t.getState();return g2(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)}}}},p2=(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=>p2(e,t.id,n,r,i))};function m2(e,t){let n=e.getState().rowSelection,r=[],i={},a=function(e,t){return e.map(e=>{var t;let o=h2(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 h2(e,t){return t[e.id]??!1}function g2(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()&&(h2(e,t)?a=!0:i=!1),e.subRows&&e.subRows.length)){let n=g2(e,t);n===`all`?a=!0:(n===`some`&&(a=!0),i=!1)}}),i?`all`:a?`some`:!1}var _2=/([0-9]+)/gm,v2=(e,t,n)=>E2(T2(e.getValue(n)).toLowerCase(),T2(t.getValue(n)).toLowerCase()),y2=(e,t,n)=>E2(T2(e.getValue(n)),T2(t.getValue(n))),b2=(e,t,n)=>w2(T2(e.getValue(n)).toLowerCase(),T2(t.getValue(n)).toLowerCase()),x2=(e,t,n)=>w2(T2(e.getValue(n)),T2(t.getValue(n))),S2=(e,t,n)=>{let r=e.getValue(n),i=t.getValue(n);return r>i?1:r<i?-1:0},C2=(e,t,n)=>w2(e.getValue(n),t.getValue(n));function w2(e,t){return e===t?0:e>t?1:-1}function T2(e){return typeof e==`number`?isNaN(e)||e===1/0||e===-1/0?``:String(e):typeof e==`string`?e:``}function E2(e,t){let n=e.split(_2).filter(Boolean),r=t.split(_2).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 D2={alphanumeric:v2,alphanumericCaseSensitive:y2,text:b2,textCaseSensitive:x2,datetime:S2,basic:C2},O2=[T0,t2,G0,q0,O0,B0,r2,i2,{getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:`auto`,sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:h0(`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 D2.datetime;if(typeof n==`string`&&(r=!0,n.split(_2).length>1))return D2.alphanumeric}return r?D2.text:D2.basic},e.getAutoSortDir=()=>typeof t.getFilteredRowModel().flatRows[0]?.getValue(e.id)==`string`?`asc`:`desc`,e.getSortingFn=()=>{if(!e)throw Error();return g0(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn===`auto`?e.getAutoSortingFn():t.options.sortingFns?.[e.columnDef.sortingFn]??D2[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())}},U0,a2,l2,d2,f2,Z0];function k2(e){let t=[...O2,...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(m0(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:y0(()=>[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}),b0(e,`debugColumns`,`_getDefaultColumnDef`)),_getColumnDefs:()=>n.options.columns,getAllColumns:y0(()=>[n._getColumnDefs()],e=>{let t=function(e,r,i){return i===void 0&&(i=0),e.map(e=>{let a=S0(n,e,i,r),o=e;return a.columns=o.columns?t(o.columns,a,i+1):[],a})};return t(e)},b0(e,`debugColumns`,`getAllColumns`)),getAllFlatColumns:y0(()=>[n.getAllColumns()],e=>e.flatMap(e=>e.getFlatColumns()),b0(e,`debugColumns`,`getAllFlatColumns`)),_getAllFlatColumnsById:y0(()=>[n.getAllFlatColumns()],e=>e.reduce((e,t)=>(e[t.id]=t,e),{}),b0(e,`debugColumns`,`getAllFlatColumnsById`)),getAllLeafColumns:y0(()=>[n.getAllColumns(),n._getOrderColumnsFn()],(e,t)=>t(e.flatMap(e=>e.getLeafColumns())),b0(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 A2(){return e=>y0(()=>[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=D0(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},b0(e.options,`debugTable`,`getRowModel`,()=>e._autoResetPageIndex()))}function j2(e,t){return e?M2(e)?v.createElement(e,t):e:null}function M2(e){return N2(e)||typeof e==`function`||P2(e)}function N2(e){return typeof e==`function`&&(()=>{let t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function P2(e){return typeof e==`object`&&typeof e.$$typeof==`symbol`&&[`react.memo`,`react.forward_ref`].includes(e.$$typeof.description)}function F2(e){let t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=v.useState(()=>({current:k2(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 I2={"super admin":`default`,admin:`secondary`,contributor:`outline`,editor:`secondary`,viewer:`outline`};function L2({roleId:e,roleName:t,roles:n}){let r=n.find(t=>t.id===e),i=t??r?.name??e;return(0,U.jsx)(vw,{variant:I2[i.toLowerCase()]??`secondary`,children:i})}function R2({user:e,currentUserId:t,currentUserRole:n,onEdit:r,onDelete:i}){let a=e.id===t,o=(e.role_name??``).toLowerCase()===`super admin`,s=n.toLowerCase()===`super admin`;return(0,U.jsxs)(`div`,{className:`flex items-center justify-end gap-1`,children:[(0,U.jsx)(J,{size:`icon`,variant:`ghost`,className:`flex size-7 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-accent-foreground`,disabled:o&&!a&&!s,onClick:()=>r(e),children:(0,U.jsx)(No,{className:`size-3.5`})}),(0,U.jsx)(J,{size:`icon`,variant:`ghost`,className:`flex size-8 items-center justify-center rounded text-destructive hover:bg-destructive/10 hover:text-destructive`,disabled:a||o,onClick:()=>i(e),children:(0,U.jsx)(qo,{className:`size-3.5`})})]})}var z2={email:``,password:``,roleId:``,enabled:!0};function B2(){let{user:e,updateUser:t}=ga(),{editorialMode:n}=ya(),{data:r,loading:i,refetch:a}=wa(`/cms/admin/users`),{data:o,loading:s}=wa(`/cms/admin/roles`),c=i||s,{request:l,loading:u,error:d}=Vv(),[f,p]=(0,v.useState)(!1),[m,h]=(0,v.useState)(z2),[g,_]=(0,v.useState)(null),[y,b]=(0,v.useState)({email:``,roleId:``,firstName:``,lastName:``,enabled:!0}),[x,S]=(0,v.useState)(null),C=o??[],w=e?.role?.toLowerCase()===`super admin`,T=C.filter(e=>n||![`Editor`,`Viewer`].includes(e.name)),E=w?T:T.filter(e=>e.name.toLowerCase()!==`super admin`),D=(0,v.useMemo)(()=>[{id:`name`,header:`Name`,cell:({row:e})=>{let{first_name:t,last_name:n}=e.original;return!t&&!n?(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):(0,U.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,U.jsx)(L2,{roleId:t(),roleName:e.original.role_name,roles:C})},{accessorKey:`enabled`,header:`Enabled`,cell:({row:t,getValue:n})=>(0,U.jsx)(rj,{checked:!!(n()??!0),onCheckedChange:async e=>{try{await l(`/cms/admin/users/${t.original.id}`,`PUT`,{enabled:e}),a()}catch{}},disabled:t.original.id===e?.id||u})},{id:`actions`,header:``,cell:({row:t})=>(0,U.jsx)(R2,{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})},onDelete:S})}],[C,e?.id,e?.role,l,a,u]),O=F2({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:D,getCoreRowModel:A2()});async function k(e){e.preventDefault();try{await l(`/cms/admin/users`,`POST`,m),p(!1),h(z2),a()}catch{}}async function A(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()}catch{}}async function j(){try{await l(`/cms/admin/users/${x.id}`,`DELETE`),S(null),a()}catch{}}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(yy,{children:(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h1`,{className:`text-2xl font-bold -mt-2`,children:`Users`}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Manage who has access to the admin panel.`})]}),(0,U.jsxs)(J,{onClick:()=>p(!0),children:[(0,U.jsx)(Po,{className:`size-4`}),`New user`]})]})}),(0,U.jsxs)(`section`,{className:`mt-24`,children:[(0,U.jsx)(`div`,{className:`rounded-md border`,children:(0,U.jsxs)(Rw,{children:[(0,U.jsx)(zw,{className:`font-bold uppercase`,children:O.getHeaderGroups().map(e=>(0,U.jsx)(Vw,{className:`hover:bg-transparent`,children:e.headers.map(e=>(0,U.jsx)(Hw,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:j2(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,U.jsx)(Bw,{children:c?(0,U.jsx)(Vw,{children:(0,U.jsx)(Uw,{colSpan:D.length,className:`h-24`,children:(0,U.jsx)(by,{className:`mx-auto size-5`})})}):O.getRowModel().rows.length===0?(0,U.jsx)(Vw,{children:(0,U.jsx)(Uw,{colSpan:D.length,className:`h-24 text-center text-muted-foreground`,children:`No users found.`})}):O.getRowModel().rows.map(e=>(0,U.jsx)(Vw,{children:e.getVisibleCells().map(e=>(0,U.jsx)(Uw,{className:`px-4 py-3`,children:j2(e.column.columnDef.cell,e.getContext())},e.id))},e.id))})]})}),(0,U.jsx)(yw,{open:f,onOpenChange:p,children:(0,U.jsxs)(Cw,{className:`sm:max-w-md`,children:[(0,U.jsx)(ww,{children:(0,U.jsx)(Ew,{children:`New user`})}),(0,U.jsxs)(`form`,{id:`create-user-form`,onSubmit:k,className:`flex flex-col gap-4`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(X,{htmlFor:`c-email`,children:`Email`}),(0,U.jsx)(Hv,{id:`c-email`,type:`email`,placeholder:`user@example.com`,value:m.email,onChange:e=>h(t=>({...t,email:e.target.value})),required:!0})]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(X,{htmlFor:`c-password`,children:`Password`}),(0,U.jsx)(Hv,{id:`c-password`,type:`password`,placeholder:`Min. 8 characters`,value:m.password,onChange:e=>h(t=>({...t,password:e.target.value})),required:!0})]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(X,{htmlFor:`c-role`,children:`Role`}),(0,U.jsxs)(Ow,{value:m.roleId,onValueChange:e=>h(t=>({...t,roleId:e})),children:[(0,U.jsx)(jw,{id:`c-role`,children:(0,U.jsx)(Aw,{placeholder:`Select a role`})}),(0,U.jsx)(Pw,{children:E.map(e=>(0,U.jsx)(Iw,{value:e.id,children:e.name.charAt(0).toUpperCase()+e.name.slice(1)},e.id))})]})]}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between rounded-md border p-3`,children:[(0,U.jsx)(X,{htmlFor:`c-enabled`,children:`Enabled`}),(0,U.jsx)(rj,{id:`c-enabled`,checked:m.enabled,onCheckedChange:e=>h(t=>({...t,enabled:e}))})]}),d&&(0,U.jsx)(`p`,{className:`text-sm text-destructive`,children:d})]}),(0,U.jsxs)(Tw,{children:[(0,U.jsx)(J,{variant:`outline`,type:`button`,onClick:()=>p(!1),children:`Cancel`}),(0,U.jsx)(J,{type:`submit`,form:`create-user-form`,disabled:u,children:u?`Creating…`:`Create user`})]})]})}),(0,U.jsx)(yw,{open:!!g,onOpenChange:e=>{e||_(null)},children:(0,U.jsxs)(Cw,{className:`sm:max-w-md`,children:[(0,U.jsx)(ww,{children:(0,U.jsx)(Ew,{children:`Edit user`})}),(0,U.jsxs)(`form`,{id:`edit-user-form`,onSubmit:A,className:`flex flex-col gap-4`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(X,{htmlFor:`e-email`,children:`Email`}),(0,U.jsx)(Hv,{id:`e-email`,type:`email`,value:y.email,onChange:e=>b(t=>({...t,email:e.target.value})),required:!0})]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(X,{htmlFor:`e-fname`,children:`First name`}),(0,U.jsx)(Hv,{id:`e-fname`,value:y.firstName,onChange:e=>b(t=>({...t,firstName:e.target.value}))})]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(X,{htmlFor:`e-lname`,children:`Last name`}),(0,U.jsx)(Hv,{id:`e-lname`,value:y.lastName,onChange:e=>b(t=>({...t,lastName:e.target.value}))})]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(X,{htmlFor:`e-role`,children:`Role`}),(0,U.jsxs)(Ow,{value:y.roleId,onValueChange:e=>b(t=>({...t,roleId:e})),children:[(0,U.jsx)(jw,{id:`e-role`,children:(0,U.jsx)(Aw,{placeholder:`Select a role`})}),(0,U.jsx)(Pw,{children:E.map(e=>(0,U.jsx)(Iw,{value:e.id,children:e.name.charAt(0).toUpperCase()+e.name.slice(1)},e.id))})]})]}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between rounded-md border p-3`,children:[(0,U.jsx)(X,{htmlFor:`e-enabled`,children:`Enabled`}),(0,U.jsx)(rj,{id:`e-enabled`,checked:y.enabled,onCheckedChange:e=>b(t=>({...t,enabled:e}))})]}),d&&(0,U.jsx)(`p`,{className:`text-sm text-destructive`,children:d})]}),(0,U.jsxs)(Tw,{children:[(0,U.jsx)(J,{variant:`outline`,type:`button`,onClick:()=>_(null),children:`Cancel`}),(0,U.jsx)(J,{type:`submit`,form:`edit-user-form`,disabled:u,children:u?`Saving…`:`Save changes`})]})]})}),(0,U.jsx)(yw,{open:!!x,onOpenChange:e=>{e||S(null)},children:(0,U.jsxs)(Cw,{className:`sm:max-w-sm`,children:[(0,U.jsx)(ww,{children:(0,U.jsx)(Ew,{children:`Delete user`})}),(0,U.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Are you sure you want to delete`,` `,(0,U.jsx)(`span`,{className:`font-medium text-foreground`,children:x?.email}),`? This action cannot be undone.`]}),d&&(0,U.jsx)(`p`,{className:`text-sm text-destructive`,children:d}),(0,U.jsxs)(Tw,{children:[(0,U.jsx)(J,{variant:`outline`,onClick:()=>S(null),children:`Cancel`}),(0,U.jsx)(J,{variant:`destructive`,onClick:j,disabled:u,children:u?`Deleting…`:`Delete`})]})]})})]})]})}var V2=[{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:`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`]}],H2=[{key:`read`,label:`R`},{key:`write`,label:`W`},{key:`delete`,label:`D`}],U2=[`Super Admin`,`Admin`,`Editor`,`Contributor`],W2=`w-44 min-w-44 max-w-44`;function G2(e){return Object.fromEntries(e.map(e=>[e.id,new Set(e.permissions)]))}function K2(e,t){return e.includes(t)}function q2(){let{user:e}=ga(),{editorialMode:t}=ya(),{data:n,loading:r,refetch:i}=wa(`/cms/admin/roles`),{request:a,loading:o}=Vv(),[s,c]=(0,v.useState)({}),[l,u]=(0,v.useState)(new Set),[d,f]=(0,v.useState)(!1);(0,v.useEffect)(()=>{n&&c(G2(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){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})}async function h(){await a(`/cms/admin/roles/reset`,`POST`),f(!1),u(new Set),i()}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=U2.indexOf(e.name),r=U2.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,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(yy,{children:(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h1`,{className:`text-2xl font-bold -mt-2`,children:`Roles`}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Configure what each role can do across the CMS.`})]}),g&&(0,U.jsxs)(J,{variant:`outline`,onClick:()=>f(!0),children:[(0,U.jsx)(Io,{className:`size-4`}),`Reset defaults`]})]})}),(0,U.jsxs)(`section`,{className:`mt-24`,children:[(0,U.jsx)(`div`,{className:`rounded-md border`,children:(0,U.jsxs)(Rw,{children:[(0,U.jsxs)(zw,{children:[(0,U.jsxs)(Vw,{className:`hover:bg-transparent`,children:[(0,U.jsx)(Hw,{className:`w-40`,rowSpan:2}),y&&(0,U.jsx)(Hw,{colSpan:3,className:`border-l text-center ${W2}`,children:y.name}),_.map(e=>(0,U.jsx)(Hw,{colSpan:3,className:`border-l ${W2}`,children:(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,U.jsx)(`span`,{children:e.name}),(0,U.jsxs)(J,{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,U.jsx)(Lo,{className:`size-3`}),`Save`]})]})},e.id))]}),(0,U.jsxs)(Vw,{className:`hover:bg-transparent`,children:[y&&H2.map((e,t)=>(0,U.jsx)(Hw,{className:`w-12 text-center font-normal ${t===0?`border-l`:``}`,children:e.label},e.key)),_.map(e=>H2.map((t,n)=>(0,U.jsx)(Hw,{className:`w-12 text-center font-normal ${n===0?`border-l`:``}`,children:t.label},`${e.id}-${t.key}`)))]})]}),(0,U.jsx)(Bw,{children:r?(0,U.jsx)(Vw,{children:(0,U.jsx)(Uw,{colSpan:99,className:`h-24`,children:(0,U.jsx)(by,{className:`mx-auto size-5`})})}):V2.map(({key:e,label:t,actions:n})=>(0,U.jsxs)(Vw,{children:[(0,U.jsx)(Uw,{className:`font-medium`,children:t}),y&&H2.map((e,t)=>(0,U.jsx)(Uw,{className:`text-center ${t===0?`border-l`:``}`,children:K2(n,e.key)?(0,U.jsx)(EO,{checked:!0,disabled:!0}):(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})},e.key)),_.map(t=>H2.map((r,i)=>{let a=K2(n,r.key),o=`${e}:${r.key}`;return(0,U.jsx)(Uw,{className:`text-center ${i===0?`border-l`:``}`,children:a?(0,U.jsx)(EO,{checked:s[t.id]?.has(o)??!1,onCheckedChange:()=>p(t.id,o)}):(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})},`${t.id}-${r.key}`)}))]},e))})]})}),t&&(0,U.jsxs)(`div`,{className:`mt-3 rounded-md border bg-muted/30 p-3`,children:[(0,U.jsx)(`p`,{className:`text-sm font-medium`,children:`Viewer`}),(0,U.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,U.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,U.jsx)(yw,{open:d,onOpenChange:f,children:(0,U.jsxs)(Cw,{className:`sm:max-w-sm`,children:[(0,U.jsx)(ww,{children:(0,U.jsx)(Ew,{children:`Reset to defaults`})}),(0,U.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,U.jsxs)(Tw,{children:[(0,U.jsx)(J,{variant:`outline`,onClick:()=>f(!1),children:`Cancel`}),(0,U.jsx)(J,{variant:`destructive`,onClick:h,disabled:o,children:o?`Resetting…`:`Reset`})]})]})})]})]})}var J2={"full-access":`default`,"read-only":`secondary`},Y2={"full-access":`Full access`,"read-only":`Read only`};function X2({value:e}){let[t,n]=(0,v.useState)(!1);function r(){navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),2e3)}return(0,U.jsx)(J,{type:`button`,size:`icon`,variant:`outline`,className:`shrink-0`,onClick:r,children:t?(0,U.jsx)(za,{className:`size-4 text-green-500`}):(0,U.jsx)(Za,{className:`size-4`})})}var Z2={name:``,accessType:``};function Q2(){let{user:e}=ga(),{data:t,loading:n,refetch:r}=wa(`/cms/admin/api-tokens`),{request:i,loading:a,error:o}=Vv(),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)(Z2),[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,U.jsx)(vw,{variant:J2[t]??`secondary`,children:Y2[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,U.jsx)(J,{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,U.jsx)(qo,{className:`size-3.5`})}):null}],b=F2({data:t??[],columns:y,getCoreRowModel:A2()});async function x(e){e.preventDefault();try{h(await i(`/cms/admin/api-tokens`,`POST`,{name:f.name,accessType:f.accessType})),r()}catch{}}function S(){d(!1),h(null),p(Z2)}async function C(){try{await i(`/cms/admin/api-tokens/${g.id}`,`DELETE`),_(null),r()}catch{}}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(yy,{children:(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h1`,{className:`text-2xl font-bold -mt-2`,children:`API Tokens`}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Manage tokens for consuming the public API.`})]}),(0,U.jsxs)(J,{onClick:()=>d(!0),disabled:!c,children:[(0,U.jsx)(Po,{className:`size-4`}),`New token`]})]})}),(0,U.jsxs)(`section`,{className:`mt-24`,children:[(0,U.jsx)(`div`,{className:`rounded-md border`,children:(0,U.jsxs)(Rw,{children:[(0,U.jsx)(zw,{className:`font-bold uppercase`,children:b.getHeaderGroups().map(e=>(0,U.jsx)(Vw,{className:`hover:bg-transparent`,children:e.headers.map(e=>(0,U.jsx)(Hw,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:j2(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,U.jsx)(Bw,{children:n?(0,U.jsx)(Vw,{children:(0,U.jsx)(Uw,{colSpan:y.length,className:`h-24`,children:(0,U.jsx)(by,{className:`mx-auto size-5`})})}):b.getRowModel().rows.length===0?(0,U.jsx)(Vw,{children:(0,U.jsx)(Uw,{colSpan:y.length,className:`h-24 text-center text-muted-foreground`,children:`No tokens yet.`})}):b.getRowModel().rows.map(e=>(0,U.jsx)(Vw,{children:e.getVisibleCells().map(e=>(0,U.jsx)(Uw,{className:`px-4 py-3`,children:j2(e.column.columnDef.cell,e.getContext())},e.id))},e.id))})]})}),(0,U.jsx)(yw,{open:u,onOpenChange:e=>{e||S()},children:(0,U.jsx)(Cw,{className:`sm:max-w-md`,children:m?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(ww,{children:(0,U.jsx)(Ew,{children:`Token generated`})}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,U.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,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(X,{children:`Token`}),(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsx)(Hv,{readOnly:!0,value:m.token,className:`font-mono text-xs`}),(0,U.jsx)(X2,{value:m.token})]})]})]}),(0,U.jsx)(Tw,{children:(0,U.jsx)(J,{onClick:S,children:`Done`})})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(ww,{children:(0,U.jsx)(Ew,{children:`New API token`})}),(0,U.jsxs)(`form`,{id:`create-token-form`,onSubmit:x,className:`flex flex-col gap-4`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(X,{htmlFor:`token-name`,children:`Name`}),(0,U.jsx)(Hv,{id:`token-name`,placeholder:`e.g. Production frontend`,value:f.name,onChange:e=>p(t=>({...t,name:e.target.value})),required:!0})]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(X,{htmlFor:`token-access`,children:`Access type`}),(0,U.jsxs)(Ow,{value:f.accessType,onValueChange:e=>p(t=>({...t,accessType:e})),children:[(0,U.jsx)(jw,{id:`token-access`,children:(0,U.jsx)(Aw,{placeholder:`Select access type`})}),(0,U.jsxs)(Pw,{children:[(0,U.jsx)(Iw,{value:`read-only`,children:`Read only`}),(0,U.jsx)(Iw,{value:`full-access`,children:`Full access`})]})]})]}),o&&(0,U.jsx)(`p`,{className:`text-sm text-destructive`,children:o})]}),(0,U.jsxs)(Tw,{children:[(0,U.jsx)(J,{variant:`outline`,type:`button`,onClick:S,children:`Cancel`}),(0,U.jsx)(J,{type:`submit`,form:`create-token-form`,disabled:a||!f.accessType||!c,children:a?`Generating…`:`Generate token`})]})]})})}),(0,U.jsx)(yw,{open:!!g,onOpenChange:e=>{e||_(null)},children:(0,U.jsxs)(Cw,{className:`sm:max-w-sm`,children:[(0,U.jsx)(ww,{children:(0,U.jsx)(Ew,{children:`Revoke token`})}),(0,U.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Are you sure you want to revoke`,` `,(0,U.jsx)(`span`,{className:`font-medium text-foreground`,children:g?.name}),`? Any frontend using it will immediately lose access.`]}),(0,U.jsxs)(Tw,{children:[(0,U.jsx)(J,{variant:`outline`,onClick:()=>_(null),children:`Cancel`}),(0,U.jsx)(J,{variant:`destructive`,onClick:C,disabled:a||!l,children:a?`Revoking…`:`Revoke`})]})]})})]})]})}var $2=[{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`}],e4={name:``,url:``,events:[]};function t4(){let{user:e}=ga(),{data:t,loading:n,refetch:r}=wa(`/cms/admin/webhooks`),{request:i,loading:a,error:o}=Vv(),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)(e4),[m,h]=(0,v.useState)(null),g=[{accessorKey:`name`,header:`Name`},{accessorKey:`url`,header:`URL`,cell:({getValue:e})=>(0,U.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,U.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e().map(e=>(0,U.jsx)(vw,{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,U.jsx)(J,{size:`icon`,variant:`ghost`,className:`size-8 text-destructive hover:text-destructive`,onClick:()=>h(e.original),children:(0,U.jsx)(qo,{className:`size-3.5`})}):null}],_=F2({data:t??[],columns:g,getCoreRowModel:A2()});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(e4),r()}catch{}}async function x(){try{await i(`/cms/admin/webhooks/${m.id}`,`DELETE`),h(null),r()}catch{}}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(yy,{children:(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h1`,{className:`text-2xl font-bold -mt-2`,children:`Webhooks`}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Notify external services when content events occur.`})]}),(0,U.jsxs)(J,{onClick:()=>d(!0),disabled:!c,children:[(0,U.jsx)(Po,{className:`size-4`}),`New webhook`]})]})}),(0,U.jsxs)(`section`,{className:`mt-24`,children:[(0,U.jsx)(`div`,{className:`rounded-md border`,children:(0,U.jsxs)(Rw,{children:[(0,U.jsx)(zw,{className:`font-bold uppercase`,children:_.getHeaderGroups().map(e=>(0,U.jsx)(Vw,{className:`hover:bg-transparent`,children:e.headers.map(e=>(0,U.jsx)(Hw,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:j2(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,U.jsx)(Bw,{children:n?(0,U.jsx)(Vw,{children:(0,U.jsx)(Uw,{colSpan:g.length,className:`h-24`,children:(0,U.jsx)(by,{className:`mx-auto size-5`})})}):_.getRowModel().rows.length===0?(0,U.jsx)(Vw,{children:(0,U.jsx)(Uw,{colSpan:g.length,className:`h-24 text-center text-muted-foreground`,children:`No webhooks yet.`})}):_.getRowModel().rows.map(e=>(0,U.jsx)(Vw,{children:e.getVisibleCells().map(e=>(0,U.jsx)(Uw,{className:`px-4 py-3`,children:j2(e.column.columnDef.cell,e.getContext())},e.id))},e.id))})]})}),(0,U.jsx)(yw,{open:u,onOpenChange:e=>{e||(d(!1),p(e4))},children:(0,U.jsxs)(Cw,{className:`sm:max-w-md`,children:[(0,U.jsx)(ww,{children:(0,U.jsx)(Ew,{children:`New webhook`})}),(0,U.jsxs)(`form`,{id:`create-webhook-form`,onSubmit:b,className:`flex flex-col gap-4`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(X,{htmlFor:`webhook-name`,children:`Name`}),(0,U.jsx)(Hv,{id:`webhook-name`,placeholder:`e.g. Dokploy deploy`,value:f.name,onChange:e=>p(t=>({...t,name:e.target.value})),required:!0})]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(X,{htmlFor:`webhook-url`,children:`URL`}),(0,U.jsx)(Hv,{id:`webhook-url`,type:`url`,placeholder:`https://...`,value:f.url,onChange:e=>p(t=>({...t,url:e.target.value})),required:!0})]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,U.jsx)(X,{children:`Events`}),$2.map(({value:e,label:t})=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(EO,{id:`event-${e}`,checked:f.events.includes(e),onCheckedChange:()=>y(e)}),(0,U.jsxs)(`label`,{htmlFor:`event-${e}`,className:`text-sm cursor-pointer`,children:[t,(0,U.jsx)(`span`,{className:`ml-2 font-mono text-xs text-muted-foreground`,children:e})]})]},e))]}),o&&(0,U.jsx)(`p`,{className:`text-sm text-destructive`,children:o})]}),(0,U.jsxs)(Tw,{children:[(0,U.jsx)(J,{variant:`outline`,type:`button`,onClick:()=>{d(!1),p(e4)},children:`Cancel`}),(0,U.jsx)(J,{type:`submit`,form:`create-webhook-form`,disabled:a||f.events.length===0||!c,children:a?`Creating…`:`Create webhook`})]})]})}),(0,U.jsx)(yw,{open:!!m,onOpenChange:e=>{e||h(null)},children:(0,U.jsxs)(Cw,{className:`sm:max-w-sm`,children:[(0,U.jsx)(ww,{children:(0,U.jsx)(Ew,{children:`Delete webhook`})}),(0,U.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Are you sure you want to delete`,` `,(0,U.jsx)(`span`,{className:`font-medium text-foreground`,children:m?.name}),`? It will stop receiving events immediately.`]}),(0,U.jsxs)(Tw,{children:[(0,U.jsx)(J,{variant:`outline`,onClick:()=>h(null),children:`Cancel`}),(0,U.jsx)(J,{variant:`destructive`,onClick:x,disabled:a||!l,children:a?`Deleting…`:`Delete`})]})]})})]})]})}function n4({...e}){return(0,U.jsx)(Vy,{"data-slot":`collapsible`,...e})}function r4({...e}){return(0,U.jsx)(Ry,{"data-slot":`collapsible-content`,...e})}function i4(){let{user:e,updateUser:t}=ga(),{loading:n,error:r,request:i}=Vv(),{request:a}=Vv(),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 mQ(n)})}catch(e){f(e instanceof Error?e.message:`Upload failed.`)}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})}catch(e){f(e instanceof Error?e.message:`Delete failed.`)}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)}catch{}}return(0,U.jsx)(n4,{open:p,onOpenChange:m,children:(0,U.jsxs)(k1,{children:[(0,U.jsxs)(A1,{children:[(0,U.jsx)(j1,{className:`uppercase`,children:`Account`}),(0,U.jsx)(M1,{children:(0,U.jsx)(J,{variant:`ghost`,size:`icon`,onClick:E,children:p?(0,U.jsx)(ns,{className:`size-4`}):(0,U.jsx)(No,{className:`size-4`})})})]}),(0,U.jsxs)(N1,{children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-4 -mt-4`,children:[(0,U.jsxs)(`div`,{className:`group relative shrink-0`,children:[(0,U.jsxs)(`button`,{type:`button`,className:`block`,onClick:()=>o.current?.click(),disabled:s||l,title:`Change avatar`,children:[(0,U.jsx)(El,{avatarUrl:e?.avatarUrl,firstName:e?.firstName,lastName:e?.lastName,email:e?.email,className:`size-20`,fallbackClassName:`text-xl`}),(0,U.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,U.jsx)(`div`,{className:`size-4 animate-spin rounded-full border-2 border-white border-t-transparent`}):(0,U.jsx)(Ra,{className:`size-5 text-white`})})]}),e?.avatarUrl&&!s&&!l&&(0,U.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,U.jsx)(qo,{className:`size-3`})})]}),(0,U.jsx)(`input`,{ref:o,type:`file`,accept:`image/*`,className:`hidden`,onChange:D}),(0,U.jsxs)(`div`,{children:[d&&(0,U.jsx)(`p`,{className:`text-xs text-destructive mb-1`,children:d}),(0,U.jsx)(`p`,{className:`font-bold text-xl`,children:e?.firstName||e?.lastName?`${e.firstName??``} ${e.lastName??``}`.trim():e?.email}),(e?.jobTitle||e?.organization)&&(0,U.jsx)(`p`,{className:`text-sm`,children:[e.jobTitle,e.organization].filter(Boolean).join(` · `)}),(0,U.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:e?.email}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2 mt-2`,children:[(0,U.jsx)(vw,{className:`capitalize`,children:e?.role}),e?.country&&(0,U.jsx)(vw,{variant:`outline`,children:e.country})]})]})]}),(0,U.jsx)(r4,{children:(0,U.jsxs)(`form`,{onSubmit:k,className:`space-y-4 mt-8`,children:[(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(X,{htmlFor:`firstName`,children:`First name`}),(0,U.jsx)(Hv,{id:`firstName`,value:h,onChange:e=>g(e.target.value)})]}),(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(X,{htmlFor:`lastName`,children:`Last name`}),(0,U.jsx)(Hv,{id:`lastName`,value:_,onChange:e=>y(e.target.value)})]}),(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(X,{htmlFor:`jobTitle`,children:`Job title`}),(0,U.jsx)(Hv,{id:`jobTitle`,value:b,onChange:e=>x(e.target.value)})]}),(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(X,{htmlFor:`organization`,children:`Organization`}),(0,U.jsx)(Hv,{id:`organization`,value:S,onChange:e=>C(e.target.value)})]}),(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(X,{htmlFor:`country`,children:`Country`}),(0,U.jsx)(Hv,{id:`country`,value:w,onChange:e=>T(e.target.value)})]})]}),r&&(0,U.jsx)(`p`,{className:`text-destructive text-sm`,children:r}),(0,U.jsx)(J,{type:`submit`,disabled:n,children:n?`Saving…`:`Save changes`})]})})]})]})})}var a4=Object.defineProperty,o4=Object.getOwnPropertySymbols,s4=Object.prototype.hasOwnProperty,c4=Object.prototype.propertyIsEnumerable,l4=(e,t,n)=>t in e?a4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,u4=(e,t)=>{for(var n in t||={})s4.call(t,n)&&l4(e,n,t[n]);if(o4)for(var n of o4(t))c4.call(t,n)&&l4(e,n,t[n]);return e},d4=(e,t)=>{var n={};for(var r in e)s4.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&o4)for(var r of o4(e))t.indexOf(r)<0&&c4.call(e,r)&&(n[r]=e[r]);return n},f4;(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})(f4||={}),(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||={})})(f4||={}),(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||={})})(f4||={});var p4=f4,m4={L:p4.QrCode.Ecc.LOW,M:p4.QrCode.Ecc.MEDIUM,Q:p4.QrCode.Ecc.QUARTILE,H:p4.QrCode.Ecc.HIGH},h4=128,g4=`L`,_4=`#FFFFFF`,v4=`#000000`,y4=!1,b4=1,x4=4,S4=0,C4=.1;function w4(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 T4(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 E4(e,t,n,r){if(r==null)return null;let i=e.length+n*2,a=Math.floor(t*C4),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 D4(e,t){return t==null?e?x4:S4:Math.max(Math.floor(t),0)}function O4({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(...p4.QrSegment.makeSegments(t)),e),[]);return p4.QrCode.encodeSegments(r,m4[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=D4(r,i);return{cells:e,margin:t,numCells:e.length+t*2,calculatedImageSettings:E4(e,o,t,a)}},[c,o,a,r,i]);return{qrcode:c,margin:u,cells:l,numCells:d,calculatedImageSettings:f}}var k4=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),A4=v.forwardRef(function(e,t){let n=e,{value:r,size:i=h4,level:a=g4,bgColor:o=_4,fgColor:s=v4,includeMargin:c=y4,minVersion:l=b4,boostLevel:u,marginSize:d,imageSettings:f}=n,p=d4(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`marginSize`,`imageSettings`]),{style:m}=p,h=d4(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}=O4({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=T4(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,k4?t.fill(new Path2D(w4(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=u4({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`,u4({style:D,height:i,width:i,ref:b,role:`img`},h)),O)});A4.displayName=`QRCodeCanvas`;var j4=v.forwardRef(function(e,t){let n=e,{value:r,size:i=h4,level:a=g4,bgColor:o=_4,fgColor:s=v4,includeMargin:c=y4,minVersion:l=b4,boostLevel:u,title:d,marginSize:f,imageSettings:p}=n,m=d4(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`title`,`marginSize`,`imageSettings`]),{margin:h,cells:g,numCells:_,calculatedImageSettings:y}=O4({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=T4(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=w4(b,h);return v.createElement(`svg`,u4({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)});j4.displayName=`QRCodeSVG`;function M4(){let{user:e,updateUser:t,logout:n}=ga(),{loading:r,error:i,request:a}=Vv(),{loading:o,error:s,request:c}=Vv(),[l,u]=(0,v.useState)(``),[d,f]=(0,v.useState)(``),[p,m]=(0,v.useState)(``),[h,g]=(0,v.useState)(``),[_,y]=(0,v.useState)(null),[b,x]=(0,v.useState)(!1),[S,C]=(0,v.useState)(null),[w,T]=(0,v.useState)(``),[E,D]=(0,v.useState)(``),[O,k]=(0,v.useState)(!1),[A,j]=(0,v.useState)([]),[M,N]=(0,v.useState)(!1);(0,v.useEffect)(()=>{typeof e?.twoFactorEnabled==`boolean`&&x(e.twoFactorEnabled)},[e?.twoFactorEnabled]);function P(){u(``),f(``),m(``),g(``),y(null),C(null),T(``)}function F(){C(null),T(``),D(``),k(!1),N(!1)}async function I(e){if(e.preventDefault(),y(null),p!==h){y(`New passwords do not match`);return}try{await a(`/cms/admin/users/me/password`,`PATCH`,{currentPassword:d,newPassword:p}),P()}catch{}}async function L(){C(await c(`/cms/admin/users/me/2fa/setup`,`POST`))}async function R(){let e=await c(`/cms/admin/users/me/2fa/verify`,`POST`,{code:w});x(!0),t({twoFactorEnabled:!0}),C(null),T(``),k(!0),j(e.backupCodes??[])}async function ee(){await c(`/cms/admin/users/me/2fa/disable`,`POST`,{code:w,password:E}),x(!1),t({twoFactorEnabled:!1}),T(``),D(``),j([]),N(!1)}return(0,U.jsxs)(k1,{children:[(0,U.jsxs)(A1,{children:[(0,U.jsx)(j1,{className:`uppercase`,children:`Security`}),(0,U.jsx)(M1,{})]}),(0,U.jsx)(N1,{className:`space-y-6`,children:(0,U.jsxs)($A,{value:l,children:[(0,U.jsxs)(ej,{children:[(0,U.jsx)(tj,{value:`password`,onClick:()=>u(e=>e===`password`?``:`password`),children:`Password`}),(0,U.jsx)(tj,{value:`two-factor`,onClick:()=>u(e=>e===`two-factor`?``:`two-factor`),children:`2FA`})]}),(0,U.jsx)(nj,{value:`password`,className:`mt-4`,children:(0,U.jsxs)(`div`,{className:`space-y-4 rounded-md border border-border p-4`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Update your account password.`}),(0,U.jsx)(J,{variant:`ghost`,size:`icon`,onClick:P,children:(0,U.jsx)(ns,{className:`size-4`})})]}),(0,U.jsxs)(`form`,{onSubmit:I,className:`space-y-4`,children:[(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(X,{htmlFor:`current`,children:`Current password`}),(0,U.jsx)(Hv,{id:`current`,type:`password`,value:d,onChange:e=>f(e.target.value),required:!0})]}),(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(X,{htmlFor:`new`,children:`New password`}),(0,U.jsx)(Hv,{id:`new`,type:`password`,value:p,onChange:e=>m(e.target.value),required:!0,minLength:8})]}),(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(X,{htmlFor:`confirm`,children:`Confirm new password`}),(0,U.jsx)(Hv,{id:`confirm`,type:`password`,value:h,onChange:e=>g(e.target.value),required:!0})]}),(_??i)&&(0,U.jsx)(`p`,{className:`text-destructive text-sm`,children:_??i}),(0,U.jsx)(J,{type:`submit`,disabled:r,children:r?`Saving…`:`Update password`})]})]})}),(0,U.jsx)(nj,{value:`two-factor`,className:`mt-4`,children:(0,U.jsxs)(`div`,{className:`space-y-4`,children:[!b&&!S&&(0,U.jsx)(J,{variant:`secondary`,onClick:L,disabled:o,children:`Enable 2FA`}),S&&!b&&(0,U.jsxs)(`div`,{className:`space-y-3 rounded-md border border-border p-4`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Scan this QR code with your authenticator app and enter the 6-digit code.`}),(0,U.jsx)(J,{variant:`ghost`,size:`icon`,onClick:F,children:(0,U.jsx)(ns,{className:`size-4`})})]}),(0,U.jsx)(`div`,{className:`inline-flex rounded-md bg-white p-2`,children:(0,U.jsx)(j4,{value:S.otpauthUri,size:176})}),(0,U.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Manual code: `,S.secret]}),(0,U.jsx)(my,{maxLength:6,value:w,onChange:T,containerClassName:`w-fit`,className:`w-fit`,children:(0,U.jsxs)(hy,{className:`w-fit`,children:[(0,U.jsx)(gy,{index:0}),(0,U.jsx)(gy,{index:1}),(0,U.jsx)(gy,{index:2}),(0,U.jsx)(gy,{index:3}),(0,U.jsx)(gy,{index:4}),(0,U.jsx)(gy,{index:5})]})}),(0,U.jsx)(J,{onClick:R,disabled:o||w.length!==6,children:`Confirm and enable 2FA`}),s&&(0,U.jsx)(`p`,{className:`text-sm text-destructive`,children:s})]}),b&&(0,U.jsxs)(`div`,{className:`space-y-3 rounded-md border border-border p-4`,children:[O&&(0,U.jsxs)(`div`,{className:`space-y-3 rounded-md border border-emerald-500/40 bg-emerald-500/10 p-3`,children:[(0,U.jsx)(`p`,{className:`text-sm font-medium text-emerald-300`,children:`2FA is now enabled.`}),(0,U.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,U.jsx)(J,{variant:`default`,onClick:()=>{n()},children:`Re-login now`}),A.length>0&&(0,U.jsxs)(`div`,{className:`space-y-2 rounded-md border border-emerald-400/30 bg-background/40 p-3`,children:[(0,U.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,U.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:A.map(e=>(0,U.jsx)(`code`,{className:`rounded bg-black/20 px-2 py-1 text-xs text-emerald-100`,children:e},e))}),(0,U.jsx)(J,{variant:`outline`,onClick:async()=>{try{await navigator.clipboard.writeText(A.join(`
223
+ `)),N(!0),setTimeout(()=>N(!1),2e3)}catch{N(!1)}},children:M?`Copied`:`Copy backup codes`})]})]}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Enter a verification code from your authenticator app to disable 2FA.`}),(0,U.jsx)(J,{variant:`ghost`,size:`icon`,onClick:()=>{T(``),D(``)},children:(0,U.jsx)(ns,{className:`size-4`})})]}),(0,U.jsx)(my,{maxLength:6,value:w,onChange:T,containerClassName:`w-fit`,className:`w-fit`,children:(0,U.jsxs)(hy,{className:`w-fit`,children:[(0,U.jsx)(gy,{index:0}),(0,U.jsx)(gy,{index:1}),(0,U.jsx)(gy,{index:2}),(0,U.jsx)(gy,{index:3}),(0,U.jsx)(gy,{index:4}),(0,U.jsx)(gy,{index:5})]})}),(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(X,{htmlFor:`disable-2fa-password`,children:`Current password`}),(0,U.jsx)(Hv,{id:`disable-2fa-password`,type:`password`,value:E,onChange:e=>D(e.target.value),required:!0})]}),(0,U.jsx)(J,{variant:`destructive`,onClick:ee,disabled:O||o||w.length!==6||!E,children:`Disable 2FA`}),s&&(0,U.jsx)(`p`,{className:`text-sm text-destructive`,children:s})]})]})})]})})]})}function N4(){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(yy,{children:(0,U.jsx)(`h1`,{className:`text-2xl font-bold -mt-2`,children:`Profile`})}),(0,U.jsx)(`section`,{className:`mt-18`,children:(0,U.jsx)(`div`,{className:`grid grid-cols-2 gap-4 items-start`,children:(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsx)(i4,{}),(0,U.jsx)(M4,{})]})})})]})}var P4=[`Super Admin`,`Admin`,`Editor`,`Contributor`],F4=Vi([{path:`/login`,element:(0,U.jsx)(vy,{})},{element:(0,U.jsx)(Ca,{children:(0,U.jsx)(Bv,{})}),children:[{index:!0,element:(0,U.jsx)(Ca,{roles:P4,redirectTo:`/content`,children:(0,U.jsx)(Kw,{})})},{path:`content`,element:(0,U.jsx)(HO,{}),children:[{index:!0,element:(0,U.jsx)(UO,{})},{path:`:slug`,element:(0,U.jsx)(yk,{})},{path:`:slug/new`,element:(0,U.jsx)(Ca,{permission:`entries:write`,redirectTo:`/content`,children:(0,U.jsx)($$,{})})},{path:`:slug/:id`,element:(0,U.jsx)($$,{})}]},{path:`media`,element:(0,U.jsx)(Ca,{roles:P4,redirectTo:`/content`,children:(0,U.jsx)(v1,{})})},{path:`content-types`,element:(0,U.jsx)(Ca,{permission:`content-types:write`,roles:P4,redirectTo:`/content`,children:(0,U.jsx)(Yw,{})}),children:[{index:!0,element:(0,U.jsx)(rT,{})},{path:`new`,element:(0,U.jsx)(BO,{})},{path:`:slug`,element:(0,U.jsx)(BO,{})}]},{path:`settings`,element:(0,U.jsx)(Ca,{permission:`settings:overview:read`,roles:P4,redirectTo:`/content`,children:(0,U.jsx)(S1,{})}),children:[{index:!0,element:(0,U.jsx)(Zr,{to:`overview`,replace:!0})},{path:`overview`,element:(0,U.jsx)(Ca,{permission:`settings:overview:read`,children:(0,U.jsx)(p0,{})})},{path:`users`,element:(0,U.jsx)(Ca,{permission:`settings:users:read`,children:(0,U.jsx)(B2,{})})},{path:`roles`,element:(0,U.jsx)(Ca,{permission:`settings:roles:read`,children:(0,U.jsx)(q2,{})})},{path:`api-tokens`,element:(0,U.jsx)(Ca,{permission:`settings:api-tokens:read`,children:(0,U.jsx)(Q2,{})})},{path:`webhooks`,element:(0,U.jsx)(Ca,{permission:`settings:webhooks:read`,children:(0,U.jsx)(t4,{})})}]},{path:`profile`,element:(0,U.jsx)(N4,{})}]},{path:`*`,element:(0,U.jsx)(Zr,{to:`/`,replace:!0})}],{basename:`/admin/`.replace(/\/$/,``)||`/`});function I4(){return(0,U.jsx)(ha,{children:(0,U.jsx)(va,{children:(0,U.jsx)(xa,{children:(0,U.jsx)(da,{router:F4})})})})}(0,_.createRoot)(document.getElementById(`root`)).render((0,U.jsx)(v.StrictMode,{children:(0,U.jsxs)(E,{attribute:`class`,defaultTheme:`dark`,enableSystem:!0,disableTransitionOnChange:!0,children:[(0,U.jsx)(I4,{}),(0,U.jsx)(({...e})=>{let{theme:t=`system`}=T();return(0,U.jsx)(l0,{theme:t,className:`toaster group`,icons:{success:(0,U.jsx)(Ga,{className:`size-4`}),info:(0,U.jsx)(vo,{className:`size-4`}),warning:(0,U.jsx)(Jo,{className:`size-4`}),error:(0,U.jsx)(Mo,{className:`size-4`}),loading:(0,U.jsx)(ko,{className:`size-4 animate-spin`})},style:{"--normal-bg":`var(--popover)`,"--normal-text":`var(--popover-foreground)`,"--normal-border":`var(--border)`,"--border-radius":`var(--radius)`},...e})},{})]})}));