framework
Version:
The (AI) Framework: turnkey, zero-config AI orchestration that wraps a coding-agent CLI (Claude Code) as a black box and takes you from an idea to a running app. Vite for AI.
415 lines • 1.18 MB
JavaScript
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=>{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}}}})),d=o(((e,t)=>{t.exports=u()})),f=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.7`})),p=o(((e,t)=>{t.exports=f()})),m=o((e=>{var t=p();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.7`})),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=d(),n=p(),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},z=[],B=-1;function ee(e){return{current:e}}function V(e){0>B||(e.current=z[B],z[B]=null,B--)}function H(e,t){B++,z[B]=e.current,e.current=t}var te=ee(null),U=ee(null),W=ee(null),ne=ee(null);function re(e,t){switch(H(W,t),H(U,e),H(te,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}}V(te),H(te,e)}function ie(){V(te),V(U),V(W)}function ae(e){e.memoizedState!==null&&H(ne,e);var t=te.current,n=qd(t,e.type);t!==n&&(H(U,e),H(te,n))}function oe(e){U.current===e&&(V(te),V(U)),ne.current===e&&(V(ne),rp._currentValue=R)}var se,ce;function le(e){if(se===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);se=t&&t[1]||``,ce=-1<e.stack.indexOf(`
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
`+se+e+ce}var ue=!1;function de(e,t){if(!e||ue)return``;ue=!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(`
`),l=s.split(`
`);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=`
`+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{ue=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?le(n):``}function fe(e,t){switch(e.tag){case 26:case 27:case 5:return le(e.type);case 16:return le(`Lazy`);case 13:return e.child!==t&&t!==null?le(`Suspense Fallback`):le(`Suspense`);case 19:return le(`SuspenseList`);case 0:case 15:return de(e.type,!1);case 11:return de(e.type.render,!1);case 1:return de(e.type,!0);case 31:return le(`Activity`);default:return``}}function pe(e){try{var t=``,n=null;do t+=fe(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
Error generating stack: `+e.message+`
`+e.stack}}var me=Object.prototype.hasOwnProperty,he=t.unstable_scheduleCallback,ge=t.unstable_cancelCallback,_e=t.unstable_shouldYield,ve=t.unstable_requestPaint,ye=t.unstable_now,be=t.unstable_getCurrentPriorityLevel,xe=t.unstable_ImmediatePriority,Se=t.unstable_UserBlockingPriority,Ce=t.unstable_NormalPriority,we=t.unstable_LowPriority,Te=t.unstable_IdlePriority,Ee=t.log,De=t.unstable_setDisableYieldValue,Oe=null,ke=null;function Ae(e){if(typeof Ee==`function`&&De(e),ke&&typeof ke.setStrictMode==`function`)try{ke.setStrictMode(Oe,e)}catch{}}var je=Math.clz32?Math.clz32:Pe,Me=Math.log,Ne=Math.LN2;function Pe(e){return e>>>=0,e===0?32:31-(Me(e)/Ne|0)|0}var Fe=256,Ie=262144,Le=4194304;function Re(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 ze(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=Re(n))):i=Re(o):i=Re(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Re(n))):i=Re(o)):i=Re(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 Be(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ve(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 He(){var e=Le;return Le<<=1,!(Le&62914560)&&(Le=4194304),e}function Ue(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function We(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ge(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-je(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&&Ke(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Ke(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-je(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function qe(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-je(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function Je(e,t){var n=t&-t;return n=n&42?1:Ye(n),(n&(e.suspendedLanes|t))===0?n:0}function Ye(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 Xe(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function Ze(){var e=L.p;return e===0?(e=window.event,e===void 0?32:yp(e.type)):e}function Qe(e,t){var n=L.p;try{return L.p=e,t()}finally{L.p=n}}var $e=Math.random().toString(36).slice(2),et=`__reactFiber$`+$e,tt=`__reactProps$`+$e,nt=`__reactContainer$`+$e,rt=`__reactEvents$`+$e,it=`__reactListeners$`+$e,at=`__reactHandles$`+$e,ot=`__reactResources$`+$e,st=`__reactMarker$`+$e;function ct(e){delete e[et],delete e[tt],delete e[rt],delete e[it],delete e[at]}function lt(e){var t=e[et];if(t)return t;for(var n=e.parentNode;n;){if(t=n[nt]||n[et]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=gf(e);e!==null;){if(n=e[et])return n;e=gf(e)}return t}e=n,n=e.parentNode}return null}function ut(e){if(e=e[et]||e[nt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function dt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function ft(e){var t=e[ot];return t||=e[ot]={hoistableStyles:new Map,hoistableScripts:new Map},t}function pt(e){e[st]=!0}var mt=new Set,ht={};function gt(e,t){_t(e,t),_t(e+`Capture`,t)}function _t(e,t){for(ht[e]=t,e=0;e<t.length;e++)mt.add(t[e])}var vt=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]*$`),yt={},bt={};function xt(e){return me.call(bt,e)?!0:me.call(yt,e)?!1:vt.test(e)?bt[e]=!0:(yt[e]=!0,!1)}function St(e,t,n){if(xt(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 Ct(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 wt(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 Tt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Et(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Dt(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 Ot(e){if(!e._valueTracker){var t=Et(e)?`checked`:`value`;e._valueTracker=Dt(e,t,``+e[t])}}function kt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Et(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function At(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 jt=/[\n"\\]/g;function Mt(e){return e.replace(jt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Nt(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=``+Tt(t)):e.value!==``+Tt(t)&&(e.value=``+Tt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Ft(e,o,Tt(n)):Ft(e,o,Tt(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=``+Tt(s):e.removeAttribute(`name`)}function Pt(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)){Ot(e);return}n=n==null?``:``+Tt(n),t=t==null?n:``+Tt(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),Ot(e)}function Ft(e,t,n){t===`number`&&At(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function It(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=``+Tt(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 Lt(e,t,n){if(t!=null&&(t=``+Tt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Tt(n)}function Rt(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=Tt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Ot(e)}function zt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Bt=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 Vt(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||Bt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Ht(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&&Vt(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&Vt(e,o,t[o])}function Ut(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 Wt=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`]]),Gt=/^[\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 Kt(e){return Gt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function qt(){}var Jt=null;function Yt(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Xt=null,Zt=null;function Qt(e){var t=ut(e);if(t&&(e=t.stateNode)){var n=e[tt]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Nt(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="`+Mt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[tt]||null;if(!a)throw Error(i(90));Nt(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&&kt(r)}break a;case`textarea`:Lt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&It(e,!!n.multiple,t,!1)}}}var $t=!1;function en(e,t,n){if($t)return e(t,n);$t=!0;try{return e(t)}finally{if($t=!1,(Xt!==null||Zt!==null)&&(Su(),Xt&&(t=Xt,e=Zt,Zt=Xt=null,Qt(t),e)))for(t=0;t<e.length;t++)Qt(e[t])}}function tn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[tt]||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 nn=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),rn=!1;if(nn)try{var an={};Object.defineProperty(an,"passive",{get:function(){rn=!0}}),window.addEventListener(`test`,an,an),window.removeEventListener(`test`,an,an)}catch{rn=!1}var on=null,sn=null,cn=null;function ln(){if(cn)return cn;var e,t=sn,n=t.length,r,i=`value`in on?on.value:on.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 cn=i.slice(e,1<r?1-r:void 0)}function un(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 dn(){return!0}function fn(){return!1}function pn(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)?dn:fn,this.isPropagationStopped=fn,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=dn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=dn)},persist:function(){},isPersistent:dn}),t}var mn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},hn=pn(mn),gn=m({},mn,{view:0,detail:0}),_n=pn(gn),vn,yn,bn,xn=m({},gn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Mn,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!==bn&&(bn&&e.type===`mousemove`?(vn=e.screenX-bn.screenX,yn=e.screenY-bn.screenY):yn=vn=0,bn=e),vn)},movementY:function(e){return`movementY`in e?e.movementY:yn}}),Sn=pn(xn),Cn=pn(m({},xn,{dataTransfer:0})),wn=pn(m({},gn,{relatedTarget:0})),Tn=pn(m({},mn,{animationName:0,elapsedTime:0,pseudoElement:0})),En=pn(m({},mn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Dn=pn(m({},mn,{data:0})),On={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},kn={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`},An={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function jn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=An[e])?!!t[e]:!1}function Mn(){return jn}var Nn=pn(m({},gn,{key:function(e){if(e.key){var t=On[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=un(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?kn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Mn,charCode:function(e){return e.type===`keypress`?un(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?un(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Pn=pn(m({},xn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Fn=pn(m({},gn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Mn})),In=pn(m({},mn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Ln=pn(m({},xn,{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})),Rn=pn(m({},mn,{newState:0,oldState:0})),zn=[9,13,27,32],Bn=nn&&`CompositionEvent`in window,Vn=null;nn&&`documentMode`in document&&(Vn=document.documentMode);var Hn=nn&&`TextEvent`in window&&!Vn,Un=nn&&(!Bn||Vn&&8<Vn&&11>=Vn),Wn=` `,Gn=!1;function Kn(e,t){switch(e){case`keyup`:return zn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function qn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Jn=!1;function Yn(e,t){switch(e){case`compositionend`:return qn(t);case`keypress`:return t.which===32?(Gn=!0,Wn):null;case`textInput`:return e=t.data,e===Wn&&Gn?null:e;default:return null}}function Xn(e,t){if(Jn)return e===`compositionend`||!Bn&&Kn(e,t)?(e=ln(),cn=sn=on=null,Jn=!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 Un&&t.locale!==`ko`?null:t.data;default:return null}}var Zn={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 Qn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!Zn[e.type]:t===`textarea`}function $n(e,t,n,r){Xt?Zt?Zt.push(r):Zt=[r]:Xt=r,t=Ad(t,`onChange`),0<t.length&&(n=new hn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var er=null,tr=null;function nr(e){Sd(e,0)}function rr(e){if(kt(dt(e)))return e}function ir(e,t){if(e===`change`)return t}var ar=!1;if(nn){var or;if(nn){var sr=`oninput`in document;if(!sr){var cr=document.createElement(`div`);cr.setAttribute(`oninput`,`return;`),sr=typeof cr.oninput==`function`}or=sr}else or=!1;ar=or&&(!document.documentMode||9<document.documentMode)}function lr(){er&&(er.detachEvent(`onpropertychange`,ur),tr=er=null)}function ur(e){if(e.propertyName===`value`&&rr(tr)){var t=[];$n(t,tr,e,Yt(e)),en(nr,t)}}function dr(e,t,n){e===`focusin`?(lr(),er=t,tr=n,er.attachEvent(`onpropertychange`,ur)):e===`focusout`&&lr()}function fr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return rr(tr)}function pr(e,t){if(e===`click`)return rr(t)}function mr(e,t){if(e===`input`||e===`change`)return rr(t)}function hr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var gr=typeof Object.is==`function`?Object.is:hr;function _r(e,t){if(gr(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(!me.call(t,i)||!gr(e[i],t[i]))return!1}return!0}function vr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function yr(e,t){var n=vr(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=vr(n)}}function br(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?br(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function xr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=At(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=At(e.document)}return t}function Sr(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 Cr=nn&&`documentMode`in document&&11>=document.documentMode,wr=null,G=null,Tr=null,K=!1;function Er(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;K||wr==null||wr!==At(r)||(r=wr,`selectionStart`in r&&Sr(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}),Tr&&_r(Tr,r)||(Tr=r,r=Ad(G,`onSelect`),0<r.length&&(t=new hn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=wr)))}function q(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Dr={animationend:q(`Animation`,`AnimationEnd`),animationiteration:q(`Animation`,`AnimationIteration`),animationstart:q(`Animation`,`AnimationStart`),transitionrun:q(`Transition`,`TransitionRun`),transitionstart:q(`Transition`,`TransitionStart`),transitioncancel:q(`Transition`,`TransitionCancel`),transitionend:q(`Transition`,`TransitionEnd`)},Or={},kr={};nn&&(kr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Dr.animationend.animation,delete Dr.animationiteration.animation,delete Dr.animationstart.animation),`TransitionEvent`in window||delete Dr.transitionend.transition);function Ar(e){if(Or[e])return Or[e];if(!Dr[e])return e;var t=Dr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in kr)return Or[e]=t[n];return e}var jr=Ar(`animationend`),Mr=Ar(`animationiteration`),Nr=Ar(`animationstart`),Pr=Ar(`transitionrun`),Fr=Ar(`transitionstart`),Ir=Ar(`transitioncancel`),Lr=Ar(`transitionend`),Rr=new Map,zr=`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(` `);zr.push(`scrollEnd`);function Br(e,t){Rr.set(e,t),gt(t,[e])}var Vr=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)},Hr=[],Ur=0,Wr=0;function Gr(){for(var e=Ur,t=Wr=Ur=0;t<e;){var n=Hr[t];Hr[t++]=null;var r=Hr[t];Hr[t++]=null;var i=Hr[t];Hr[t++]=null;var a=Hr[t];if(Hr[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&&Yr(n,i,a)}}function Kr(e,t,n,r){Hr[Ur++]=e,Hr[Ur++]=t,Hr[Ur++]=n,Hr[Ur++]=r,Wr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function qr(e,t,n,r){return Kr(e,t,n,r),Xr(e)}function Jr(e,t){return Kr(e,null,null,t),Xr(e)}function Yr(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-je(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function Xr(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 Zr={};function Qr(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 $r(e,t,n,r){return new Qr(e,t,n,r)}function ei(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ti(e,t){var n=e.alternate;return n===null?(n=$r(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 ni(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 ri(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)ei(e)&&(s=1);else if(typeof e==`string`)s=Jf(e,n,te.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case k:return e=$r(31,n,t,a),e.elementType=k,e.lanes=o,e;case y:return ii(n.children,a,o,t);case b:s=8,a|=24;break;case x:return e=$r(12,n,t,a|2),e.elementType=x,e.lanes=o,e;case T:return e=$r(13,n,t,a),e.elementType=T,e.lanes=o,e;case E:return e=$r(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=$r(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function ii(e,t,n,r){return e=$r(7,e,r,t),e.lanes=n,e}function ai(e,t,n){return e=$r(6,e,null,t),e.lanes=n,e}function oi(e){var t=$r(18,null,null,0);return t.stateNode=e,t}function si(e,t,n){return t=$r(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var ci=new WeakMap;function li(e,t){if(typeof e==`object`&&e){var n=ci.get(e);return n===void 0?(t={value:e,source:t,stack:pe(t)},ci.set(e,t),t):n}return{value:e,source:t,stack:pe(t)}}var ui=[],di=0,fi=null,pi=0,mi=[],hi=0,gi=null,_i=1,vi=``;function yi(e,t){ui[di++]=pi,ui[di++]=fi,fi=e,pi=t}function bi(e,t,n){mi[hi++]=_i,mi[hi++]=vi,mi[hi++]=gi,gi=e;var r=_i;e=vi;var i=32-je(r)-1;r&=~(1<<i),n+=1;var a=32-je(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,_i=1<<32-je(t)+i|n<<i|r,vi=a+e}else _i=1<<a|n<<i|r,vi=e}function xi(e){e.return!==null&&(yi(e,1),bi(e,1,0))}function Si(e){for(;e===fi;)fi=ui[--di],ui[di]=null,pi=ui[--di],ui[di]=null;for(;e===gi;)gi=mi[--hi],mi[hi]=null,vi=mi[--hi],mi[hi]=null,_i=mi[--hi],mi[hi]=null}function Ci(e,t){mi[hi++]=_i,mi[hi++]=vi,mi[hi++]=gi,_i=t.id,vi=t.overflow,gi=e}var wi=null,Ti=null,Ei=!1,Di=null,Oi=!1,ki=Error(i(519));function Ai(e){throw Ii(li(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),ki}function ji(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[et]=e,t[tt]=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),Pt(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),Rt(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=qt),t=!0):t=!1,t||Ai(e,!0)}function Mi(e){for(wi=e.return;wi;)switch(wi.tag){case 5:case 31:case 13:Oi=!1;return;case 27:case 3:Oi=!0;return;default:wi=wi.return}}function Ni(e){if(e!==wi)return!1;if(!Ei)return Mi(e),Ei=!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&&Ti&&Ai(e),Mi(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Ti=hf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Ti=hf(e)}else t===27?(t=Ti,nf(e.type)?(e=mf,mf=null,Ti=e):Ti=t):Ti=wi?pf(e.stateNode.nextSibling):null;return!0}function Pi(){Ti=wi=null,Ei=!1}function Fi(){var e=Di;return e!==null&&($l===null?$l=e:$l.push.apply($l,e),Di=null),e}function Ii(e){Di===null?Di=[e]:Di.push(e)}var Li=ee(null),Ri=null,zi=null;function Bi(e,t,n){H(Li,t._currentValue),t._currentValue=n}function Vi(e){e._currentValue=Li.current,V(Li)}function Hi(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 Ui(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),Hi(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),Hi(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 Wi(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;gr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===ne.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&&Ui(t,e,n,r),t.flags|=262144}function Gi(e){for(e=e.firstContext;e!==null;){if(!gr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ki(e){Ri=e,zi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function qi(e){return Yi(Ri,e)}function Ji(e,t){return Ri===null&&Ki(e),Yi(e,t)}function Yi(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},zi===null){if(e===null)throw Error(i(308));zi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else zi=zi.next=t;return n}var Xi=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()})}},Zi=t.unstable_scheduleCallback,Qi=t.unstable_NormalPriority,$i={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ea(){return{controller:new Xi,data:new Map,refCount:0}}function ta(e){e.refCount--,e.refCount===0&&Zi(Qi,function(){e.controller.abort()})}var na=null,ra=0,ia=0,aa=null;function oa(e,t){if(na===null){var n=na=[];ra=0,ia=md(),aa={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return ra++,t.then(sa,sa),t}function sa(){if(--ra===0&&na!==null){aa!==null&&(aa.status=`fulfilled`);var e=na;na=null,ia=0,aa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function ca(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 la=I.S;I.S=function(e,t){nu=ye(),typeof t==`object`&&t&&typeof t.then==`function`&&oa(e,t),la!==null&&la(e,t)};var ua=ee(null);function da(){var e=ua.current;return e===null?Ll.pooledCache:e}function fa(e,t){t===null?H(ua,ua.current):H(ua,t.pool)}function pa(){var e=da();return e===null?null:{parent:$i._currentValue,pool:e}}var ma=Error(i(460)),ha=Error(i(474)),ga=Error(i(542)),_a={then:function(){}};function va(e){return e=e.status,e===`fulfilled`||e===`rejected`}function ya(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(qt,qt),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Ca(e),e;default:if(typeof t.status==`string`)t.then(qt,qt);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,Ca(e),e}throw xa=t,ma}}function ba(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(xa=e,ma):e}}var xa=null;function Sa(){if(xa===null)throw Error(i(459));var e=xa;return xa=null,e}function Ca(e){if(e===ma||e===ga)throw Error(i(483))}var wa=null,Ta=0;function Ea(e){var t=Ta;return Ta+=1,wa===null&&(wa=[]),ya(wa,e,t)}function Da(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Oa(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 ka(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=ti(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=ai(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&&ba(i)===t.type)?(t=a(t,n.props),Da(t,n),t.return=e,t):(t=ri(n.type,n.key,n.props,null,e.mode,r),Da(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=si(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=ii(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=ai(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case _:return n=ri(t.type,t.key,t.props,null,e.mode,n),Da(n,t),n.return=e,n;case v:return t=si(t,e.mode,n),t.return=e,t;case O:return t=ba(t),f(e,t,n)}if(F(t)||M(t))return t=ii(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Ea(t),n);if(t.$$typeof===C)return f(e,Ji(e,t),n);Oa(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=ba(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,Ea(n),r);if(n.$$typeof===C)return p(e,t,Ji(e,n),r);Oa(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=ba(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,Ea(r),i);if(r.$$typeof===C)return m(e,t,n,Ji(t,r),i);Oa(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),Ei&&yi(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 Ei&&yi(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)}),Ei&&yi(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),Ei&&yi(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 Ei&&yi(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)}),Ei&&yi(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&&ba(l)===r.type){n(e,r.sibling),c=a(r,o.props),Da(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===y?(c=ii(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=ri(o.type,o.key,o.props,null,e.mode,c),Da(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=si(o,e.mode,c),c.return=e,e=c}return s(e);case O:return o=ba(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,Ea(o),c);if(o.$$typeof===C)return b(e,r,Ji(e,o),c);Oa(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=ai(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Ta=0;var i=b(e,t,n,r);return wa=null,i}catch(t){if(t===ma||t===ga)throw t;var a=$r(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Aa=ka(!0),ja=ka(!1),Ma=!1;function Na(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Pa(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 Fa(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ia(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=Xr(e),Yr(e,null,n),t}return Kr(e,r,t,n),Xr(e)}function La(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,qe(e,n)}}function Ra(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 za=!1;function Ba(){if(za){var e=aa;if(e!==null)throw e}}function Va(e,t,n,r){za=!1;var i=e.updateQueue;Ma=!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===ia&&(za=!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:Ma=!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 Ha(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Ua(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Ha(n[e],t)}var Wa=ee(null),Ga=ee(0);function Ka(e,t){e=Gl,H(Ga,e),H(Wa,t),Gl=e|t.baseLanes}function qa(){H(Ga,Gl),H(Wa,Wa.current)}function Ja(){Gl=Ga.current,V(Wa),V(Ga)}var Ya=ee(null),J=null;function Xa(e){var t=e.alternate;H(eo,eo.current&1),H(Ya,e),J===null&&(t===null||Wa.current!==null||t.memoizedState!==null)&&(J=e)}function Za(e){H(eo,eo.current),H(Ya,e),J===null&&(J=e)}function Y(e){e.tag===22?(H(eo,eo.current),H(Ya,e),J===null&&(J=e)):Qa(e)}function Qa(){H(eo,eo.current),H(Ya,Ya.current)}function $a(e){V(Ya),J===e&&(J=null),V(eo)}var eo=ee(0);function to(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 no=0,ro=null,io=null,ao=null,oo=!1,so=!1,co=!1,lo=0,uo=0,fo=null,po=0;function mo(){throw Error(i(321))}function ho(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!gr(e[n],t[n]))return!1;return!0}function go(e,t,n,r,i,a){return no=a,ro=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,I.H=e===null||e.memoizedState===null?Ps:Fs,co=!1,a=n(r,i),co=!1,so&&(a=vo(t,n,r,i)),_o(e),a}function _o(e){I.H=Ns;var t=io!==null&&io.next!==null;if(no=0,ao=io=ro=null,oo=!1,uo=0,fo=null,t)throw Error(i(300));e===null||Qs||(e=e.dependencies,e!==null&&Gi(e)&&(Qs=!0))}function vo(e,t,n,r){ro=e;var a=0;do{if(so&&(fo=null),uo=0,so=!1,25<=a)throw Error(i(301));if(a+=1,ao=io=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=Is,o=t(n,r)}while(so);return o}function yo(){var e=I.H,t=e.useState()[0];return t=typeof t.then==`function`?Eo(t):t,e=e.useState()[0],(io===null?null:io.memoizedState)!==e&&(ro.flags|=1024),t}function bo(){var e=lo!==0;return lo=0,e}function xo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function So(e){if(oo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}oo=!1}no=0,ao=io=ro=null,so=!1,uo=lo=0,fo=null}function Co(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ao===null?ro.memoizedState=ao=e:ao=ao.next=e,ao}function wo(){if(io===null){var e=ro.alternate;e=e===null?null:e.memoizedState}else e=io.next;var t=ao===null?ro.memoizedState:ao.next;if(t!==null)ao=t,io=e;else{if(e===null)throw ro.alternate===null?Error(i(467)):Error(i(310));io=e,e={memoizedState:io.memoizedState,baseState:io.baseState,baseQueue:io.baseQueue,queue:io.queue,next:null},ao===null?ro.memoizedState=ao=e:ao=ao.next=e}return ao}function To(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Eo(e){var t=uo;return uo+=1,fo===null&&(fo=[]),e=ya(fo,e,t),t=ro,(ao===null?t.memoizedState:ao.next)===null&&(t=t.alternate,I.H=t===null||t.memoizedState===null?Ps:Fs),e}function Do(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Eo(e);if(e.$$typeof===C)return qi(e)}throw Error(i(438,String(e)))}function Oo(e){var t=null,n=ro.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=ro.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=To(),ro.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 ko(e,t){return typeof t==`function`?t(e):t}function Ao(e){return jo(wo(),io,e)}function jo(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?(no&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===ia&&(d=!0);else if((no&p)===p){u=u.next,p===ia&&(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,ro.lanes|=p,ql|=p;f=u.action,co&&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,ro.lanes|=f,ql|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!gr(o,e.memoizedState)&&(Qs=!0,d&&(n=aa,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 Mo(e){var t=wo(),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);gr(o,t.memoizedState)||(Qs=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function No(e,t,n){var r=ro,a=wo(),o=Ei;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!gr((io||a).memoizedState,n);if(s&&(a.memoizedState=n,Qs=!0),a=a.queue,is(Io.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||ao!==null&&ao.memoizedState.tag&1){if(r.flags|=2048,$o(9,{destroy:void 0},Fo.bind(null,r,a,n,t),null),Ll===null)throw Error(i(349));o||no&127||Po(r,t,n)}return n}function Po(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=ro.updateQueue,t===null?(t=To(),ro.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Fo(e,t,n,r){t.value=n,t.getSnapshot=r,Lo(t)&&Ro(e)}function Io(e,t,n){return n(function(){Lo(t)&&Ro(e)})}function Lo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!gr(e,n)}catch{return!0}}function Ro(e){var t=Jr(e,2);t!==null&&_u(t,e,2)}function zo(e){var t=Co();if(typeof e==`function`){var n=e;if(e=n(),co){Ae(!0);try{n()}finally{Ae(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ko,lastRenderedState:e},t}function Bo(e,t,n,r){return e.baseState=n,jo(e,io,typeof r==`function`?r:ko)}function Vo(e,t,n,r,a){if(As(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,Ho(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Ho(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),Uo(e,t,s)}catch(n){Go(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),I.T=a}}else try{a=n(i,r),Uo(e,t,a)}catch(n){Go(e,t,n)}}function Uo(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Wo(e,t,n)},function(n){return Go(e,t,n)}):Wo(e,t,n)}function Wo(e,t,n){t.status=`fulfilled`,t.value=n,Ko(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Ho(e,n)))}function Go(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Ko(t),t=t.next;while(t!==r)}e.action=null}function Ko(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function qo(e,t){return t}function Jo(e,t){if(Ei){var n=Ll.formState;if(n!==null){a:{var r=ro;if(Ei){if(Ti){b:{for(var i=Ti,a=Oi;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){Ti=pf(i.nextSibling),r=i.data===`F!`;break a}}Ai(r)}r=!1}r&&(t=n[0])}}return n=Co(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:qo,lastRenderedState:t},n.queue=r,n=Ds.bind(null,ro,r),r.dispatch=n,r=zo(!1),a=ks.bind(null,ro,!1,r.queue),r=Co(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Vo.bind(null,ro,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Yo(e){return Xo(wo(),io,e)}function Xo(e,t,n){if(t=jo(e,t,qo)[0],e=Ao(ko)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Eo(t)}catch(e){throw e===ma?ga:e}else r=t;t=wo();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(ro.flags|=2048,$o(9,{destroy:void 0},Zo.bind(null,i,n),null)),[r,a,e]}function Zo(e,t){e.action=t}function Qo(e){var t=wo(),n=io;if(n!==null)return Xo(t,n,e);wo(),t=t.memoizedState,n=wo();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function $o(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=ro.updateQueue,t===null&&(t=To(),ro.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 es(){return wo().memoizedState}function ts(e,t,n,r){var i=Co();ro.flags|=e,i.memoizedState=$o(1|t,{destroy:void 0},n,r===void 0?null:r)}function ns(e,t,n,r){var i=wo();r=r===void 0?null:r;var a=i.memoizedState.inst;io!==null&&r!==null&&ho(r,io.memoizedState.deps)?i.memoizedState=$o(t,a,n,r):(ro.flags|=e,i.memoizedState=$o(1|t,a,n,r))}function rs(e,t){ts(8390656,8,e,t)}function is(e,t){ns(2048,8,e,t)}function as(e){ro.flags|=4;var t=ro.updateQueue;if(t===null)t=To(),ro.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function ss(e){var t=wo().memoizedState;return as({ref:t,nextImpl:e}),function(){if(Il&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function cs(e,t){return ns(4,2,e,t)}function ls(e,t){return ns(4,4,e,t)}function us(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 ds(e,t,n){n=n==null?null:n.concat([e]),ns(4,4,us.bind(null,t,e),n)}function fs(){}function ps(e,t){var n=wo();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&ho(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function ms(e,t){var n=wo();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&ho(t,r[1]))return r[0];if(r=e(),co){Ae(!0);try{e()}finally{Ae(!1)}}return n.memoizedState=[r,t],r}function hs(e,t,n){return n===void 0||no&1073741824&&!(zl&261930)?e.memoizedState=t:(e.memoizedState=n,e=gu(),ro.lanes|=e,ql|=e,n)}function gs(e,t,n,r){return gr(n,t)?n:Wa.current===null?!(no&42)||no&1073741824&&!(zl&261930)?(Qs=!0,e.memoizedState=n):(e=gu(),ro.lanes|=e,ql|=e,t):(e=hs(e,n,r),gr(e,t)||(Qs=!0),e)}function _s(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,ks(e,!1,t,n);try{var c=i(),l=I.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Os(e,t,ca(c,r),hu(e)):Os(e,t,r,hu(e))}catch(n){Os(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 vs(){}function ys(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=bs(e).queue;_s(e,a,t,R,n===null?vs:function(){return xs(e),n(r)})}function bs(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:ko,lastRenderedState:R},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ko,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function xs(e){var t=bs(e);t.next===null&&(t=e.alternate.memoizedState),Os(e,t.next.queue,{},hu())}function Ss(){return qi(rp)}function Cs(){return wo().memoizedState}function ws(){return wo().memoizedState}function Ts(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=hu();e=Fa(n);var r=Ia(t,e,n);r!==null&&(_u(r,t,n),La(r,t,n)),t={cache:ea()},e.payload=t;return}t=t.return}}function Es(e,t,n){var r=hu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},As(e)?js(t,n):(n=qr(e,t,n,r),n!==null&&(_u(n,e,r),Ms(n,t,r)))}function Ds(e,t,n){Os(e,t,n,hu())}function Os(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(As(e))js(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,gr(s,o))return Kr(e,t,i,0),Ll===null&&Gr(),!1}catch{}if(n=qr(e,t,i,r),n!==null)return _u(n,e,r),Ms(n,t,r),!0}return!1}function ks(e,t,n,r){if(r={lane:2,revertLane:md(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},As(e)){if(t)throw Error(i(479))}else t=qr(e,n,r,2),t!==null&&_u(t,e,2)}function As(e){var t=e.alternate;return e===ro||t!==null&&t===ro}function js(e,t){so=oo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ms(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,qe(e,n)}}var Ns={readContext:qi,use:Do,useCallback:mo,useContext:mo,useEffect:mo,useImperativeHandle:mo,useLayoutEffect:mo,useInsertionEffect:mo,useMemo:mo,useReducer:mo,useRef:mo,useState:mo,useDebugValue:mo,useDeferredValue:mo,useTransition:mo,useSyncExternalStore:mo,useId:mo,useHostTransitionStatus:mo,useFormState:mo,useActionState:mo,useOptimistic:mo,useMemoCache:mo,useCacheRefresh:mo};Ns.useEffectEvent=mo;var Ps={readContext:qi,use:Do,useCallback:function(e,t){return Co().memoizedState=[e,t===void 0?null:t],e},useContext:qi,useEffect:rs,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),ts(4194308,4,us.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ts(4194308,4,e,t)},useInsertionEffect:function(e,t){ts(4,2,e,t)},useMemo:function(e,t){var n=Co();t=t===void 0?null:t;var r=e();if(co){Ae(!0);try{e()}finally{Ae(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Co();if(n!==void 0){var i=n(t);if(co){Ae(!0);try{n(t)}finally{Ae(!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=Es.bind(null,ro,e),[r.memoizedState,e]},useRef:function(e){var t=Co();return e={current:e},t.memoizedState=e},useState:function(e){e=zo(e);var t=e.queue,n=Ds.bind(null,ro,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:fs,useDeferredValue:function(e,t){return hs(Co(),e,t)},useTransition:function(){var e=zo(!1);return e=_s.bind(null,ro,e.queue,!0,!1),Co().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=ro,a=Co();if(Ei){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Ll===null)throw Error(i(349));zl&127||Po(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,rs(Io.bind(null,r,o,e),[e]),r.flags|=2048,$o(9,{destroy:void 0},Fo.bind(null,r,o,n,t),null),n},useId:function(){var e=Co(),t=Ll.identifierPrefix;if(Ei){var n=vi,r=_i;n=(r&~(1<<32-je(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=lo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=po++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Ss,useFormState:Jo,useActionState:Jo,useOptimistic:function(e){var t=Co();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=ks.bind(null,ro,!0,n),n.dispatch=t,[e,t]},useMemoCache:Oo,useCacheRefresh:function(){return Co().memoizedState=Ts.bind(null,ro)},useEffectEvent:function(e){var t=Co(),n={impl:e};return t.memoizedState=n,function(){if(Il&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Fs={readContext:qi,use:Do,useCallback:ps,useContext:qi,useEffect:is,useImperativeHandle:ds,useInsertionEffect:cs,useLayoutEffect:ls,useMemo:ms,useReducer:Ao,useRef:es,useState:function(){return Ao(ko)},useDebugValue:fs,useDeferredValue:function(e,t){return gs(wo(),io.memoizedState,e,t)},useTransition:function(){var e=Ao(ko)[0],t=wo().memoizedState;return[typeof e==`boolean`?e:Eo(e),t]},useSyncExternalStore:No,useId:Cs,useHostTransitionStatus:Ss,useFormState:Yo,useActionState:Yo,useOptimistic:function(e,t){return Bo(wo(),io,e,t)},useMemoCache:Oo,useCacheRefresh:ws};Fs.useEffectEvent=ss;var Is={readContext:qi,use:Do,useCallback:ps,useContext:qi,useEffect:is,useImperativeHandle:ds,useInsertionEffect:cs,useLayoutEffect:ls,useMemo:ms,useReducer:Mo,useRef:es,useState:function(){return Mo(ko)},useDebugValue:fs,useDeferredValue:function(e,t){var n=wo();return io===null?hs(n,e,t):gs(n,io.memoizedState,e,t)},useTransition:function(){var e=Mo(ko)[0],t=wo().memoizedState;return[typeof e==`boolean`?e:Eo(e),t]},useSyncExternalStore:No,useId:Cs,useHostTransitionStatus:Ss,useFormState:Qo,useActionState:Qo,useOptimistic:function(e,t){var n=wo();return io===null?(n.baseState=e,[e,n.queue.dispatch]):Bo(n,io,e,t)},useMemoCache:Oo,useCacheRefresh:ws};Is.useEffectEvent=ss;function Ls(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 Rs={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=hu(),i=Fa(r);i.payload=t,n!=null&&(i.callback=n),t=Ia(e,i,r),t!==null&&(_u(t,e,r),La(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=hu(),i=Fa(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Ia(e,i,r),t!==null&&(_u(t,e,r),La(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=hu(),r=Fa(n);r.tag=2,t!=null&&(r.callback=t),t=Ia(e,r,n),t!==null&&(_u(t,e,n),La(t,e,n))}};function zs(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?!_r(n,r)||!_r(i,a):!0}function Bs(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&&Rs.enqueueReplaceState(t,t.state,null)}function Vs(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 Hs(e){Vr(e)}function Us(e){console.error(e)}function Ws(e){Vr(e)}function Gs(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Ks(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=Fa(n),n.tag=3,n.payload={element:null},n.callback=function(){Gs(e,t)},n}function Js(e){return e=Fa(e),e.tag=3,e}function Ys(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(){Ks(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Ks(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 Xs(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Wi(t,n,a,!0),n=Ya.current,n!==null){switch(n.tag){case 31:case 13:return J===null?ku():n.alternate===null&&Kl===0&&(Kl=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===_a?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===_a?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(Ei)return t=Ya.current,t===null?(r!==ki&&(t=Error(i(423),{cause:r}),Ii(li(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=li(r,n),a=qs(e.stateNode,r,a),Ra(e,a),Kl!==4&&(Kl=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==ki&&(e=Error(i(422),{cause:r}),Ii(li(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=li(o,n),Ql===null?Ql=[o]:Ql.push(o),Kl!==4&&(Kl=2),t===null)return!0;r=li(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),Ra(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=Js(a),Ys(a,e,n,r),Ra(n,a),!1}n=n.return}while(n!==null);return!1}var Zs=Error(i(461)),Qs=!1;function $s(e,t,n,r){t.child=e===null?ja(t,null,n,r):Aa(t,e.child,n,r)}function ec(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 Ki(t),r=go(e,t,n,o,a,i),s=bo(),e!==null&&!Qs?(xo(e,t,i),wc(e,t,i)):(Ei&&s&&xi(t),t.flags|=1,$s(e,t,r,i),t.child)}function tc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ei(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,nc(e,t,a,r,i)):(e=ri(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Tc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?_r:n,n(o,r)&&e.ref===t.ref)return wc(e,t,i)}return t.flags|=1,e=ti(a,r),e.ref=t.ref,e.return=t,t.child=e}function nc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(_r(a,r)&&e.ref===t.ref)if(Qs=!1,t.pendingProps=r=a,Tc(e,i))e.flags&131072&&(Qs=!0);else return t.lanes=e.lanes,wc(e,t,i)}return uc(e,t,n,r,i)}function rc(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 ac(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&fa(t,a===null?null:a.cachePool),a===null?qa():Ka(t,a),Y(t);else return r=t.lanes=536870912,ac(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&fa(t,null),qa(),Qa(t)):(fa(t,a.cachePool),Ka(t,a),Qa(t),t.memoizedState=null);return $s(e,t,i,n),t.child}function ic(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function ac(e,t,n,r,i){var a=da();return a=a===null?null:{parent:$i._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&fa(t,null),qa(),Y(t),e!==null&&Wi(e,t,r,!0),t.childLanes=i,null}function oc(e,t){return t=yc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function sc(e,t,n){return Aa(t,e.child,null,n),e=oc(t,t.pendingProps),e.flags|=2,$a(t),t.memoizedState=null,e}function cc(e,t,n){var r=t.pendingProps,a=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(Ei){if(r.mode===`hidden`)return e=oc(t,r),t.lanes=536870912,ic(null,e);if(Za(t),(e=Ti)?(e=lf(e,Oi),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:gi===null?null:{id:_i,overflow:vi},retryLane:536870912,hydrationErrors:null},n=oi(e),n.return=t,t.child=n,wi=t,Ti=null)):e=null,e===null)throw Ai(t);return t.lanes=536870912,null}return oc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(Za(t),a)if(t.flags&256)t.flags&=-257,t=sc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558));else if(Qs||Wi(e,t,n,!1),a=(n&e.childLanes)!==0,Qs||a){if(r=Ll,r!==null&&(s=Je(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,Jr(e,s),_u(r,e,s),Zs;ku(),t=sc(e,t,n)}else e=o.treeContext,Ti=pf(s.nextSibling),wi=t,Ei=!0,Di=null,Oi=!1,e!==null&&Ci(t,e),t=oc(t,r),t.flags|=4096;return t}return e=ti(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function lc(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 uc(e,t,n,r,i){return Ki(t),n=go(e,t,n,r,void 0,i),r=bo(),e!==null&&!Qs?(xo(e,t,i),wc(e,t,i)):(Ei&&r&&xi(t),t.flags|=1,$s(e,t,n,i),t.child)}function dc(e,t,n,r,i,a){return Ki(t),t.updateQueue=null,n=vo(t,r,n,i),_o(e),r=bo(),e!==null&&!Qs?(xo(e,t,a),wc(e,t,a)):(Ei&&r&&xi(t),t.flags|=1,$s(e,t,n,a),t.child)}function fc(e,t,n,r,i){if(Ki(t),t.stateNode===null){var a=Zr,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=Rs,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Na(t),o=n.contextType,a.context=typeof o==`object`&&o?qi(o):Zr,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Ls(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&&Rs.enqueueReplaceState(a,a.state,null),Va(t,r,a,i),Ba(),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=Vs(n,s);a.props=c;var l=a.context,u=n.contextType;o=Zr,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)&&Bs(t,a,r,o),Ma=!1;var f=t.memoizedState;a.state=f,Va(t,r,a,i),Ba(),l=t.memoizedState,s||f!==l||Ma?(typeof d==`function`&&(Ls(t,n,d,r),l=t.memoizedState),(c=Ma||zs(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,Pa(e,t),o=t.memoizedProps,u=Vs(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=Zr,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)&&Bs(t,a,r,c),Ma=!1,f=t.memoizedState,a.state=f,Va(t,r,a,i),Ba();var p=t.memoizedState;o!==d||f!==p||Ma||e!==null&&e.dependencies!==null&&Gi(e.dependencies)?(typeof s==`function`&&(Ls(t,n,s,r),p=t.memoizedState),(u=Ma||zs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Gi(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,lc(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=Aa(t,e.child,null,i),t.child=Aa(t,null,n,i)):$s(e,t,n,i),t.memoizedState=a.state,e=t.child):e=wc(e,t,i),e}function pc(e,t,n,r){return Pi(),t.flags|=256,$s(e,t,n,r),t.child}var mc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function hc(e){return{baseLanes:e,cachePool:pa()}}function gc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=Xl),e}function _c(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:(eo.current&2)!=0),s&&(a=!0,t.flags&=-129),s=(t.flags&32)!=0,t.flags&=-33,e===null){if(Ei){if(a?Xa(t):Qa(t),(e=Ti)?(e=lf(e,Oi),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:gi===null?null:{id:_i,overflow:vi},retryLane:536870912,hydrationErrors:null},n=oi(e),n.return=t,t.child=n,wi=t,Ti=null)):e=null,e===null)throw Ai(t);return df(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(Qa(t),a=t.mode,c=yc({mode:`hidden`,children:c},a),r=ii(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=hc(n),r.childLanes=gc(e,s,n),t.memoizedState=mc,ic(null,r)):(Xa(t),vc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(Xa(t),t.flags&=-257,t=bc(e,t,n)):t.memoizedState===null?(Qa(t),c=r.fallback,a=t.mode,r=yc({mode:`visible`,children:r.children},a),c=ii(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Aa(t,e.child,null,n),r=t.child,r.memoizedState=hc(n),r.childLanes=gc(e,s,n),t.memoizedState=mc,t=ic(null,r)):(Qa(t),t.child=e.child,t.flags|=128,t=null);else if(Xa(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,Ii({value:r,source:null,stack:null}),t=bc(e,t,n)}else if(Qs||Wi(e,t,n,!1),s=(n&e.childLanes)!==0,Qs||s){if(s=Ll,s!==null&&(r=Je(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,Jr(e,r),_u(s,e,r),Zs;uf(c)||ku(),t=bc(e,t,n)}else uf(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Ti=pf(c.nextSibling),wi=t,Ei=!0,Di=null,Oi=!1,e!==null&&Ci(t,e),t=vc(t,r.children),t.flags|=4096);return t}return a?(Qa(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=ti(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=ii(c,a,n,null),c.flags|=2):c=ti(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,ic(null,r),r=t.child,c=e.child.memoizedState,c===null?c=hc(n):(a=c.cachePool,a===null?a=pa():(l=$i._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=gc(e,s,n),t.memoizedState=mc,ic(e.child,r)):(Xa(t),n=e.child,e=n.sibling,n=ti(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 vc(e,t){return t=yc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function yc(e,t){return e=$r(22,e,null,t),e.lanes=0,e}function bc(e,t,n){return Aa(t,e.child,null,n),e=vc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function xc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Hi(e.return,t,n)}function Sc(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 Cc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=eo.current,s=(o&2)!=0;if(s?(o=o&1|2,t.flags|=128):o&=1,H(eo,o),$s(e,t,r,n),r=Ei?pi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&xc(e,n,t);else if(e.tag===19)xc(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&&to(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Sc(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&&to(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Sc(t,!0,n,null,a,r);break;case`together`:Sc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function wc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),ql|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Wi(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=ti(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ti(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Tc(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&Gi(e))):!0}function Ec(e,t,n){switch(t.tag){case 3:re(t,t.stateNode.containerInfo),Bi(t,$i,e.memoizedState.cache),Pi();break;case 27:case 5:ae(t);break;case 4:re(t,t.stateNode.containerInfo);break;case 10:Bi(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Za(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(Xa(t),e=wc(e,t,n),e===null?null:e.sibling):_c(e,t,n):(Xa(t),t.flags|=128,null);Xa(t);break;case 19:var i=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=(Wi(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return Cc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),H(eo,eo.current),r)break;return null;case 22:return t.lanes=0,rc(e,t,n,t.pendingProps);case 24:Bi(t,$i,e.memoizedState.cache)}return wc(e,t,n)}function Dc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Qs=!0;else{if(!Tc(e,n)&&!(t.flags&128))return Qs=!1,Ec(e,t,n);Qs=!!(e.flags&131072)}else Qs=!1,Ei&&t.flags&1048576&&bi(t,pi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=ba(t.elementType),t.type=e,typeof e==`function`)ei(e)?(r=Vs(e,r),t.tag=1,t=fc(null,t,e,r,n)):(t.tag=0,t=uc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===w){t.tag=11,t=ec(null,t,e,r,n);break a}else if(a===D){t.tag=14,t=tc(null,t,e,r,n);break a}}throw t=P(e)||e,Error(i(306,t,``))}}return t;case 0:return uc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Vs(r,t.pendingProps),fc(e,t,r,a,n);case 3:a:{if(re(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,Pa(e,t),Va(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Bi(t,$i,r),r!==o.cache&&Ui(t,[$i],n,!0),Ba(),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=pc(e,t,r,n);break a}else if(r!==a){a=li(Error(i(424)),t),Ii(a),t=pc(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(Ti=pf(e.firstChild),wi=t,Ei=!0,Di=null,Oi=!0,n=ja(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Pi(),r===a){t=wc(e,t,n);break a}$s(e,t,r,n)}t=t.child}return t;case 26:return lc(e,t),e===null?(n=Pf(t.type,null,t.pendingProps,null))?t.memoizedState=n:Ei||(n=t.type,e=t.pendingProps,r=Gd(W.current).createElement(n),r[et]=t,r[tt]=e,zd(r,n,e),pt(r),t.stateNode=r):t.memoizedState=Pf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ae(t),e===null&&Ei&&(r=t.stateNode=_f(t.type,t.pendingProps,W.current),wi=t,Oi=!0,a=Ti,nf(t.type)?(mf=a,Ti=pf(r.firstChild)):Ti=a),$s(e,t,t.pendingProps.children,n),lc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ei&&((a=r=Ti)&&(r=sf(r,t.type,t.pendingProps,Oi),r===null?a=!1:(t.stateNode=r,wi=t,Ti=pf(r.firstChild),Oi=!1,a=!0)),a||Ai(t)),ae(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=go(e,t,yo,null,null,n),rp._currentValue=a),lc(e,t),$s(e,t,r,n),t.child;case 6:return e===null&&Ei&&((e=n=Ti)&&(n=cf(n,t.pendingProps,Oi),n===null?e=!1:(t.stateNode=n,wi=t,Ti=null,e=!0)),e||Ai(t)),null;case 13:return _c(e,t,n);case 4:return re(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Aa(t,null,r,n):$s(e,t,r,n),t.child;case 11:return ec(e,t,t.type,t.pendingProps,n);case 7:return $s(e,t,t.pendingProps,n),t.child;case 8:return $s(e,t,t.pendingProps.children,n),t.child;case 12:return $s(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Bi(t,t.type,r.value),$s(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,Ki(t),a=qi(a),r=r(a),t.flags|=1,$s(e,t,r,n),t.child;case 14:return tc(e,t,t.type,t.pendingProps,n);case 15:return nc(e,t,t.type,t.pendingProps,n);case 19:return Cc(e,t,n);case 31:return cc(e,t,n);case 22:return rc(e,t,n,t.pendingProps);case 24:return Ki(t),r=qi($i),e===null?(a=da(),a===null&&(a=Ll,o=ea(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},Na(t),Bi(t,$i,a)):((e.lanes&n)!==0&&(Pa(e,t),Va(t,null,null,n),Ba()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,Bi(t,$i,r),r!==a.cache&&Ui(t,[$i],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Bi(t,$i,r))),$s(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Oc(e){e.flags|=4}function kc(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 xa=_a,ha}else e.flags&=-16777217}function Ac(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 xa=_a,ha}function jc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:He(),e.lanes|=t,Zl|=t)}function Mc(e,t){if(!Ei)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 Nc(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 Pc(e,t,n){var r=t.pendingProps;switch(Si(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Nc(t),null;case 1:return Nc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Vi($i),ie(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Ni(t)?Oc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Fi())),Nc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(Oc(t),o===null?(Nc(t),kc(t,a,null,r,n)):(Nc(t),Ac(t,o))):o?o===e.memoizedState?(Nc(t),t.flags&=-16777217):(Oc(t),Nc(t),Ac(t,o)):(e=e.memoizedProps,e!==r&&Oc(t),Nc(t),kc(t,a,e,r,n)),null;case 27:if(oe(t),n=W.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Oc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Nc(t),null}e=te.current,Ni(t)?ji(t,e):(e=_f(a,r,n),t.stateNode=e,Oc(t))}return Nc(t),null;case 5:if(oe(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Oc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Nc(t),null}if(o=te.current,Ni(t))ji(t,o);else{var s=Gd(W.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[et]=t,o[tt]=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&&Oc(t)}}return Nc(t),kc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Oc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=W.current,Ni(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=wi,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[et]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Id(e.nodeValue,n)),e||Ai(t,!0)}else e=Gd(e).createTextNode(r),e[et]=t,t.stateNode=e}return Nc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Ni(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[et]=t}else Pi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Nc(t),e=!1}else n=Fi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?($a(t),t):($a(t),null);if(t.flags&128)throw Error(i(558))}return Nc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Ni(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[et]=t}else Pi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Nc(t),a=!1}else a=Fi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?($a(t),t):($a(t),null)}return $a(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),jc(t,t.updateQueue),Nc(t),null);case 4:return ie(),e===null&&Ed(t.stateNode.containerInfo),Nc(t),null;case 10:return Vi(t.type),Nc(t),null;case 19:if(V(eo),r=t.memoizedState,r===null)return Nc(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)Mc(r,!1);else{if(Kl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=to(e),o!==null){for(t.flags|=128,Mc(r,!1),e=o.updateQueue,t.updateQueue=e,jc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ni(n,e),n=n.sibling;return H(eo,eo.current&1|2),Ei&&yi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&ye()>ru&&(t.flags|=128,a=!0,Mc(r,!1),t.lanes=4194304)}else{if(!a)if(e=to(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,jc(t,e),Mc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!Ei)return Nc(t),null}else 2*ye()-r.renderingStartTime>ru&&n!==536870912&&(t.flags|=128,a=!0,Mc(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?(Nc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=ye(),e.sibling=null,n=eo.current,H(eo,a?n&1|2:n&1),Ei&&yi(t,r.treeForkCount),e);case 22:case 23:return $a(t),Ja(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Nc(t),t.subtreeFlags&6&&(t.flags|=8192)):Nc(t),n=t.updateQueue,n!==null&&jc(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&&V(ua),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Vi($i),Nc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Fc(e,t){switch(Si(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Vi($i),ie(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return oe(t),null;case 31:if(t.memoizedState!==null){if($a(t),t.alternate===null)throw Error(i(340));Pi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if($a(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Pi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return V(eo),null;case 4:return ie(),null;case 10:return Vi(t.type),null;case 22:case 23:return $a(t),Ja(),e!==null&&V(ua),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Vi($i),null;case 25:return null;default:return null}}function Ic(e,t){switch(Si(t),t.tag){case 3:Vi($i),ie();break;case 26:case 27:case 5:oe(t);break;case 4:ie();break;case 31:t.memoizedState!==null&&$a(t);break;case 13:$a(t);break;case 19:V(eo);break;case 10:Vi(t.type);break;case 22:case 23:$a(t),Ja(),e!==null&&V(ua);break;case 24:Vi($i)}}function Lc(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 Rc(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 zc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Ua(t,n)}catch(t){qu(e,e.return,t)}}}function Bc(e,t,n){n.props=Vs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){qu(e,t,n)}}function Vc(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 Hc(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 Uc(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 Wc(e,t,n){try{var r=e.stateNode;Bd(r,e.type,n,t),r[tt]=t}catch(t){qu(e,e.return,t)}}function Gc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&nf(e.type)||e.tag===4}function Kc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Gc(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 qc(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=qt));else if(r!==4&&(r===27&&nf(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(qc(e,t,n),e=e.sibling;e!==null;)qc(e,t,n),e=e.sibling}function Jc(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(Jc(e,t,n),e=e.sibling;e!==null;)Jc(e,t,n),e=e.sibling}function Yc(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[et]=e,t[tt]=n}catch(t){qu(e,e.return,t)}}var Xc=!1,Zc=!1,Qc=!1,$c=typeof WeakSet==`function`?WeakSet:Set,el=null;function tl(e,t){if(e=e.containerInfo,Ud=fp,e=xr(e),Sr(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,el=t;el!==null;)if(t=el,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,el=e;else for(;el!==null;){switch(t=el,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=Vs(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,el=e;break}el=t.return}}function nl(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:_l(e,n),r&4&&Lc(5,n);break;case 1:if(_l(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){qu(n,n.return,e)}else{var i=Vs(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){qu(n,n.return,e)}}r&64&&zc(n),r&512&&Vc(n,n.return);break;case 3:if(_l(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{Ua(e,t)}catch(e){qu(n,n.return,e)}}break;case 27:t===null&&r&4&&Yc(n);case 26:case 5:_l(e,n),t===null&&r&4&&Uc(n),r&512&&Vc(n,n.return);break;case 12:_l(e,n);break;case 31:_l(e,n),r&4&&cl(e,n);break;case 13:_l(e,n),r&4&&ll(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||Xc,!r){t=t!==null&&t.memoizedState!==null||Zc,i=Xc;var a=Zc;Xc=r,(Zc=t)&&!a?yl(e,n,(n.subtreeFlags&8772)!=0):_l(e,n),Xc=i,Zc=a}break;case 30:break;default:_l(e,n)}}function rl(e){var t=e.alternate;t!==null&&(e.alternate=null,rl(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&ct(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 il=null,al=!1;function ol(e,t,n){for(n=n.child;n!==null;)sl(e,t,n),n=n.sibling}function sl(e,t,n){if(ke&&typeof ke.onCommitFiberUnmount==`function`)try{ke.onCommitFiberUnmount(Oe,n)}catch{}switch(n.tag){case 26:Zc||Hc(n,t),ol(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Zc||Hc(n,t);var r=il,i=al;nf(n.type)&&(il=n.stateNode,al=!1),ol(e,t,n),vf(n.stateNode),il=r,al=i;break;case 5:Zc||Hc(n,t);case 6:if(r=il,i=al,il=null,ol(e,t,n),il=r,al=i,il!==null)if(al)try{(il.nodeType===9?il.body:il.nodeName===`HTML`?il.ownerDocument.body:il).removeChild(n.stateNode)}catch(e){qu(n,t,e)}else try{il.removeChild(n.stateNode)}catch(e){qu(n,t,e)}break;case 18:il!==null&&(al?(e=il,rf(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Rp(e)):rf(il,n.stateNode));break;case 4:r=il,i=al,il=n.stateNode.containerInfo,al=!0,ol(e,t,n),il=r,al=i;break;case 0:case 11:case 14:case 15:Rc(2,n,t),Zc||Rc(4,n,t),ol(e,t,n);break;case 1:Zc||(Hc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Bc(n,t,r)),ol(e,t,n);break;case 21:ol(e,t,n);break;case 22:Zc=(r=Zc)||n.memoizedState!==null,ol(e,t,n),Zc=r;break;default:ol(e,t,n)}}function cl(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 ll(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 ul(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new $c),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new $c),t;default:throw Error(i(435,e.tag))}}function dl(e,t){var n=ul(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Qu.bind(null,e,t);t.then(r,r)}})}function fl(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)){il=c.stateNode,al=!1;break a}break;case 5:il=c.stateNode,al=!1;break a;case 3:case 4:il=c.stateNode.containerInfo,al=!0;break a}c=c.return}if(il===null)throw Error(i(160));sl(o,s,a),il=null,al=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)ml(t,e),t=t.sibling}var pl=null;function ml(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:fl(t,e),hl(e),r&4&&(Rc(3,e,e.return),Lc(3,e),Rc(5,e,e.return));break;case 1:fl(t,e),hl(e),r&512&&(Zc||n===null||Hc(n,n.return)),r&64&&Xc&&(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=pl;if(fl(t,e),hl(e),r&512&&(Zc||n===null||Hc(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[st]||o[et]||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[et]=e,pt(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[et]=e,pt(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&&Wc(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:fl(t,e),hl(e),r&512&&(Zc||n===null||Hc(n,n.return)),n!==null&&r&4&&Wc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(fl(t,e),hl(e),r&512&&(Zc||n===null||Hc(n,n.return)),e.flags&32){a=e.stateNode;try{zt(a,``)}catch(t){qu(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Wc(e,a,n===null?a:n.memoizedProps)),r&1024&&(Qc=!0);break;case 6:if(fl(t,e),hl(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=pl,pl=xf(t.containerInfo),fl(t,e),pl=a,hl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Rp(t.containerInfo)}catch(t){qu(e,e.return,t)}Qc&&(Qc=!1,gl(e));break;case 4:r=pl,pl=xf(e.stateNode.containerInfo),fl(t,e),hl(e),pl=r;break;case 12:fl(t,e),hl(e);break;case 31:fl(t,e),hl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,dl(e,r)));break;case 13:fl(t,e),hl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(tu=ye()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,dl(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=Xc,d=Zc;if(Xc=u||a,Zc=d||l,fl(t,e),Zc=d,Xc=u,hl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||Xc||Zc||vl(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,dl(e,n))));break;case 19:fl(t,e),hl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,dl(e,r)));break;case 30:break;case 21:break;default:fl(t,e),hl(e)}}function hl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Gc(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;Jc(e,Kc(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(zt(o,``),n.flags&=-33),Jc(e,Kc(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;qc(e,Kc(e),s);break;default:throw Error(i(161))}}catch(t){qu(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function gl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;gl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function _l(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)nl(e,t.alternate,t),t=t.sibling}function vl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Rc(4,t,t.return),vl(t);break;case 1:Hc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Bc(t,t.return,n),vl(t);break;case 27:vf(t.stateNode);case 26:case 5:Hc(t,t.return),vl(t);break;case 22:t.memoizedState===null&&vl(t);break;case 30:vl(t);break;default:vl(t)}e=e.sibling}}function yl(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:yl(i,a,n),Lc(4,a);break;case 1:if(yl(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++)Ha(c[i],s)}catch(e){qu(r,r.return,e)}}n&&o&64&&zc(a),Vc(a,a.return);break;case 27:Yc(a);case 26:case 5:yl(i,a,n),n&&r===null&&o&4&&Uc(a),Vc(a,a.return);break;case 12:yl(i,a,n);break;case 31:yl(i,a,n),n&&o&4&&cl(i,a);break;case 13:yl(i,a,n),n&&o&4&&ll(i,a);break;case 22:a.memoizedState===null&&yl(i,a,n),Vc(a,a.return);break;case 30:break;default:yl(i,a,n)}t=t.sibling}}function bl(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&&ta(n))}function xl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ta(e))}function Sl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Cl(e,t,n,r),t=t.sibling}function Cl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Sl(e,t,n,r),i&2048&&Lc(9,t);break;case 1:Sl(e,t,n,r);break;case 3:Sl(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&&ta(e)));break;case 12:if(i&2048){Sl(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 Sl(e,t,n,r);break;case 31:Sl(e,t,n,r);break;case 13:Sl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?Sl(e,t,n,r):(a._visibility|=2,wl(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?Sl(e,t,n,r):Tl(e,t),i&2048&&bl(o,t);break;case 24:Sl(e,t,n,r),i&2048&&xl(t.alternate,t);break;default:Sl(e,t,n,r)}}function wl(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:wl(a,o,s,c,i),Lc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,wl(a,o,s,c,i)):u._visibility&2?wl(a,o,s,c,i):Tl(a,o),i&&l&2048&&bl(o.alternate,o);break;case 24:wl(a,o,s,c,i),i&&l&2048&&xl(o.alternate,o);break;default:wl(a,o,s,c,i)}t=t.sibling}}function Tl(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:Tl(n,r),i&2048&&bl(r.alternate,r);break;case 24:Tl(n,r),i&2048&&xl(r.alternate,r);break;default:Tl(n,r)}t=t.sibling}}var El=8192;function Dl(e,t,n){if(e.subtreeFlags&El)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&El&&e.memoizedState!==null&&Xf(n,pl,e.memoizedState,e.memoizedProps);break;case 5:Dl(e,t,n);break;case 3:case 4:var r=pl;pl=xf(e.stateNode.containerInfo),Dl(e,t,n),pl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=El,El=16777216,Dl(e,t,n),El=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];el=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&&Rc(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];el=r,Nl(r,e)}kl(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Rc(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(;el!==null;){var n=el;switch(n.tag){case 0:case 11:case 15:Rc(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:ta(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,el=r;else a:for(n=e;el!==null;){r=el;var i=r.sibling,a=r.return;if(rl(r),r===n){el=null;break a}if(i!==null){i.return=a,el=i;break a}el=a}}}var Pl={getCacheForType:function(e){var t=qi($i),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return qi($i).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?Ze():md()}function gu(){if(Xl===0)if(!(zl&536870912)||Ei){var e=Ie;Ie<<=1,!(Ie&3932160)&&(Ie=262144),Xl=e}else Xl=536870912;return e=Ya.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)),We(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||Be(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-ye(),10<a)){if(xu(r,t,Xl,!Hl),ze(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:qt},Ol(t,a,d);var m=(a&62914560)===a?tu-ye():(a&4194048)===a?nu-ye():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(!gr(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-je(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Ke(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,zi=Ri=null,So(e),wa=null,Ta=0,e=Rl;for(;e!==null;)Ic(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=ti(e.current,null),zl=t,Bl=0,Vl=null,Hl=!1,Ul=Be(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-je(r),a=1<<i;t|=e[i],r&=~a}return Gl=t,Gr(),n}function Tu(e,t){ro=null,I.H=Ns,t===ma||t===ga?(t=Sa(),Bl=3):t===ha?(t=Sa(),Bl=4):Bl=t===Zs?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Vl=t,Rl===null&&(Kl=1,Gs(e,li(t,e.current)))}function Eu(){var e=Ya.current;return e===null?!0:(zl&4194048)===zl?J===null:(zl&62914560)===zl||zl&536870912?e===J:!1}function Du(){var e=I.H;return I.H=Ns,e===null?Ns:e}function Ou(){var e=I.A;return I.A=Pl,e}function ku(){Kl=4,Hl||(zl&4194048)!==zl&&Ya.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:Ya.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++,zi=Ri=null,Il=r,I.H=i,I.A=a,Rl===null&&(Ll=null,zl=0,Gr()),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=ye()+500,wu(e,t)):Ul=Be(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(va(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:va(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 zi=Ri=null,I.H=r,I.A=a,Il=n,Rl===null?(Ll=null,zl=0,Gr(),Kl):0}function Nu(){for(;Rl!==null&&!_e();)Pu(Rl)}function Pu(e){var t=Dc(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=dc(n,t,t.pendingProps,t.type,void 0,zl);break;case 11:t=dc(n,t,t.pendingProps,t.type.render,t.ref,zl);break;case 5:So(t);default:Ic(n,t),t=Rl=ni(t,Gl),t=Dc(n,t,Gl)}e.memoizedProps=e.pendingProps,t===null?Lu(e):Rl=t}function Iu(e,t,n,r){zi=Ri=null,So(t),wa=null,Ta=0;var i=t.return;try{if(Xs(e,i,t,n,zl)){Kl=1,Gs(e,li(n,e.current)),Rl=null;return}}catch(t){if(i!==null)throw Rl=i,t;Kl=1,Gs(e,li(n,e.current)),Rl=null;return}t.flags&32768?(Ei||r===1?e=!0:Ul||zl&536870912?e=!1:(Hl=e=!0,(r===2||r===9||r===3||r===6)&&(r=Ya.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=Pc(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=Fc(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|=Wr,Ge(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(Ce,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{tl(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{ml(t,e);var a=Wd,o=xr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&br(s.ownerDocument.documentElement,s)){if(c!==null&&Sr(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 _=yr(s,h),v=yr(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{nl(e,t.alternate,t)}finally{Il=i,L.p=r,I.T=n}}ou=3}}function Hu(){if(ou===4||ou===3){ou=0,ve();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),Xe(n),t=t.stateNode,ke&&typeof ke.onCommitFiberRoot==`function`)try{ke.onCommitFiberRoot(Oe,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,ta(t)))}function Wu(){return Bu(),Vu(),Hu(),Gu()}function Gu(){if(ou!==5)return!1;var e=su,t=uu;uu=0;var n=Xe(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),Cl(o,o.current,s,n),Il=c,sd(0,!1),ke&&typeof ke.onPostCommitFiberRoot==`function`)try{ke.onPostCommitFiberRoot(Oe,o)}catch{}return!0}finally{L.p=a,I.T=r,Uu(e,t)}}function Ku(e,t,n){t=li(n,t),t=qs(e.stateNode,t,2),e=Ia(e,t,2),e!==null&&(We(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=li(n,e),n=Js(2),r=Ia(t,n,2),r!==null&&(Ys(n,r,t,e),We(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>ye()-tu?!(Il&2)&&wu(e,0):Yl|=n,Zl===zl&&(Zl=0)),od(e)}function Xu(e,t){t===0&&(t=He()),e=Jr(e,t),e!==null&&(We(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 he(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-je(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=ze(r,r===Ll?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Be(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=ye(),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-je(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Ve(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Ll,n=zl,n=ze(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&&ge(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Be(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&ge(r),Xe(n)){case 2:case 8:n=Se;break;case 32:n=Ce;break;case 268435456:n=Te;break;default:n=Ce}return r=dd.bind(null,e),n=he(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&ge(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=ze(e,e===Ll?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(vu(e,r,t),ud(e,ye()),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?he(xe,cd):ld()})}function md(){if(ad===0){var e=ia;e===0&&(e=Fe,Fe<<=1,!(Fe&261888)&&(Fe=256)),ad=e}return ad}function hd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Kt(``+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[tt]||null).action),o=r.submitter;o&&(t=(t=o[tt]||null)?hd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new hn(`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);ys(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),ys(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var vd=0;vd<zr.length;vd++){var yd=zr[vd];Br(yd.toLowerCase(),`on`+(yd[0].toUpperCase()+yd.slice(1)))}Br(jr,`onAnimationEnd`),Br(Mr,`onAnimationIteration`),Br(Nr,`onAnimationStart`),Br(`dblclick`,`onDoubleClick`),Br(`focusin`,`onFocus`),Br(`focusout`,`onBlur`),Br(Pr,`onTransitionRun`),Br(Fr,`onTransitionStart`),Br(Ir,`onTransitionCancel`),Br(Lr,`onTransitionEnd`),_t(`onMouseEnter`,[`mouseout`,`mouseover`]),_t(`onMouseLeave`,[`mouseout`,`mouseover`]),_t(`onPointerEnter`,[`pointerout`,`pointerover`]),_t(`onPointerLeave`,[`pointerout`,`pointerover`]),gt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),gt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),gt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),gt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),gt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),gt(`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){Vr(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){Vr(e)}i.currentTarget=null,a=c}}}}function Cd(e,t){var n=t[rt];n===void 0&&(n=t[rt]=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,mt.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,!rn||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=lt(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}en(function(){var r=a,i=Yt(n),s=[];a:{var c=Rr.get(e);if(c!==void 0){var l=hn,u=e;switch(e){case`keypress`:if(un(n)===0)break a;case`keydown`:case`keyup`:l=Nn;break;case`focusin`:u=`focus`,l=wn;break;case`focusout`:u=`blur`,l=wn;break;case`beforeblur`:case`afterblur`:l=wn;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=Sn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Cn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Fn;break;case jr:case Mr:case Nr:l=Tn;break;case Lr:l=In;break;case`scroll`:case`scrollend`:l=_n;break;case`wheel`:l=Ln;break;case`copy`:case`cut`:case`paste`:l=En;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Pn;break;case`toggle`:case`beforetoggle`:l=Rn}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=tn(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!==Jt&&(u=n.relatedTarget||n.fromElement)&&(lt(u)||u[nt]))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?lt(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=Sn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Pn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:dt(l),h=u==null?c:dt(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,lt(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?dt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=ir;else if(Qn(c))if(ar)v=mr;else{v=fr;var y=dr}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&Ut(r.elementType)&&(v=ir):v=pr;if(v&&=v(e,r)){$n(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&Ft(c,`number`,c.value)}switch(y=r?dt(r):window,e){case`focusin`:(Qn(y)||y.contentEditable===`true`)&&(wr=y,G=r,Tr=null);break;case`focusout`:Tr=G=wr=null;break;case`mousedown`:K=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:K=!1,Er(s,n,i);break;case`selectionchange`:if(Cr)break;case`keydown`:case`keyup`:Er(s,n,i)}var b;if(Bn)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 Jn?Kn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Un&&n.locale!==`ko`&&(Jn||x!==`onCompositionStart`?x===`onCompositionEnd`&&Jn&&(b=ln()):(on=i,sn=`value`in on?on.value:on.textContent,Jn=!0)),y=Ad(r,x),0<y.length&&(x=new Dn(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=qn(n),b!==null&&(x.data=b)))),(b=Hn?Yn(e,n):Xn(e,n))&&(x=Ad(r,`onBeforeInput`),0<x.length&&(y=new Dn(`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=tn(e,n),i!=null&&r.unshift(kd(e,i,a)),i=tn(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=tn(n,a),l!=null&&o.unshift(kd(n,l,c))):i||(l=tn(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,`
`).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===``||zt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&zt(e,``+r);break;case`className`:Ct(e,`class`,r);break;case`tabIndex`:Ct(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Ct(e,n,r);break;case`style`:Ht(e,r,o);break;case`data`:if(t!==`object`){Ct(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=Kt(``+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=Kt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=qt);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=Kt(``+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),St(e,`popover`,r);break;case`xlinkActuate`:wt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:wt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:wt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:wt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:wt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:wt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:wt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:wt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:wt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:St(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=Wt.get(n)||n,St(e,n,r))}}function Rd(e,t,n,r,a,o){switch(n){case`style`:Ht(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`?zt(e,r):(typeof r==`number`||typeof r==`bigint`)&&zt(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=qt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!ht.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[tt]||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,``):St(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)}}Pt(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&&It(e,!!r,n,!0):It(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)}Rt(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(Ut(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)}}Nt(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?It(e,!!n,n?[]:``,!1):It(e,!!n,t,!0)):It(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)}Lt(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(Ut(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[st]||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),ct(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[st])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]);ct(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=ut(e);t!==null&&t.tag===5&&t.type===`form`?xs(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=Mt(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),pt(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="`+Mt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Mt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Mt(n.imageSizes)+`"]`)):i+=`[href="`+Mt(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),pt(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="`+Mt(r)+`"][href="`+Mt(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),pt(r),n.head.appendChild(r)}}}function jf(e,t,n){Sf.S(e,t,n);var r=Tf;if(r&&e){var i=ft(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`);pt(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=ft(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`),pt(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=ft(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`),pt(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=W.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=ft(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=ft(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=ft(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="`+Mt(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),pt(t),e.head.appendChild(t))}function zf(e){return`[src="`+Mt(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~="`+Mt(n.href)+`"]`);if(r)return t.instance=r,pt(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`),pt(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,pt(o),o;r=Lf(n),(a=yf.get(a))&&Uf(r,a),o=(e.ownerDocument||e).createElement(`link`),pt(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,pt(a),a):(r=n,(a=yf.get(o))&&(r=m({},n),Wf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),pt(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[st]||a[et]||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,pt(a);return}a=t.ownerDocument||t,r=Lf(r),(i=yf.get(i))&&Uf(r,i),a=a.createElement(`link`),pt(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=Ue(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ue(0),this.hiddenUpdates=Ue(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=$r(3,null,null,t),e.current=a,a.stateNode=e,t=ea(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Na(a),e}function op(e){return e?(e=Zr,e):Zr}function sp(e,t,n,r,i,a){i=op(i),r.context===null?r.context=i:r.pendingContext=i,r=Fa(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Ia(e,r,t),n!==null&&(_u(n,e,t),La(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=Jr(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=Ye(t);var n=Jr(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=ut(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Re(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-je(o);s.entanglements[1]|=c,o&=~c}od(a),!(Il&6)&&(ru=ye()+500,sd(0,!1))}}break;case 31:case 13:s=Jr(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=Yt(e),vp(e)}var _p=null;function vp(e){if(_p=null,e=lt(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(be()){case xe:return 2;case Se:return 8;case Ce:case we:return 32;case Te: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=ut(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=lt(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,Qe(e.priority,function(){dp(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,Qe(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);Jt=r,n.target.dispatchEvent(r),Jt=null}else return t=ut(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=ut(n);a!==null&&(e.splice(t,3),t-=3,ys(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[tt]||null;if(typeof a==`function`)o||Lp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[tt]||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[nt]=null}};function Vp(e){this._internalRoot=e}Vp.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ze();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.7`)throw Error(i(527,Hp,`19.2.7`));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 X={bundleType:0,version:`19.2.7`,rendererPackageName:`react-dom`,currentDispatcherRef:I,reconcilerVersion:`19.2.7`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Up=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Up.isDisabled&&Up.supportsFiber)try{Oe=Up.inject(X),ke=Up}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Hs,s=Us,c=Ws;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[nt]=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(p(),1),y=[`claude`,`codex`];function b(e){return e!==void 0&&y.includes(e)}var x={claude:`Claude Code`,codex:`Codex`};function S(e){return e===`claude-code`||e===`claude-web`||e===`github-actions`?`claude`:b(e)?e:void 0}function C(e){return Array.isArray(e)?[...e]:e?[e]:[]}function w(e){switch(e.kind){case`session`:return`◆ ${e.fake?`fake`:e.driver}${e.model?` (${e.model})`:``} in ${e.workspace}${e.sessionLink?` — ${e.sessionLink}`:``}`;case`session-update`:return` session ${e.sessionId}${e.sessionLink?` — ${e.sessionLink}`:``}`;case`system-prompt`:return` system prompt sent (${e.text.length} chars)`;case`preview`:return`▶ your app is running at ${e.url}`;case`browser-stream`:return`◆ browser preview: http://127.0.0.1:${e.port}/stream`;case`browser`:return`◆ browser: ${e.url}`;case`log`:return` ${e.message}`;case`error`:return`✗ ${e.headline}${e.detail?`\n ${e.detail.replace(/\n/g,`
`)}`:``}`;case`view`:return`▶ view: ${e.title}`;case`session-name`:return` session: ${e.name}`;case`ready-for-merge`:return`✓ ready for merge`;case`open-pr`:return` pull request written${e.title?`: ${e.title}`:``}`;case`settled`:return`◆ done for now — waiting for your next message`;case`ticket`:return` implementing ${e.path}`;case`branch`:return` branch: ${e.branch}`;case`cloud-anchor`:return` hand-off anchor: ${e.sha.slice(0,7)}`;case`pull-request`:return` pull request: #${e.number}`;case`on-before-mergeable`:switch(e.outcome){case`queued`:return`✓ post-merge cleanup: quality follow-ups queued`;case`incomplete`:return` ! post-merge cleanup: queueing did not complete cleanly`;case`skipped`:return` ~ post-merge cleanup skipped: ${D(e.reason)}`}case`handoff-armed`:return e.pr&&e.merge?` when this ends: push the branch, open a PR, and merge it`:e.pr?` when this ends: push the branch and open a draft PR`:e.push?` when this ends: push the branch`:` when this ends: nothing — push and PR are both off`;case`handoff`:{let t=e.outcome!==`failed`&&e.merge?`\n${T(e.merge)}`:``;switch(e.outcome){case`done`:return(e.url?`✓ opened ${e.url}`:`✓ branch pushed`)+t;case`skipped`:return` ~ handoff skipped: ${O(e.reason)}`+t;case`failed`:return` ! could not ${e.step===`pr`?`open the PR`:`push the branch`}: ${e.error}`}}case`usage`:{let t=`over ${e.turns} turn${e.turns===1?``:`s`}`;return e.costUsd===void 0?` tokens: ${(e.inputTokens+e.cacheReadTokens+e.outputTokens).toLocaleString(`en-US`)} (${e.outputTokens.toLocaleString(`en-US`)} out) ${t} — no price reported`:` spend: $${e.costUsd.toFixed(4)} ${t}`}case`choice`:{let t=t=>e.multi?t.default?`[x]`:`[ ]`:t.id===e.recommended?`●`:`○`,n=e.options.map(e=>` ${t(e)} ${e.label}`).join(`
`);return`? ${e.title}\n${n}`}case`choice-resolved`:return` ✓ chose ${C(e.picked).join(`, `)||`(none)`} (${e.by})`;case`driver`:return k(e.event);case`intent`:return`▶ "${j(e.text)}"`;case`end`:return e.ok?`✓ finished`:e.stopped?`■ stopped`:`✗ failed: ${e.detail??`unknown error`}`}}function T(e){switch(e.outcome){case`auto-armed`:return`✓ auto-merge armed: the PR lands when its checks pass`;case`watched`:return`✓ merge on green: the daemon merges the PR when its checks pass`;case`merged`:return`✓ merged the PR`;case`withheld`:return` ~ merge withheld: ${E(e.reason)}`;case`failed`:return` ! could not merge the PR: ${e.error}`}}function E(e){switch(e){case`not-ready-for-merge`:return`the session never signalled ready-for-merge`;case`session-todo-open`:return`the session's own TODO file still has open entries`}}function D(e){switch(e){case`not-ready-for-merge`:return`the session never signalled ready-for-merge`;case`run-stopped`:return`the run was stopped`;case`fake-run`:return`this was a fake run`;case`no-session-name`:return`the session never called setSessionName()`;case`no-bin-path`:return`the framework binary path is unknown`}}function O(e){switch(e){case`not-armed`:return`push and PR are both off for this session`;case`branch-gone`:return`the branch no longer exists`;case`no-commits`:return`the session committed nothing`;case`commit-failed`:return`the session's pending work could not be committed, so nothing was published (the work stays on its branch)`;case`no-remote`:return`this repo has no remote to push to`;case`already-open`:return`the branch already has a pull request`;case`already-landed`:return`the branch's pull request already landed everything the session did`;case`already-pushed`:return`the branch is already on the remote`;case`run-stopped`:return`the run was stopped`;case`fake-run`:return`this was a fake run`}}function k(e){switch(e.type){case`start`:return` › prompt: ${j(e.prompt,140)}`;case`session`:return` session ${e.sessionId}`;case`text`:return` ${j(e.text)}`;case`action`:return` · ${e.label}`;case`result`:return` ‹ turn complete`;case`rate-limit`:return` ${A(e.limit)}`;case`error`:return` ! agent error: ${e.message}`;case`notice`:return` ~ ${e.message}`}}function A(e){let t=new Date(e.resetsAt).toISOString();return e.status===`rejected`?`✗ quota exhausted (${e.window}), resets ${t}`:e.status===`allowed_warning`?`! quota running low (${e.window}), resets ${t}`:`· quota ${e.status} (${e.window}), resets ${t}`}function j(e,t=100){let n=e.replace(/\s+/g,` `).trim();return n.length>t?n.slice(0,t-1)+`…`:n}var M=[`B`,`KB`,`MB`,`GB`,`TB`];function N(e,t=`–`){if(typeof e!=`number`||!Number.isFinite(e)||e<0)return t;let n=e,r=0;for(;n>=1024&&r<M.length-1;)n/=1024,r++;return`${n<10&&r>0?Math.round(n*10)/10:Math.round(n)} ${M[r]}`}function P(e){return e instanceof Error?e.message:String(e)}function F(e){let t={readyForMerge:!1};for(let n of e)n.kind===`session-name`?t.sessionName=n.name:n.kind===`ready-for-merge`&&(t.readyForMerge=!0);return t}function I(e){let t=[];for(let n of e)n.kind===`error`&&t.push({headline:n.headline,...n.detail?{detail:n.detail}:{}});return t}function L(e,t){let n={push:t?.push??!0,pr:t?.pr??!0,merge:t?.merge??!1};for(let t of e)t.kind===`handoff-armed`?(n.push=t.push,n.pr=t.pr,t.merge!==void 0&&(n.merge=t.merge)):t.kind===`handoff`&&(n.result=t.outcome===`done`?{outcome:`done`,...t.url?{url:t.url}:{}}:t.outcome===`failed`?{outcome:`failed`,error:t.error}:{outcome:`skipped`,reason:t.reason});return n}function R(e){let t=null;for(let n of e)n.kind===`session`?t={driver:n.driver,fake:n.fake,workspace:n.workspace,...n.sessionLink?{sessionLink:n.sessionLink}:{},...n.model?{model:n.model}:{}}:n.kind===`session-update`&&(t={...t??{},sessionId:n.sessionId,...n.sessionLink?{sessionLink:n.sessionLink}:{}});return t}var z=/\$\{\{([\s\S]*?)\}\}/g,B=class extends Error{fragment;constructor(e,t){super(`[framework] template fragment \${{${e}}} ${t}`),this.name=`TemplateFragmentError`,this.fragment=e}};function ee(e,t){let n=Object.keys(t),r=n.map(e=>t[e]);return e.replace(z,(e,t)=>{let i;try{i=Function(...n,`'use strict'; return (${t});`)(...r)}catch(e){throw new B(t,`failed to evaluate: ${P(e)}`)}if(i===void 0)throw new B(t,`evaluated to undefined (typo in the expression?)`);return String(i)})}var V="# The data branch\n\nThe framework's own data — `tickets/**.md` (plans and locks included), `TODO_AGENTS.md`, the session archives — lives on the dedicated branch `tf-data`, never on code branches. Your checkout does not contain these files.\n\nRead them off the branch (fetch first): `git show tf-data:<FILE>` — `origin/tf-data:` when the local branch doesn't exist.\n\nWrite them, only when the instructions say to edit tickets or the queue, as a commit on `tf-data` pushed immediately — rebase and retry on a rejected push. Never switch your checkout to the branch, and never put these files on your session branch: a data change is pushed directly, it does not ride your PR.",H=`Open TODO_AGENTS.md and work on the FIRST open entry only. When the work is done and published, check the entry off. Do not start any other entry.`,te=`Refactor \${{ tf.params.what }} to make it as maintainable as possible:
- Look for maintainability red flags, and fix them.`,U=`Analyze \${{ tf.params.what }} and look for opportunities to refactor code.
For each codebase subset that needs it, add following entries to TODO_AGENTS.md (usually as low priority) and replace <CODEBASE_SUBSET> with a clear designation.
- "Apply \${{ tf.presets.maintainability.filePath }} with tf.params.what set to <CODEBASE_SUBSET>"
- "Apply \${{ tf.presets.security_audit.filePath }} with tf.params.what set to <CODEBASE_SUBSET>"`,W=`- Make a thorough market research
- Write it to \`knowledge-base/MARKET_RESEARCH.md\`
- Add TODO_AGENTS.md entry: "Read <SESSION_NAME> then suggest new tickets"
SESSION_NAME: the name of the session`,ne='For the <COUNT> most important tickets `tickets/<TICKET>.md` without `<TICKET>.plan.md` and `<TICKET>.lock.md`, add the following to TODO_AGENTS.md\n- "Create tickets/<TICKET>.plan.md"\n\nPut the entries in the right `## Priority` following a mix of sensible criteria after reading `tickets/<TICKET>.md` (e.g. if ticket seems low effort => higher priority).\n\nCOUNT: 10',re=`Refactor \${{ tf.params.what }} to make it as easy as possible for humans to read:
- Pinnacle architectural split
- Does each file and each <FUNCTION> represent a sensible and natural abstraction?
- Rate the *seams*, not just the boxes: for each call site, ask whether the responsibility sits on the right side of the boundary — should a caller's wrapper move down into the callee (or vice versa)? A <FUNCTION> can be clean, DRY and well-tested in isolation yet still be in the wrong place. "Well-factored" is not "well-located".
- Linearity (for humans)
- Put yourself in the shoes of a human reader who reads everything in a linear fashion
- Top to bottom: place callers above callees so readers encounter high-level logic before implementation details (humans think high-level first)
- Altitude pass: for each entry-point / orchestration <FUNCTION>, read it top-to-bottom as prose. Flag any line that drops the reader into lower-level mechanism (a flag, a thunk, a log verb, error plumbing) in the middle of what should be a high-level narrative. For each, ask: can that mechanism move down into the callee so the caller reads at one consistent altitude? Prioritize the reading path of all the <FUNCTION> a reader hits first.
- Before starting to work: list *ALL* files and *ALL* <FUNCTION> in this chat, rate them all (0: convoluted abstraction, hard to read, wrong place — 10: perfect), and give a reason for your rating
- DON'T skip any file nor any <FUNCTION> in your rating list — write an extra separated list in this chat of all files and all <FUNCTION> and put a ✅ tick to each entry to double check whether you forgot to rate something. So two lists: one list of ratings & explanation, and a second confirmation list.
- Separate commit for each refactor
- Work until it's exceptionally good. We as an expert team will check against every little detail.
- If we see that you gave mostly a 10/10 rating, that's a sign you've been lazy... so make sure you scrutinize everything and spend a substantial amount of time. We don't want to prompt you again and again to achieve quality — autonomously strive for quality on your own without us pushing you.
- Give summary of what you worked on: print the lists again with old rating => new rating with link to commit(s)
FUNCTION: an actual function or a class, procedure, etc. (anything that represents a unit of logic)`,ie=`Measure "problem variability" of \${{ tf.params.what }}
- List all high-level flows the code implements, i.e. the list of all "problems" the code solves
- Give a rating for each problem (from 0 to 10) following this criteria: does the code solves the problem in an obviously optimal way (10), or is it highly unclear whether the problem can be solved in a better way (0)?
- Write down the ratings in a new file <REVIEW_FILE>
- Show the list to the user and enable him to select problems via \`showMultiSelect()\`, <AWAIT>
- Set default to \`true\` for entries with low rating
- For all problems the user selected, add a new entry to <TODO_FILE>
- The entry: "Deep-dive research for alternative solutions, see <REVIEW_FILE>"
AWAIT: Stop, await user answer before resuming
REVIEW_FILE: \`REVIEW-PROBLEMS_<SESSION_NAME>.agent.md\`
TODO_FILE: \`TODO_<SESSION_NAME>.agent.md\`
SESSION_NAME: the name of the current Git branch — sanitize it to be a SLUG, if name is generic (e.g. \`main\`) then create a succinct SLUG`,ae=`Security audit \${{ tf.params.what }}
- Scrutinize the entire code for potential security issues
- Make it exhaustive (100% coverage)
- List every aspect you considered and, for each aspect, include a verdict as well as an explanation for non-obvious verdicts
- If you see any security issue, fix each security issue in a separate commit`,oe=`1. Study what this product does today: skim the README, the docs, and the main user-facing surfaces, plus the existing \`tickets/\`
2. Think like a product manager and propose net-new features the product should have next
- Net-new capabilities a user would want, not bugs, refactors, or chores
- Skip anything an existing ticket already covers, and anything already built
- Favour features that fit the product's direction and are worth building
3. Write each proposed feature as a new ticket under \`tickets/\`, following the ticket format
4. Show a short summary of what you proposed via \`showMarkdown()\``,se=`Suggest new tickets`,ce="1. Look at all tickets and pick tickets to work on next\n2. Show the tickets you picked via `showMultiSelect()`\n - For each ticket, if high confidence the ticket is a good candidate to work on next => set its default to `true`, otherwise `false`\n3. <AWAIT>\n4. Add approved tickets to `TODO_AGENTS.md`\n\nAWAIT: Stop, await user answer before resuming",le=`1. Look at all tickets and choose tickets to work on next
- Only pick tickets that are significant (no quick-wins) and consensual (zero open questions, zero variability, e.g. a single fairly obvious plan)
2. Add tickets to TODO_AGENTS.md
Always set <SESSION_NAME> to triage-consensual
- If branch tf-<SESSION_NAME> already exists, abort and tell user that the branch already exists and that triage is already pending.`,ue="Look at `tickets/*` and choose tickets to work on next:\n- Pick a ticket if it has a `.plan.md` that shows it's a quick-win (low `effort` value) with `uncertainty: 0`\n- Add tickets to TODO_AGENTS.md\n - With sensible prioritization, and consider bumping the priority of lowest effort tickets (e.g. to make `effort: 0` the next tasks agents work on)\n\nAlways set <SESSION_NAME> to triage-quick\n- If branch tf-<SESSION_NAME> already exists, abort and tell user the branch already exists and triage is already pending.",de='Update `tickets/` from this repo\'s GitHub issues, bringing across what has changed since the last import rather than starting over — the whole update as one commit.\n\nNote the current UTC time before you fetch anything, in ISO 8601. That is the timestamp you will record at the end, and taking it first is deliberate: an issue edited while you work is then picked up by the next update instead of being missed.\n\nRead `tickets/meta.json` for `lastImportedAt`.\n\nDo one of the following:\n- [Error] If there are existing `tickets/*.md` but `lastImportedAt` is missing, or `gh` is missing or logged out, report the error — say which of those it is — and abort\n- [Empty] If `tickets/` is empty (or doesn\'t exist), treat it as a first import and bring every open issue across\n- [Update] Fetch only what changed: `gh issue list --state all --limit 500 --json number,title,body,state,labels,updatedAt --search "updated:>=<lastImportedAt>"`, and the discussion with `gh api --paginate "repos/{owner}/{repo}/issues/comments?since=<lastImportedAt>"`\n\nThen reconcile, one ticket file per issue:\n- An issue with no ticket yet gets one\n- An issue that already has a ticket has that ticket updated in place. Keep its filename, and keep its `.plan.md` but consider setting `outdated: yes`.\n- New comments are worth folding into the ticket only where they change what the work is. Do not paste the thread.\n- If an issue is now closed, remove its ticket, `.plan.md`, and `.lock.md`\n\nFinish by writing `tickets/meta.json` as `{"lastImportedAt": "<the UTC time you noted at the start>"}`, and say in one line how many tickets you added, updated and removed.',fe=`Review all UI flows of \${{ tf.params.what }}
1. Before starting to work: list *ALL* UI flows
- DON'T skip any UI flow (100% coverage)
2. Then, give a UX rating for each UI flow (10: perfect UX, 0: unusable UX), and give a reason for your rating
3. Improve UI flows with bad UX rating
- Separate commit for each UI flow you improved
- Work until it's exceptionally good. We as an expert team will check against every little detail.
- If we see that you gave mostly a 10/10 rating, that's a sign you've been lazy... so make sure you scrutinize everything and spend a substantial amount of time. We don't want to prompt you again and again to achieve quality — autonomously strive for quality on your own without us pushing you.
- Give summary of what you worked on: print the UI flow list again with old rating => new rating with link to commits`,pe='## Awaiting a choice\nWhen these instructions tell you to showChoices() / showMultiSelect() / showMarkdown() and then AWAIT, do not decide for the user.\nEnd your turn with one fenced code block, then stop.\nTag it `await-choices`:\n```await-choices\n{ "title": "<the question>", "options": [{ "label": "<option>", "detail": "<optional one-liner>" }], "recommended": "<the label to default to>" }\n```\nEvery question you stop to ask is this one block, whatever it is about:\n- An approval is two options: `{ "title": "Ship this?", "options": [{ "label": "Approve" }, { "label": "Decline", "stop": true }], "recommended": "Approve" }`.\n- A plan or document you wrote and want signed off adds `"file": "PLAN_<slug>.agent.md"`, and the framework shows that file beside the question.\n- Several answers at once (showMultiSelect) adds `"multi": true`, and `"default": true` on the entries that start checked.\n- `recommended` is what the framework picks when nobody is there to answer, so name the option that is safe to take unattended — never an option marked `stop`.\n- `"stop": true` marks an answer that ends the session instead of resuming you: the user is taking over and will come back with fresh instructions. Mark the option that rejects your work — declining a plan, saying no to the approach — and leave it off everything else. You are not re-prompted with that answer, so do not plan around being told it.\n\nThe framework shows it, waits for the user, and re-prompts you with their answer. Do not continue past it on your own.\n\n## Handing the browser to a human\nWhen you are working in a browser and hit something you cannot or should not get past yourself — a login wall, a captcha, an SSO or 2FA step — stop and hand it over. Never type a password, never attempt a captcha, and never use a credential you found lying around in the repo or the environment. Ask with the same `await-choices` block, naming the page and recommending the option that is true when nobody is there:\n```await-choices\n{ "title": "<what the human needs to do> (<the page you are stuck on>)", "options": [{ "label": "Handled it" }, { "label": "Could not handle it" }], "recommended": "Could not handle it" }\n```\nThe user acts in that browser, then you are re-prompted. If their answer says it was not handled, do not retry the same page — say what you could not reach and work on what you can, or stop.\n\n## Showing a document without waiting\nTo display markdown in the side panel without blocking (a plan, a summary, a writeup) and keep working, put a `show-markdown` block anywhere in your turn. The first line is its title:\n```show-markdown\n# <title>\n<the markdown body>\n```\nThis just shows it; you do not stop. Re-emit the same title to update that view in place.',me="## You have a real browser\n\nThis run has a real Chrome attached, through the `chrome-devtools` tools (`new_page`, `navigate_page`, `click`, `fill`, `take_snapshot`, `evaluate_script`). It is the same browser a human can watch and take over, so use it for anything you need to *see* or *act on*: pages that render their content with JavaScript, a flow you have to click through, a form to fill, an app you are checking actually works.\n\nWhen you only need to read a page, `WebFetch` is still the better tool: it is faster and hands you the text directly. Use the browser when `WebFetch` would come back with nothing useful, such as a page that is blank until its JavaScript runs.\n\nPrefer navigating within a single page rather than opening new pages, so the user can more easily watch you navigate.",he=`## This session runs detached — decide alone, land everything
It was handed to a remote service: nothing that can answer a gate is attached to it, and no
machine sees its workspace. Two consequences:
- Where these instructions say to showChoices() / showMultiSelect() / showMarkdown() and then
AWAIT: do not emit the await block and do not stop — take the most plausible interpretation,
the option you would have marked \`recommended\`, state in one line which assumption you made,
and carry the work through to the end. The non-blocking blocks (show-markdown,
set-session-name, ready-for-merge) are unaffected.
- Before ending: commit your work on your session branch and open a pull request for it. If the
deliverable is analysis, a plan, or a decision, write it into committed files — a result that
lives only in this conversation, or in a gitignored file, reaches nobody. End without a pull
request only when the task genuinely required no repository change, and say so explicitly in
your final message.`,ge="## Session name\nWhen you call setSessionName(<name>) (after creating and checking out the `tf-<name>` branch), also emit a `set-session-name` block naming it, so the dashboard shows which session this is. The first non-empty line is the name (a `[a-z0-9-]` slug):\n```set-session-name\n<name>\n```\nYou do not stop; re-emit it if you rename the session.\n\n## Ready for merge\nWhen you call setReadyForMerge() — you believe the work is complete and ready for human review — emit an empty `ready-for-merge` block. This flips the dashboard status from building to ready; it does not stop your turn.\n```ready-for-merge\n```\n\n## Opening a pull request\nWhenever you emit `ready-for-merge`, emit an `open-pr` block too, naming and describing the work. The Framework opens the pull request for you — you do not need to run `gh pr create` yourself. Write it like a commit message: the first line is the title, the rest is the body.\n```open-pr\n<one line naming what the change does, under 100 characters>\n\n<what changed, and why — markdown, as long as it needs to be>\n```\nWithout it the pull request has no name for your work and can only repeat the prompt you were given, which does not say what the work turned out to be. The Framework supplies the rest: the ticket's issue reference where there is one, and recording the number so every surface shows the same pull request. You do not stop, and you can re-emit it as the work changes — the last one is used. Opening the pull request yourself instead still works; you then own all of the above.\n\n## Reporting an error\nWhen you hit something only the user can fix — a missing file you were told to read, a command that will not run, a login you do not have — emit an `error` block saying what is wrong, then carry on or stop as the task requires. The first line is the headline; anything below it is the detail.\n```error\n<what is wrong, in one line>\n\n<the detail: what you ran, what it said>\n```\nThe Framework marks it in the session log and counts it on the session, so the user sees it without reading the whole log. It does not stop your turn and it does not ask the user anything — use `AWAIT` for a question. Report the same thing once: a re-emitted identical block is ignored.",_e=`# System prompt
SHOW_MD: Show it via \`showMarkdown()\`
SHOW_CHOICES: Show it via \`showChoices()\`
AWAIT: Stop, await user answer before resuming
SESSION_NAME: the name of the session
TODO_FILE: \`TODO_AGENTS.md\`
## Analyze the user prompt
Analyze the user prompt and follow the instructions below.
### Ambiguous prompt
If it isn't clear what you should do (e.g. unclear scope, unclear user prompt), make a list of interpretations sorted by plausibility, <SHOW_CHOICES>, <AWAIT>
### Scope
- If the scope of what you'll work on is *large*, create a \`PLAN_<SESSION_NAME>.agent.md\` of what you'll work on, <SHOW_MD>, <AWAIT>
- If the scope is potentially *very large* (e.g. spans over many hours/days of work), consider adding entries to <TODO_FILE> (backlog of follow-up tasks) and show new entries <SHOW_MD>
## Before starting changes
Do the following before applying your first change.
### Workspace
Your working directory is the whole of your workspace. Every file you read or write is under it.
- Address files relative to it. An absolute path is how you leave it without noticing
- It may sit *inside* another checkout of the same repo. That outer copy is the user's own working tree — not another view of your files, and never yours to edit
- The same file can therefore exist twice. The one under your working directory is yours; editing the other one puts your work somewhere your branch and your commits cannot reach it
- If something you need is genuinely outside, say so and stop — do not reach for it
### Session name
1. Create a <SESSION_NAME> as a string [a-z0-9-]+ that succinctly represents the intention of the user prompt
2. Create a new branch \`tf-<SESSION_NAME>\` and \`$ git checkout\` it — do all the work in that branch
3. Call setSessionName(<SESSION_NAME>)
## Before applying changes
Do the following before applying changes — do it again anytime you make new changes.
### Alternatives
Measure "variability":
- List all high-level problems that you're about to solve
- Give a rating to each problem (from 0 to 10) following this criteria: is there an obviously optimal way to solve the problem (10), or is it highly unclear whether the problem can be solved in a better way (0)?
- Explore and suggest alternatives for problems with a low rating
- For each problem that has alternatives: list all alternatives sorted in a sensible order, <SHOW_CHOICES>, <AWAIT>
## After applying changes
After you're done, decide: is <SESSION_NAME> finished, with no work left to do?
- Yes: call setReadyForMerge() — required, the work is never merged without it
- No: don't call it; say what's left instead
# User prompt
\${{tf.prompt}}`,ve=`# Ticketing format
## tickets/<DATE>_<SLUG>.md
DATE: yyyy-mm-dd
SLUG: succinct kebab-case slug of the ticket title
Body:
\`\`\`md
Priority: 0-10 [optional, 10: critical — act immediately, 0: only if capacity]
Topics: [list-of-topics] [optional]
GitHub: [#42](https://github.com/org/repo/issues/42) [optional]
# Ticket title
## TLDR
...
## Why it matters
...
[optional: more info (any heading and format you want)]
\`\`\`
When a ticket is closed, it should be removed from the repository (also its \`.plan.md\` and \`.lock.md\`), so that \`tickets/*\` only contains open tickets.
## tickets/<DATE>_<SLUG>.lock.md
Body:
\`\`\`md
CLAIMED: <SESSION_ID> (<SESSION_NAME>)
\`\`\`
Whenever an agent is working/planning a ticket, a \`.lock.md\` file must be created to avoid two agents working/planning the same ticket. If pushing the lock hits a conflict on that same \`.lock.md\`, another agent claimed the ticket first: back off and pick something else — never resolve the conflict in your favor.
## tickets/<DATE>_<SLUG>.plan.md
For an existing ticket (e.g. \`tickets/2042-01-01_some-ticket.md\`), a plan can be created (\`tickets/2042-01-01_some-ticket.plan.md\`).
Body:
\`\`\`md
Effort: 0-10 [0: implementation is trivial, 10: implementation takes months]
Uncertainty: 0-10 [0: implementation without meaningful alternatives, 10: highly uncertain how to implement]
Outdated: yes [optional, only if the ticket was updated in a way that makes the plan outdated]
# [Plan] Ticket title
Single-sentence describing this file's content.
## TLDR [optional]
Brief overiew of this file's content.
## Problems [optional]
List of all significant aspects with low confidence on how to implement, with explanation why uncertain.
## Solutions [optional]
For each problem, list of ways to solve the problem (including meaningful shortcuts, for quicker implementation).
## Considerations [optional]
Exhaustive list of all significant aspects to be considered (including edge cases).
## Implementation [optional]
Concrete plan to implement the ticket.
\`\`\`
Notes:
- Covers both spiking (e.g. high-level research without implementation plan) and planning (e.g. concrete implementation proposal)
- The \`.plan.md\` file can be modified multiple times over an extended period (e.g. a ticket requiring repeated human intervention, transitioning from spiking to concrete plan)
- All sections are just proposals and optional: you can use any headings with any format
- The uncertainty value:
- Gauges whether there are *significant* alternatives, minor variability such as syntax should be ignored
- Is used for evaluating whether human intervention is needed (0 => clearly no human intervention needed)
- Example of how to gauge uncertainty and alternatives:
- List all aspects that need to be considered
- Give an uncertainty rating (0-10) to each aspect following this criteria: is there an obviously optimal way to implement it (0), or is it highly unclear whether it can be implemented in a better way (10)?
- Explore and suggest alternatives for each aspect with a low rating`,ye=`# TODO_AGENTS.md
Content:
\`\`\`md
## Priority 10 (critical — act immediately)
...
## Priority 9
- [Succinct description](/link-for-more-details)
- Or self-contained TODO item with complete description of what should be done
...
## Priority 0 (only if capacity)
...
\`\`\`
The TODO_AGENTS.md file lists *all* tasks AI will work on next, sorted by priority.
To remove an item (e.g. when done), simply remove it from \`TODO_AGENTS.md\`.
Priority 10 is rarely used (e.g. critical production bugs) and should be treated as utmost priority.
Within a priority, the first tasks have higher priority (they're the "next" tasks within that "priortiy queue").`,be=pe,xe=he,Se=me,Ce=ge,we=_e,Te={prompt:``},Ee={path:`knowledge-base/DECISIONS.md`,comment:`decisions taken, and why`},De={path:`knowledge-base/FACTS.md`,comment:`non-obvious facts relevant to the project`},Oe={path:`knowledge-base/INSIGHTS.md`,comment:`insights relevant to the project`},ke=[ve,ye,V],Ae=`Ticketing format`,je=`TODO_AGENTS.md`,Me=`The data branch`,Ne=[Ee,{path:`GOAL.md`,comment:`the goal of the project (long-term direction, scope, non-scope, ...)`},{path:`BUSINESS_LOGIC.md`,comment:`codebase business logic`},De,Oe,{path:`knowledge-base/MARKET_RESEARCH.md`,comment:`the market the project competes in`},{path:`knowledge-base/**.md`,comment:`more files holding knowledge related to the project`},{path:`tickets/**.md`,comment:`things to potentially work on; format: the "${Ae}" section below; lives on the data branch — read/write per the "${Me}" section below`},{path:`TODO_AGENTS.md`,comment:`the AI task queue; format: the "${je}" section below; lives on the data branch — read/write per the "${Me}" section below`}],Pe=`
# User prompt
`;function Fe(e=Te){let t=we.indexOf(Pe),n=t===-1?we:we.slice(0,t),r=t===-1?"${{tf.prompt}}":we.slice(t+15);return{system:ee(n,{tf:e}).trim(),user:ee(r,{tf:e}).trim()}}function Ie(e={}){let t=[],n=e.context?.map(e=>e.trim()).filter(Boolean)??[],r=e.vanilla!==!0,i=r?Ne:[];if(n.length||i.length){let e=`Context:${n.length?` ${n.join(`, `)}`:``}`,r=i.map(e=>`- \`${e.path}\` (${e.comment})`);t.push([e,...r].join(`
`))}r&&t.push(...ke,Fe(e.tf).system);let a=e.user?.trim();return a&&t.push(a),t.join(`
`)}function Le(e={}){if(e.transparent)return``;let t=Ie(e),n=e.browser?[Se]:[],r=e.handsOff?[xe]:[];return[...t?[t]:[],...n,be,...r,Ce].join(`
`)}var Re=`.the-framework`,ze=[`maintainability`,`readability`,`security_audit`,`research`,`ux`,`maintenance`],Be=`${Re}/presets`;function Ve(e){return`${Be}/${e}.md`}function He(){return Object.fromEntries(ze.map(e=>[e,{filePath:Ve(e)}]))}var Ue='${{ tf.session_name || "entire codebase" }}';function We(e){return{session_name:e.session_name,presets:e.presets??He()}}function Ge(e={}){return ee(Ue,{tf:{...We(e),params:{}}})}function Ke(e){let{template:t,what:n}=e;return n===void 0?{...e,params:[],render:()=>t}:{...e,params:[{name:`what`,default:Ue,description:n}],render:(e,n={})=>{let r=e?.trim()||Ge(n);return ee(t,{tf:{...We(n),params:{what:r}}})}}}var qe={research:Ke({name:`research`,template:ie,what:`What to measure problem variability of`,label:`Research`}),maintainability:Ke({name:`maintainability`,template:te,what:`What to refactor for maintainability`,label:`Maintainability`}),readability:Ke({name:`readability`,template:re,what:`What to refactor for readability`,label:`Readability`}),securityAudit:Ke({name:`security-audit`,template:ae,what:`What to security-audit`,label:`Security audit`}),ux:Ke({name:`ux`,template:fe,what:`What to review the UX of`,label:`UX (auto)`}),maintenance:Ke({name:`maintenance`,template:U,what:`What to analyze for refactor opportunities`,label:`Maintenance`,tooltip:`Queue maintainability + security work per codebase subset (TODO_AGENTS.md)`}),marketResearch:Ke({name:`market-research`,template:W,label:`Market research`}),updateTickets:Ke({name:`update-tickets`,template:de,label:`Update from GitHub`,newAgent:!0,tooltip:"Bring `tickets/` up to date with the GitHub issues. An empty `tickets/` gets a full first import."}),planTickets:Ke({name:`plan-tickets`,template:ne,label:`Plan tickets (aka spike)`,tooltip:"Turn `tickets/*.md` into costed plans (`tickets/*.plan.md`)"}),suggestNewTickets:Ke({name:`suggest-new-tickets`,template:se,label:`Suggest new tickets`}),suggestNewFeatures:Ke({name:`suggest-new-features`,template:oe,label:`Suggest new features`,tooltip:"Propose net-new features as tickets in `tickets/`"}),suggestTicketsToWorkOn:Ke({name:`suggest-tickets-to-work-on`,template:ce,label:`Suggest tickets to work on`,tooltip:`Add tickets to queue (TODO_AGENTS.md)`}),drainQueue:Ke({name:`drain-queue`,template:H,label:`Spin up agents working on the AI queue`,tooltip:`Work the entries already on the queue (TODO_AGENTS.md)`}),triageQuick:Ke({name:`triage-quick`,template:ue,label:`Add quick-win work to AI Queue`,tooltip:"Add `tickets/*.md` to queue (TODO_AGENTS.md), only quick-win and consensual tickets"}),triageConsensual:Ke({name:`triage-consensual`,template:le,label:`Add consensual work to AI Queue`,tooltip:"Add `tickets/*.md` to queue (TODO_AGENTS.md), only significant (no quick-wins) and consensual tickets"})},Je=[qe.research,qe.readability,qe.maintainability,qe.securityAudit,qe.ux,qe.suggestNewTickets,qe.suggestNewFeatures,qe.suggestTicketsToWorkOn,qe.planTickets,qe.marketResearch,qe.updateTickets,qe.maintenance,qe.triageQuick,qe.triageConsensual],Ye={browser:`notifyBrowser`,discord:`notifyDiscord`},Xe={humanIntervention:`notifyHumanIntervention`,newActivity:`notifyNewActivity`},Ze={methods:{browser:!0,discord:!1},categories:{humanIntervention:!0,newActivity:!1}};function Qe(e,t){return e[Ye[t]]??Ze.methods[t]}function $e(e,t){return e[Xe[t]]??Ze.categories[t]}var et=[{name:qe.updateTickets.name,prompt:qe.updateTickets.render(),label:qe.updateTickets.label,tooltip:qe.updateTickets.tooltip},{name:qe.triageQuick.name,prompt:qe.triageQuick.render(),label:qe.triageQuick.label,tooltip:qe.triageQuick.tooltip,pinnedBranch:`tf-${qe.triageQuick.name}`},{name:qe.triageConsensual.name,prompt:qe.triageConsensual.render(),label:qe.triageConsensual.label,tooltip:qe.triageConsensual.tooltip,pinnedBranch:`tf-${qe.triageConsensual.name}`},{name:qe.planTickets.name,prompt:qe.planTickets.render(),label:qe.planTickets.label,tooltip:qe.planTickets.tooltip,fansOut:!0}],tt={name:qe.drainQueue.name,prompt:qe.drainQueue.render(),label:qe.drainQueue.label,tooltip:qe.drainQueue.tooltip,drains:!0,autoMerge:!0},nt={name:qe.maintenance.name,prompt:qe.maintenance.render(),describe:`sweeping the codebase for maintenance work`,label:qe.maintenance.label,tooltip:qe.maintenance.tooltip},rt=[tt,...et,nt];function it(e){return e.kind===`awaiting`?`awaiting:${e.projectId}:${e.awaitId??``}`:e.kind===`unpushed`?`unpushed:${e.projectId}:${e.agentId??``}`:e.url}function at(e){return`${e.kind}:${e.projectId}:${e.agentId}`}var ot=class{keyOf;scopeOf;seen=new Set;warmedUp=new Set;constructor(e,t){this.keyOf=e,this.scopeOf=t}observe(e,t){let n=e.filter(e=>this.warmedUp.has(this.scopeOf(e))&&!this.seen.has(this.keyOf(e)));for(let t of e)this.seen.add(this.keyOf(t));for(let e of t)this.warmedUp.add(e);return n}},st=[`local`,`push`,`pr`,`merge`];function ct(e,t){return st.indexOf(e)>=st.indexOf(t)}function lt(e){return e.push?e.pr?e.merge?`merge`:`pr`:`push`:`local`}function ut(e){return{...e.transparent===void 0?{}:{transparent:e.transparent},...e.vanilla===void 0?{}:{vanilla:e.vanilla},...e.handoff===void 0?{}:{handoff:e.handoff}}}function dt(e){return e.handoff??`pr`}function ft(e,t=[]){let n=e.vanilla??!1,r=e.transparent??!1,i=e.onBeforeMergeableQuality??!1,a=e.browser??!1,o=dt(e),s=e.model??``,c=e.driver??`claude`,l=e.target??`local`;return{vanilla:n,transparent:r,...i?{onBeforeMergeable:!0}:{},handoff:o,...a&&c===`claude`?{browser:!0}:{},...s?{model:s}:{},...c===`claude`?{}:{driver:c},...l&&l!==`local`?{target:l}:{},...t.length?{context:t}:{}}}var pt={webhook:`DISCORD_WEBHOOK`};Object.keys(pt);function mt(e){return pt[e]}function ht(e,t){let n=t.trim();if(!n)return;let r;try{r=new URL(n)}catch{return`That is not a URL.`}if(r.protocol!==`https:`&&r.protocol!==`http:`)return`A webhook URL must be http or https.`}var gt=/^127(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}$/;function _t(e){return e===`localhost`||e===`::1`||e===`[::1]`||gt.test(e)}var vt=`/_rpc`;function yt(e){return async(...t)=>{let n=await fetch(`${vt}/${e}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t)}),r=await n.text(),i;try{i=r?JSON.parse(r):{}}catch{throw Error(`${e} got a non-JSON reply (${n.status})`)}if(!n.ok)throw Error(i.error??`${e} failed (${n.status})`);return i.ret}}async function bt(e,t){let n=new URLSearchParams({projectId:e,...t?{agentId:t}:{}}),r=new AbortController,i=await fetch(`${vt}/events?${n.toString()}`,{signal:r.signal});if(!i.ok||!i.body)throw Error(`could not subscribe to events (${i.status})`);let a,o,s=!1,c=e=>{s||(s=!0,o?.(e))};return(async()=>{let e=i.body.getReader(),t=new TextDecoder,n=``;try{for(;;){let{done:r,value:i}=await e.read();if(r)break;n+=t.decode(i,{stream:!0});let o=n.indexOf(`
`);for(;o>=0;o=n.indexOf(`
`)){let e=n.slice(0,o);n=n.slice(o+2);let t=e.split(`
`).filter(e=>e.startsWith(`data:`)).map(e=>e.slice(5).trim()).join(``);if(t)try{a?.(JSON.parse(t))}catch{}}}c()}catch(e){c(r.signal.aborted?void 0:e instanceof Error?e:Error(String(e)))}})(),{listen:e=>{a=e},onClose:e=>{o=e,s&&e()},close:()=>{s||r.abort(),c()}}}var xt=yt(`onPreferences`),St=yt(`patchPreferences`),Ct=yt(`onProjectPresets`),wt=yt(`saveProjectPresets`),Tt=yt(`onEditors`),Et=yt(`onNotifyChannels`),Dt=yt(`saveDiscordCredentials`),Ot=yt(`onProjects`),kt=yt(`sendAddProject`),At=yt(`onOnboarding`),jt=yt(`onRepoAutoMerge`),Mt=yt(`onDriverReady`),Nt=`settings`,Pt=`tickets`,Ft=`plan`;function It(e){let[t,n,r,i]=e.split(`/`).filter(Boolean).map(Rt);return t===`settings`?{view:`settings`,projectId:null,agentId:null}:t===`tickets`?{view:`tickets`,projectId:null,agentId:null}:t?n===`tickets`?{view:`tickets`,projectId:t,agentId:null,ticketSlug:r??null,...r&&i===`plan`?{plan:!0}:{}}:{projectId:t,agentId:n??null}:{projectId:null,agentId:null}}function Lt({view:e,projectId:t,agentId:n,ticketSlug:r,plan:i}){if(e===`settings`)return`/${Nt}`;if(e===`tickets`&&!t)return`/${Pt}`;if(!t)return`/`;let a=encodeURIComponent(t);if(e===`tickets`){let e=`/${a}/${Pt}`;if(!r)return e;let t=`${e}/${encodeURIComponent(r)}`;return i?`${t}/${Ft}`:t}return n?`/${a}/${encodeURIComponent(n)}`:`/${a}`}function Rt(e){try{return decodeURIComponent(e)}catch{return e}}var zt={},Bt=null,Vt=null,Ht=new Map,Ut=null,Wt=!1,Gt=new Map,Kt=new Set,qt=[],Jt=new Map,Yt=new Map,Xt=0,Zt=0,Qt=new Set;function $t(){Jt=new Map,Yt=new Map;for(let e of Qt)e()}function en(e){return Qt.add(e),()=>Qt.delete(e)}function tn(e){let t=e?Ht.get(e):void 0;return t?ut(t):zt}function nn(e){let t=e??``,n=Jt.get(t);if(n)return n;let r=tn(e),i=r===zt?Bt??zt:{...Bt??zt,...r};return Jt.set(t,i),i}function rn(e){let t=e??``,n=Yt.get(t);if(n)return n;let r={},i=[[`global`,Bt??zt],[`repo`,tn(e)]];for(let[e,t]of i)for(let[n,i]of Object.entries(t))i!==void 0&&(r[n]=e);return Yt.set(t,r),r}function an(e){!Bt&&!Vt&&(Vt=xt().then(e=>{Bt??=e}).catch(()=>{Bt??={}}).finally(()=>{Vt=null,$t()})),Wt||on(),cn(e)}function on(){Ut||=Ot().then(e=>{Ht.clear();for(let t of e)t.fileConfig&&Ht.set(t.id,t.fileConfig)}).catch(()=>{}).finally(()=>{Ut=null,Wt=!0,$t()})}function sn(){on()}if(typeof window<`u`){let e=()=>{sn(),pn()};window.addEventListener(`focus`,e),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&e()})}function cn(e){!e||Gt.has(e)||Kt.has(e)||(Kt.add(e),Ct(e).then(t=>{Gt.has(e)||Gt.set(e,t)}).catch(()=>{Gt.has(e)||Gt.set(e,[])}).finally(()=>{Kt.delete(e),$t()}))}function ln(){let e=typeof window>`u`?null:It(window.location.pathname).projectId,t=(0,v.useSyncExternalStore)(en,()=>e?Gt.get(e)??qt:qt,()=>qt);return(0,v.useEffect)(()=>cn(e),[e]),t}function un(e){let t=dn();t&&(Gt.set(t,e),wt(t,e).catch(()=>{}),$t())}function dn(){return typeof window>`u`?null:It(window.location.pathname).projectId}function fn(e){Bt={...Bt??{},...e};let t=++Xt;Zt++,St(e).then(e=>{e.ok&&t===Xt&&(Bt=e.preferences,$t())}).catch(()=>{}).finally(()=>Zt--),$t()}function pn(){let e=Xt;xt().then(t=>{e!==Xt||Zt>0||(Bt=t,$t())}).catch(()=>{})}function mn(){return typeof window>`u`?null:It(window.location.pathname).projectId}function hn(){let e=typeof window>`u`?null:It(window.location.pathname).projectId,t=(0,v.useSyncExternalStore)(en,()=>nn(e),()=>zt);return(0,v.useEffect)(()=>an(e),[e]),t}function gn(){let e=typeof window>`u`?null:It(window.location.pathname).projectId,t=(0,v.useSyncExternalStore)(en,()=>rn(e),()=>_n);return(0,v.useEffect)(()=>an(e),[e]),t}var _n={};function vn(e){return e.theme??`system`}function yn(e,t){return e===`dark`||e===`system`&&t}function bn(e){return Qe(e,`browser`)}function xn(e){return Qe(e,`discord`)}function Sn(e){return $e(e,`newActivity`)}function Cn(e){return $e(e,`humanIntervention`)}function wn(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=wn(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function Tn(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=wn(e))&&(r&&(r+=` `),r+=t);return r}var En=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,Dn=Tn,On=(e,t)=>n=>{if(t?.variants==null)return Dn(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=En(t)||En(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 Dn(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)},kn=`-`,An=e=>{let t=Pn(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{let n=e.split(kn);return n[0]===``&&n.length!==1&&n.shift(),jn(n,t)||Nn(e)},getConflictingClassGroupIds:(e,t)=>{let i=n[e]||[];return t&&r[e]?[...i,...r[e]]:i}}},jn=(e,t)=>{if(e.length===0)return t.classGroupId;let n=e[0],r=t.nextPart.get(n),i=r?jn(e.slice(1),r):void 0;if(i)return i;if(t.validators.length===0)return;let a=e.join(kn);return t.validators.find(({validator:e})=>e(a))?.classGroupId},Mn=/^\[(.+)\]$/,Nn=e=>{if(Mn.test(e)){let t=Mn.exec(e)[1],n=t?.substring(0,t.indexOf(`:`));if(n)return`arbitrary..`+n}},Pn=e=>{let{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return Rn(Object.entries(e.classGroups),n).forEach(([e,n])=>{Fn(n,r,e,t)}),r},Fn=(e,t,n,r)=>{e.forEach(e=>{if(typeof e==`string`){let r=e===``?t:In(t,e);r.classGroupId=n;return}if(typeof e==`function`){if(Ln(e)){Fn(e(r),t,n,r);return}t.validators.push({validator:e,classGroupId:n});return}Object.entries(e).forEach(([e,i])=>{Fn(i,In(t,e),n,r)})})},In=(e,t)=>{let n=e;return t.split(kn).forEach(e=>{n.nextPart.has(e)||n.nextPart.set(e,{nextPart:new Map,validators:[]}),n=n.nextPart.get(e)}),n},Ln=e=>e.isThemeGetter,Rn=(e,t)=>t?e.map(([e,n])=>[e,n.map(e=>typeof e==`string`?t+e:typeof e==`object`?Object.fromEntries(Object.entries(e).map(([e,n])=>[t+e,n])):e)]):e,zn=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=new Map,r=new Map,i=(i,a)=>{n.set(i,a),t++,t>e&&(t=0,r=n,n=new Map)};return{get(e){let t=n.get(e);if(t!==void 0)return t;if((t=r.get(e))!==void 0)return i(e,t),t},set(e,t){n.has(e)?n.set(e,t):i(e,t)}}},Bn=`!`,Vn=e=>{let{separator:t,experimentalParseClassName:n}=e,r=t.length===1,i=t[0],a=t.length,o=e=>{let n=[],o=0,s=0,c;for(let l=0;l<e.length;l++){let u=e[l];if(o===0){if(u===i&&(r||e.slice(l,l+a)===t)){n.push(e.slice(s,l)),s=l+a;continue}if(u===`/`){c=l;continue}}u===`[`?o++:u===`]`&&o--}let l=n.length===0?e:e.substring(s),u=l.startsWith(Bn);return{modifiers:n,hasImportantModifier:u,baseClassName:u?l.substring(1):l,maybePostfixModifierPosition:c&&c>s?c-s:void 0}};return n?e=>n({className:e,parseClassName:o}):o},Hn=e=>{if(e.length<=1)return e;let t=[],n=[];return e.forEach(e=>{e[0]===`[`?(t.push(...n.sort(),e),n=[]):n.push(e)}),t.push(...n.sort()),t},Un=e=>({cache:zn(e.cacheSize),parseClassName:Vn(e),...An(e)}),Wn=/\s+/,Gn=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=t,a=[],o=e.trim().split(Wn),s=``;for(let e=o.length-1;e>=0;--e){let t=o[e],{modifiers:c,hasImportantModifier:l,baseClassName:u,maybePostfixModifierPosition:d}=n(t),f=!!d,p=r(f?u.substring(0,d):u);if(!p){if(!f){s=t+(s.length>0?` `+s:s);continue}if(p=r(u),!p){s=t+(s.length>0?` `+s:s);continue}f=!1}let m=Hn(c).join(`:`),h=l?m+Bn:m,g=h+p;if(a.includes(g))continue;a.push(g);let _=i(p,f);for(let e=0;e<_.length;++e){let t=_[e];a.push(h+t)}s=t+(s.length>0?` `+s:s)}return s};function Kn(){let e=0,t,n,r=``;for(;e<arguments.length;)(t=arguments[e++])&&(n=qn(t))&&(r&&(r+=` `),r+=n);return r}var qn=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=qn(e[r]))&&(n&&(n+=` `),n+=t);return n};function Jn(e,...t){let n,r,i,a=o;function o(o){return n=Un(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)}function s(e){let t=r(e);if(t)return t;let a=Gn(e,n);return i(e,a),a}return function(){return a(Kn.apply(null,arguments))}}var Yn=e=>{let t=t=>t[e]||[];return t.isThemeGetter=!0,t},Xn=/^\[(?:([a-z-]+):)?(.+)\]$/i,Zn=/^\d+\/\d+$/,Qn=new Set([`px`,`full`,`screen`]),$n=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,er=/\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$/,tr=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,nr=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,rr=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ir=e=>or(e)||Qn.has(e)||Zn.test(e),ar=e=>yr(e,`length`,br),or=e=>!!e&&!Number.isNaN(Number(e)),sr=e=>yr(e,`number`,or),cr=e=>!!e&&Number.isInteger(Number(e)),lr=e=>e.endsWith(`%`)&&or(e.slice(0,-1)),ur=e=>Xn.test(e),dr=e=>$n.test(e),fr=new Set([`length`,`size`,`percentage`]),pr=e=>yr(e,fr,xr),mr=e=>yr(e,`position`,xr),hr=new Set([`image`,`url`]),gr=e=>yr(e,hr,Cr),_r=e=>yr(e,``,Sr),vr=()=>!0,yr=(e,t,n)=>{let r=Xn.exec(e);return r?r[1]?typeof t==`string`?r[1]===t:t.has(r[1]):n(r[2]):!1},br=e=>er.test(e)&&!tr.test(e),xr=()=>!1,Sr=e=>nr.test(e),Cr=e=>rr.test(e),wr=Jn(()=>{let e=Yn(`colors`),t=Yn(`spacing`),n=Yn(`blur`),r=Yn(`brightness`),i=Yn(`borderColor`),a=Yn(`borderRadius`),o=Yn(`borderSpacing`),s=Yn(`borderWidth`),c=Yn(`contrast`),l=Yn(`grayscale`),u=Yn(`hueRotate`),d=Yn(`invert`),f=Yn(`gap`),p=Yn(`gradientColorStops`),m=Yn(`gradientColorStopPositions`),h=Yn(`inset`),g=Yn(`margin`),_=Yn(`opacity`),v=Yn(`padding`),y=Yn(`saturate`),b=Yn(`scale`),x=Yn(`sepia`),S=Yn(`skew`),C=Yn(`space`),w=Yn(`translate`),T=()=>[`auto`,`contain`,`none`],E=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],D=()=>[`auto`,ur,t],O=()=>[ur,t],k=()=>[``,ir,ar],A=()=>[`auto`,or,ur],j=()=>[`bottom`,`center`,`left`,`left-bottom`,`left-top`,`right`,`right-bottom`,`right-top`,`top`],M=()=>[`solid`,`dashed`,`dotted`,`double`,`none`],N=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],P=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`],F=()=>[``,`0`,ur],I=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],L=()=>[or,ur];return{cacheSize:500,separator:`:`,theme:{colors:[vr],spacing:[ir,ar],blur:[`none`,``,dr,ur],brightness:L(),borderColor:[e],borderRadius:[`none`,``,`full`,dr,ur],borderSpacing:O(),borderWidth:k(),contrast:L(),grayscale:F(),hueRotate:L(),invert:F(),gap:O(),gradientColorStops:[e],gradientColorStopPositions:[lr,ar],inset:D(),margin:D(),opacity:L(),padding:O(),saturate:L(),scale:L(),sepia:F(),skew:L(),space:O(),translate:O()},classGroups:{aspect:[{aspect:[`auto`,`square`,`video`,ur]}],container:[`container`],columns:[{columns:[dr]}],"break-after":[{"break-after":I()}],"break-before":[{"break-before":I()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:[...j(),ur]}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:[h]}],"inset-x":[{"inset-x":[h]}],"inset-y":[{"inset-y":[h]}],start:[{start:[h]}],end:[{end:[h]}],top:[{top:[h]}],right:[{right:[h]}],bottom:[{bottom:[h]}],left:[{left:[h]}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[`auto`,cr,ur]}],basis:[{basis:D()}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`wrap`,`wrap-reverse`,`nowrap`]}],flex:[{flex:[`1`,`auto`,`initial`,`none`,ur]}],grow:[{grow:F()}],shrink:[{shrink:F()}],order:[{order:[`first`,`last`,`none`,cr,ur]}],"grid-cols":[{"grid-cols":[vr]}],"col-start-end":[{col:[`auto`,{span:[`full`,cr,ur]},ur]}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":[vr]}],"row-start-end":[{row:[`auto`,{span:[cr,ur]},ur]}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":[`auto`,`min`,`max`,`fr`,ur]}],"auto-rows":[{"auto-rows":[`auto`,`min`,`max`,`fr`,ur]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:[`normal`,...P()]}],"justify-items":[{"justify-items":[`start`,`end`,`center`,`stretch`]}],"justify-self":[{"justify-self":[`auto`,`start`,`end`,`center`,`stretch`]}],"align-content":[{content:[`normal`,...P(),`baseline`]}],"align-items":[{items:[`start`,`end`,`center`,`baseline`,`stretch`]}],"align-self":[{self:[`auto`,`start`,`end`,`center`,`stretch`,`baseline`]}],"place-content":[{"place-content":[...P(),`baseline`]}],"place-items":[{"place-items":[`start`,`end`,`center`,`baseline`,`stretch`]}],"place-self":[{"place-self":[`auto`,`start`,`end`,`center`,`stretch`]}],p:[{p:[v]}],px:[{px:[v]}],py:[{py:[v]}],ps:[{ps:[v]}],pe:[{pe:[v]}],pt:[{pt:[v]}],pr:[{pr:[v]}],pb:[{pb:[v]}],pl:[{pl:[v]}],m:[{m:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[C]}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":[C]}],"space-y-reverse":[`space-y-reverse`],w:[{w:[`auto`,`min`,`max`,`fit`,`svw`,`lvw`,`dvw`,ur,t]}],"min-w":[{"min-w":[ur,t,`min`,`max`,`fit`]}],"max-w":[{"max-w":[ur,t,`none`,`full`,`min`,`max`,`fit`,`prose`,{screen:[dr]},dr]}],h:[{h:[ur,t,`auto`,`min`,`max`,`fit`,`svh`,`lvh`,`dvh`]}],"min-h":[{"min-h":[ur,t,`min`,`max`,`fit`,`svh`,`lvh`,`dvh`]}],"max-h":[{"max-h":[ur,t,`min`,`max`,`fit`,`svh`,`lvh`,`dvh`]}],size:[{size:[ur,t,`auto`,`min`,`max`,`fit`]}],"font-size":[{text:[`base`,dr,ar]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`,sr]}],"font-family":[{font:[vr]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`,ur]}],"line-clamp":[{"line-clamp":[`none`,or,sr]}],leading:[{leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`,ir,ur]}],"list-image":[{"list-image":[`none`,ur]}],"list-style-type":[{list:[`none`,`disc`,`decimal`,ur]}],"list-style-position":[{list:[`inside`,`outside`]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[_]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[_]}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...M(),`wavy`]}],"text-decoration-thickness":[{decoration:[`auto`,`from-font`,ir,ar]}],"underline-offset":[{"underline-offset":[`auto`,ir,ur]}],"text-decoration-color":[{decoration:[e]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:O()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,ur]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,ur]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-opacity":[{"bg-opacity":[_]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:[...j(),mr]}],"bg-repeat":[{bg:[`no-repeat`,{repeat:[``,`x`,`y`,`round`,`space`]}]}],"bg-size":[{bg:[`auto`,`cover`,`contain`,pr]}],"bg-image":[{bg:[`none`,{"gradient-to":[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},gr]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[m]}],"gradient-via-pos":[{via:[m]}],"gradient-to-pos":[{to:[m]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[a]}],"rounded-s":[{"rounded-s":[a]}],"rounded-e":[{"rounded-e":[a]}],"rounded-t":[{"rounded-t":[a]}],"rounded-r":[{"rounded-r":[a]}],"rounded-b":[{"rounded-b":[a]}],"rounded-l":[{"rounded-l":[a]}],"rounded-ss":[{"rounded-ss":[a]}],"rounded-se":[{"rounded-se":[a]}],"rounded-ee":[{"rounded-ee":[a]}],"rounded-es":[{"rounded-es":[a]}],"rounded-tl":[{"rounded-tl":[a]}],"rounded-tr":[{"rounded-tr":[a]}],"rounded-br":[{"rounded-br":[a]}],"rounded-bl":[{"rounded-bl":[a]}],"border-w":[{border:[s]}],"border-w-x":[{"border-x":[s]}],"border-w-y":[{"border-y":[s]}],"border-w-s":[{"border-s":[s]}],"border-w-e":[{"border-e":[s]}],"border-w-t":[{"border-t":[s]}],"border-w-r":[{"border-r":[s]}],"border-w-b":[{"border-b":[s]}],"border-w-l":[{"border-l":[s]}],"border-opacity":[{"border-opacity":[_]}],"border-style":[{border:[...M(),`hidden`]}],"divide-x":[{"divide-x":[s]}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":[s]}],"divide-y-reverse":[`divide-y-reverse`],"divide-opacity":[{"divide-opacity":[_]}],"divide-style":[{divide:M()}],"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-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:[``,...M()]}],"outline-offset":[{"outline-offset":[ir,ur]}],"outline-w":[{outline:[ir,ar]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:k()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[_]}],"ring-offset-w":[{"ring-offset":[ir,ar]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:[``,`inner`,`none`,dr,_r]}],"shadow-color":[{shadow:[vr]}],opacity:[{opacity:[_]}],"mix-blend":[{"mix-blend":[...N(),`plus-lighter`,`plus-darker`]}],"bg-blend":[{"bg-blend":N()}],filter:[{filter:[``,`none`]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":[``,`none`,dr,ur]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[y]}],sepia:[{sepia:[x]}],"backdrop-filter":[{"backdrop-filter":[``,`none`]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[_]}],"backdrop-saturate":[{"backdrop-saturate":[y]}],"backdrop-sepia":[{"backdrop-sepia":[x]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[`none`,`all`,``,`colors`,`opacity`,`shadow`,`transform`,ur]}],duration:[{duration:L()}],ease:[{ease:[`linear`,`in`,`out`,`in-out`,ur]}],delay:[{delay:L()}],animate:[{animate:[`none`,`spin`,`ping`,`pulse`,`bounce`,ur]}],transform:[{transform:[``,`gpu`,`none`]}],scale:[{scale:[b]}],"scale-x":[{"scale-x":[b]}],"scale-y":[{"scale-y":[b]}],rotate:[{rotate:[cr,ur]}],"translate-x":[{"translate-x":[w]}],"translate-y":[{"translate-y":[w]}],"skew-x":[{"skew-x":[S]}],"skew-y":[{"skew-y":[S]}],"transform-origin":[{origin:[`center`,`top`,`top-right`,`right`,`bottom-right`,`bottom`,`bottom-left`,`left`,`top-left`,ur]}],accent:[{accent:[`auto`,e]}],appearance:[{appearance:[`none`,`auto`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,ur]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":[`none`,`auto`]}],resize:[{resize:[`none`,`y`,`x`,``]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"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`,ur]}],fill:[{fill:[e,`none`]}],"stroke-w":[{stroke:[ir,ar,sr]}],stroke:[{stroke:[e,`none`]}],sr:[`sr-only`,`not-sr-only`],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-s`,`border-w-e`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-s`,`border-color-e`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]}}});function G(...e){return wr(Tn(e))}var Tr=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})),K=o(((e,t)=>{t.exports=Tr()}))(),Er=On(`inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-primary)] disabled:pointer-events-none disabled:opacity-50`,{variants:{variant:{default:`bg-[var(--color-primary)] text-[var(--color-primary-foreground)] hover:opacity-90`,outline:`border border-[var(--color-border)] bg-transparent hover:bg-[var(--color-accent)] hover:text-[var(--color-accent-foreground)]`,ghost:`hover:bg-[var(--color-accent)] hover:text-[var(--color-accent-foreground)]`,destructive:`bg-[var(--color-danger)] text-[var(--color-background)] hover:opacity-90`},size:{default:`h-9 px-4 py-2`,sm:`h-8 px-3`,xs:`h-7 gap-1 px-2 text-xs`,icon:`h-9 w-9`,"icon-sm":`h-7 w-7`}},defaultVariants:{variant:`default`,size:`default`}});function q({className:e,variant:t,size:n,...r}){return(0,K.jsx)(`button`,{className:G(Er({variant:t,size:n}),e),...r})}var Dr=class extends v.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`Dashboard render error:`,e,t.componentStack)}reset=()=>this.setState({error:null});render(){let{error:e}=this.state;return e?(0,K.jsxs)(`div`,{role:`alert`,className:`flex min-h-screen flex-col items-center justify-center gap-3 bg-background p-8 text-center text-foreground`,children:[(0,K.jsx)(`p`,{className:`text-base font-medium`,children:`Something went wrong`}),(0,K.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:`The dashboard hit an error and could not finish drawing this view. Your session is safe — the daemon keeps running. Try again, or reload the page.`}),e.message&&(0,K.jsx)(`pre`,{className:`max-w-md overflow-x-auto rounded-md bg-muted px-3 py-2 text-left text-xs text-muted-foreground`,children:e.message}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(q,{variant:`outline`,onClick:this.reset,children:`Try again`}),(0,K.jsx)(q,{onClick:()=>window.location.reload(),children:`Reload`})]})]}):this.props.children}};function Or({children:e}){let t=vn(hn());return(0,v.useEffect)(()=>{let e=document.documentElement,n=window.matchMedia(`(prefers-color-scheme: dark)`),r=()=>e.classList.toggle(`dark`,yn(t,n.matches));if(r(),t===`system`)return n.addEventListener(`change`,r),()=>n.removeEventListener(`change`,r)},[t]),(0,K.jsx)(`div`,{className:`min-h-screen bg-background text-foreground`,children:(0,K.jsx)(Dr,{children:e})})}var kr=yt(`onAgents`),Ar=yt(`onRetainedWorktrees`),jr=yt(`onAgentWorktree`),Mr=yt(`onAgent`),Nr=yt(`onDocs`),Pr=yt(`onTicket`),Fr=yt(`onTicketsMeta`),Ir=yt(`onAllTickets`),Lr=yt(`onOverview`),Rr=yt(`onRecentAgents`),zr=yt(`onHotTickets`),Br=yt(`onInterventions`),Vr=yt(`onOpenQuestions`),Hr=yt(`onActivity`),Ur=yt(`onDashboard`),Wr=yt(`onProjectFiles`),Gr=yt(`onProjectFileStatus`),Kr=yt(`onFileDiff`),qr=yt(`onAgentChanges`),Jr=yt(`onFileContent`),Yr=yt(`onGithubUrl`),Xr=yt(`onGitStatus`),Zr=yt(`onAgentHandoff`),Qr=yt(`onSystemPromptUser`),$r=yt(`onBridgeQuestion`),ei=yt(`onBridgeStatus`),ti=yt(`onBridgeToken`),ni=yt(`onBridgeAnswer`),ri=yt(`onBridgeEvents`),ii=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),ai=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),oi={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`},si=(0,v.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,v.createElement)(`svg`,{ref:c,...oi,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:ai(`lucide`,i),...s},[...o.map(([e,t])=>(0,v.createElement)(e,t)),...Array.isArray(a)?a:[a]])),ci=(e,t)=>{let n=(0,v.forwardRef)(({className:n,...r},i)=>(0,v.createElement)(si,{ref:i,iconNode:t,className:ai(`lucide-${ii(e)}`,n),...r}));return n.displayName=`${e}`,n},li=ci(`ArrowDownWideNarrow`,[[`path`,{d:`m3 16 4 4 4-4`,key:`1co6wj`}],[`path`,{d:`M7 20V4`,key:`1yoxec`}],[`path`,{d:`M11 4h10`,key:`1w87gc`}],[`path`,{d:`M11 8h7`,key:`djye34`}],[`path`,{d:`M11 12h4`,key:`q8tih4`}]]),ui=ci(`ArrowDown`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),di=ci(`ArrowLeft`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),fi=ci(`ArrowUpNarrowWide`,[[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}],[`path`,{d:`M11 12h4`,key:`q8tih4`}],[`path`,{d:`M11 16h7`,key:`uosisv`}],[`path`,{d:`M11 20h10`,key:`jvxblo`}]]),pi=ci(`ArrowUp`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),mi=ci(`BellOff`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]),hi=ci(`Bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),gi=ci(`Bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),_i=ci(`CalendarClock`,[[`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:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M17.5 17.5 16 16.3V14`,key:`akvzfd`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),vi=ci(`Check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),yi=ci(`ChevronDown`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),bi=ci(`ChevronRight`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),xi=ci(`CircleHelp`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Si=ci(`ClipboardList`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`M12 11h4`,key:`1jrz19`}],[`path`,{d:`M12 16h4`,key:`n85exb`}],[`path`,{d:`M8 11h.01`,key:`1dfujw`}],[`path`,{d:`M8 16h.01`,key:`18s6g9`}]]),Ci=ci(`ClipboardPlus`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`M9 14h6`,key:`159ibu`}],[`path`,{d:`M12 17v-6`,key:`1y8rbf`}]]),wi=ci(`Cloud`,[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]),Ti=ci(`Code`,[[`polyline`,{points:`16 18 22 12 16 6`,key:`z7tu5w`}],[`polyline`,{points:`8 6 2 12 8 18`,key:`1eg1df`}]]),Ei=ci(`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`}]]),Di=ci(`EllipsisVertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),Oi=ci(`ExternalLink`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),ki=ci(`File`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}]]),Ai=ci(`Flame`,[[`path`,{d:`M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z`,key:`96xj49`}]]),ji=ci(`FolderGit2`,[[`path`,{d:`M9 20H4a2 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.9H20a2 2 0 0 1 2 2v5`,key:`1w6njk`}],[`circle`,{cx:`13`,cy:`12`,r:`2`,key:`1j92g6`}],[`path`,{d:`M18 19c-2.8 0-5-2.2-5-5v8`,key:`pkpw2h`}],[`circle`,{cx:`20`,cy:`19`,r:`2`,key:`1obnsp`}]]),Mi=ci(`FolderOpen`,[[`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`}]]),Ni=ci(`FolderX`,[[`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`}],[`path`,{d:`m9.5 10.5 5 5`,key:`ra9qjz`}],[`path`,{d:`m14.5 10.5-5 5`,key:`l2rkpq`}]]),Pi=ci(`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`}]]),Fi=ci(`GitBranch`,[[`line`,{x1:`6`,x2:`6`,y1:`3`,y2:`15`,key:`17qcm7`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M18 9a9 9 0 0 1-9 9`,key:`n2h4wq`}]]),Ii=ci(`GitMerge`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]),Li=ci(`GitPullRequest`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]),Ri=ci(`Github`,[[`path`,{d:`M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4`,key:`tonef`}],[`path`,{d:`M9 18c-4.51 2-5-2-7-2`,key:`9comsn`}]]),zi=ci(`Hammer`,[[`path`,{d:`m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9`,key:`eefl8a`}],[`path`,{d:`m18 15 4-4`,key:`16gjal`}],[`path`,{d:`m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172V7l-2.26-2.26a6 6 0 0 0-4.202-1.756L9 2.96l.92.82A6.18 6.18 0 0 1 12 8.4V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5`,key:`b7pghm`}]]),Bi=ci(`Inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),Vi=ci(`Laptop`,[[`path`,{d:`M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16`,key:`tarvll`}]]),Hi=ci(`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`}]]),Ui=ci(`LayoutDashboard`,[[`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`}]]),Wi=ci(`ListPlus`,[[`path`,{d:`M11 12H3`,key:`51ecnj`}],[`path`,{d:`M16 6H3`,key:`1wxfjs`}],[`path`,{d:`M16 18H3`,key:`12xzn7`}],[`path`,{d:`M18 9v6`,key:`1twb98`}],[`path`,{d:`M21 12h-6`,key:`bt1uis`}]]),Gi=ci(`ListTodo`,[[`rect`,{x:`3`,y:`5`,width:`6`,height:`6`,rx:`1`,key:`1defrl`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`M13 6h8`,key:`15sg57`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 18h8`,key:`oe0vm4`}]]),Ki=ci(`LoaderCircle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),qi=ci(`LockOpen`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 9.9-1`,key:`1mm8w8`}]]),Ji=ci(`MessageCircleQuestion`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Yi=ci(`MonitorSmartphone`,[[`path`,{d:`M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8`,key:`10dyio`}],[`path`,{d:`M10 19v-3.96 3.15`,key:`1irgej`}],[`path`,{d:`M7 19h5`,key:`qswx4l`}],[`rect`,{width:`6`,height:`10`,x:`16`,y:`12`,rx:`2`,key:`1egngj`}]]),Xi=ci(`Monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),Zi=ci(`Moon`,[[`path`,{d:`M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z`,key:`a7tn18`}]]),Qi=ci(`Play`,[[`polygon`,{points:`6 3 20 12 6 21 6 3`,key:`1oa8hb`}]]),$i=ci(`Plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),ea=ci(`RefreshCw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),ta=ci(`Search`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),na=ci(`Settings`,[[`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`,key:`1qme2f`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),ra=ci(`SquareCheckBig`,[[`path`,{d:`M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5`,key:`1uzm8b`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),ia=ci(`SquareSlash`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`line`,{x1:`9`,x2:`15`,y1:`15`,y2:`9`,key:`1dfufj`}]]),aa=ci(`Square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),oa=ci(`Sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),sa=ci(`Ticket`,[[`path`,{d:`M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z`,key:`qn84l0`}],[`path`,{d:`M13 5v2`,key:`dyzc3o`}],[`path`,{d:`M13 17v2`,key:`1ont0d`}],[`path`,{d:`M13 11v2`,key:`1wjjxi`}]]),ca=ci(`Trash2`,[[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6`,key:`4alrt4`}],[`path`,{d:`M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2`,key:`v07s0e`}],[`line`,{x1:`10`,x2:`10`,y1:`11`,y2:`17`,key:`1uufr5`}],[`line`,{x1:`14`,x2:`14`,y1:`11`,y2:`17`,key:`xtxkd`}]]),la=ci(`TriangleAlert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),ua=ci(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function da({className:e,...t}){return(0,K.jsx)(`span`,{className:G(`inline-flex items-center rounded-full border border-[var(--color-border)] px-2 py-0.5 text-xs font-medium`,e),...t})}function fa(e){let t=new Map;for(let n of e){if(n.kind===`choice-resolved`){t.delete(n.id);continue}if(n.kind===`end`){t.clear();continue}if(n.kind===`choice`){let{kind:e,...r}=n;t.set(n.id,r)}}return[...t.values()]}function pa(e){let t=new Map;for(let n of e)if(n.kind===`view`){let{kind:e,...r}=n;t.set(n.id,r)}return[...t.values()]}function ma(e){let t=xa(e);return t.length>0&&!t.some(e=>e.kind===`end`)}function ha(e){let t=!1;for(let n of e)n.kind===`settled`?t=!0:(n.kind===`driver`&&n.event.type===`start`||n.kind===`end`)&&(t=!1);return t}function ga(e){let t=xa(e).find(e=>e.kind===`end`);if(!(!t||t.kind!==`end`))return{ok:t.ok,stopped:t.stopped===!0,...t.detail===void 0?{}:{detail:t.detail}}}function _a(e){let t=xa(e),n=t.find(e=>e.kind===`end`);if(n?.kind!==`end`||!n.ok||t.some(e=>e.kind===`handoff`))return!1;let r;for(let t of e)t.kind===`handoff-armed`&&(r=t.push);return r===!0}function va(e){return e.status===`done`&&e.handoff?.push===!0&&e.handoffReport===void 0}function ya(e){let t;for(let n of e){if(n.kind!==`driver`||n.event.type!==`action`)continue;let e=/^run (https?:\/\/\S+)$/.exec(n.event.label);e&&(t=e[1])}return t}function ba(e){let t;for(let n of e){if(n.kind!==`driver`||n.event.type!==`action`)continue;let e=/^cloud (https:\/\/claude\.ai\/code\/(session_[A-Za-z0-9]+)\S*)$/.exec(n.event.label);e&&(t={url:e[1],id:e[2]})}return t}function xa(e){let t=0;for(let n=e.length-1;n>=0;n--)if(e[n]?.kind===`session`){t=n;break}return e.slice(t)}function Sa(e){if(!e)return;let t=new Date(e);return Number.isNaN(t.getTime())?void 0:t}function Ca(e,t=`—`){let n=Sa(e);return n?n.toLocaleString():t}function wa(e,t=`—`){let n=Sa(e);return n?n.toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`}):t}function Ta(e,t=`—`){let n=Sa(e);if(!n)return t;let r=Math.max(0,Math.floor((Date.now()-n.getTime())/1e3));if(r<60)return`${r}s ago`;let i=Math.floor(r/60);if(i<60)return`${i}m ago`;let a=Math.floor(i/60);if(a<24)return`${a}h ago`;let o=Math.floor(a/24);return o<7?`${o}d ago`:o<365?`${Math.floor(o/7)}w ago`:`${Math.floor(o/365)}y ago`}function Ea(e){let t=Math.round((e-Date.now())/6e4);return t<=0?`any moment`:t<60?`in ${t} min`:`in ${Math.round(t/60)} hr`}function Da(e,t=`—`){let n=Sa(e);if(!n)return t;let r=Math.round((Date.now()-n.getTime())/1e3);if(r<60)return`just now`;let i=Math.round(r/60);if(i<60)return`${i}m ago`;let a=Math.round(i/60);if(a<24)return`${a}h ago`;let o=Math.round(a/24);return o<=7?`${o}d ago`:n.toLocaleDateString()}function Oa(e){let t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60);return r<24?`${r}h`:`${Math.floor(r/24)}d`}function ka(e,t){return`${e} ${t}${e===1?``:`s`}`}function Aa(e){let t=Math.max(0,Math.floor(e/1e3));if(t<60)return ka(t,`second`);let n=Math.floor(t/60);if(n<60)return ka(n,`minute`);let r=Math.floor(n/60);return r<24?ka(r,`hour`):ka(Math.floor(r/24),`day`)}function ja(e){return e.toLocaleTimeString(void 0,{hour:`numeric`,minute:`2-digit`}).toLowerCase().replace(/\s+/g,``)}function Ma(e){let t=new Date(e);return`${t.toLocaleDateString(void 0,{weekday:`long`})} ${ja(t)}`}function Na(e){let t=new Date(e),n=t.toLocaleDateString(void 0,{month:`short`,day:`numeric`}),r=Intl.DateTimeFormat().resolvedOptions().timeZone;return`Quota resets on ${n}, ${ja(t)} (${r})`}var Pa={running:`text-primary`,done:`text-success`,stopped:`text-warning`,failed:`text-danger`};function Fa(e){return e.intent?.trim()||e.sessionName?.trim()||e.branch?.trim()||wa(e.startedAt)}function Ia({className:e,title:t}){return(0,K.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,className:e,...Ra(t),children:[t&&(0,K.jsx)(`title`,{children:t}),(0,K.jsx)(`path`,{d:`m4.714 15.956l4.718-2.648l.079-.23l-.08-.128h-.23l-.79-.048l-2.695-.073l-2.337-.097l-2.265-.122l-.57-.121l-.535-.704l.055-.353l.48-.321l.685.06l1.518.104l2.277.157l1.651.098l2.447.255h.389l.054-.158l-.133-.097l-.103-.098l-2.356-1.596l-2.55-1.688l-1.336-.972l-.722-.491L2 6.223l-.158-1.008l.656-.722l.88.06l.224.061l.893.686l1.906 1.476l2.49 1.833l.364.304l.146-.104l.018-.072l-.164-.274l-1.354-2.446l-1.445-2.49l-.644-1.032l-.17-.619a3 3 0 0 1-.103-.729L6.287.133L6.7 0l.995.134l.42.364l.619 1.415L9.735 4.14l1.555 3.03l.455.898l.243.832l.09.255h.159V9.01l.127-1.706l.237-2.095l.23-2.695l.08-.76l.376-.91l.747-.492l.583.28l.48.685l-.067.444l-.286 1.851l-.558 2.903l-.365 1.942h.213l.243-.242l.983-1.306l1.652-2.064l.728-.82l.85-.904l.547-.431h1.032l.759 1.129l-.34 1.166l-1.063 1.347l-.88 1.142l-1.263 1.7l-.79 1.36l.074.11l.188-.02l2.853-.606l1.542-.28l1.84-.315l.832.388l.09.395l-.327.807l-1.967.486l-2.307.462l-3.436.813l-.043.03l.049.061l1.548.146l.662.036h1.62l3.018.225l.79.522l.473.638l-.08.485l-1.213.62l-1.64-.389l-3.825-.91l-1.31-.329h-.183v.11l1.093 1.068l2.003 1.81l2.508 2.33l.127.578l-.321.455l-.34-.049l-2.204-1.657l-.85-.747l-1.925-1.62h-.127v.17l.443.649l2.343 3.521l.122 1.08l-.17.353l-.607.213l-.668-.122l-1.372-1.924l-1.415-2.168l-1.141-1.943l-.14.08l-.674 7.254l-.316.37l-.728.28l-.607-.461l-.322-.747l.322-1.476l.388-1.924l.316-1.53l.285-1.9l.17-.632l-.012-.042l-.14.018l-1.432 1.967l-2.18 2.945l-1.724 1.845l-.413.164l-.716-.37l.066-.662l.401-.589l2.386-3.036l1.439-1.882l.929-1.086l-.006-.158h-.055L4.138 18.56l-1.13.146l-.485-.456l.06-.746l.231-.243l1.907-1.312Z`})]})}function La({className:e,title:t}){return(0,K.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,className:e,...Ra(t),children:[t&&(0,K.jsx)(`title`,{children:t}),(0,K.jsx)(`path`,{d:`M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.0201 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z`})]})}function Ra(e){return e?{role:`img`}:{"aria-hidden":`true`}}function za({driver:e,className:t,title:n}){return(0,K.jsx)(e===`codex`?La:Ia,{className:t,...n?{title:n}:{}})}function Ba(){let[e,t]=(0,v.useState)(!1),[n,r]=(0,v.useState)(null);return{busy:e,error:n,reset:(0,v.useCallback)(()=>r(null),[]),run:(0,v.useCallback)(async(e,n=`Something went wrong.`)=>{t(!0),r(null);try{let t=await e();if(Va(t)){r(t.error??n);return}return t}catch(e){r(e instanceof Error?e.message:n);return}finally{t(!1)}},[])}}function Va(e){return typeof e==`object`&&!!e&&`ok`in e&&e.ok===!1}function Ha(){}var Ua=Object.freeze([]),Wa=Object.freeze({});function Ga({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=v.useRef(e!==void 0),[a,o]=v.useState(t);return[i?e:a,v.useCallback(e=>{i||o(e)},[])]}var Ka={};function qa(e,t){let n=v.useRef(Ka);return n.current===Ka&&(n.current=e(t)),n}var Ja=v[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],Ya=Ja&&Ja!==v.useLayoutEffect?Ja:e=>e();function J(e){let t=qa(Xa).current;return t.next=e,Ya(t.effect),t.trampoline}function Xa(){let e={next:void 0,callback:Za,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function Za(){}var Y=typeof document<`u`?v.useLayoutEffect:()=>{};function Qa(e,t,n,r){let i=qa(eo).current;return to(i,e,t,n,r)&&ro(i,[e,t,n,r]),i.callback}function $a(e){let t=qa(eo).current;return no(t,e)&&ro(t,e),t.callback}function eo(){return{callback:null,cleanup:null,refs:[]}}function to(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function no(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function ro(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n;break;default:}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null;break;default:}}}}}}var io={clip:`rect(0 0 0 0)`,overflow:`hidden`,whiteSpace:`nowrap`,position:`fixed`,top:0,left:0,border:0,padding:0,width:1,height:1,margin:-1},ao=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),oo=function(e){return e.disabled=`data-disabled`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),so={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},co={valid(e){return e===null?null:e?{[oo.valid]:``}:{[oo.invalid]:``}}};function lo(e){return v.useMemo(()=>({checked(t){return e.indeterminate?{}:t?{[ao.checked]:``}:{[ao.unchecked]:``}},...co}),[e.indeterminate])}function uo(e,...t){let n=new URL(`https://base-ui.com/production-error/${e}`);return t.forEach(e=>n.searchParams.append(`args[]`,e)),`Base UI error #${e}; visit ${n} for the full message.`}var fo=19;function po(e){return fo>=e}function mo(e){if(!v.isValidElement(e))return null;let t=e,n=t.props;return(po(19)?n?.ref:t.ref)??null}function ho(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function go(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e);continue}i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function _o(e,t){return typeof e==`function`?e(t):e}function vo(e,t){return typeof e==`function`?e(t):e}var yo={};function bo(e,t,n,r,i){let a={...Eo(e,yo)};return t&&(a=So(a,t)),n&&(a=So(a,n)),r&&(a=So(a,r)),i&&(a=So(a,i)),a}function xo(e){if(e.length===0)return yo;if(e.length===1)return Eo(e[0],yo);let t={...Eo(e[0],yo)};for(let n=1;n<e.length;n+=1)t=So(t,e[n]);return t}function So(e,t){return To(t)?t(e):Co(e,t)}function Co(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=ho(e.style,r);break;case`className`:e[n]=ko(e.className,r);break;default:wo(n,r)?e[n]=Do(e[n],r):e[n]=r}}return e}function wo(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function To(e){return typeof e==`function`}function Eo(e,t){return To(e)?e(t):e??yo}function Do(e,t){return t?e?n=>{if(Ao(n)){let r=n;Oo(r);let i=t(r);return r.baseUIHandlerPrevented||e?.(r),i}let r=t(n);return e?.(n),r}:t:e}function Oo(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function ko(e,t){return t?e?t+` `+e:t:e}function Ao(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}var jo={style:{transition:`none`}},Mo=`data-base-ui-click-trigger`,No={fallbackAxisSide:`none`},Po={fallbackAxisSide:`end`},Fo={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0};function Io(e,t,n={}){let r=t.render,i=Lo(t,n);return n.enabled===!1?null:Ro(e,r,i,n.state??Wa)}function Lo(e,t={}){let{className:n,style:r,render:i}=e,{state:a=Wa,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?_o(n,a):void 0,d=l?vo(r,a):void 0,f=l?go(a,c):Wa,p=l?ho(f,Array.isArray(s)?xo(s):s)??Wa:Wa;return typeof document<`u`&&(l?Array.isArray(o)?p.ref=$a([p.ref,mo(i),...o]):p.ref=Qa(p.ref,mo(i),o):Qa(null,null)),l?(u!==void 0&&(p.className=ko(p.className,u)),d!==void 0&&(p.style=ho(p.style,d)),p):Wa}function Ro(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=bo(n,t.props);return e.ref=n.ref,v.cloneElement(t,e)}if(e&&typeof e==`string`)return zo(e,n);throw Error(uo(8))}function zo(e,t){return e===`button`?(0,v.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,v.createElement)(`img`,{alt:``,...t,key:t.key}):v.createElement(e,t)}var Bo={...v},Vo=0;function Ho(e,t=`mui`){let[n,r]=v.useState(e),i=e||n;return v.useEffect(()=>{n??(Vo+=1,r(`${t}-${Vo}`))},[n,t]),i}var Uo=Bo.useId;function Wo(e,t){if(Uo!==void 0){let n=Uo();return e??(t?`${t}-${n}`:n)}return Ho(e,t)}function Go(e){return Wo(e,`base-ui`)}function Ko(){return typeof window<`u`}function qo(e){return Xo(e)?(e.nodeName||``).toLowerCase():`#document`}function Jo(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Yo(e){return((Xo(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Xo(e){return Ko()?e instanceof Node||e instanceof Jo(e).Node:!1}function Zo(e){return Ko()?e instanceof Element||e instanceof Jo(e).Element:!1}function Qo(e){return Ko()?e instanceof HTMLElement||e instanceof Jo(e).HTMLElement:!1}function $o(e){return!Ko()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Jo(e).ShadowRoot}function es(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=fs(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function ts(e){return/^(table|td|th)$/.test(qo(e))}function ns(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var rs=/transform|translate|scale|rotate|perspective|filter/,is=/paint|layout|strict|content/,as=e=>!!e&&e!==`none`,ss;function cs(e){let t=Zo(e)?fs(e):e;return as(t.transform)||as(t.translate)||as(t.scale)||as(t.rotate)||as(t.perspective)||!us()&&(as(t.backdropFilter)||as(t.filter))||rs.test(t.willChange||``)||is.test(t.contain||``)}function ls(e){let t=ms(e);for(;Qo(t)&&!ds(t);){if(cs(t))return t;if(ns(t))return null;t=ms(t)}return null}function us(){return ss??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),ss}function ds(e){return/^(html|body|#document)$/.test(qo(e))}function fs(e){return Jo(e).getComputedStyle(e)}function ps(e){return Zo(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ms(e){if(qo(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||$o(e)&&e.host||Yo(e);return $o(t)?t.host:t}function hs(e){let t=ms(e);return ds(t)?(e.ownerDocument||e).body:Qo(t)&&es(t)?t:hs(t)}function gs(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=hs(e),i=r===e.ownerDocument?.body,a=Jo(r);if(i){let e=_s(a);return t.concat(a,a.visualViewport||[],es(r)?r:[],e&&n?gs(e):[])}else return t.concat(r,gs(r,[],n))}function _s(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var vs=v.createContext(void 0);function ys(e=!1){let t=v.useContext(vs);if(t===void 0&&!e)throw Error(uo(16));return t}function bs(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:v.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function xs(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0}=e,a=v.useRef(null),o=ys(!0)!==void 0,s=J(()=>{let e=a.current;return!!(e?.tagName===`A`&&e?.href)}),{props:c}=bs({focusableWhenDisabled:n,disabled:t,composite:o,tabIndex:r,isNativeButton:i}),l=v.useCallback(()=>{let e=a.current;Ss(e)&&o&&t&&c.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,c.disabled,o]);return Y(l,[l]),{getButtonProps:v.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:l,...u}=e;return bo({type:i?`button`:void 0,onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(Oo(e),o?.(e)),e.baseUIHandlerPrevented)return;let r=e.target===e.currentTarget&&!i&&!s()&&!t,a=e.key===`Enter`,c=e.key===` `;r&&((c||a)&&e.preventDefault(),a&&n?.(e))},onKeyUp(e){t||(Oo(e),a?.(e)),!e.baseUIHandlerPrevented&&e.target===e.currentTarget&&!i&&!t&&e.key===` `&&n?.(e)},onPointerDown(e){if(t){e.preventDefault();return}l?.(e)}},i?void 0:{role:`button`},c,u)},[t,c,i,s]),buttonRef:J(e=>{a.current=e,l()})}}function Ss(e){return Qo(e)&&e.tagName===`BUTTON`}var Cs=v.createContext({invalid:void 0,name:void 0,validityData:{state:so,errors:[],error:``,value:``,initialValue:null},setValidityData:Ha,disabled:void 0,touched:!1,setTouched:Ha,dirty:!1,setDirty:Ha,filled:!1,setFilled:Ha,focused:!1,setFocused:Ha,validate:()=>null,validationMode:`onSubmit`,validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(e=Wa)=>e,getInputValidationProps:(e=Wa)=>e,inputRef:{current:null},commit:async()=>{}}});function ws(e=!0){let t=v.useContext(Cs);if(t.setValidityData===Ha&&!e)throw Error(uo(28));return t}var Ts=v.createContext({disabled:!1});function Es(){return v.useContext(Ts)}function Ds(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}var Os=v.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Ha,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function ks(){return v.useContext(Os)}var As=l(h());function js(e){let{enabled:t=!0,value:n,id:r,name:i,controlRef:a,commit:o}=e,{formRef:s}=ks(),{invalid:c,markedDirtyRef:l,validityData:u,setValidityData:d}=ws(),f=J(e.getValue);Y(()=>{if(!t)return;let e=n;e===void 0&&(e=f()),u.initialValue===null&&e!==null&&d(t=>({...t,initialValue:e}))},[t,d,n,u.initialValue,f]),Y(()=>{!t||!r||s.current.fields.set(r,{getValue:f,name:i,controlRef:a,validityData:Ds(u,c),validate(){let e=n;e===void 0&&(e=f()),l.current=!0,As.flushSync(()=>o(e))}})},[o,a,t,s,f,r,c,l,i,u,n]),Y(()=>{let e=s.current.fields;return()=>{r&&e.delete(r)}},[s,r])}var Ms=v.createContext({controlId:void 0,setControlId:Ha,labelId:void 0,setLabelId:Ha,messageIds:[],setMessageIds:Ha,getDescriptionProps:e=>e});function Ns(){return v.useContext(Ms)}var Ps=v.createContext(void 0);function Fs(e=!0){let t=v.useContext(Ps);if(t===void 0&&!e)throw Error(uo(3));return t}var Is=v.createContext(void 0);function Ls(){let e=v.useContext(Is);if(e===void 0)throw Error(uo(14));return e}var Rs=`none`,zs=`trigger-press`,Bs=`trigger-hover`,Vs=`trigger-focus`,Hs=`outside-press`,Us=`item-press`,Ws=`close-press`,Gs=`track-press`,Ks=`input-change`,qs=`focus-out`,Js=`escape-key`,Ys=`list-navigation`,Xs=`keyboard`,Zs=`drag`,Qs=`cancel-open`,$s=`sibling-open`,ec=`disabled`,tc=`imperative-action`;function nc(e,t,n,r){let i=!1,a=!1,o=r??Wa;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}function rc(e,t,n){let r=n??Wa;return{reason:e,event:t??new Event(`base-ui`),...r}}function ic(e,t){let n=v.useRef(e),r=J(t);Y(()=>{n.current!==e&&r(n.current)},[e,r]),Y(()=>{n.current=e},[e])}var ac=`data-parent`,oc=v.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i=!1,disabled:a=!1,id:o,indeterminate:s=!1,inputRef:c,name:l,onCheckedChange:u,parent:d=!1,readOnly:f=!1,render:p,required:m=!1,uncheckedValue:h,value:g,nativeButton:_=!1,...y}=e,{clearErrors:b}=ks(),{disabled:x,name:S,setDirty:C,setFilled:w,setFocused:T,setTouched:E,state:D,validationMode:O,validityData:k,shouldValidateOnChange:A,validation:j}=ws(),M=Es(),{labelId:N,controlId:P,setControlId:F,getDescriptionProps:I}=Ns(),L=Fs(),R=L?.parent,z=R&&L.allValues,B=x||M.disabled||L?.disabled||a,ee=S??l,V=g??ee,H=Go(),te=Go(),U=P;z?U=d?te:`${R.id}-${V}`:o&&(U=o);let W={};z&&(d?W=L.parent.getParentProps():V&&(W=L.parent.getChildProps(V)));let ne=J(u),{checked:re=n,indeterminate:ie=s,onCheckedChange:ae,...oe}=W,se=L?.value,ce=L?.setValue,le=L?.defaultValue,ue=v.useRef(null),{getButtonProps:de,buttonRef:fe}=xs({disabled:B,native:_}),pe=L?.validation??j,[me,he]=Ga({controlled:V&&se&&!d?se.includes(V):re,default:V&&le&&!d?le.includes(V):i,name:`Checkbox`,state:`checked`});Y(()=>{if(F!==Ha)return F(U),()=>{F(void 0)}},[U,L,F,d]),js({enabled:!L,id:H,commit:pe.commit,value:me,controlRef:ue,name:ee,getValue:()=>me});let ge=v.useRef(null),_e=Qa(c,ge,pe.inputRef);Y(()=>{ge.current&&(ge.current.indeterminate=ie,me&&w(!0))},[me,ie,w]),ic(me,()=>{L&&!d||(b(ee),w(me),C(me!==k.initialValue),A()?pe.commit(me):pe.commit(me,!0))});let ve=bo({checked:me,disabled:B,name:d?void 0:ee,id:U??void 0,required:m,ref:_e,style:io,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,onChange(e){if(e.nativeEvent.defaultPrevented)return;let t=e.target.checked,n=nc(Rs,e.nativeEvent);if(ae?.(t,n),ne(t,n),!n.isCanceled&&(he(t),V&&se&&ce&&!d)){let e=t?[...se,V]:se.filter(e=>e!==V);ce(e,n)}},onFocus(){ue.current?.focus()}},g===void 0?Wa:{value:(L?me&&g:g)||``},I,L?pe.getValidationProps:pe.getInputValidationProps),ye=z?!!re:me,be=z&&ie||s;v.useEffect(()=>{R&&V&&R.disabledStatesRef.current.set(V,B)},[R,B,V]);let xe=v.useMemo(()=>({...D,checked:ye,disabled:B,readOnly:f,required:m,indeterminate:be}),[D,ye,B,f,m,be]),Se=lo(xe),Ce=Io(`span`,e,{state:xe,ref:[fe,ue,t,L?.registerControlRef],props:[{id:H,role:`checkbox`,"aria-checked":ie?`mixed`:me,"aria-readonly":f||void 0,"aria-required":m||void 0,"aria-labelledby":N,[ac]:d?``:void 0,onFocus(){T(!0)},onBlur(){let e=ge.current;e&&(E(!0),T(!1),O===`onBlur`&&pe.commit(L?se:e.checked))},onClick(e){f||B||(e.preventDefault(),ge.current?.click())}},I,pe.getValidationProps,y,oe,de],stateAttributesMapping:Se});return(0,K.jsxs)(Is.Provider,{value:xe,children:[Ce,!me&&!L&&ee&&!d&&h!==void 0&&(0,K.jsx)(`input`,{type:`hidden`,name:ee,value:h}),(0,K.jsx)(`input`,{...ve})]})});function sc(e){let t=qa(cc,e).current;return t.next=e,Y(t.effect),t}function cc(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var lc=[];function uc(e){v.useEffect(e,lc)}var dc=null;globalThis.requestAnimationFrame;var fc=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,--this.callbacksCount)}},pc=class e{static create(){return new e}static request(e){return fc.request(e)}static cancel(e){return fc.cancel(e)}currentId=dc;request(e){this.cancel(),this.currentId=fc.request(()=>{this.currentId=dc,e()})}cancel=()=>{this.currentId!==dc&&(fc.cancel(this.currentId),this.currentId=dc)};disposeEffect=()=>this.cancel};function mc(){let e=qa(pc.create).current;return uc(e.disposeEffect),e}function hc(e){return e==null?e:`current`in e?e.current:e}function gc(e,t=!1,n=!0){let r=mc();return J((i,a=null)=>{r.cancel();let o=hc(e);o!=null&&(typeof o.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED?i():r.request(()=>{function e(){o&&Promise.all(o.getAnimations().map(e=>e.finished)).then(()=>{a!=null&&a.aborted||As.flushSync(i)}).catch(()=>{if(n){if(a!=null&&a.aborted)return;As.flushSync(i)}else o.getAnimations().length>0&&o.getAnimations().some(e=>e.pending||e.playState!==`finished`)&&e()})}t?r.request(e):e()}))})}function _c(e){let{enabled:t=!0,open:n,ref:r,onComplete:i}=e,a=sc(n),o=J(i),s=gc(r,n);v.useEffect(()=>{t&&s(()=>{n===a.current&&o()})},[t,n,o,s,a])}function vc(e,t=!1,n=!1){let[r,i]=v.useState(e&&t?`idle`:void 0),[a,o]=v.useState(e);return e&&!a&&(o(!0),i(`starting`)),!e&&a&&r!==`ending`&&!n&&i(`ending`),!e&&!a&&r===`ending`&&i(void 0),Y(()=>{if(!e&&a&&r!==`ending`&&n){let e=pc.request(()=>{i(`ending`)});return()=>{pc.cancel(e)}}},[e,a,r,n]),Y(()=>{if(!e||t)return;let n=pc.request(()=>{As.flushSync(()=>{i(void 0)})});return()=>{pc.cancel(n)}},[t,e]),Y(()=>{if(!e||!t)return;e&&a&&r!==`idle`&&i(`starting`);let n=pc.request(()=>{i(`idle`)});return()=>{pc.cancel(n)}},[t,e,a,i,r]),v.useMemo(()=>({mounted:a,setMounted:o,transitionStatus:r}),[a,r])}var yc=function(e){return e.startingStyle=`data-starting-style`,e.endingStyle=`data-ending-style`,e}({}),bc={[yc.startingStyle]:``},xc={[yc.endingStyle]:``},Sc={transitionStatus(e){return e===`starting`?bc:e===`ending`?xc:null}},Cc=v.forwardRef(function(e,t){let{render:n,className:r,keepMounted:i=!1,...a}=e,o=Ls(),s=o.checked||o.indeterminate,{transitionStatus:c,setMounted:l}=vc(s),u=v.useRef(null),d=v.useMemo(()=>({...o,transitionStatus:c}),[o,c]);_c({open:s,ref:u,onComplete(){s||l(!1)}});let f=lo(o),p=v.useMemo(()=>({...f,...Sc,...co}),[f]),m=i||s,h=Io(`span`,e,{enabled:m,ref:[t,u],state:d,stateAttributesMapping:p,props:a});return m?h:null});function wc({className:e,disabled:t=!1,...n}){return(0,K.jsx)(oc,{disabled:t,className:G(`inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px] border border-border bg-transparent`,`transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-primary)]`,`data-[checked]:border-primary data-[checked]:bg-primary data-[checked]:text-primary-foreground`,`data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:(0,K.jsx)(Cc,{className:`flex items-center justify-center text-current`,children:(0,K.jsx)(vi,{className:`h-3 w-3`,strokeWidth:3,"aria-hidden":!0})})})}function Tc({onAdded:e,onClose:t}){let[n,r]=(0,v.useState)(``),[i,a]=(0,v.useState)(!1),{busy:o,error:s,reset:c,run:l}=Ba(),[u,d]=(0,v.useState)(!1),[f,p]=(0,v.useState)(null),m=(0,v.useRef)(null);(0,v.useEffect)(()=>{let e=document.activeElement instanceof HTMLElement?document.activeElement:null;return()=>e?.focus()},[]),(0,v.useEffect)(()=>{if(!f)return;let e=setTimeout(t,2500);return()=>clearTimeout(e)},[f]);let h=e=>{e.preventDefault(),!(!n.trim()||o)&&(c(),d(!0))},g=async()=>{if(o)return;let t=await l(()=>kt(n.trim(),i),`Failed to add the project.`);t?.ok?(d(!1),p({added:t.added,alreadyActivated:t.alreadyActivated}),e()):d(!1)},_=e=>{if(e.key===`Escape`){e.preventDefault(),t();return}if(e.key!==`Tab`||!m.current)return;let n=[...m.current.querySelectorAll(`button, input, [tabindex]:not([tabindex="-1"])`)].filter(e=>!e.hasAttribute(`disabled`)),r=n[0],i=n[n.length-1];!r||!i||(e.shiftKey&&document.activeElement===r?(e.preventDefault(),i.focus()):!e.shiftKey&&document.activeElement===i&&(e.preventDefault(),r.focus()))},y=f&&[`Added ${f.added} project${f.added===1?``:`s`}`,f.alreadyActivated>0?`${f.alreadyActivated} already added`:null].filter(Boolean).join(` · `);return(0,K.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-start justify-center bg-black/40 pt-24`,onKeyDown:_,children:[(0,K.jsx)(`div`,{className:`absolute inset-0`,onClick:t}),(0,K.jsx)(`div`,{ref:m,role:`dialog`,"aria-modal":`true`,"aria-label":`Add project`,className:`relative w-96 max-w-[90vw] rounded-lg border border-border bg-background p-4 shadow-lg`,children:f?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{role:`status`,className:`mb-3 text-sm font-medium`,children:y}),(0,K.jsx)(`div`,{className:`flex justify-end`,children:(0,K.jsx)(q,{type:`button`,size:`sm`,autoFocus:!0,onClick:t,children:`Done`})})]}):u?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`mb-2 text-sm font-medium`,children:`Do you trust this repository?`}),(0,K.jsx)(`p`,{className:`mb-2 break-all text-xs text-muted-foreground`,children:(0,K.jsx)(`code`,{className:`rounded bg-muted px-1`,children:n.trim()})}),(0,K.jsx)(`p`,{className:`mb-3 text-xs text-muted-foreground`,children:`Adding it lets the agent read its files. Hidden instructions in an untrusted repo can hijack the agent (prompt injection), so only add repos you trust.`}),s&&(0,K.jsx)(`p`,{className:`mb-2 text-xs text-danger`,children:s}),(0,K.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,K.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,disabled:o,onClick:()=>d(!1),children:`Back`}),(0,K.jsx)(q,{type:`button`,size:`sm`,disabled:o,onClick:()=>void g(),children:o?`Adding…`:`I trust it, add it`})]})]}):(0,K.jsxs)(`form`,{onSubmit:h,children:[(0,K.jsx)(`p`,{className:`mb-2 text-sm font-medium`,children:`Add project`}),(0,K.jsx)(`input`,{value:n,onChange:e=>r(e.target.value),placeholder:`/absolute/path/to/repo`,"aria-label":`Repository path`,autoFocus:!0,disabled:o,className:`mb-2 w-full rounded-md border border-border bg-transparent px-2 py-1 text-sm outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-primary)]`}),(0,K.jsxs)(`label`,{className:`mb-2 flex cursor-pointer items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,K.jsx)(wc,{checked:i,onCheckedChange:a,disabled:o}),`It's a folder of repos`]}),s&&(0,K.jsx)(`p`,{className:`mb-2 text-xs text-danger`,children:s}),(0,K.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,K.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,disabled:o,onClick:t,children:`Cancel`}),(0,K.jsx)(q,{type:`submit`,size:`sm`,disabled:o||!n.trim(),children:`Add`})]})]})})]})}var Ec=v.createContext(void 0);function Dc(e){let t=v.useContext(Ec);if(t===void 0&&!e)throw Error(uo(33));return t}var Oc=v.createContext(void 0);function kc(e){let t=v.useContext(Oc);if(t===void 0&&!e)throw Error(uo(36));return t}var Ac=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=yc.startingStyle]=`startingStyle`,e[e.endingStyle=yc.endingStyle]=`endingStyle`,e.anchorHidden=`data-anchor-hidden`,e}({}),jc=function(e){return e.popupOpen=`data-popup-open`,e.pressed=`data-pressed`,e}({}),Mc={[jc.popupOpen]:``},Nc={[jc.popupOpen]:``,[jc.pressed]:``},Pc={[Ac.open]:``},Fc={[Ac.closed]:``},Ic={[Ac.anchorHidden]:``},Lc={open(e){return e?Mc:null}},Rc={open(e){return e?Nc:null}},zc={open(e){return e?Pc:Fc},anchorHidden(e){return e?Ic:null}},Bc=v.createContext(void 0);function Vc(e=!0){let t=v.useContext(Bc);if(t===void 0&&!e)throw Error(uo(25));return t}var Hc=v.createContext(void 0);function Uc(){let e=v.useContext(Hc);if(e===void 0)throw Error(uo(30));return e}var Wc={type:`regular-item`};function Gc(e){let{closeOnClick:t,disabled:n=!1,highlighted:r,id:i,store:a,nativeButton:o,itemMetadata:s,nodeId:c}=e,l=v.useRef(null),u=Vc(!0),d=u!==void 0,{events:f}=a.useState(`floatingTreeRoot`),{getButtonProps:p,buttonRef:m}=xs({disabled:n,focusableWhenDisabled:!0,native:o}),h=v.useCallback(e=>bo({id:i,role:`menuitem`,tabIndex:r?0:-1,onMouseMove(e){c&&f.emit(`itemhover`,{nodeId:c,target:e.currentTarget})},onMouseEnter(){s.type===`submenu-trigger`&&s.setActive()},onKeyUp(e){e.key===` `&&a.context.typingRef.current&&e.preventBaseUIHandler()},onClick(e){t&&f.emit(`close`,{domEvent:e,reason:Us})},onMouseUp(e){if(u){let t=u.initialCursorPointRef.current;if(u.initialCursorPointRef.current=null,d&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1)return}l.current&&a.context.allowMouseUpTriggerRef.current&&(!d||e.button===2)&&s.type===`regular-item`&&l.current.click()}},e,p),[i,r,p,t,f,a,d,u,s,c]),g=Qa(l,m);return v.useMemo(()=>({getItemProps:h,itemRef:g}),[h,g])}var Kc=v.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function qc(){return v.useContext(Kc)}var Jc=function(e){return e[e.None=0]=`None`,e[e.GuessFromOrder=1]=`GuessFromOrder`,e}({});function Yc(e={}){let{label:t,metadata:n,textRef:r,indexGuessBehavior:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,elementsRef:l,labelsRef:u,nextIndexRef:d}=qc(),f=v.useRef(-1),[p,m]=v.useState(a??(i===Jc.GuessFromOrder?()=>{if(f.current===-1){let e=d.current;d.current+=1,f.current=e}return f.current}:-1)),h=v.useRef(null),g=v.useCallback(e=>{if(h.current=e,p!==-1&&e!==null&&(l.current[p]=e,u)){let n=t!==void 0;u.current[p]=n?t:r?.current?.textContent??e.textContent}},[p,l,u,t,r]);return Y(()=>{if(a!=null)return;let e=h.current;if(e)return o(e,n),()=>{s(e)}},[a,o,s,n]),Y(()=>{if(a==null)return c(e=>{let t=h.current?e.get(h.current)?.index:null;t!=null&&m(t)})},[a,c,m]),v.useMemo(()=>({ref:g,index:p}),[p,g])}var Xc=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.highlighted=`data-highlighted`,e}({}),Zc={checked(e){return e?{[Xc.checked]:``}:{[Xc.unchecked]:``}},...Sc},Qc=v.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!1,checked:l,defaultChecked:u,onCheckedChange:d,...f}=e,p=Yc({label:a}),m=Dc(!0),h=Go(i),{store:g}=kc(),_=g.useState(`isActive`,p.index),y=g.useState(`itemProps`),[b,x]=Ga({controlled:l,default:u??!1,name:`MenuCheckboxItem`,state:`checked`}),{getItemProps:S,itemRef:C}=Gc({closeOnClick:c,disabled:s,highlighted:_,id:h,store:g,nativeButton:o,nodeId:m?.nodeId,itemMetadata:Wc}),w=v.useMemo(()=>({disabled:s,highlighted:_,checked:b}),[s,_,b]),T=Io(`div`,e,{state:w,stateAttributesMapping:Zc,props:[y,{role:`menuitemcheckbox`,"aria-checked":b,onClick:J(e=>{let t={...nc(Us,e.nativeEvent),preventUnmountOnClose:()=>{}};d?.(!b,t),!t.isCanceled&&x(e=>!e)})},f,S],ref:[C,t,p.ref]});return(0,K.jsx)(Hc.Provider,{value:w,children:T})}),$c=v.forwardRef(function(e,t){let{render:n,className:r,keepMounted:i=!1,...a}=e,o=Uc(),s=v.useRef(null),{transitionStatus:c,setMounted:l}=vc(o.checked);return _c({open:o.checked,ref:s,onComplete(){o.checked||l(!1)}}),Io(`span`,e,{state:v.useMemo(()=>({checked:o.checked,disabled:o.disabled,highlighted:o.highlighted,transitionStatus:c}),[o.checked,o.disabled,o.highlighted,c]),ref:[t,s],stateAttributesMapping:Zc,props:{"aria-hidden":!0,...a},enabled:i||o.checked})}),el=v.createContext(void 0);function tl(){let e=v.useContext(el);if(e===void 0)throw Error(uo(31));return e}var nl=v.forwardRef(function(e,t){let{render:n,className:r,...i}=e,[a,o]=v.useState(void 0),s=v.useMemo(()=>({setLabelId:o}),[o]),c=Io(`div`,e,{ref:t,props:{role:`group`,"aria-labelledby":a,...i}});return(0,K.jsx)(el.Provider,{value:s,children:c})}),rl=v.forwardRef(function(e,t){let{className:n,render:r,id:i,...a}=e,o=Go(i),{setLabelId:s}=tl();return Y(()=>(s(o),()=>{s(void 0)}),[s,o]),Io(`div`,e,{ref:t,props:{id:o,role:`presentation`,...a}})}),il=v.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!0,...l}=e,u=Yc({label:a}),d=Dc(!0),f=Go(i),{store:p}=kc(),m=p.useState(`isActive`,u.index),h=p.useState(`itemProps`),{getItemProps:g,itemRef:_}=Gc({closeOnClick:c,disabled:s,highlighted:m,id:f,store:p,nativeButton:o,nodeId:d?.nodeId,itemMetadata:Wc});return Io(`div`,e,{state:v.useMemo(()=>({disabled:s,highlighted:m}),[s,m]),props:[h,l,g],ref:[_,t,u.ref]})}),al=0,ol=class e{static create(){return new e}currentId=al;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=al,t()},e)}isStarted(){return this.currentId!==al}clear=()=>{this.currentId!==al&&(clearTimeout(this.currentId),this.currentId=al)};disposeEffect=()=>this.clear};function sl(){let e=qa(ol.create).current;return uc(e.disposeEffect),e}var cl=typeof navigator<`u`,ll=vl(),ul=bl(),dl=yl(),fl=typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter:none`),pl=ll.platform===`MacIntel`&&ll.maxTouchPoints>1||/iP(hone|ad|od)|iOS/.test(ll.platform);cl&&/firefox/i.test(dl);var ml=cl&&/apple/i.test(navigator.vendor);cl&&/Edg/i.test(dl);var hl=cl&&/android/i.test(ul)||/android/i.test(dl),gl=cl&&ul.toLowerCase().startsWith(`mac`)&&!navigator.maxTouchPoints,_l=dl.includes(`jsdom/`);function vl(){if(!cl)return{platform:``,maxTouchPoints:-1};let e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??-1}}function yl(){if(!cl)return``;let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:e,version:t})=>`${e}/${t}`).join(` `):navigator.userAgent}function bl(){if(!cl)return``;let e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??``}var xl=`data-base-ui-focusable`,Sl=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,Cl=`ArrowLeft`,wl=`ArrowRight`,Tl=`ArrowUp`,El=`ArrowDown`;function Dl(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function Ol(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&$o(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function kl(e){return`composedPath`in e?e.composedPath()[0]:e.target}function Al(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function jl(e){return e.matches(`html,body`)}function Ml(e){return e?.ownerDocument||document}function Nl(e){return Qo(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function Pl(e){return e?e.getAttribute(`role`)===`combobox`&&Nl(e):!1}function Fl(e){if(!e||_l)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function Il(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function Ll(e,t,n=!0){return e.filter(e=>e.parentId===t&&(!n||e.context?.open)).flatMap(t=>[t,...Ll(e,t.id,n)])}function Rl(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function zl(e){e.preventDefault(),e.stopPropagation()}function Bl(e){return`nativeEvent`in e}function Vl(e){return e.mozInputSource===0&&e.isTrusted?!0:hl&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function Hl(e){return _l?!1:!hl&&e.width===0&&e.height===0||hl&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function Ul(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function Wl(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}var Gl=[`top`,`right`,`bottom`,`left`],Kl=Math.min,ql=Math.max,Jl=Math.round,Yl=Math.floor,Xl=e=>({x:e,y:e}),Zl={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Ql(e,t,n){return ql(e,Kl(t,n))}function $l(e,t){return typeof e==`function`?e(t):e}function eu(e){return e.split(`-`)[0]}function tu(e){return e.split(`-`)[1]}function nu(e){return e===`x`?`y`:`x`}function ru(e){return e===`y`?`height`:`width`}function iu(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function au(e){return nu(iu(e))}function ou(e,t,n){n===void 0&&(n=!1);let r=tu(e),i=au(e),a=ru(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=hu(o)),[o,hu(o)]}function su(e){let t=hu(e);return[cu(e),t,cu(t)]}function cu(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var lu=[`left`,`right`],uu=[`right`,`left`],du=[`top`,`bottom`],fu=[`bottom`,`top`];function pu(e,t,n){switch(e){case`top`:case`bottom`:return n?t?uu:lu:t?lu:uu;case`left`:case`right`:return t?du:fu;default:return[]}}function mu(e,t,n,r){let i=tu(e),a=pu(eu(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(cu)))),a}function hu(e){let t=eu(e);return Zl[t]+e.slice(t.length)}function gu(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function _u(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:gu(e)}function vu(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 yu(e,t,n){return Math.floor(e/t)!==n}function bu(e,t){return t<0||t>=e.current.length}function xu(e,t){return Cu(e,{disabledIndices:t})}function Su(e,t){return Cu(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Cu(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.current.length-1&&Ou(e,a,r));return a}function wu(e,{event:t,orientation:n,loopFocus:r,rtl:i,cols:a,disabledIndices:o,minIndex:s,maxIndex:c,prevIndex:l,stopEvent:u=!1}){let d=l,f=[],p={},m=!1;{let t=null,n=-1;e.current.forEach((e,r)=>{if(e==null)return;let i=e.closest(`[role="row"]`);i&&(m=!0),(i!==t||n===-1)&&(t=i,n+=1,f[n]=[]),f[n].push(r),p[r]=n})}let h=m&&f.length>0&&f.some(e=>e.length!==a);function g(t){if(!h||l===-1)return;let n=p[l];if(n==null)return;let i=f[n].indexOf(l),a=t===`up`?n-1:n+1;r&&(a<0?a=f.length-1:a>=f.length&&(a=0));let s=new Set;for(;a>=0&&a<f.length&&!s.has(a);){s.add(a);let n=f[a];if(n.length===0){a=t===`up`?a-1:a+1;continue}let c=Math.min(i,n.length-1);for(let t=c;t>=0;--t){let r=n[t];if(!Ou(e,r,o))return r}a=t===`up`?a-1:a+1,r&&(a<0?a=f.length-1:a>=f.length&&(a=0))}}if(t.key===`ArrowUp`){let n=g(`up`);if(n!==void 0)u&&zl(t),d=n;else{if(u&&zl(t),l===-1)d=c;else if(d=Cu(e,{startingIndex:d,amount:a,decrement:!0,disabledIndices:o}),r&&(l-a<s||d<0)){let e=l%a,t=c%a,n=c-(t-e);d=t===e?c:t>e?n:n-a}bu(e,d)&&(d=l)}}if(t.key===`ArrowDown`){let n=g(`down`);n===void 0?(u&&zl(t),l===-1?d=s:(d=Cu(e,{startingIndex:l,amount:a,disabledIndices:o}),r&&l+a>c&&(d=Cu(e,{startingIndex:l%a-a,amount:a,disabledIndices:o}))),bu(e,d)&&(d=l)):(u&&zl(t),d=n)}if(n===`both`){let n=Yl(l/a);t.key===(i?`ArrowLeft`:`ArrowRight`)&&(u&&zl(t),l%a===a-1?r&&(d=Cu(e,{startingIndex:l-l%a-1,disabledIndices:o})):(d=Cu(e,{startingIndex:l,disabledIndices:o}),r&&yu(d,a,n)&&(d=Cu(e,{startingIndex:l-l%a-1,disabledIndices:o}))),yu(d,a,n)&&(d=l)),t.key===(i?`ArrowRight`:`ArrowLeft`)&&(u&&zl(t),l%a===0?r&&(d=Cu(e,{startingIndex:l+(a-l%a),decrement:!0,disabledIndices:o})):(d=Cu(e,{startingIndex:l,decrement:!0,disabledIndices:o}),r&&yu(d,a,n)&&(d=Cu(e,{startingIndex:l+(a-l%a),decrement:!0,disabledIndices:o}))),yu(d,a,n)&&(d=l));let s=Yl(c/a)===n;bu(e,d)&&(d=r&&s?t.key===(i?`ArrowRight`:`ArrowLeft`)?c:Cu(e,{startingIndex:l-l%a-1,disabledIndices:o}):l)}return d}function Tu(e,t,n){let r=[],i=0;return e.forEach(({width:e,height:a},o)=>{let s=!1;for(n&&(i=0);!s;){let n=[];for(let r=0;r<e;r+=1)for(let e=0;e<a;e+=1)n.push(i+r+e*t);i%t+e<=t&&n.every(e=>r[e]==null)?(n.forEach(e=>{r[e]=o}),s=!0):i+=1}}),[...r]}function Eu(e,t,n,r,i){if(e===-1)return-1;let a=n.indexOf(e),o=t[e];switch(i){case`tl`:return a;case`tr`:return o?a+o.width-1:a;case`bl`:return o?a+(o.height-1)*r:a;case`br`:return n.lastIndexOf(e);default:return-1}}function Du(e,t){return t.flatMap((t,n)=>e.includes(t)?[n]:[])}function Ou(e,t,n){if(typeof n==`function`)return n(t);if(n)return n.includes(t);let r=e.current[t];return r?r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`:!1}var ku=[`input:not([inert]):not([inert] *)`,`select:not([inert]):not([inert] *)`,`textarea:not([inert]):not([inert] *)`,`a[href]:not([inert]):not([inert] *)`,`area[href]:not([inert]):not([inert] *)`,`button:not([inert]):not([inert] *)`,`[tabindex]:not(slot):not([inert]):not([inert] *)`,`audio[controls]:not([inert]):not([inert] *)`,`video[controls]:not([inert]):not([inert] *)`,`[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)`,`details>summary:first-of-type:not([inert]):not([inert] *)`,`details:not([inert]):not([inert] *)`].join(`,`),Au=typeof Element>`u`,ju=Au?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Mu=!Au&&Element.prototype.getRootNode?function(e){return e?.getRootNode?.call(e)}:function(e){return e?.ownerDocument},Nu=function(e,t){t===void 0&&(t=!0);var n=e?.getAttribute?.call(e,`inert`);return n===``||n===`true`||t&&e&&(typeof e.closest==`function`?e.closest(`[inert]`):Nu(e.parentNode))},Pu=function(e){var t=e?.getAttribute?.call(e,`contenteditable`);return t===``||t===`true`},Fu=function(e,t,n){if(Nu(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(ku));return t&&ju.call(e,ku)&&r.unshift(e),r=r.filter(n),r},Iu=function(e,t,n){for(var r=[],i=Array.from(e);i.length;){var a=i.shift();if(!Nu(a,!1))if(a.tagName===`SLOT`){var o=a.assignedElements(),s=Iu(o.length?o:a.children,!0,n);n.flatten?r.push.apply(r,s):r.push({scopeParent:a,candidates:s})}else{ju.call(a,ku)&&n.filter(a)&&(t||!e.includes(a))&&r.push(a);var c=a.shadowRoot||typeof n.getShadowRoot==`function`&&n.getShadowRoot(a),l=!Nu(c,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(a));if(c&&l){var u=Iu(c===!0?a.children:c.children,!0,n);n.flatten?r.push.apply(r,u):r.push({scopeParent:a,candidates:u})}else i.unshift.apply(i,a.children)}}return r},Lu=function(e){return!isNaN(parseInt(e.getAttribute(`tabindex`),10))},Ru=function(e){if(!e)throw Error(`No node provided`);return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||Pu(e))&&!Lu(e)?0:e.tabIndex},zu=function(e,t){var n=Ru(e);return n<0&&t&&!Lu(e)?0:n},Bu=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Vu=function(e){return e.tagName===`INPUT`},Hu=function(e){return Vu(e)&&e.type===`hidden`},Uu=function(e){return e.tagName===`DETAILS`&&Array.prototype.slice.apply(e.children).some(function(e){return e.tagName===`SUMMARY`})},Wu=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]},Gu=function(e){if(!e.name)return!0;var t=e.form||Mu(e),n=function(e){return t.querySelectorAll(`input[type="radio"][name="`+e+`"]`)},r;if(typeof window<`u`&&window.CSS!==void 0&&typeof window.CSS.escape==`function`)r=n(window.CSS.escape(e.name));else try{r=n(e.name)}catch(e){return console.error(`Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s`,e.message),!1}var i=Wu(r,e.form);return!i||i===e},Ku=function(e){return Vu(e)&&e.type===`radio`},qu=function(e){return Ku(e)&&!Gu(e)},Ju=function(e){var t=e&&Mu(e),n=t?.host,r=!1;if(t&&t!==e){var i,a,o;for(r=!!((i=n)!=null&&(a=i.ownerDocument)!=null&&a.contains(n)||e!=null&&(o=e.ownerDocument)!=null&&o.contains(e));!r&&n;){var s,c;t=Mu(n),n=t?.host,r=!!((s=n)!=null&&(c=s.ownerDocument)!=null&&c.contains(n))}}return r},Yu=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return n===0&&r===0},Xu=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if(n===`full-native`&&`checkVisibility`in e)return!e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});var i=getComputedStyle(e).visibility;if(i===`hidden`||i===`collapse`)return!0;var a=ju.call(e,`details>summary:first-of-type`)?e.parentElement:e;if(ju.call(a,`details:not([open]) *`))return!0;if(!n||n===`full`||n===`full-native`||n===`legacy-full`){if(typeof r==`function`){for(var o=e;e;){var s=e.parentElement,c=Mu(e);if(s&&!s.shadowRoot&&r(s)===!0)return Yu(e);e=e.assignedSlot?e.assignedSlot:!s&&c!==e.ownerDocument?c.host:s}e=o}if(Ju(e))return!e.getClientRects().length;if(n!==`legacy-full`)return!0}else if(n===`non-zero-area`)return Yu(e);return!1},Zu=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if(t.tagName===`FIELDSET`&&t.disabled){for(var n=0;n<t.children.length;n++){var r=t.children.item(n);if(r.tagName===`LEGEND`)return ju.call(t,`fieldset[disabled] *`)?!0:!r.contains(e)}return!0}t=t.parentElement}return!1},Qu=function(e,t){return!(t.disabled||Hu(t)||Xu(t,e)||Uu(t)||Zu(t))},$u=function(e,t){return!(qu(t)||Ru(t)<0||!Qu(e,t))},ed=function(e){var t=parseInt(e.getAttribute(`tabindex`),10);return!!(isNaN(t)||t>=0)},td=function(e){var t=[],n=[];return e.forEach(function(e,r){var i=!!e.scopeParent,a=i?e.scopeParent:e,o=zu(a,i),s=i?td(e.candidates):a;o===0?i?t.push.apply(t,s):t.push(a):n.push({documentOrder:r,tabIndex:o,item:e,isScope:i,content:s})}),n.sort(Bu).reduce(function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e},[]).concat(t)},nd=function(e,t){return t||={},td(t.getShadowRoot?Iu([e],t.includeContainer,{filter:$u.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:ed}):Fu(e,t.includeContainer,$u.bind(null,t)))},rd=function(e,t){return t||={},t.getShadowRoot?Iu([e],t.includeContainer,{filter:Qu.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):Fu(e,t.includeContainer,Qu.bind(null,t))},id=function(e,t){if(t||={},!e)throw Error(`No node provided`);return ju.call(e,ku)!==!1&&$u(t,e)},ad=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver==`function`&&ResizeObserver.toString().includes(`[native code]`)?`full`:`none`});function od(e,t){let n=nd(e,ad()),r=n.length;if(r===0)return;let i=Dl(Ml(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function sd(e){return od(Ml(e).body,1)||e}function cd(e){return od(Ml(e).body,-1)||e}function ld(e,t){if(!e)return null;let n=nd(Ml(e).body,ad()),r=n.length;if(r===0)return null;let i=n.indexOf(e);return i===-1?null:n[(i+t+r)%r]}function ud(e){return ld(e,1)}function dd(e){return ld(e,-1)}function fd(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!Ol(n,r)}function pd(e){nd(e,ad()).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function md(e){e.querySelectorAll(`[data-tabindex]`).forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}function hd(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var gd=class{nodesRef={current:[]};events=hd();addNode(e){this.nodesRef.current.push(e)}removeNode(e){let t=this.nodesRef.current.findIndex(t=>t===e);t!==-1&&this.nodesRef.current.splice(t,1)}},_d=v.createContext(null),vd=v.createContext(null),yd=()=>v.useContext(_d)?.id||null,bd=e=>{let t=v.useContext(vd);return e??t};function xd(e){let t=Wo(),n=bd(e),r=yd();return Y(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function Sd(e){let{children:t,id:n}=e,r=yd();return(0,K.jsx)(_d.Provider,{value:v.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function Cd(e){let{children:t,externalTree:n}=e,r=qa(()=>n??new gd).current;return(0,K.jsx)(vd.Provider,{value:r,children:t})}function wd(e){return`data-base-ui-${e}`}var Td=wd(`safe-polygon`),Ed=`button,[role="button"],select,[tabindex]:not([tabindex="-1"]),${Sl}`;function Dd(e){return e?!!e.closest(Ed):!1}function Od(e,t,n){if(n&&!Ul(n))return 0;if(typeof e==`number`)return e;if(typeof e==`function`){let n=e();return typeof n==`number`?n:n?.[t]}return e?.[t]}function kd(e){return typeof e==`function`?e():e}function Ad(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`domReferenceElement`),{dataRef:o,events:s}=n.context,{enabled:c=!0,delay:l=0,handleClose:u=null,mouseOnly:d=!1,restMs:f=0,move:p=!0,triggerElement:m=null,externalTree:h}=t,g=bd(h),_=yd(),y=sc(u),b=sc(l),x=sc(f),S=v.useRef(void 0),C=v.useRef(!1),w=sl(),T=v.useRef(void 0),E=sl(),D=v.useRef(!0),O=v.useRef(!1),k=v.useRef(()=>{}),A=v.useRef(!1),j=J(()=>{let e=o.current.openEvent?.type;return e?.includes(`mouse`)&&e!==`mousedown`}),M=J(()=>C.current?!0:o.current.openEvent?[`click`,`mousedown`].includes(o.current.openEvent.type):!1);v.useEffect(()=>{if(!c)return;function e(e){e.open||(w.clear(),E.clear(),D.current=!0,A.current=!1)}return s.on(`openchange`,e),()=>{s.off(`openchange`,e)}},[c,s,w,E]),v.useEffect(()=>{if(!c||!y.current||!r)return;function e(e){M()||j()&&n.setOpen(!1,nc(Bs,e,e.currentTarget??void 0))}let t=Ml(i).documentElement;return t.addEventListener(`mouseleave`,e),()=>{t.removeEventListener(`mouseleave`,e)}},[i,r,n,c,y,j,M]);let N=v.useCallback((e,t=!0)=>{let r=Od(b.current,`close`,S.current);r&&!T.current?w.start(r,()=>n.setOpen(!1,nc(Bs,e))):t&&(w.clear(),n.setOpen(!1,nc(Bs,e)))},[b,n,w]),P=J(()=>{k.current(),T.current=void 0}),F=J(()=>{if(O.current){let e=Ml(i).body;e.style.pointerEvents=``,e.removeAttribute(Td),O.current=!1}}),I=J(e=>{if(!Dd(kl(e))){C.current=!1;return}C.current=!0});v.useEffect(()=>{if(!c)return;function e(e){if(w.clear(),D.current=!1,d&&!Ul(S.current)||kd(x.current)>0&&!Od(b.current,`open`))return;let t=Od(b.current,`open`,S.current),i=e.currentTarget??void 0,a=n.select(`domReferenceElement`),o=a&&i&&!Ol(a,i);t?w.start(t,()=>{n.select(`open`)||n.setOpen(!0,nc(Bs,e,i))}):(!r||o)&&n.setOpen(!0,nc(Bs,e,i))}function t(e){if(M()){F();return}k.current();let t=Ml(i);E.clear(),A.current=!1;let a=n.context.triggerElements;if(!(e.relatedTarget&&a.hasElement(e.relatedTarget))){if(y.current&&o.current.floatingContext){r||w.clear(),T.current=y.current({...o.current.floatingContext,tree:g,x:e.clientX,y:e.clientY,onClose(){F(),P(),M()||N(e,!0)}});let n=T.current;t.addEventListener(`mousemove`,n),k.current=()=>{t.removeEventListener(`mousemove`,n)};return}(S.current!==`touch`||!Ol(i,e.relatedTarget))&&N(e)}}function s(e){if(M()||!o.current.floatingContext)return;let t=n.context.triggerElements;e.relatedTarget&&t.hasElement(e.relatedTarget)||y.current?.({...o.current.floatingContext,tree:g,x:e.clientX,y:e.clientY,onClose(){F(),P(),M()||N(e)}})(e)}function l(){w.clear(),F()}function u(e){M()||N(e,!1)}let f=m??a;if(Zo(f)){let n=i;return r&&f.addEventListener(`mouseleave`,s),p&&f.addEventListener(`mousemove`,e,{once:!0}),f.addEventListener(`mouseenter`,e),f.addEventListener(`mouseleave`,t),n&&(n.addEventListener(`mouseleave`,s),n.addEventListener(`mouseenter`,l),n.addEventListener(`mouseleave`,u),n.addEventListener(`pointerdown`,I,!0)),()=>{r&&f.removeEventListener(`mouseleave`,s),p&&f.removeEventListener(`mousemove`,e),f.removeEventListener(`mouseenter`,e),f.removeEventListener(`mouseleave`,t),n&&(n.removeEventListener(`mouseleave`,s),n.removeEventListener(`mouseenter`,l),n.removeEventListener(`mouseleave`,u),n.removeEventListener(`pointerdown`,I,!0))}}},[c,d,p,a,i,m,n,N,P,F,r,g,b,y,o,M,x,w,E,I]),Y(()=>{if(c&&r&&y.current?.__options?.blockPointerEvents&&j()){O.current=!0;let e=i;if(Zo(a)&&e){let t=Ml(i).body;t.setAttribute(Td,``);let n=a,r=g?.nodesRef.current.find(e=>e.id===_)?.context?.elements.floating;return r&&(r.style.pointerEvents=``),t.style.pointerEvents=`none`,n.style.pointerEvents=`auto`,e.style.pointerEvents=`auto`,()=>{t.style.pointerEvents=``,n.style.pointerEvents=``,e.style.pointerEvents=``}}}},[c,r,_,g,y,j,a,i]),Y(()=>{r||(S.current=void 0,A.current=!1,C.current=!1,P(),F())},[r,P,F]),v.useEffect(()=>()=>{P(),w.clear(),E.clear(),C.current=!1},[c,a,P,w,E]),v.useEffect(()=>F,[F]);let L=v.useMemo(()=>{function e(e){S.current=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,r=e.currentTarget,i=n.select(`domReferenceElement`)&&!Ol(n.select(`domReferenceElement`),e.target);function a(){!D.current&&(!n.select(`open`)||i)&&n.setOpen(!0,nc(Bs,t,r))}d&&!Ul(S.current)||n.select(`open`)&&!i||kd(x.current)===0||!i&&A.current&&e.movementX**2+e.movementY**2<2||(E.clear(),S.current===`touch`||i?a():(A.current=!0,E.start(kd(x.current),a)))}}},[d,n,x,E]);return v.useMemo(()=>c?{reference:L}:{},[c,L])}var jd=v.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new ol,currentIdRef:{current:null},currentContextRef:{current:null}});function Md(e){let{children:t,delay:n,timeoutMs:r=0}=e,i=v.useRef(n),a=v.useRef(n),o=v.useRef(null),s=v.useRef(null),c=sl();return(0,K.jsx)(jd.Provider,{value:v.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeout:c}),[r,c]),children:t})}function Nd(e,t={open:!1}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`floatingId`),{enabled:i=!0,open:a}=t,{currentIdRef:o,delayRef:s,timeoutMs:c,initialDelayRef:l,currentContextRef:u,hasProvider:d,timeout:f}=v.useContext(jd),[p,m]=v.useState(!1);return Y(()=>{function e(){m(!1),u.current?.setIsInstantPhase(!1),o.current=null,u.current=null,s.current=l.current}if(i&&o.current&&!a&&o.current===r){if(m(!1),c)return f.start(c,e),()=>{f.clear()};e()}},[i,a,r,o,s,c,l,u,f]),Y(()=>{if(!i||!a)return;let e=u.current,t=o.current;u.current={onOpenChange:n.setOpen,setIsInstantPhase:m},o.current=r,s.current={open:0,close:Od(l.current,`close`)},t!==null&&t!==r?(f.clear(),m(!0),e?.setIsInstantPhase(!0),e?.onOpenChange(!1,nc(Rs))):(m(!1),e?.setIsInstantPhase(!1))},[i,a,r,n,o,s,c,l,u,f]),Y(()=>()=>{u.current=null},[u]),v.useMemo(()=>({hasProvider:d,delayRef:s,isInstantPhase:p}),[d,s,p])}function Pd(e){return e?.ownerDocument||document}var Fd=v.forwardRef(function(e,t){let[n,r]=v.useState();Y(()=>{ml&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,K.jsx)(`span`,{...e,ref:t,style:io,"aria-hidden":!n||void 0,...i,"data-base-ui-focus-guard":``})}),Id=0;function Ld(e,t={}){let{preventScroll:n=!1,cancelPrevious:r=!0,sync:i=!1}=t;r&&cancelAnimationFrame(Id);let a=()=>e?.focus({preventScroll:n});i?a():Id=requestAnimationFrame(a)}var Rd={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function zd(e){return e===`inert`?Rd.inert:e===`aria-hidden`?Rd[`aria-hidden`]:Rd.none}var Bd=new WeakSet,Vd={},Hd=0,Ud=e=>e&&(e.host||Ud(e.parentNode)),Wd=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=Ud(t);return e.contains(n)?n:null}).filter(e=>e!=null);function Gd(e,t,n,r){let i=`data-base-ui-inert`,a=r?`inert`:n?`aria-hidden`:null,o=Wd(t,e),s=new Set,c=new Set(o),l=[];Vd[i]||(Vd[i]=new WeakMap);let u=Vd[i];o.forEach(d),f(t),s.clear();function d(e){!e||s.has(e)||(s.add(e),e.parentNode&&d(e.parentNode))}function f(e){!e||c.has(e)||[].forEach.call(e.children,e=>{if(qo(e)!==`script`)if(s.has(e))f(e);else{let t=a?e.getAttribute(a):null,n=t!==null&&t!==`false`,r=zd(a),o=(r.get(e)||0)+1,s=(u.get(e)||0)+1;r.set(e,o),u.set(e,s),l.push(e),o===1&&n&&Bd.add(e),s===1&&e.setAttribute(i,``),!n&&a&&e.setAttribute(a,a===`inert`?``:`true`)}})}return Hd+=1,()=>{l.forEach(e=>{let t=zd(a),n=(t.get(e)||0)-1,r=(u.get(e)||0)-1;t.set(e,n),u.set(e,r),n||(!Bd.has(e)&&a&&e.removeAttribute(a),Bd.delete(e)),r||e.removeAttribute(i)}),--Hd,Hd||(Rd.inert=new WeakMap,Rd[`aria-hidden`]=new WeakMap,Rd.none=new WeakMap,Bd=new WeakSet,Vd={})}}function Kd(e,t=!1,n=!1){let r=Ml(e[0]).body;return Gd(e.concat(Array.from(r.querySelectorAll(`[aria-live]`))),r,t,n)}var qd=v.createContext(null),Jd=()=>v.useContext(qd),Yd=wd(`portal`);function Xd(e={}){let{ref:t,container:n,componentProps:r=Wa,elementProps:i,elementState:a}=e,o=Wo(),s=Jd()?.portalNode,[c,l]=v.useState(null),[u,d]=v.useState(null),f=v.useRef(null);Y(()=>{if(n===null){f.current&&(f.current=null,d(null),l(null));return}if(o==null)return;let e=(n&&(Xo(n)?n:n.current))??s??document.body;if(e==null){f.current&&(f.current=null,d(null),l(null));return}f.current!==e&&(f.current=e,d(null),l(e))},[n,s,o]);let p=Io(`div`,r,{ref:[t,d],state:a,props:[{id:o,[Yd]:``},i]});return{portalNode:u,portalSubtree:c&&p?As.createPortal(p,c):null}}var Zd=v.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,renderGuards:o,...s}=e,{portalNode:c,portalSubtree:l}=Xd({container:r,ref:t,componentProps:e,elementProps:s}),u=v.useRef(null),d=v.useRef(null),f=v.useRef(null),p=v.useRef(null),[m,h]=v.useState(null),g=m?.modal,_=m?.open,y=typeof o==`boolean`?o:!!m&&!m.modal&&m.open&&!!c;v.useEffect(()=>{if(!c||g)return;function e(e){c&&fd(e)&&(e.type===`focusin`?md:pd)(c)}return c.addEventListener(`focusin`,e,!0),c.addEventListener(`focusout`,e,!0),()=>{c.removeEventListener(`focusin`,e,!0),c.removeEventListener(`focusout`,e,!0)}},[c,g]),v.useEffect(()=>{!c||_||md(c)},[_,c]);let b=v.useMemo(()=>({beforeOutsideRef:u,afterOutsideRef:d,beforeInsideRef:f,afterInsideRef:p,portalNode:c,setFocusManagerState:h}),[c]);return(0,K.jsxs)(v.Fragment,{children:[l,(0,K.jsxs)(qd.Provider,{value:b,children:[y&&c&&(0,K.jsx)(Fd,{"data-type":`outside`,ref:u,onFocus:e=>{fd(e,c)?f.current?.focus():cd(m?m.domReference:null)?.focus()}}),y&&c&&(0,K.jsx)(`span`,{"aria-owns":c.id,style:Fo}),c&&As.createPortal(n,c),y&&c&&(0,K.jsx)(Fd,{"data-type":`outside`,ref:d,onFocus:e=>{fd(e,c)?p.current?.focus():(sd(m?m.domReference:null)?.focus(),m?.closeOnFocusOut&&m?.onOpenChange(!1,nc(`focus-out`,e.nativeEvent)))}})]})]})});function Qd(e,t){let n=Jo(e.target);return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||`keyboard`:`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var $d=20,ef=[];function tf(){ef=ef.filter(e=>e.isConnected)}function nf(e){tf(),e&&qo(e)!==`body`&&(ef.push(e),ef.length>$d&&(ef=ef.slice(-20)))}function rf(){return tf(),ef[ef.length-1]}function af(e){if(!e)return null;let t=ad();return id(e,t)?e:nd(e,t)[0]||e}function of(e){return!e||!e.isConnected?!1:typeof e.checkVisibility==`function`?e.checkVisibility():fs(e).display!==`none`}function sf(e,t){if(!t.current.includes(`floating`)&&!e.getAttribute(`role`)?.includes(`dialog`))return;let n=ad(),r=rd(e,n).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return id(e,n)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),i=e.getAttribute(`tabindex`);t.current.includes(`floating`)||r.length===0?i!==`0`&&e.setAttribute(`tabindex`,`0`):(i!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function cf(e){let{context:t,children:n,disabled:r=!1,order:i=[`content`],initialFocus:a=!0,returnFocus:o=!0,restoreFocus:s=!1,modal:c=!0,closeOnFocusOut:l=!0,openInteractionType:u=``,getInsideElements:d=()=>[],nextFocusableElement:f,previousFocusableElement:p,beforeContentFocusGuardRef:m,externalTree:h}=e,g=`rootStore`in t?t.rootStore:t,_=g.useState(`open`),y=g.useState(`domReferenceElement`),b=g.useState(`floatingElement`),{events:x,dataRef:S}=g.context,C=J(()=>S.current.floatingContext?.nodeId),w=J(d),T=a===!1,E=Pl(y)&&T,D=sc(i),O=sc(a),k=sc(o),A=sc(u),j=bd(h),M=Jd(),N=v.useRef(null),P=v.useRef(null),F=v.useRef(!1),I=v.useRef(!1),L=v.useRef(!1),R=v.useRef(-1),z=v.useRef(``),B=v.useRef(``),ee=sl(),V=sl(),H=mc(),te=M!=null,U=Il(b),W=J((e=U)=>e?nd(e,ad()):[]),ne=J(e=>{let t=W(e);return D.current.map(()=>t).filter(Boolean).flat()});v.useEffect(()=>{if(r||!c)return;function e(e){e.key===`Tab`&&Ol(U,Dl(Ml(U)))&&W().length===0&&!E&&zl(e)}let t=Ml(U);return t.addEventListener(`keydown`,e),()=>{t.removeEventListener(`keydown`,e)}},[r,y,U,c,D,E,W,ne]),v.useEffect(()=>{if(r||!b)return;function e(e){let t=kl(e),n=W().indexOf(t);n!==-1&&(R.current=n)}return b.addEventListener(`focusin`,e),()=>{b.removeEventListener(`focusin`,e)}},[r,b,W]),v.useEffect(()=>{if(r||!_)return;let e=Ml(U);function t(){L.current=!1}function n(e){let t=kl(e),n=Ol(b,t)||Ol(y,t)||Ol(M?.portalNode,t);L.current=!n,B.current=e.pointerType||`keyboard`}function i(){B.current=`keyboard`}return e.addEventListener(`pointerdown`,n,!0),e.addEventListener(`pointerup`,t,!0),e.addEventListener(`pointercancel`,t,!0),e.addEventListener(`keydown`,i,!0),()=>{e.removeEventListener(`pointerdown`,n,!0),e.removeEventListener(`pointerup`,t,!0),e.removeEventListener(`pointercancel`,t,!0),e.removeEventListener(`keydown`,i,!0)}},[r,b,y,U,_,M]),v.useEffect(()=>{if(r||!l)return;function e(){I.current=!0,V.start(0,()=>{I.current=!1})}function t(e){let t=e.relatedTarget,n=e.currentTarget,r=kl(e);queueMicrotask(()=>{let i=C(),a=g.context.triggerElements,o=!(Ol(y,t)||Ol(b,t)||Ol(t,b)||Ol(M?.portalNode,t)||t!=null&&a.hasElement(t)||a.hasMatchingElement(e=>Ol(e,t))||t?.hasAttribute(wd(`focus-guard`))||j&&(Ll(j.nodesRef.current,i).find(e=>Ol(e.context?.elements.floating,t)||Ol(e.context?.elements.domReference,t))||Rl(j.nodesRef.current,i).find(e=>[e.context?.elements.floating,Il(e.context?.elements.floating)].includes(t)||e.context?.elements.domReference===t)));if(n===y&&U&&sf(U,D),s&&n!==y&&!of(r)&&Dl(Ml(U))===Ml(U).body){if(Qo(U)&&(U.focus(),s===`popup`)){H.request(()=>{U.focus()});return}let e=R.current,t=W(),n=t[e]||t[t.length-1]||U;Qo(n)&&n.focus()}if(S.current.insideReactTree){S.current.insideReactTree=!1;return}(E||!c)&&t&&o&&!I.current&&(E||t!==rf())&&(F.current=!0,g.setOpen(!1,nc(qs,e)))})}function n(){L.current||(S.current.insideReactTree=!0,ee.start(0,()=>{S.current.insideReactTree=!1}))}let i=Qo(y)?y:null,a=[];if(!(!b&&!i))return i&&(i.addEventListener(`focusout`,t),i.addEventListener(`pointerdown`,e),a.push(()=>{i.removeEventListener(`focusout`,t),i.removeEventListener(`pointerdown`,e)})),b&&(b.addEventListener(`focusout`,t),M&&(b.addEventListener(`focusout`,n,!0),a.push(()=>{b.removeEventListener(`focusout`,n,!0)})),a.push(()=>{b.removeEventListener(`focusout`,t)})),()=>{a.forEach(e=>{e()})}},[r,y,b,U,c,j,M,g,l,s,W,E,C,D,S,ee,V,H]);let re=v.useRef(null),ie=v.useRef(null),ae=Qa(re,m,M?.beforeInsideRef),oe=Qa(ie,M?.afterInsideRef);v.useEffect(()=>{if(r||!b||!_)return;let e=Array.from(M?.portalNode?.querySelectorAll(`[${wd(`portal`)}]`)||[]),t=(j?Rl(j.nodesRef.current,C()):[]).find(e=>Pl(e.context?.elements.domReference||null))?.context?.elements.domReference,n=Kd([b,t,...e,...w(),N.current,P.current,re.current,ie.current,M?.beforeOutsideRef.current,M?.afterOutsideRef.current,hc(p),hc(f),E?y:null].filter(e=>e!=null),c||E);return()=>{n()}},[_,r,y,b,c,D,M,E,j,C,w,f,p]),Y(()=>{if(!_||r||!Qo(U))return;let e=Dl(Ml(U));queueMicrotask(()=>{let t=ne(U),n=O.current,r=typeof n==`function`?n(A.current||``):n;if(r===void 0||r===!1)return;let i;i=r===!0||r===null?t[0]||U:hc(r),i=i||t[0]||U,!Ol(U,e)&&Ld(i,{preventScroll:i===U})})},[r,_,U,T,ne,O,A]),Y(()=>{if(r||!U)return;let e=Ml(U);nf(Dl(e));function t(e){if(e.open||(z.current=Qd(e.nativeEvent,B.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(F.current=!0),e.reason===`outside-press`)if(e.nested)F.current=!1;else if(Vl(e.nativeEvent)||Hl(e.nativeEvent))F.current=!1;else{let e=!1;document.createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?F.current=!1:F.current=!0}}x.on(`openchange`,t);let n=e.createElement(`span`);n.setAttribute(`tabindex`,`-1`),n.setAttribute(`aria-hidden`,`true`),Object.assign(n.style,io),te&&y&&y.insertAdjacentElement(`afterend`,n);function i(){let e=k.current,t=typeof e==`function`?e(z.current):e;if(t===void 0||t===!1)return null;if(t===null&&(t=!0),typeof t==`boolean`){let e=y||rf();return e&&e.isConnected?e:n}let r=y||rf()||n;return hc(t)||r}return()=>{x.off(`openchange`,t);let r=Dl(e),a=Ol(b,r)||j&&Ll(j.nodesRef.current,C(),!1).some(e=>Ol(e.context?.elements.floating,r)),o=i();queueMicrotask(()=>{let t=af(o),i=typeof k.current!=`boolean`;k.current&&!F.current&&Qo(t)&&(!(!i&&t!==r&&r!==e.body)||a)&&t.focus({preventScroll:!0}),n.remove()})}},[r,b,U,k,S,x,j,te,y,C]),v.useEffect(()=>{queueMicrotask(()=>{F.current=!1})},[r]),v.useEffect(()=>{if(r||!_)return;function e(e){kl(e)?.closest(`[data-base-ui-click-trigger]`)&&(I.current=!0)}let t=Ml(U);return t.addEventListener(`pointerdown`,e,!0),()=>{t.removeEventListener(`pointerdown`,e,!0)}},[r,_,U]),Y(()=>{if(!r&&M)return M.setFocusManagerState({modal:c,closeOnFocusOut:l,open:_,onOpenChange:g.setOpen,domReference:y}),()=>{M.setFocusManagerState(null)}},[r,M,c,_,g,l,y]),Y(()=>{if(!(r||!U))return sf(U,D),()=>{queueMicrotask(tf)}},[r,U,D]);let se=!r&&(!c||!E)&&(te||c);return(0,K.jsxs)(v.Fragment,{children:[se&&(0,K.jsx)(Fd,{"data-type":`inside`,ref:ae,onFocus:e=>{if(c){let e=ne();Ld(e[e.length-1])}else M?.portalNode&&(F.current=!1,fd(e,M.portalNode)?sd(y)?.focus():hc(p??M.beforeOutsideRef)?.focus())}}),n,se&&(0,K.jsx)(Fd,{"data-type":`inside`,ref:oe,onFocus:e=>{c?Ld(ne()[0]):M?.portalNode&&(l&&(F.current=!0),fd(e,M.portalNode)?cd(y)?.focus():hc(f??M.afterOutsideRef)?.focus())}})]})}function lf(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.context.dataRef,{enabled:i=!0,event:a=`click`,toggle:o=!0,ignoreMouse:s=!1,stickIfOpen:c=!0,touchOpenDelay:l=0}=t,u=v.useRef(void 0),d=mc(),f=sl(),p=v.useMemo(()=>({onPointerDown(e){u.current=e.pointerType},onMouseDown(e){let t=u.current,i=e.nativeEvent,p=n.select(`open`);if(e.button!==0||a===`click`||Ul(t,!0)&&s)return;let m=r.current.openEvent,h=m?.type,g=n.select(`domReferenceElement`)!==e.currentTarget,_=p&&g||!(p&&o&&(!(m&&c)||h===`click`||h===`mousedown`));if(Nl(i.target)){let e=nc(zs,i,i.target);_&&t===`touch`&&l>0?f.start(l,()=>{n.setOpen(!0,e)}):n.setOpen(_,e);return}let v=e.currentTarget;d.request(()=>{let e=nc(zs,i,v);_&&t===`touch`&&l>0?f.start(l,()=>{n.setOpen(!0,e)}):n.setOpen(_,e)})},onClick(e){if(a===`mousedown-only`)return;let t=u.current;if(a===`mousedown`&&t){u.current=void 0;return}if(Ul(t,!0)&&s)return;let i=n.select(`open`),d=r.current.openEvent,p=n.select(`domReferenceElement`)!==e.currentTarget,m=i&&p||!(i&&o&&(!(d&&c)||Wl(d))),h=nc(zs,e.nativeEvent,e.currentTarget);m&&t===`touch`&&l>0?f.start(l,()=>{n.setOpen(!0,h)}):n.setOpen(m,h)},onKeyDown(){u.current=void 0}}),[r,a,s,n,c,o,d,f,l]);return v.useMemo(()=>i?{reference:p}:Wa,[i,p])}function uf(e,t){let n=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){let a=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},o=t.axis===`x`||t.axis===`both`,s=t.axis===`y`||t.axis===`both`,c=[`mouseenter`,`mousemove`].includes(t.dataRef.current.openEvent?.type||``)&&t.pointerType!==`touch`,l=a.width,u=a.height,d=a.x,f=a.y;return n==null&&t.x&&o&&(n=a.x-t.x),r==null&&t.y&&s&&(r=a.y-t.y),d-=n||0,f-=r||0,l=0,u=0,!i||c?(l=t.axis===`y`?a.width:0,u=t.axis===`x`?a.height:0,d=o&&t.x!=null?t.x:d,f=s&&t.y!=null?t.y:f):i&&!c&&(u=t.axis===`x`?a.height:u,l=t.axis===`y`?a.width:l),i=!0,{width:l,height:u,x:d,y:f,top:f,right:d+l,bottom:f+u,left:d}}}}function df(e){return e!=null&&e.clientX!=null}function ff(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`domReferenceElement`),o=n.context.dataRef,{enabled:s=!0,axis:c=`both`,x:l=null,y:u=null}=t,d=v.useRef(!1),f=v.useRef(null),[p,m]=v.useState(),[h,g]=v.useState([]),_=J((e,t)=>{d.current||o.current.openEvent&&!df(o.current.openEvent)||n.set(`positionReference`,uf(a,{x:e,y:t,axis:c,dataRef:o,pointerType:p}))}),y=J(e=>{l!=null||u!=null||(r?f.current||g([]):_(e.clientX,e.clientY))}),b=Ul(p)?i:r,x=v.useCallback(()=>{if(!b||!s||l!=null||u!=null)return;let e=Jo(i);function t(n){let r=kl(n);Ol(i,r)?(e.removeEventListener(`mousemove`,t),f.current=null):_(n.clientX,n.clientY)}if(!o.current.openEvent||df(o.current.openEvent)){e.addEventListener(`mousemove`,t);let n=()=>{e.removeEventListener(`mousemove`,t),f.current=null};return f.current=n,n}n.set(`positionReference`,a)},[b,s,l,u,i,o,a,n,_]);v.useEffect(()=>x(),[x,h]),v.useEffect(()=>{s&&!i&&(d.current=!1)},[s,i]),v.useEffect(()=>{!s&&r&&(d.current=!0)},[s,r]),Y(()=>{s&&(l!=null||u!=null)&&(d.current=!1,_(l,u))},[s,l,u,_]);let S=v.useMemo(()=>{function e(e){m(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:y,onMouseEnter:y}},[y]);return v.useMemo(()=>s?{reference:S}:{},[s,S])}function pf(e,t,n){let{reference:r,floating:i}=e,a=iu(t),o=au(t),s=ru(o),c=eu(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}}let m=tu(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function mf(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}=$l(t,e),p=_u(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=vu(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=vu(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 hf=50,gf=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:mf},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=pf(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<hf&&(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}=pf(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},_f=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}=$l(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=eu(r),_=iu(o),v=eu(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[hu(o)]:su(o)),x=p!==`none`;!d&&x&&b.push(...mu(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=ou(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`&&_!==iu(t))||T.every(e=>iu(e.placement)!==_||e.overflows[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=iu(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 vf(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function yf(e){return Gl.some(t=>e[t]>=0)}var bf=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=$l(e,t);switch(i){case`referenceHidden`:{let e=vf(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:yf(e)}}}case`escaped`:{let e=vf(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:yf(e)}}}default:return{}}}}},xf=new Set([`left`,`top`]);async function Sf(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=eu(n),s=tu(n),c=iu(n)===`y`,l=xf.has(o)?-1:1,u=a&&c?-1:1,d=$l(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 Cf=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 Sf(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}}}}},wf=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}=$l(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=iu(i),p=nu(f),m=u[p],h=u[f],g=(e,t)=>Ql(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},Tf=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}=$l(e,t),u={x:n,y:r},d=iu(i),f=nu(d),p=u[f],m=u[d],h=$l(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};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=xf.has(eu(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}}}},Ef=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=$l(e,t),c=await i.detectOverflow(t,s),l=eu(n),u=tu(n),d=iu(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=Kl(p-c[m],g),y=Kl(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*ql(c.left,c.right):S=p-2*ql(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function Df(e){let t=fs(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Qo(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Jl(n)!==a||Jl(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Of(e){return Zo(e)?e:e.contextElement}function kf(e){let t=Of(e);if(!Qo(t))return Xl(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Df(t),o=(a?Jl(n.width):n.width)/r,s=(a?Jl(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Af=Xl(0);function jf(e){let t=Jo(e);return!us()||!t.visualViewport?Af:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Mf(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Jo(e)}function Nf(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Of(e),o=Xl(1);t&&(r?Zo(r)&&(o=kf(r)):o=kf(e));let s=Mf(a,n,r)?jf(a):Xl(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&&r){let e=Jo(a),t=Zo(r)?Jo(r):r,n=e,i=_s(n);for(;i&&t!==n;){let e=kf(i),t=i.getBoundingClientRect(),r=fs(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=Jo(i),i=_s(n)}}return vu({width:u,height:d,x:c,y:l})}function Pf(e,t){let n=ps(e).scrollLeft;return t?t.left+n:Nf(Yo(e)).left+n}function Ff(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Pf(e,n),y:n.top+t.scrollTop}}function If(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Yo(r),s=t?ns(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Xl(1),u=Xl(0),d=Qo(r);if((d||!a)&&((qo(r)!==`body`||es(o))&&(c=ps(r)),d)){let e=Nf(r);l=kf(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Ff(o,c):Xl(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 Lf(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Rf(e){let t=ps(e),n=e.ownerDocument.body,r=ql(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=ql(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Pf(e),o=-t.scrollTop;return fs(n).direction===`rtl`&&(a+=ql(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var zf=25;function Bf(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=Jo(e),a=Yo(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!us()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(Pf(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=zf&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Vf(e,t){let n=Nf(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=kf(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Hf(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Bf(e,n,t);else if(t===`document`)r=Rf(Yo(e));else if(Zo(t))r=Vf(t,n);else{let n=jf(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return vu(r)}function Uf(e,t){let n=t.get(e);if(n)return n;let r=gs(e,[],!1).filter(e=>Zo(e)&&qo(e)!==`body`),i=null,a=fs(e).position===`fixed`,o=a?ms(e):e;for(;Zo(o)&&!ds(o);){let e=fs(o),t=cs(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=ms(o)}return t.set(e,r),r}function Wf(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?ns(t)?[]:Uf(t,this._c):[].concat(n),r],o=Hf(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=Hf(t,a[e],i);s=ql(n.top,s),c=Kl(n.right,c),l=Kl(n.bottom,l),u=ql(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Gf(e){let{width:t,height:n}=Df(e);return{width:t,height:n}}function Kf(e,t,n){let r=Qo(t),i=Yo(t),a=n===`fixed`,o=Nf(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Xl(0);if((r||!a)&&((qo(t)!==`body`||es(i))&&(s=ps(t)),r)){let e=Nf(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=Pf(i));let l=i&&!r&&!a?Ff(i,s):Xl(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function qf(e){return fs(e).position===`static`}function Jf(e,t){if(!Qo(e)||fs(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Yo(e)===n&&(n=n.ownerDocument.body),n}function Yf(e,t){let n=Jo(e);if(ns(e))return n;if(!Qo(e)){let t=ms(e);for(;t&&!ds(t);){if(Zo(t)&&!qf(t))return t;t=ms(t)}return n}let r=Jf(e,t);for(;r&&ts(r)&&qf(r);)r=Jf(r,t);return r&&ds(r)&&qf(r)&&!cs(r)?n:r||ls(e)||n}var Xf=async function(e){let t=this.getOffsetParent||Yf,n=this.getDimensions,r=await n(e.floating);return{reference:Kf(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Zf(e){return fs(e).direction===`rtl`}var Qf={convertOffsetParentRelativeRectToViewportRelativeRect:If,getDocumentElement:Yo,getClippingRect:Wf,getOffsetParent:Yf,getElementRects:Xf,getClientRects:Lf,getDimensions:Gf,getScale:kf,isElement:Zo,isRTL:Zf};function $f(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function ep(e,t,n){let r=null,i,a=Yo(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=Yl(d),h=Yl(a.clientWidth-(u+f)),g=Yl(a.clientHeight-(d+p)),_=Yl(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:ql(0,Kl(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!$f(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=Jo(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function tp(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=Of(e),u=i||a?[...l?gs(l):[],...t?gs(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?ep(l,n,a):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?Nf(e):null;c&&g();function g(){let t=Nf(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 np=Cf,rp=wf,ip=_f,ap=Ef,op=bf,sp=Tf,cp=(e,t,n)=>{let r=new Map,i=n??{},a={...Qf,...i.platform,_c:r};return gf(e,t,{...i,platform:a})},lp=typeof document<`u`?v.useLayoutEffect:function(){};function up(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(!up(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)&&!up(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function dp(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function fp(e,t){let n=dp(e);return Math.round(t*n)/n}function pp(e){let t=v.useRef(e);return lp(()=>{t.current=e}),t}function mp(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);up(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=pp(c),O=pp(i),k=pp(l),A=v.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),cp(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!up(T.current,t)&&(T.current=t,As.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);lp(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=v.useRef(!1);lp(()=>(j.current=!0,()=>{j.current=!1}),[]),lp(()=>{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]),N=v.useMemo(()=>({reference:x,floating:S}),[x,S]),P=v.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=fp(N.floating,u.x),r=fp(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...dp(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return v.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:P}),[u,A,M,N,P])}var hp=(e,t)=>{let n=np(e);return{name:n.name,fn:n.fn,options:[e,t]}},gp=(e,t)=>{let n=rp(e);return{name:n.name,fn:n.fn,options:[e,t]}},_p=(e,t)=>({fn:sp(e).fn,options:[e,t]}),vp=(e,t)=>{let n=ip(e);return{name:n.name,fn:n.fn,options:[e,t]}},yp=(e,t)=>{let n=ap(e);return{name:n.name,fn:n.fn,options:[e,t]}},bp=(e,t)=>{let n=op(e);return{name:n.name,fn:n.fn,options:[e,t]}},xp={intentional:`onClick`,sloppy:`onPointerDown`};function Sp(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function Cp(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`referenceElement`),o=n.useState(`domReferenceElement`),{onOpenChange:s,dataRef:c}=n.context,{enabled:l=!0,escapeKey:u=!0,outsidePress:d=!0,outsidePressEvent:f=`sloppy`,referencePress:p=!1,referencePressEvent:m=`sloppy`,ancestorScroll:h=!1,bubbles:g,externalTree:_}=t,y=bd(_),b=J(typeof d==`function`?d:()=>!1),x=typeof d==`function`?b:d,S=v.useRef(!1),{escapeKey:C,outsidePress:w}=Sp(g),T=v.useRef(null),E=sl(),D=sl(),O=J(()=>{D.clear(),c.current.insideReactTree=!1}),k=v.useRef(!1),A=v.useRef(``),j=J(e=>{A.current=e.pointerType}),M=J(()=>{let e=A.current,t=e===`pen`||!e?`mouse`:e,n=typeof f==`function`?f():f;return typeof n==`string`?n:n[t]}),N=J(e=>{if(!r||!l||!u||e.key!==`Escape`||k.current)return;let t=c.current.floatingContext?.nodeId,i=y?Ll(y.nodesRef.current,t):[];if(!C&&i.length>0){let e=!0;if(i.forEach(t=>{t.context?.open&&!t.context.dataRef.current.__escapeKeyBubbles&&(e=!1)}),!e)return}let a=nc(Js,Bl(e)?e.nativeEvent:e);n.setOpen(!1,a),!C&&!a.isPropagationAllowed&&e.stopPropagation()}),P=J(e=>{let t=M();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}),F=J(()=>{c.current.insideReactTree=!0,D.start(0,O)}),I=J((e,t=!1)=>{if(P(e)){O();return}if(c.current.insideReactTree){O();return}if(M()===`intentional`&&t||typeof x==`function`&&!x(e))return;let r=kl(e),i=`[${wd(`inert`)}]`,a=Ml(n.select(`floatingElement`)).querySelectorAll(i),o=n.context.triggerElements;if(r&&(o.hasElement(r)||o.hasMatchingElement(e=>Ol(e,r))))return;let s=Zo(r)?r:null;for(;s&&!ds(s);){let e=ms(s);if(ds(e)||!Zo(e))break;s=e}if(a.length&&Zo(r)&&!jl(r)&&!Ol(r,n.select(`floatingElement`))&&Array.from(a).every(e=>!Ol(s,e)))return;if(Qo(r)&&!(`touches`in e)){let t=ds(r),n=fs(r),i=/auto|scroll/,a=t||i.test(n.overflowX),o=t||i.test(n.overflowY),s=a&&r.clientWidth>0&&r.scrollWidth>r.clientWidth,c=o&&r.clientHeight>0&&r.scrollHeight>r.clientHeight,l=n.direction===`rtl`,u=c&&(l?e.offsetX<=r.offsetWidth-r.clientWidth:e.offsetX>r.clientWidth),d=s&&e.offsetY>r.clientHeight;if(u||d)return}let l=c.current.floatingContext?.nodeId,u=y&&Ll(y.nodesRef.current,l).some(t=>Al(e,t.context?.elements.floating));if(Al(e,n.select(`floatingElement`))||Al(e,n.select(`domReferenceElement`))||u)return;let d=y?Ll(y.nodesRef.current,l):[];if(d.length>0){let e=!0;if(d.forEach(t=>{t.context?.open&&!t.context.dataRef.current.__outsidePressBubbles&&(e=!1)}),!e)return}n.setOpen(!1,nc(Hs,e)),O()}),L=J(e=>{M()!==`sloppy`||e.pointerType===`touch`||!n.select(`open`)||!l||Al(e,n.select(`floatingElement`))||Al(e,n.select(`domReferenceElement`))||I(e)}),R=J(e=>{if(M()!==`sloppy`||!n.select(`open`)||!l||Al(e,n.select(`floatingElement`))||Al(e,n.select(`domReferenceElement`)))return;let t=e.touches[0];t&&(T.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},E.start(1e3,()=>{T.current&&(T.current.dismissOnTouchEnd=!1,T.current.dismissOnMouseDown=!1)}))}),z=J(e=>{let t=kl(e);function n(){R(e),t?.removeEventListener(e.type,n)}t?.addEventListener(e.type,n)}),B=J(e=>{let t=S.current;if(S.current=!1,E.clear(),e.type===`mousedown`&&T.current&&!T.current.dismissOnMouseDown)return;let n=kl(e);function r(){e.type===`pointerdown`?L(e):I(e,t),n?.removeEventListener(e.type,r)}n?.addEventListener(e.type,r)}),ee=J(e=>{if(M()!==`sloppy`||!T.current||Al(e,n.select(`floatingElement`))||Al(e,n.select(`domReferenceElement`)))return;let t=e.touches[0];if(!t)return;let r=Math.abs(t.clientX-T.current.startX),i=Math.abs(t.clientY-T.current.startY),a=Math.sqrt(r*r+i*i);a>5&&(T.current.dismissOnTouchEnd=!0),a>10&&(I(e),E.clear(),T.current=null)}),V=J(e=>{let t=kl(e);function n(){ee(e),t?.removeEventListener(e.type,n)}t?.addEventListener(e.type,n)}),H=J(e=>{M()!==`sloppy`||!T.current||Al(e,n.select(`floatingElement`))||Al(e,n.select(`domReferenceElement`))||(T.current.dismissOnTouchEnd&&I(e),E.clear(),T.current=null)}),te=J(e=>{let t=kl(e);function n(){H(e),t?.removeEventListener(e.type,n)}t?.addEventListener(e.type,n)});v.useEffect(()=>{if(!r||!l)return;c.current.__escapeKeyBubbles=C,c.current.__outsidePressBubbles=w;let e=new ol;function t(e){n.setOpen(!1,nc(Rs,e))}function s(){e.clear(),k.current=!0}function d(){e.start(us()?5:0,()=>{k.current=!1})}let f=Ml(i);f.addEventListener(`pointerdown`,j,!0),u&&(f.addEventListener(`keydown`,N),f.addEventListener(`compositionstart`,s),f.addEventListener(`compositionend`,d)),x&&(f.addEventListener(`click`,B,!0),f.addEventListener(`pointerdown`,B,!0),f.addEventListener(`touchstart`,z,!0),f.addEventListener(`touchmove`,V,!0),f.addEventListener(`touchend`,te,!0),f.addEventListener(`mousedown`,B,!0));let p=[];return h&&(Zo(o)&&(p=gs(o)),Zo(i)&&(p=p.concat(gs(i))),!Zo(a)&&a&&a.contextElement&&(p=p.concat(gs(a.contextElement)))),p=p.filter(e=>e!==f.defaultView?.visualViewport),p.forEach(e=>{e.addEventListener(`scroll`,t,{passive:!0})}),()=>{f.removeEventListener(`pointerdown`,j,!0),u&&(f.removeEventListener(`keydown`,N),f.removeEventListener(`compositionstart`,s),f.removeEventListener(`compositionend`,d)),x&&(f.removeEventListener(`click`,B,!0),f.removeEventListener(`pointerdown`,B,!0),f.removeEventListener(`touchstart`,z,!0),f.removeEventListener(`touchmove`,V,!0),f.removeEventListener(`touchend`,te,!0),f.removeEventListener(`mousedown`,B,!0)),p.forEach(e=>{e.removeEventListener(`scroll`,t)}),e.clear()}},[c,i,a,o,u,x,r,s,h,l,C,w,N,I,B,L,z,V,te,j,n]),v.useEffect(O,[x,O]);let U=v.useMemo(()=>({onKeyDown:N,...p&&{[xp[m]]:e=>{n.setOpen(!1,nc(`trigger-press`,e.nativeEvent))},...m!==`intentional`&&{onClick(e){n.setOpen(!1,nc(`trigger-press`,e.nativeEvent))}}}}),[N,n,p,m]),W=J(e=>{let t=kl(e.nativeEvent);!Ol(n.select(`floatingElement`),t)||e.button!==0||(S.current=!0)}),ne=v.useMemo(()=>({onKeyDown:N,onPointerDown:W,onMouseDown:W,onMouseUp:W,onClickCapture:F,onMouseDownCapture:F,onPointerDownCapture:F,onMouseUpCapture:F,onTouchEndCapture:F,onTouchMoveCapture:F}),[N,W,F]);return v.useMemo(()=>l?{reference:U,floating:ne,trigger:U}:{},[l,U,ne])}var wp=Symbol(`NOT_FOUND`);function Tp(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function Ep(e,t=`expected all items to be functions, instead received the following types: `){if(!e.every(e=>typeof e==`function`)){let n=e.map(e=>typeof e==`function`?`function ${e.name||`unnamed`}()`:typeof e).join(`, `);throw TypeError(`${t}[${n}]`)}}var Dp=e=>Array.isArray(e)?e:[e];function Op(e){let t=Array.isArray(e[0])?e[0]:e;return Ep(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function kp(e,t){let n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}function Ap(e){let t;return{get(n){return t&&e(t.key,n)?t.value:wp},put(e,n){t={key:e,value:n}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function jp(e,t){let n=[];function r(e){let r=n.findIndex(n=>t(e,n.key));if(r>-1){let e=n[r];return r>0&&(n.splice(r,1),n.unshift(e)),e.value}return wp}function i(t,i){r(t)===wp&&(n.unshift({key:t,value:i}),n.length>e&&n.pop())}function a(){return n}function o(){n=[]}return{get:r,put:i,getEntries:a,clear:o}}var Mp=(e,t)=>e===t;function Np(e){return function(t,n){if(t===null||n===null||t.length!==n.length)return!1;let{length:r}=t;for(let i=0;i<r;i++)if(!e(t[i],n[i]))return!1;return!0}}function Pp(e,t){let{equalityCheck:n=Mp,maxSize:r=1,resultEqualityCheck:i}=typeof t==`object`?t:{equalityCheck:t},a=Np(n),o=0,s=r<=1?Ap(a):jp(r,a);function c(){let t=s.get(arguments);if(t===wp){if(t=e.apply(null,arguments),o++,i){let e=s.getEntries().find(e=>i(e.value,t));e&&(t=e.value,o!==0&&o--)}s.put(arguments,t)}return t}return c.clearCache=()=>{s.clear(),c.resetResultsCount()},c.resultsCount=()=>o,c.resetResultsCount=()=>{o=0},c}var Fp=class{constructor(e){this.value=e}deref(){return this.value}},Ip=typeof WeakRef>`u`?Fp:WeakRef,Lp=0,Rp=1;function zp(){return{s:Lp,v:void 0,o:null,p:null}}function Bp(e){return e instanceof Ip?e.deref():e}function Vp(e,t={}){let n=zp(),{resultEqualityCheck:r}=t,i,a=0;function o(){let t=n,{length:o}=arguments;for(let e=0,n=o;e<n;e++){let n=arguments[e];if(typeof n==`function`||typeof n==`object`&&n){let e=t.o;e===null&&(t.o=e=new WeakMap);let r=e.get(n);r===void 0?(t=zp(),e.set(n,t)):t=r}else{let e=t.p;e===null&&(t.p=e=new Map);let r=e.get(n);r===void 0?(t=zp(),e.set(n,t)):t=r}}let s=t,c;if(t.s===Rp)c=t.v;else if(c=e.apply(null,arguments),a++,r){let e=Bp(i);e!=null&&r(e,c)&&(c=e,a!==0&&a--),i=typeof c==`object`&&c||typeof c==`function`?new Ip(c):c}return s.s=Rp,s.v=c,c}return o.clearCache=()=>{n=zp(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function Hp(e,...t){let n=typeof e==`function`?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t=0,r=0,i,a={},o=e.pop();typeof o==`object`&&(a=o,o=e.pop()),Tp(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=Vp,argsMemoizeOptions:u=[]}={...n,...a},d=Dp(c),f=Dp(u),p=Op(e),m=s(function(){return t++,o.apply(null,arguments)},...d),h=l(function(){r++;let e=kp(p,arguments);return i=m.apply(null,e),i},...f);return Object.assign(h,{resultFunc:o,memoizedResultFunc:m,dependencies:p,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>i,recomputations:()=>t,resetRecomputations:()=>{t=0},memoize:s,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}Hp({memoize:Pp,memoizeOptions:{maxSize:1,equalityCheck:Object.is}});var X=(e,t,n,r,i,a,...o)=>{if(o.length>0)throw Error(uo(1));let s;if(e&&t&&n&&r&&i&&a)s=(o,s,c,l)=>a(e(o,s,c,l),t(o,s,c,l),n(o,s,c,l),r(o,s,c,l),i(o,s,c,l),s,c,l);else if(e&&t&&n&&r&&i)s=(a,o,s,c)=>i(e(a,o,s,c),t(a,o,s,c),n(a,o,s,c),r(a,o,s,c),o,s,c);else if(e&&t&&n&&r)s=(i,a,o,s)=>r(e(i,a,o,s),t(i,a,o,s),n(i,a,o,s),a,o,s);else if(e&&t&&n)s=(r,i,a,o)=>n(e(r,i,a,o),t(r,i,a,o),i,a,o);else if(e&&t)s=(n,r,i,a)=>t(e(n,r,i,a),r,i,a);else if(e)s=e;else throw Error(`Missing arguments`);return s},Up=o((e=>{var t=p();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 d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),Wp=o(((e,t)=>{t.exports=Up()})),Gp=o((e=>{var t=p(),n=Wp();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}})),Kp=o(((e,t)=>{t.exports=Gp()})),qp=Wp(),Jp=Kp(),Yp=po(19)?Zp:Qp;function Xp(e,t,n,r,i){return Yp(e,t,n,r,i)}function Zp(e,t,n,r,i){let a=v.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,qp.useSyncExternalStore)(e.subscribe,a,a)}function Qp(e,t,n,r,i){return(0,Jp.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var $p=class e{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(t){for(let n in t)if(!Object.is(this.state[n],t[n])){e.prototype.setState.call(this,{...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||e.prototype.setState.call(this,{...this.state,[t]:n})}notifyAll(){let t={...this.state};e.prototype.setState.call(this,t)}},em=class extends $p{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}controlledValues=new Map;useSyncedValue(e,t){v.useDebugValue(e),Y(()=>{this.state[e]!==t&&this.set(e,t)},[e,t])}useSyncedValueWithCleanup(e,t){Y(()=>(this.state[e]!==t&&this.set(e,t),()=>{this.set(e,void 0)}),[e,t])}useSyncedValues(e){Y(()=>{this.update(e)},Object.values(e))}useControlledProp(e,t,n){v.useDebugValue(e);let r=t!==void 0;this.controlledValues.has(e)||(this.controlledValues.set(e,r),!r&&!Object.is(this.state[e],n)&&super.setState({...this.state,[e]:n})),Y(()=>{r&&!Object.is(this.state[e],t)&&super.setState({...this.state,[e]:t})},[e,t,n,r])}set(e,t){this.controlledValues.get(e)!==!0&&super.set(e,t)}update(e){let t={...e};for(let e in t)if(Object.hasOwn(t,e)&&this.controlledValues.get(e)===!0){delete t[e];continue}super.update(t)}setState(e){let t={...e};for(let e in t)if(Object.hasOwn(t,e)&&this.controlledValues.get(e)===!0){delete t[e];continue}super.setState({...this.state,...t})}select=(e,t,n,r)=>{let i=this.selectors[e];return i(this.state,t,n,r)};useState=(e,t,n,r)=>{v.useDebugValue(e);let i=this.selectors[e];return Xp(this,i,t,n,r)};useContextCallback(e,t){v.useDebugValue(e);let n=J(t??Ha);this.context[e]=n}useStateSetter(e){let t=v.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},tm={open:X(e=>e.open),domReferenceElement:X(e=>e.domReferenceElement),referenceElement:X(e=>e.positionReference??e.referenceElement),floatingElement:X(e=>e.floatingElement),floatingId:X(e=>e.floatingId)},nm=class extends em{constructor(e){let{nested:t,noEmit:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:hd(),nested:t,noEmit:n,triggerElements:i},tm)}setOpen=(e,t)=>{if((!e||!this.state.open||Wl(t.event))&&(this.context.dataRef.current.openEvent=e?t.event:void 0),!this.context.noEmit){let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)}this.context.onOpenChange?.(e,t)}};function rm(e,t){let n=v.useRef(null);return v.useCallback(r=>{if(e!==void 0&&(n.current!==null&&(t.context.triggerElements.delete(n.current),n.current=null),r!==null))return n.current=e,t.context.triggerElements.add(e,r),()=>{n.current!==null&&(t.context.triggerElements.delete(n.current),n.current=null)}},[t,e])}function im(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=rm(e,n),o=J(t=>{let i=a(t);return t!==null&&n.select(`open`)&&n.select(`activeTriggerId`)==null&&n.update({activeTriggerId:e,activeTriggerElement:t,...r}),i});return Y(()=>{i&&n.update({activeTriggerElement:t.current,...r})},[i,n,t,...Object.values(r)]),{registerTrigger:o,isMountedByThisTrigger:i}}function am(e){let t=e.useState(`open`);Y(()=>{if(t&&!e.select(`activeTriggerId`)&&e.context.triggerElements.size===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[n,r]=t.value;e.update({activeTriggerId:n,activeTriggerElement:r})}}},[t,e])}function om(e,t,n){let{mounted:r,setMounted:i,transitionStatus:a}=vc(e);t.useSyncedValues({mounted:r,transitionStatus:a});let o=J(()=>{i(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return _c({enabled:!t.useState(`preventUnmountingOnClose`),open:e,ref:t.context.popupRef,onComplete(){e||o()}}),{forceUnmount:o,transitionStatus:a}}var sm=class{constructor(){this.elements=new Set,this.idMap=new Map}add(e,t){let n=this.idMap.get(e);n!==t&&(n!==void 0&&this.elements.delete(n),this.elements.add(t),this.idMap.set(e,t))}delete(e){let t=this.idMap.get(e);t&&(this.elements.delete(t),this.idMap.delete(e))}hasElement(e){return this.elements.has(e)}hasMatchingElement(e){for(let t of this.elements)if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}get size(){return this.idMap.size}};function cm(){return new nm({open:!1,floatingElement:null,referenceElement:null,triggerElements:new sm,floatingId:``,nested:!1,noEmit:!1,onOpenChange:void 0})}function lm(){return{open:!1,mounted:!1,transitionStatus:`idle`,floatingRootContext:cm(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,popupElement:null,positionerElement:null,activeTriggerProps:Wa,inactiveTriggerProps:Wa,popupProps:Wa}}var um={open:X(e=>e.open),mounted:X(e=>e.mounted),transitionStatus:X(e=>e.transitionStatus),floatingRootContext:X(e=>e.floatingRootContext),preventUnmountingOnClose:X(e=>e.preventUnmountingOnClose),payload:X(e=>e.payload),activeTriggerId:X(e=>e.activeTriggerId),activeTriggerElement:X(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:X((e,t)=>t!==void 0&&e.activeTriggerId===t),isOpenedByTrigger:X((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.open),isMountedByTrigger:X((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.mounted),triggerProps:X((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:X(e=>e.popupProps),popupElement:X(e=>e.popupElement),positionerElement:X(e=>e.positionerElement)};function dm(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=Wo(),a=yd()!=null,o=qa(()=>new nm({open:t,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:r.triggers??new sm,floatingId:i,nested:a,noEmit:e.noEmit||!1})).current;return Y(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=Zo(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o.context.noEmit=e.noEmit||!1,o}function fm(e={}){let{nodeId:t,externalTree:n}=e,r=dm(e),i=e.rootContext||r,a={reference:i.useState(`referenceElement`),floating:i.useState(`floatingElement`),domReference:i.useState(`domReferenceElement`)},[o,s]=v.useState(null),c=v.useRef(null),l=bd(n);Y(()=>{a.domReference&&(c.current=a.domReference)},[a.domReference]);let u=mp({...e,elements:{...a,...o&&{reference:o}}}),d=v.useCallback(e=>{let t=Zo(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;s(t),u.refs.setReference(t)},[u.refs]),[f,p]=v.useState(null),[m,h]=v.useState(null);i.useSyncedValue(`referenceElement`,f),i.useSyncedValue(`domReferenceElement`,Zo(f)?f:null),i.useSyncedValue(`floatingElement`,m);let g=v.useCallback(e=>{(Zo(e)||e===null)&&(c.current=e,p(e)),(Zo(u.refs.reference.current)||u.refs.reference.current===null||e!==null&&!Zo(e))&&u.refs.setReference(e)},[u.refs,p]),_=v.useCallback(e=>{h(e),u.refs.setFloating(e)},[u.refs]),y=v.useMemo(()=>({...u.refs,setReference:g,setFloating:_,setPositionReference:d,domReference:c}),[u.refs,g,_,d]),b=v.useMemo(()=>({...u.elements,domReference:a.domReference}),[u.elements,a.domReference]),x=i.useState(`open`),S=i.useState(`floatingId`),C=v.useMemo(()=>({...u,dataRef:i.context.dataRef,open:x,onOpenChange:i.setOpen,events:i.context.events,floatingId:S,refs:y,elements:b,nodeId:t,rootStore:i}),[u,y,b,t,i,x,S]);return Y(()=>{i.context.dataRef.current.floatingContext=C;let e=l?.nodesRef.current.find(e=>e.id===t);e&&(e.context=C)}),v.useMemo(()=>({...u,context:C,refs:y,elements:b,rootStore:i}),[u,y,b,C,i])}function pm(e){let{popupStore:t,noEmit:n=!1,treatPopupAsFloatingElement:r=!1,onOpenChange:i}=e,a=Wo(),o=yd()!=null,s=t.useState(`open`),c=t.useState(`activeTriggerElement`),l=t.useState(r?`popupElement`:`positionerElement`),u=t.context.triggerElements,d=qa(()=>new nm({open:s,referenceElement:c,floatingElement:l,triggerElements:u,onOpenChange:i,floatingId:a,nested:o,noEmit:n})).current;return Y(()=>{let e={open:s,floatingId:a,referenceElement:c,floatingElement:l};Zo(c)&&(e.domReferenceElement=c),d.update(e)},[s,a,c,l,d]),d.context.onOpenChange=i,d.context.nested=o,d.context.noEmit=n,d}var mm=gl&&ml;function hm(e,t={}){let n=`rootStore`in e?e.rootStore:e,{events:r,dataRef:i}=n.context,{enabled:a=!0,visibleOnly:o=!0}=t,s=v.useRef(!1),c=sl(),l=v.useRef(!0);v.useEffect(()=>{let e=n.select(`domReferenceElement`);if(!a)return;let t=Jo(e);function r(){!n.select(`open`)&&Qo(e)&&e===Dl(Ml(e))&&(s.current=!0)}function i(){l.current=!0}function o(){l.current=!1}return t.addEventListener(`blur`,r),mm&&(t.addEventListener(`keydown`,i,!0),t.addEventListener(`pointerdown`,o,!0)),()=>{t.removeEventListener(`blur`,r),mm&&(t.removeEventListener(`keydown`,i,!0),t.removeEventListener(`pointerdown`,o,!0))}},[n,a]),v.useEffect(()=>{if(!a)return;function e(e){(e.reason===`trigger-press`||e.reason===`escape-key`)&&(s.current=!0)}return r.on(`openchange`,e),()=>{r.off(`openchange`,e)}},[r,a]);let u=v.useMemo(()=>({onMouseLeave(){s.current=!1},onFocus(e){if(s.current)return;let t=kl(e.nativeEvent);if(o&&Zo(t)){if(mm&&!e.relatedTarget){if(!l.current&&!Nl(t))return}else if(!Fl(t))return}n.setOpen(!0,nc(Vs,e.nativeEvent,e.currentTarget))},onBlur(e){s.current=!1;let t=e.relatedTarget,r=e.nativeEvent,a=Zo(t)&&t.hasAttribute(wd(`focus-guard`))&&t.getAttribute(`data-type`)===`outside`;c.start(0,()=>{let o=n.select(`domReferenceElement`),s=Dl(o?o.ownerDocument:document);!t&&s===o||Ol(i.current.floatingContext?.refs.floating.current,s)||Ol(o,s)||a||n.context.triggerElements.hasElement(e.relatedTarget)||n.setOpen(!1,nc(Vs,r))})}}),[i,n,o,c]);return v.useMemo(()=>a?{reference:u,trigger:u}:{},[a,u])}var gm=wd(`safe-polygon`),_m=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${Sl}`;function vm(e){return e?!!e.closest(_m):!1}function ym(e){let t=v.useRef(void 0),n=v.useRef(!1),r=v.useRef(void 0),i=v.useRef(!0),a=v.useRef(!1),o=v.useRef(()=>{}),s=v.useRef(!1),c=sl(),l=sl(),u=v.useRef(void 0);return v.useMemo(()=>{let d=e.context.dataRef.current;return d.hoverInteractionState||={pointerTypeRef:t,interactedInsideRef:n,handlerRef:r,blockMouseMoveRef:i,performedPointerEventsMutationRef:a,unbindMouseMoveRef:o,restTimeoutPendingRef:s,openChangeTimeout:c,restTimeout:l,handleCloseOptionsRef:u},d.hoverInteractionState},[e,t,n,r,i,a,o,s,c,l,u])}var bm=new Set([`click`,`mousedown`]);function xm(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`domReferenceElement`),{dataRef:o}=n.context,{enabled:s=!0,closeDelay:c=0,externalTree:l}=t,{pointerTypeRef:u,interactedInsideRef:d,handlerRef:f,performedPointerEventsMutationRef:p,unbindMouseMoveRef:m,restTimeoutPendingRef:h,openChangeTimeout:g,handleCloseOptionsRef:_}=ym(n),y=bd(l),b=yd(),x=J(()=>d.current?!0:o.current.openEvent?bm.has(o.current.openEvent.type):!1),S=J(()=>{let e=o.current.openEvent?.type;return e?.includes(`mouse`)&&e!==`mousedown`}),C=v.useCallback((e,t=!0)=>{let r=Sm(c,u.current);r&&!f.current?g.start(r,()=>n.setOpen(!1,nc(Bs,e))):t&&(g.clear(),n.setOpen(!1,nc(Bs,e)))},[c,f,n,u,g]),w=J(()=>{m.current(),f.current=void 0}),T=J(()=>{if(p.current){let e=Ml(i).body;e.style.pointerEvents=``,e.removeAttribute(gm),p.current=!1}}),E=J(e=>{if(!vm(kl(e))){d.current=!1;return}d.current=!0});Y(()=>{r||(u.current=void 0,h.current=!1,d.current=!1,w(),T())},[r,u,h,d,w,T]),v.useEffect(()=>()=>{w()},[w]),v.useEffect(()=>T,[T]),Y(()=>{if(s&&r&&_.current?.blockPointerEvents&&S()&&Zo(a)&&i){p.current=!0;let e=Ml(i).body;e.setAttribute(gm,``);let t=a,n=i,r=y?.nodesRef.current.find(e=>e.id===b)?.context?.elements.floating;return r&&(r.style.pointerEvents=``),e.style.pointerEvents=`none`,t.style.pointerEvents=`auto`,n.style.pointerEvents=`auto`,()=>{e.style.pointerEvents=``,t.style.pointerEvents=``,n.style.pointerEvents=``}}},[s,r,a,i,_,S,y,b,p]),v.useEffect(()=>{if(!s)return;function e(e){if(x()||!o.current.floatingContext)return;let t=n.context.triggerElements;e.relatedTarget&&t.hasElement(e.relatedTarget)||(T(),w(),x()||C(e))}function t(e){g.clear(),T(),f.current?.(e),w()}function r(e){x()||C(e,!1)}let a=i;return a&&(a.addEventListener(`mouseleave`,e),a.addEventListener(`mouseenter`,t),a.addEventListener(`mouseleave`,r),a.addEventListener(`pointerdown`,E,!0)),()=>{a&&(a.removeEventListener(`mouseleave`,e),a.removeEventListener(`mouseenter`,t),a.removeEventListener(`mouseleave`,r),a.removeEventListener(`pointerdown`,E,!0))}})}function Sm(e,t){return t&&!Ul(t)?0:typeof e==`function`?e():e}function Cm(e){return typeof e==`function`?e():e}var wm={current:null};function Tm(e,t={}){let n=`rootStore`in e?e.rootStore:e,{dataRef:r,events:i}=n.context,{enabled:a=!0,delay:o=0,handleClose:s=null,mouseOnly:c=!1,restMs:l=0,move:u=!0,triggerElementRef:d=wm,externalTree:f,isActiveTrigger:p=!0}=t,m=bd(f),{pointerTypeRef:h,interactedInsideRef:g,handlerRef:_,blockMouseMoveRef:y,performedPointerEventsMutationRef:b,unbindMouseMoveRef:x,restTimeoutPendingRef:S,openChangeTimeout:C,restTimeout:w,handleCloseOptionsRef:T}=ym(n),E=sc(s),D=sc(o),O=sc(l);p&&(T.current=E.current?.__options);let k=J(()=>g.current?!0:r.current.openEvent?[`click`,`mousedown`].includes(r.current.openEvent.type):!1),A=v.useCallback((e,t=!0)=>{let r=Od(D.current,`close`,h.current);r&&!_.current?C.start(r,()=>n.setOpen(!1,nc(Bs,e))):t&&(C.clear(),n.setOpen(!1,nc(Bs,e)))},[D,_,n,h,C]),j=J(()=>{x.current(),_.current=void 0}),M=J(()=>{if(b.current){let e=Ml(n.select(`domReferenceElement`)).body;e.style.pointerEvents=``,e.removeAttribute(gm),b.current=!1}});v.useEffect(()=>{if(!a)return;function e(e){e.open||(C.clear(),w.clear(),y.current=!0,S.current=!1)}return i.on(`openchange`,e),()=>{i.off(`openchange`,e)}},[a,i,C,w,y,S]);let N=J(e=>{if(k()||!r.current.floatingContext)return;let t=n.context.triggerElements;e.relatedTarget&&t.hasElement(e.relatedTarget)||E.current?.({...r.current.floatingContext,tree:m,x:e.clientX,y:e.clientY,onClose(){M(),j(),k()||A(e)}})(e)});return v.useEffect(()=>{if(!a)return;let e=d.current??(p?n.select(`domReferenceElement`):null);if(!Zo(e))return;function t(e){if(C.clear(),y.current=!1,c&&!Ul(h.current)||Cm(O.current)>0&&!Od(D.current,`open`))return;let t=Od(D.current,`open`,h.current),r=n.select(`domReferenceElement`),i=n.context.triggerElements,a=(i.hasElement(e.target)||i.hasMatchingElement(t=>Ol(t,e.target)))&&(!r||!Ol(r,e.target)),o=e.currentTarget??null;t?C.start(t,()=>{n.select(`open`)||n.setOpen(!0,nc(Bs,e,o))}):(!n.select(`open`)||a)&&n.setOpen(!0,nc(Bs,e,o))}function i(e){if(k()){M();return}x.current();let t=Ml(n.select(`domReferenceElement`));w.clear(),S.current=!1;let i=n.context.triggerElements;if(!(e.relatedTarget&&i.hasElement(e.relatedTarget))){if(E.current&&r.current.floatingContext){n.select(`open`)||C.clear(),_.current=E.current({...r.current.floatingContext,tree:m,x:e.clientX,y:e.clientY,onClose(){M(),j(),k()||A(e,!0)}});let i=_.current;i(e),t.addEventListener(`mousemove`,i),x.current=()=>{t.removeEventListener(`mousemove`,i)};return}(h.current!==`touch`||!Ol(n.select(`floatingElement`),e.relatedTarget))&&A(e)}}function o(e){N(e)}return n.select(`open`)&&e.addEventListener(`mouseleave`,o),u&&e.addEventListener(`mousemove`,t,{once:!0}),e.addEventListener(`mouseenter`,t),e.addEventListener(`mouseleave`,i),()=>{e.removeEventListener(`mouseleave`,o),u&&e.removeEventListener(`mousemove`,t),e.removeEventListener(`mouseenter`,t),e.removeEventListener(`mouseleave`,i)}},[j,M,y,r,D,A,n,a,E,N,p,k,c,u,h,O,w,S,C,d,m,x,_]),v.useMemo(()=>{function e(e){h.current=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,r=e.currentTarget,i=n.select(`domReferenceElement`),a=n.context.triggerElements,o=n.select(`open`),s=(a.hasElement(e.target)||a.hasMatchingElement(t=>Ol(t,e.target)))&&(!i||!Ol(i,e.target));if(c&&!Ul(h.current)||o&&!s||Cm(O.current)===0||!s&&S.current&&e.movementX**2+e.movementY**2<2)return;w.clear();function l(){!y.current&&(!o||s)&&n.setOpen(!0,nc(Bs,t,r))}h.current===`touch`?As.flushSync(()=>{l()}):s&&o?l():(S.current=!0,w.start(Cm(O.current),l))}}},[y,c,n,h,O,w,S])}function Em(e=[]){let t=e.map(e=>e?.reference),n=e.map(e=>e?.floating),r=e.map(e=>e?.item),i=e.map(e=>e?.trigger),a=v.useCallback(t=>Dm(t,e,`reference`),t),o=v.useCallback(t=>Dm(t,e,`floating`),n),s=v.useCallback(t=>Dm(t,e,`item`),r),c=v.useCallback(t=>Dm(t,e,`trigger`),i);return v.useMemo(()=>({getReferenceProps:a,getFloatingProps:o,getItemProps:s,getTriggerProps:c}),[a,o,s,c])}function Dm(e,t,n){let r=new Map,i=n===`item`,a={};n===`floating`&&(a.tabIndex=-1,a[xl]=``);for(let t in e)i&&e&&(t===`active`||t===`selected`)||(a[t]=e[t]);for(let o=0;o<t.length;o+=1){let s,c=t[o]?.[n];s=typeof c==`function`?e?c(e):null:c,s&&Om(a,s,i,r)}return Om(a,e,i,r),a}function Om(e,t,n,r){for(let i in t){let a=t[i];n&&(i===`active`||i===`selected`)||(i.startsWith(`on`)?(r.has(i)||r.set(i,[]),typeof a==`function`&&(r.get(i)?.push(a),e[i]=(...e)=>r.get(i)?.map(t=>t(...e)).find(e=>e!==void 0))):e[i]=a)}}var km=`Escape`;function Am(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function jm(e,t){return Am(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function Mm(e,t,n){return Am(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function Nm(e,t,n){return Am(t,n?e===Cl:e===wl,e===El)}function Pm(e,t,n,r){return t===`both`||t===`horizontal`&&r&&r>1?e===km:Am(t,n?e===wl:e===Cl,e===Tl)}function Fm(e,t){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`domReferenceElement`),o=n.context.dataRef,{listRef:s,activeIndex:c,onNavigate:l=()=>{},enabled:u=!0,selectedIndex:d=null,allowEscape:f=!1,loopFocus:p=!1,nested:m=!1,rtl:h=!1,virtual:g=!1,focusItemOnOpen:_=`auto`,focusItemOnHover:y=!0,openOnArrowKeyDown:b=!0,disabledIndices:x=void 0,orientation:S=`vertical`,parentOrientation:C,cols:w=1,scrollItemIntoView:T=!0,itemSizes:E,dense:D=!1,id:O,resetOnPointerLeave:k=!0,externalTree:A}=t,j=sc(Il(i)),M=yd(),N=bd(A);Y(()=>{o.current.orientation=S},[o,S]);let P=Pl(a),F=v.useRef(_),I=v.useRef(d??-1),L=v.useRef(null),R=v.useRef(!0),z=J(e=>{l(I.current===-1?null:I.current,e)}),B=v.useRef(z),ee=v.useRef(!!i),V=v.useRef(r),H=v.useRef(!1),te=v.useRef(!1),U=sc(x),W=sc(r),ne=sc(T),re=sc(d),ie=sc(k),ae=J(()=>{function e(e){g?N?.events.emit(`virtualfocus`,e):Ld(e,{sync:H.current,preventScroll:!0})}let t=s.current[I.current],n=te.current;t&&e(t),(H.current?e=>e():requestAnimationFrame)(()=>{let r=s.current[I.current]||t;if(!r)return;t||e(r);let i=ne.current;i&&se&&(n||!R.current)&&r.scrollIntoView?.(typeof i==`boolean`?{block:`nearest`,inline:`nearest`}:i)})});Y(()=>{u&&(r&&i?(I.current=d??-1,F.current&&d!=null&&(te.current=!0,z())):ee.current&&(I.current=-1,B.current()))},[u,r,i,d,z]),Y(()=>{if(u){if(!r){H.current=!1;return}if(i)if(c==null){if(H.current=!1,re.current!=null)return;if(ee.current&&(I.current=-1,ae()),(!V.current||!ee.current)&&F.current&&(L.current!=null||F.current===!0&&L.current==null)){let e=0,t=()=>{s.current[0]==null?(e<2&&(e?requestAnimationFrame:queueMicrotask)(t),e+=1):(I.current=L.current==null||Mm(L.current,S,h)||m?xu(s):Su(s),L.current=null,z())};t()}}else bu(s,c)||(I.current=c,ae(),te.current=!1)}},[u,r,i,c,re,m,s,S,h,z,ae,U]),Y(()=>{if(!u||i||!N||g||!ee.current)return;let e=N.nodesRef.current,t=e.find(e=>e.id===M)?.context?.elements.floating,n=Dl(Ml(i)),r=e.some(e=>e.context&&Ol(e.context.elements.floating,n));t&&!r&&R.current&&t.focus({preventScroll:!0})},[u,i,N,M,g]),Y(()=>{B.current=z,V.current=r,ee.current=!!i}),Y(()=>{r||(L.current=null,F.current=_)},[r,_]);let oe=c!=null,se=v.useMemo(()=>{function e(e){if(!W.current)return;let t=s.current.indexOf(e.currentTarget);t!==-1&&I.current!==t&&(I.current=t,z(e))}return{onFocus(t){H.current=!0,e(t)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(t){H.current=!0,te.current=!1,y&&e(t)},onPointerLeave(e){if(!W.current||!R.current||e.pointerType===`touch`)return;H.current=!0;let t=e.relatedTarget;!y||s.current.includes(t)||ie.current&&(I.current=-1,z(e),g||j.current?.focus({preventScroll:!0}))}}},[W,j,y,s,z,ie,g]),ce=v.useCallback(()=>C??N?.nodesRef.current.find(e=>e.id===M)?.context?.dataRef?.current.orientation,[M,N,C]),le=J(e=>{if(R.current=!1,H.current=!0,e.which===229||!W.current&&e.currentTarget===j.current)return;if(m&&Pm(e.key,S,h,w)){jm(e.key,ce())||zl(e),n.setOpen(!1,nc(Ys,e.nativeEvent)),Qo(a)&&(g?N?.events.emit(`virtualfocus`,a):a.focus());return}let t=I.current,i=xu(s,x),o=Su(s,x);if(P||(e.key===`Home`&&(zl(e),I.current=i,z(e)),e.key===`End`&&(zl(e),I.current=o,z(e))),w>1){let t=E||Array.from({length:s.current.length},()=>({width:1,height:1})),n=Tu(t,w,D),r=n.findIndex(e=>e!=null&&!Ou(s,e,x)),a=n.reduce((e,t,n)=>t!=null&&!Ou(s,t,x)?n:e,-1),c=n[wu({current:n.map(e=>e==null?null:s.current[e])},{event:e,orientation:S,loopFocus:p,rtl:h,cols:w,disabledIndices:Du([...(typeof x==`function`?null:x)||s.current.map((e,t)=>Ou(s,t,x)?t:void 0),void 0],n),minIndex:r,maxIndex:a,prevIndex:Eu(I.current>o?i:I.current,t,n,w,e.key===`ArrowDown`?`bl`:e.key===(h?`ArrowLeft`:`ArrowRight`)?`tr`:`tl`),stopEvent:!0})];if(c!=null&&(I.current=c,z(e)),S===`both`)return}if(jm(e.key,S)){if(zl(e),r&&!g&&Dl(e.currentTarget.ownerDocument)===e.currentTarget){I.current=Mm(e.key,S,h)?i:o,z(e);return}Mm(e.key,S,h)?p?t>=o?f&&t!==s.current.length?I.current=-1:(H.current=!1,I.current=i):I.current=Cu(s,{startingIndex:t,disabledIndices:x}):I.current=Math.min(o,Cu(s,{startingIndex:t,disabledIndices:x})):p?t<=i?f&&t!==-1?I.current=s.current.length:(H.current=!1,I.current=o):I.current=Cu(s,{startingIndex:t,decrement:!0,disabledIndices:x}):I.current=Math.max(i,Cu(s,{startingIndex:t,decrement:!0,disabledIndices:x})),bu(s,I.current)&&(I.current=-1),z(e)}}),ue=v.useMemo(()=>g&&r&&oe&&{"aria-activedescendant":`${O}-${c}`},[g,r,oe,O,c]),de=v.useMemo(()=>({"aria-orientation":S===`both`?void 0:S,...P?{}:ue,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&r&&!g){let t=kl(e.nativeEvent);if(t&&!Ol(j.current,t))return;zl(e),n.setOpen(!1,nc(qs,e.nativeEvent)),Qo(a)&&a.focus();return}le(e)},onPointerMove(){R.current=!0}}),[ue,le,j,S,P,n,r,g,a]),fe=v.useMemo(()=>{function e(e){_===`auto`&&Vl(e.nativeEvent)&&(F.current=!g)}function t(e){F.current=_,_===`auto`&&Hl(e.nativeEvent)&&(F.current=!0)}return{onKeyDown(e){let t=n.select(`open`);R.current=!1;let r=e.key.startsWith(`Arrow`),i=Nm(e.key,ce(),h),a=jm(e.key,S),o=(m?i:a)||e.key===`Enter`||e.key.trim()===``;if(g&&t)return le(e);if(!(!t&&!b&&r)){if(o){let t=jm(e.key,ce());L.current=m&&t?null:e.key}if(m){i&&(zl(e),t?(I.current=xu(s,U.current),z(e)):n.setOpen(!0,nc(Ys,e.nativeEvent,e.currentTarget)));return}a&&(re.current!=null&&(I.current=re.current),zl(e),!t&&b?n.setOpen(!0,nc(Ys,e.nativeEvent,e.currentTarget)):le(e),t&&z(e))}},onFocus(e){n.select(`open`)&&!g&&(I.current=-1,z(e))},onPointerDown:t,onPointerEnter:t,onMouseDown:e,onClick:e}},[le,U,_,s,m,z,n,b,S,ce,h,re,g]),pe=v.useMemo(()=>({...ue,...fe}),[ue,fe]);return v.useMemo(()=>u?{reference:pe,floating:de,item:se,trigger:fe}:{},[u,pe,de,fe,se])}var Im=new Map([[`select`,`listbox`],[`combobox`,`listbox`],[`label`,!1]]);function Lm(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingId`),a=n.useState(`domReferenceElement`),o=n.useState(`floatingElement`),{enabled:s=!0,role:c=`dialog`}=t,l=Wo(),u=a?.id||l,d=v.useMemo(()=>Il(o)?.id||i,[o,i]),f=Im.get(c)??c,p=yd()!=null,m=v.useMemo(()=>f===`tooltip`||c===`label`?Wa:{"aria-haspopup":f===`alertdialog`?`dialog`:f,"aria-expanded":`false`,...f===`listbox`&&{role:`combobox`},...f===`menu`&&p&&{role:`menuitem`},...c===`select`&&{"aria-autocomplete":`none`},...c===`combobox`&&{"aria-autocomplete":`list`}},[f,p,c]),h=v.useMemo(()=>f===`tooltip`||c===`label`?{[`aria-${c===`label`?`labelledby`:`describedby`}`]:r?d:void 0}:{...m,"aria-expanded":r?`true`:`false`,"aria-controls":r?d:void 0,...f===`menu`&&{id:u}},[f,d,r,u,c,m]),g=v.useMemo(()=>{let e={id:d,...f&&{role:f}};return f===`tooltip`||c===`label`?e:{...e,...f===`menu`&&{"aria-labelledby":u}}},[f,d,u,c]),_=v.useCallback(({active:e,selected:t})=>{let n={role:`option`,...e&&{id:`${d}-fui-option`}};switch(c){case`select`:case`combobox`:return{...n,"aria-selected":t};default:}return{}},[d,c]);return v.useMemo(()=>s?{reference:h,floating:g,item:_,trigger:m}:{},[s,h,g,m,_])}function Rm(e,t){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.context.dataRef,{listRef:a,activeIndex:o,onMatch:s,onTypingChange:c,enabled:l=!0,findMatch:u=null,resetMs:d=750,ignoreKeys:f=Ua,selectedIndex:p=null}=t,m=sl(),h=v.useRef(``),g=v.useRef(p??o??-1),_=v.useRef(null);Y(()=>{r&&(m.clear(),_.current=null,h.current=``)},[r,m]),Y(()=>{r&&h.current===``&&(g.current=p??o??-1)},[r,p,o]);let y=J(e=>{e?i.current.typing||(i.current.typing=e,c?.(e)):i.current.typing&&(i.current.typing=e,c?.(e))}),b=J(e=>{function t(e,t,n){let r=u?u(t,n):t.find(e=>e?.toLocaleLowerCase().indexOf(n.toLocaleLowerCase())===0);return r?e.indexOf(r):-1}let n=a.current;if(h.current.length>0&&h.current[0]!==` `&&(t(n,n,h.current)===-1?y(!1):e.key===` `&&zl(e)),n==null||f.includes(e.key)||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;r&&e.key!==` `&&(zl(e),y(!0)),n.every(e=>!e||e[0]?.toLocaleLowerCase()!==e[1]?.toLocaleLowerCase())&&h.current===e.key&&(h.current=``,g.current=_.current),h.current+=e.key,m.start(d,()=>{h.current=``,g.current=_.current,y(!1)});let i=g.current,o=t(n,[...n.slice((i||0)+1),...n.slice(0,(i||0)+1)],h.current);o===-1?e.key!==` `&&(h.current=``,y(!1)):(s?.(o),_.current=o)}),x=v.useMemo(()=>({onKeyDown:b}),[b]),S=v.useMemo(()=>({onKeyDown:b,onKeyUp(e){e.key===` `&&y(!1)}}),[b,y]);return v.useMemo(()=>l?{reference:x,floating:S}:{},[l,x,S])}function zm(e,t){let[n,r]=e,i=!1,a=t.length;for(let e=0,o=a-1;e<a;o=e++){let[a,s]=t[e]||[0,0],[c,l]=t[o]||[0,0];s>=r!=l>=r&&n<=(c-a)*(r-s)/(l-s)+a&&(i=!i)}return i}function Bm(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}function Vm(e={}){let{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:r=!0}=e,i=new ol,a=!1,o=null,s=null,c=typeof performance<`u`?performance.now():0;function l(e,t){let n=performance.now(),r=n-c;if(o===null||s===null||r===0)return o=e,s=t,c=n,null;let i=e-o,a=t-s,l=Math.sqrt(i*i+a*a)/r;return o=e,s=t,c=n,l}let u=({x:e,y:n,placement:o,elements:s,onClose:c,nodeId:u,tree:d})=>function(f){function p(){i.clear(),c()}if(i.clear(),!s.domReference||!s.floating||o==null||e==null||n==null)return;let{clientX:m,clientY:h}=f,g=[m,h],_=kl(f),v=f.type===`mouseleave`,y=Ol(s.floating,_),b=Ol(s.domReference,_),x=s.domReference.getBoundingClientRect(),S=s.floating.getBoundingClientRect(),C=o.split(`-`)[0],w=e>S.right-S.width/2,T=n>S.bottom-S.height/2,E=Bm(g,x),D=S.width>x.width,O=S.height>x.height,k=(D?x:S).left,A=(D?x:S).right,j=(O?x:S).top,M=(O?x:S).bottom;if(y&&(a=!0,!v))return;if(b&&(a=!1),b&&!v){a=!0;return}if(v&&Zo(f.relatedTarget)&&Ol(s.floating,f.relatedTarget)||d&&Ll(d.nodesRef.current,u).some(({context:e})=>e?.open))return;if(C===`top`&&n>=x.bottom-1||C===`bottom`&&n<=x.top+1||C===`left`&&e>=x.right-1||C===`right`&&e<=x.left+1)return p();let N=[];switch(C){case`top`:N=[[k,x.top+1],[k,S.bottom-1],[A,S.bottom-1],[A,x.top+1]];break;case`bottom`:N=[[k,S.top+1],[k,x.bottom-1],[A,x.bottom-1],[A,S.top+1]];break;case`left`:N=[[S.right-1,M],[S.right-1,j],[x.left+1,j],[x.left+1,M]];break;case`right`:N=[[x.right-1,M],[x.right-1,j],[S.left+1,j],[S.left+1,M]];break;default:}function P([e,n]){switch(C){case`top`:return[[D?e+t/2:w?e+t*4:e-t*4,n+t+1],[D?e-t/2:w?e+t*4:e-t*4,n+t+1],[S.left,w||D?S.bottom-t:S.top],[S.right,w?D?S.bottom-t:S.top:S.bottom-t]];case`bottom`:return[[D?e+t/2:w?e+t*4:e-t*4,n-t],[D?e-t/2:w?e+t*4:e-t*4,n-t],[S.left,w||D?S.top+t:S.bottom],[S.right,w?D?S.top+t:S.bottom:S.top+t]];case`left`:{let r=[e+t+1,O?n+t/2:T?n+t*4:n-t*4],i=[e+t+1,O?n-t/2:T?n+t*4:n-t*4];return[[T||O?S.right-t:S.left,S.top],[T?O?S.right-t:S.left:S.right-t,S.bottom],r,i]}case`right`:return[[e-t,O?n+t/2:T?n+t*4:n-t*4],[e-t,O?n-t/2:T?n+t*4:n-t*4],[T||O?S.left+t:S.right,S.top],[T?O?S.left+t:S.right:S.left+t,S.bottom]];default:return[]}}if(!zm([m,h],N)){if(a&&!E)return p();if(!v&&r){let e=l(f.clientX,f.clientY);if(e!==null&&e<.1)return p()}zm([m,h],P([e,n]))?!a&&r&&i.start(40,p):p()}};return u.__options={blockPointerEvents:n},u}var Hm=v.createContext(void 0);function Um(e){let t=v.useContext(Hm);if(t===void 0&&!e)throw Error(uo(69));return t}var Wm=`ArrowUp`,Gm=`ArrowDown`,Km=`ArrowLeft`,qm=`ArrowRight`,Jm=`Home`,Ym=new Set([Km,qm]),Xm=new Set([Wm,Gm]);[...new Set([...Ym,...Xm])];var Zm=new Set([Wm,Gm,Km,qm,Jm,`End`]);function Qm(e){return e===`starting`?jo:Wa}var $m={...zc,...Sc},eh=v.forwardRef(function(e,t){let{render:n,className:r,finalFocus:i,...a}=e,{store:o}=kc(),{side:s,align:c}=Dc(),l=Um(!0)!=null,u=o.useState(`open`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`mounted`),m=o.useState(`instantType`),h=o.useState(`activeTriggerElement`),g=o.useState(`parent`),_=o.useState(`lastOpenChangeReason`),y=o.useState(`rootId`),b=o.useState(`floatingRootContext`),x=o.useState(`floatingTreeRoot`),S=o.useState(`closeDelay`),C=o.useState(`activeTriggerElement`);_c({open:u,ref:o.context.popupRef,onComplete(){u&&o.context.onOpenChangeComplete?.(!0)}}),v.useEffect(()=>{function e(e){o.setOpen(!1,nc(e.reason,e.domEvent))}return x.events.on(`close`,e),()=>{x.events.off(`close`,e)}},[x.events,o]);let w=o.useState(`hoverEnabled`),T=o.useState(`disabled`);xm(b,{enabled:w&&!T&&g.type!==`context-menu`&&g.type!==`menubar`,closeDelay:S});let E=Io(`div`,e,{state:v.useMemo(()=>({transitionStatus:d,side:s,align:c,open:u,nested:g.type===`menu`,instant:m}),[d,s,c,u,g.type,m]),ref:[t,o.context.popupRef],stateAttributesMapping:$m,props:[f,{onKeyDown(e){l&&Zm.has(e.key)&&e.stopPropagation()}},Qm(d),a,{"data-rootownerid":y}]}),D=g.type===void 0||g.type===`context-menu`;return(h||g.type===`menubar`&&_!==`outside-press`)&&(D=!0),(0,K.jsx)(cf,{context:b,modal:!1,disabled:!p,returnFocus:i===void 0?D:i,initialFocus:g.type!==`menu`,restoreFocus:!0,externalTree:g.type===`menubar`?void 0:x,previousFocusableElement:C,nextFocusableElement:g.type===void 0?o.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:g.type===void 0?o.context.beforeContentFocusGuardRef:void 0,children:E})}),th=v.createContext(void 0);function nh(){let e=v.useContext(th);if(e===void 0)throw Error(uo(32));return e}var rh=v.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=kc();return i.useState(`mounted`)||n?(0,K.jsx)(th.Provider,{value:n,children:(0,K.jsx)(Zd,{ref:t,...r})}):null});function ih(e){return po(19)?e:e?`true`:void 0}var ah=v.createContext(void 0);function oh(){return v.useContext(ah)?.direction??`ltr`}var sh=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,offsetParent:d=`real`}=$l(e,t)||{};if(l==null)return{};let f=_u(u),p={x:n,y:r},m=au(i),h=ru(m),g=await o.getDimensions(l),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=a.reference[h]+a.reference[m]-p[m]-a.floating[h],S=p[m]-a.reference[m],C=d===`real`?await o.getOffsetParent?.(l):s.floating,w=s.floating[b]||a.floating[h];(!w||!await o.isElement?.(C))&&(w=s.floating[b]||a.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=Math.min(f[v],E),O=Math.min(f[y],E),k=D,A=w-g[h]-O,j=w/2-g[h]/2+T,M=Ql(k,j,A),N=!c.arrow&&tu(i)!=null&&j!==M&&a.reference[h]/2-(j<k?D:O)-g[h]/2<0,P=N?j<k?j-k:j-A:0;return{[m]:p[m]+P,data:{[m]:M,centerOffset:j-M-P,...N&&{alignmentOffset:P}},reset:N}}}),ch=(e,t)=>({...sh(e),options:[e,t]}),lh={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0;return{data:{referenceHidden:(await bp().fn(e)).data?.referenceHidden||a}}}},uh={sideX:`left`,sideY:`top`},dh={name:`adaptiveOrigin`,async fn(e){let{x:t,y:n,rects:{floating:r},elements:{floating:i},platform:a,strategy:o,placement:s}=e,c=Jo(i),l=c.getComputedStyle(i);if(!(l.transitionDuration!==`0s`&&l.transitionDuration!==``))return{x:t,y:n,data:uh};let u=await a.getOffsetParent?.(i),d={width:0,height:0};if(o===`fixed`&&c?.visualViewport)d={width:c.visualViewport.width,height:c.visualViewport.height};else if(u===c){let e=Pd(i);d={width:e.documentElement.clientWidth,height:e.documentElement.clientHeight}}else await a.isElement?.(u)&&(d=await a.getDimensions(u));let f=eu(s),p=t,m=n;f===`left`&&(p=d.width-(t+r.width)),f===`top`&&(m=d.height-(n+r.height));let h=f===`left`?`right`:uh.sideX,g=f===`top`?`bottom`:uh.sideY;return{x:p,y:m,data:{sideX:h,sideY:g}}}};function fh(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function ph(e,t,n){let{rects:r,placement:i}=e;return{side:fh(t,eu(i),n),align:tu(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function mh(e){let{anchor:t,positionMethod:n=`absolute`,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,collisionBoundary:s,collisionPadding:c=5,sticky:l=!1,arrowPadding:u=5,disableAnchorTracking:d=!1,keepMounted:f=!1,floatingRootContext:p,mounted:m,collisionAvoidance:h,shiftCrossAxis:g=!1,nodeId:_,adaptiveOrigin:y,lazyFlip:b=!1,externalTree:x}=e,[S,C]=v.useState(null);!m&&S!==null&&C(null);let w=h.side||`flip`,T=h.align||`flip`,E=h.fallbackAxisSide||`end`,D=typeof t==`function`?t:void 0,O=J(D),k=D?O:t,A=sc(t),j=oh()===`rtl`,M=S||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":j?`left`:`right`,"inline-start":j?`right`:`left`}[r],N=a===`center`?M:`${M}-${a}`,P=c,F=+(r===`bottom`),I=+(r===`top`),L=+(r===`right`),R=+(r===`left`);typeof P==`number`?P={top:P+F,right:P+R,bottom:P+I,left:P+L}:P&&={top:(P.top||0)+F,right:(P.right||0)+R,bottom:(P.bottom||0)+I,left:(P.left||0)+L};let z={boundary:s===`clipping-ancestors`?`clippingAncestors`:s,padding:P},B=v.useRef(null),ee=sc(i),V=sc(o),H=[hp(e=>{let t=ph(e,r,j),n=typeof ee.current==`function`?ee.current(t):ee.current,i=typeof V.current==`function`?V.current(t):V.current;return{mainAxis:n,crossAxis:i,alignmentAxis:i}},[typeof i==`function`?0:i,typeof o==`function`?0:o,j,r])],te=T===`none`&&w!==`shift`,U=!te&&(l||g||w===`shift`),W=w===`none`?null:vp({...z,padding:{top:P.top+1,right:P.right+1,bottom:P.bottom+1,left:P.left+1},mainAxis:!g&&w===`flip`,crossAxis:T===`flip`&&`alignment`,fallbackAxisSideDirection:E}),ne=te?null:gp(e=>{let t=Pd(e.elements.floating).documentElement;return{...z,rootBoundary:g?{x:0,y:0,width:t.clientWidth,height:t.clientHeight}:void 0,mainAxis:T!==`none`,crossAxis:U,limiter:l||g?void 0:_p(e=>{if(!B.current)return{};let{width:t,height:n}=B.current.getBoundingClientRect(),r=iu(eu(e.placement)),i=r===`y`?t:n,a=r===`y`?P.left+P.right:P.top+P.bottom;return{offset:i/2+a/2}})}},[z,l,g,P,T]);w===`shift`||T===`shift`||a===`center`?H.push(ne,W):H.push(W,ne),H.push(yp({...z,apply({elements:{floating:e},rects:{reference:t},availableWidth:n,availableHeight:r}){Object.entries({"--available-width":`${n}px`,"--available-height":`${r}px`,"--anchor-width":`${t.width}px`,"--anchor-height":`${t.height}px`}).forEach(([t,n])=>{e.style.setProperty(t,n)})}}),ch(()=>({element:B.current||document.createElement(`div`),padding:u,offsetParent:`floating`}),[u]),{name:`transformOrigin`,fn(e){let{elements:t,middlewareData:n,placement:a,rects:o,y:s}=e,c=eu(a),l=iu(c),u=B.current,d=n.arrow?.x||0,f=n.arrow?.y||0,p=u?.clientWidth||0,m=u?.clientHeight||0,h=d+p/2,g=f+m/2,_=Math.abs(n.shift?.y||0),v=o.reference.height/2,y=typeof i==`function`?i(ph(e,r,j)):i,b=_>y,x={top:`${h}px calc(100% + ${y}px)`,bottom:`${h}px ${-y}px`,left:`calc(100% + ${y}px) ${g}px`,right:`${-y}px ${g}px`}[c],S=`${h}px ${o.reference.y+v-s}px`;return t.floating.style.setProperty(`--transform-origin`,U&&l===`y`&&b?S:x),{}}},lh,y),Y(()=>{!m&&p&&p.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[m,p]);let re=v.useMemo(()=>({elementResize:!d&&typeof ResizeObserver<`u`,layoutShift:!d&&typeof IntersectionObserver<`u`}),[d]),{refs:ie,elements:ae,x:oe,y:se,middlewareData:ce,update:le,placement:ue,context:de,isPositioned:fe,floatingStyles:pe}=fm({rootContext:p,placement:N,middleware:H,strategy:n,whileElementsMounted:f?void 0:(...e)=>tp(...e,re),nodeId:_,externalTree:x}),{sideX:me,sideY:he}=ce.adaptiveOrigin||uh,ge=fe?n:`fixed`,_e=v.useMemo(()=>y?{position:ge,[me]:oe,[he]:se}:{position:ge,...pe},[y,ge,me,oe,he,se,pe]),ve=v.useRef(null);Y(()=>{if(!m)return;let e=A.current,t=typeof e==`function`?e():e,n=(hh(t)?t.current:t)||null;n!==ve.current&&(ie.setPositionReference(n),ve.current=n)},[m,ie,k,A]),v.useEffect(()=>{if(!m)return;let e=A.current;typeof e!=`function`&&hh(e)&&e.current!==ve.current&&(ie.setPositionReference(e.current),ve.current=e.current)},[m,ie,k,A]),v.useEffect(()=>{if(f&&m&&ae.domReference&&ae.floating)return tp(ae.domReference,ae.floating,le,re)},[f,m,ae,le,re]);let ye=eu(ue),be=fh(r,ye,j),xe=tu(ue)||`center`,Se=!!ce.hide?.referenceHidden;Y(()=>{b&&m&&fe&&C(ye)},[b,m,fe,ye]);let Ce=v.useMemo(()=>({position:`absolute`,top:ce.arrow?.y,left:ce.arrow?.x}),[ce.arrow]),we=ce.arrow?.centerOffset!==0;return v.useMemo(()=>({positionerStyles:_e,arrowStyles:Ce,arrowRef:B,arrowUncentered:we,side:be,align:xe,physicalSide:ye,anchorHidden:Se,refs:ie,context:de,isPositioned:fe,update:le}),[_e,Ce,B,we,be,xe,ye,Se,ie,de,fe,le])}function hh(e){return e!=null&&`current`in e}function gh(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=J(i),o=v.useRef(0),s=qa(vh).current,c=qa(_h).current,[l,u]=v.useState(0),d=v.useRef(l),f=J((e,t)=>{c.set(e,t??null),d.current+=1,u(d.current)}),p=J(e=>{c.delete(e),d.current+=1,u(d.current)}),m=v.useMemo(()=>{let e=new Map;return Array.from(c.keys()).filter(e=>e.isConnected).sort(yh).forEach((t,n)=>{let r=c.get(t)??{};e.set(t,{...r,index:n})}),e},[c,l]);Y(()=>{if(typeof MutationObserver!=`function`||m.size===0)return;let e=new MutationObserver(e=>{let t=new Set,n=e=>t.has(e)?t.delete(e):t.add(e);e.forEach(e=>{e.removedNodes.forEach(n),e.addedNodes.forEach(n)}),t.size===0&&(d.current+=1,u(d.current))});return m.forEach((t,n)=>{n.parentElement&&e.observe(n.parentElement,{childList:!0})}),()=>{e.disconnect()}},[m]),Y(()=>{d.current===l&&(n.current.length!==m.size&&(n.current.length=m.size),r&&r.current.length!==m.size&&(r.current.length=m.size),o.current=m.size),a(m)},[a,m,n,r,l]),Y(()=>()=>{n.current=[]},[n]),Y(()=>()=>{r&&(r.current=[])},[r]);let h=J(e=>(s.add(e),()=>{s.delete(e)}));Y(()=>{s.forEach(e=>e(m))},[s,m]);let g=v.useMemo(()=>({register:f,unregister:p,subscribeMapChange:h,elementsRef:n,labelsRef:r,nextIndexRef:o}),[f,p,h,n,r,o]);return(0,K.jsx)(Kc.Provider,{value:g,children:t})}function _h(){return new Map}function vh(){return new Set}function yh(e,t){let n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}var bh=v.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n?.getBoundingClientRect();i=`polygon(
0% 0%,
100% 0%,
100% 100%,
0% 100%,
0% 0%,
${e.left}px ${e.top}px,
${e.left}px ${e.bottom}px,
${e.right}px ${e.bottom}px,
${e.right}px ${e.top}px,
${e.left}px ${e.top}px
)`}return(0,K.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),xh=v.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o,align:s,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=No,...g}=e,{store:_}=kc(),y=nh(),b=Vc(!0),x=_.useState(`parent`),S=_.useState(`floatingRootContext`),C=_.useState(`floatingTreeRoot`),w=_.useState(`mounted`),T=_.useState(`open`),E=_.useState(`modal`),D=_.useState(`activeTriggerElement`),O=_.useState(`lastOpenChangeReason`),k=_.useState(`floatingNodeId`),A=_.useState(`floatingParentNodeId`),j=n,M=c,N=l,P=s;x.type===`context-menu`&&(j=n??x.context?.anchor,P??=`start`,!o&&P!==`center`&&(N=e.alignOffset??2,M=e.sideOffset??-5));let F=o,I=P;x.type===`menu`?(F??=`inline-end`,I??=`start`):x.type===`menubar`&&(F??=`bottom`,I??=`start`);let L=x.type===`context-menu`,R=mh({anchor:j,floatingRootContext:S,positionMethod:b?`fixed`:r,mounted:w,side:F,sideOffset:M,align:I,alignOffset:N,arrowPadding:L?0:f,collisionBoundary:u,collisionPadding:d,sticky:p,nodeId:k,keepMounted:y,disableAnchorTracking:m,collisionAvoidance:h,shiftCrossAxis:L,externalTree:C}),z=v.useMemo(()=>{let e={};return T||(e.pointerEvents=`none`),{role:`presentation`,hidden:!w,style:{...R.positionerStyles,...e}}},[T,w,R.positionerStyles]);v.useEffect(()=>{function e(e){e.open?(e.parentNodeId===k&&_.set(`hoverEnabled`,!1),e.nodeId!==k&&e.parentNodeId===_.select(`floatingParentNodeId`)&&_.setOpen(!1,nc($s))):e.parentNodeId===k&&e.reason!==`sibling-open`&&_.set(`hoverEnabled`,!0)}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[_,C.events,k]),v.useEffect(()=>{if(_.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==_.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;_.setOpen(!1,nc(t))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[C.events,_]),v.useEffect(()=>{function e(e){!T||e.nodeId!==_.select(`floatingParentNodeId`)||e.target&&D&&D!==e.target&&_.setOpen(!1,nc($s))}return C.events.on(`itemhover`,e),()=>{C.events.off(`itemhover`,e)}},[C.events,T,D,_]),v.useEffect(()=>{let e={open:T,nodeId:k,parentNodeId:A,reason:_.select(`lastOpenChangeReason`)};C.events.emit(`menuopenchange`,e)},[C.events,T,_,k,A]);let B=v.useMemo(()=>({open:T,side:R.side,align:R.align,anchorHidden:R.anchorHidden,nested:x.type===`menu`}),[T,R.side,R.align,R.anchorHidden,x.type]),ee=v.useMemo(()=>({side:R.side,align:R.align,arrowRef:R.arrowRef,arrowUncentered:R.arrowUncentered,arrowStyles:R.arrowStyles,nodeId:R.context.nodeId}),[R.side,R.align,R.arrowRef,R.arrowUncentered,R.arrowStyles,R.context.nodeId]),V=Io(`div`,e,{state:B,stateAttributesMapping:zc,ref:[t,_.useStateSetter(`positionerElement`)],props:[z,g]}),H=w&&x.type!==`menu`&&(x.type!==`menubar`&&E&&O!==`trigger-hover`||x.type===`menubar`&&x.context.modal),te=null;return x.type===`menubar`?te=x.context.contentElement:x.type===void 0&&(te=D),(0,K.jsxs)(Ec.Provider,{value:ee,children:[H&&(0,K.jsx)(bh,{ref:x.type===`context-menu`||x.type===`nested-context-menu`?x.context.internalBackdropRef:null,inert:ih(!T),cutout:te}),(0,K.jsx)(Sd,{id:k,children:(0,K.jsx)(gh,{elementsRef:_.context.itemDomElements,labelsRef:_.context.itemLabels,children:V})})]})}),Sh={},Ch={},wh=``;function Th(e){if(typeof document>`u`)return!1;let t=Pd(e);return Jo(t).innerWidth-t.documentElement.clientWidth>0}function Eh(e){let t=Pd(e),n=t.documentElement,r=t.body,i=es(n)?n:r,a=i.style.overflow;return i.style.overflow=`hidden`,()=>{i.style.overflow=a}}function Dh(e){let t=Pd(e),n=t.documentElement,r=t.body,i=Jo(n),a=0,o=0,s=pc.create(),c=typeof CSS<`u`&&CSS.supports?.(`scrollbar-gutter`,`stable`);if(fl&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let e=i.getComputedStyle(n),t=i.getComputedStyle(r),s=(e.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,Sh={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},wh=n.style.scrollBehavior,Ch={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let l=n.scrollHeight>n.clientHeight,u=n.scrollWidth>n.clientWidth,d=e.overflowY===`scroll`||t.overflowY===`scroll`,f=e.overflowX===`scroll`||t.overflowX===`scroll`,p=Math.max(0,i.innerWidth-n.clientWidth),m=Math.max(0,i.innerHeight-n.clientHeight),h=parseFloat(t.marginTop)+parseFloat(t.marginBottom),g=parseFloat(t.marginLeft)+parseFloat(t.marginRight),_=es(n)?n:r;if(c){n.style.scrollbarGutter=s,_.style.overflowY=`hidden`,_.style.overflowX=`hidden`;return}Object.assign(n.style,{scrollbarGutter:s,overflowY:`hidden`,overflowX:`hidden`}),(l||d)&&(n.style.overflowY=`scroll`),(u||f)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:h||m?`calc(100dvh - ${h+m}px)`:`100dvh`,width:g||p?`calc(100vw - ${g+p}px)`:`100vw`,boxSizing:`border-box`,overflow:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`}function u(){Object.assign(n.style,Sh),Object.assign(r.style,Ch),c||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=wh)}function d(){u(),s.request(l)}return l(),i.addEventListener(`resize`,d),()=>{s.cancel(),u(),typeof i.removeEventListener==`function`&&i.removeEventListener(`resize`,d)}}var Oh=new class{lockCount=0;restore=null;timeoutLock=ol.create();timeoutUnlock=ol.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=Pd(e).documentElement,n=Jo(t).getComputedStyle(t).overflowY;if(n===`hidden`||n===`clip`){this.restore=Ha;return}let r=pl||!Th(e);this.restore=r?Eh(e):Dh(e)}};function kh(e=!0,t=null){Y(()=>{if(e)return Oh.acquire(t)},[e,t])}var Ah=v.createContext(null);function jh(e){let t=v.useContext(Ah);if(t===null&&!e)throw Error(uo(5));return t}function Mh(e){let t=v.useRef(``),n=v.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:v.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n&&e(n,n.pointerType),e(n,t.current),t.current=``},[e]),onPointerDown:n}}function Nh(e){let[t,n]=v.useState(null),r=J((t,r)=>{e||n(r)}),i=v.useCallback(()=>{n(null)},[]),{onClick:a,onPointerDown:o}=Mh(r);return v.useMemo(()=>({openMethod:t,reset:i,triggerProps:{onClick:a,onPointerDown:o}}),[t,i,a,o])}var Ph={...um,disabled:X(e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled),modal:X(e=>(e.parent.type===void 0||e.parent.type===`context-menu`)&&(e.modal??!0)),allowMouseEnter:X(e=>e.parent.type===`menu`?e.parent.store.select(`allowMouseEnter`):e.allowMouseEnter),stickIfOpen:X(e=>e.stickIfOpen),parent:X(e=>e.parent),rootId:X(e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId),activeIndex:X(e=>e.activeIndex),isActive:X((e,t)=>e.activeIndex===t),hoverEnabled:X(e=>e.hoverEnabled),instantType:X(e=>e.instantType),lastOpenChangeReason:X(e=>e.openChangeReason),floatingTreeRoot:X(e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot),floatingNodeId:X(e=>e.floatingNodeId),floatingParentNodeId:X(e=>e.floatingParentNodeId),itemProps:X(e=>e.itemProps),closeDelay:X(e=>e.closeDelay),keyboardEventRelay:X(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)})},Fh=class e extends em{constructor(e){super({...Ih(),...e},{positionerRef:v.createRef(),popupRef:v.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:v.createRef(),beforeContentFocusGuardRef:v.createRef(),onOpenChangeComplete:void 0,triggerElements:new sm},Ph),this.observe(X(e=>e.allowMouseEnter),(e,t)=>{this.state.parent.type===`menu`&&e!==t&&this.state.parent.store.set(`allowMouseEnter`,e)}),this.unsubscribeParentListener=this.observe(`parent`,e=>{if(this.unsubscribeParentListener?.(),e.type===`menu`){this.unsubscribeParentListener=e.store.subscribe(()=>{this.notifyAll()}),this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef;return}e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}static useStore(t,n){return qa(()=>t??new e(n)).current}unsubscribeParentListener=null};function Ih(){return{...lm(),disabled:!1,modal:!0,allowMouseEnter:!0,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new gd,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:Wa,keyboardEventRelay:void 0,closeDelay:0}}var Lh=v.createContext(void 0);function Rh(){return v.useContext(Lh)}function zh(e){let{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,defaultOpen:a=!1,disabled:o=!1,modal:s,loopFocus:c=!0,orientation:l=`vertical`,actionsRef:u,closeParentOnEsc:d=!0,handle:f,triggerId:p,defaultTriggerId:m=null,highlightItemOnHover:h=!0}=e,g=Vc(!0),_=kc(!0),y=jh(!0),b=Rh(),x=v.useMemo(()=>b&&_?{type:`menu`,store:_.store}:y?{type:`menubar`,context:y}:g&&!_?{type:`context-menu`,context:g}:{type:void 0},[g,_,y,b]),S=Fh.useStore(f?.store,{parent:x}),C=S.useState(`floatingTreeRoot`),w=xd(C),T=yd();Y(()=>{g&&!_?S.update({parent:{type:`context-menu`,context:g},floatingNodeId:w,floatingParentNodeId:T}):_&&S.update({floatingNodeId:w,floatingParentNodeId:T})},[g,_,w,T,S]),S.useControlledProp(`open`,n,a),S.useControlledProp(`activeTriggerId`,p,m),S.useContextCallback(`onOpenChangeComplete`,i);let E=S.useState(`open`),D=S.useState(`activeTriggerElement`),O=S.useState(`positionerElement`),k=S.useState(`hoverEnabled`),A=S.useState(`modal`),j=S.useState(`disabled`),M=S.useState(`lastOpenChangeReason`),N=S.useState(`parent`),P=S.useState(`activeIndex`),F=S.useState(`payload`),I=S.useState(`floatingParentNodeId`),L=v.useRef(null),R=I!=null,z;S.useSyncedValues({disabled:o,modal:N.type===void 0?s:void 0,rootId:Wo()});let{openMethod:B,triggerProps:ee,reset:V}=Nh(E);am(S);let{forceUnmount:H}=om(E,S,()=>{S.update({allowMouseEnter:!1,stickIfOpen:!0}),V()}),te=v.useRef(N.type!==`context-menu`),U=sl();v.useEffect(()=>{if(E||(L.current=null),N.type===`context-menu`){if(!E){U.clear(),te.current=!1;return}U.start(500,()=>{te.current=!0})}},[U,E,N.type]),kh(E&&A&&M!==`trigger-hover`&&B!==`touch`,O),Y(()=>{!E&&!k&&S.set(`hoverEnabled`,!0)},[E,k,S]);let W=v.useRef(!0),ne=sl(),re=J((e,t)=>{let n=t.reason;if(E===e&&t.trigger===D||(t.preventUnmountOnClose=()=>{S.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&(t.trigger=D??void 0),r?.(e,t),t.isCanceled))return;let i={open:e,nativeEvent:t.event,reason:t.reason,nested:R};z?.emit(`openchange`,i);let a=t.event;if(e===!1&&a?.type===`click`&&a.pointerType===`touch`&&!W.current)return;if(!e&&P!==null){let e=S.context.itemDomElements.current[P];queueMicrotask(()=>{e?.setAttribute(`tabindex`,`-1`)})}e&&n===`trigger-focus`?(W.current=!1,ne.start(300,()=>{W.current=!0})):(W.current=!0,ne.clear());let o=(n===`trigger-press`||n===`item-press`)&&a.detail===0&&a?.isTrusted,s=!e&&(n===`escape-key`||n==null);function c(){let r={open:e,openChangeReason:n};L.current=t.event??null;let i=t.trigger?.id??null;(i||e)&&(r.activeTriggerId=i,r.activeTriggerElement=t.trigger??null),S.update(r)}n===`trigger-hover`?As.flushSync(c):c(),N.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?S.set(`instantType`,`group`):o||s?S.set(`instantType`,o?`click`:`dismiss`):S.set(`instantType`,void 0)}),ie=v.useCallback(e=>{let t=nc(e);return t.preventUnmountOnClose=()=>{S.set(`preventUnmountingOnClose`,!0)},t},[S]),ae=v.useCallback(()=>{S.setOpen(!1,ie(tc))},[S,ie]);v.useImperativeHandle(u,()=>({unmount:H,close:ae}),[H,ae]);let oe;N.type===`context-menu`&&(oe=N.context),v.useImperativeHandle(oe?.positionerRef,()=>O,[O]),v.useImperativeHandle(oe?.actionsRef,()=>({setOpen:re}),[re]);let se=pm({popupStore:S,onOpenChange:re});z=se.context.events,v.useEffect(()=>{let e=({open:e,eventDetails:t})=>re(e,t);return z.on(`setOpen`,e),()=>{z?.off(`setOpen`,e)}},[z,re]);let ce=Cp(se,{enabled:!j,bubbles:d&&N.type===`menu`,outsidePress(){return N.type!==`context-menu`||L.current?.type===`contextmenu`||te.current},externalTree:R?C:void 0}),le=Lm(se,{role:`menu`}),ue=oh(),de=v.useCallback(e=>{S.select(`activeIndex`)!==e&&S.set(`activeIndex`,e)},[S]),fe=Fm(se,{enabled:!j,listRef:S.context.itemDomElements,activeIndex:P,nested:N.type!==void 0,loopFocus:c,orientation:l,parentOrientation:N.type===`menubar`?N.context.orientation:void 0,rtl:ue===`rtl`,disabledIndices:Ua,onNavigate:de,openOnArrowKeyDown:N.type!==`context-menu`,externalTree:R?C:void 0,focusItemOnHover:h}),pe=v.useCallback(e=>{S.context.typingRef.current=e},[S]),{getReferenceProps:me,getFloatingProps:he,getItemProps:ge,getTriggerProps:_e}=Em([ce,le,fe,Rm(se,{listRef:S.context.itemLabels,activeIndex:P,resetMs:500,onMatch:e=>{E&&e!==P&&S.set(`activeIndex`,e)},onTypingChange:pe})]),ve=v.useMemo(()=>{let e=bo(me(),{onMouseEnter(){S.set(`hoverEnabled`,!0)},onMouseMove(){S.set(`allowMouseEnter`,!0)}},ee);return delete e.role,e},[me,S,ee]),ye=v.useMemo(()=>{let e=_e();if(!e)return e;let{role:t,"aria-controls":n,...r}=e;return r},[_e]),be=mc(),xe=v.useMemo(()=>he({onMouseEnter(){N.type===`menu`&&be.request(()=>S.set(`hoverEnabled`,!1))},onMouseMove(){S.set(`allowMouseEnter`,!0)},onClick(){S.select(`hoverEnabled`)&&S.set(`hoverEnabled`,!1)},onKeyDown(e){let t=S.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}}),[he,N.type,be,S]),Se=v.useMemo(()=>ge(),[ge]);S.useSyncedValues({floatingRootContext:se,activeTriggerProps:ve,inactiveTriggerProps:ye,popupProps:xe,itemProps:Se});let Ce=v.useMemo(()=>({store:S,parent:x}),[S,x]),we=(0,K.jsx)(Oc.Provider,{value:Ce,children:typeof t==`function`?t({payload:F}):t});return N.type===void 0||N.type===`context-menu`?(0,K.jsx)(Cd,{externalTree:C,children:we}):we}function Bh(e){let{closeParentOnEsc:t=!1}=e,n=kc().store,r=v.useMemo(()=>({parentMenu:n}),[n]);return(0,K.jsx)(Lh.Provider,{value:r,children:(0,K.jsx)(zh,{...e,closeParentOnEsc:t})})}function Vh(e){let t=e.getBoundingClientRect(),n=window.getComputedStyle(e,`::before`),r=window.getComputedStyle(e,`::after`);if(!(n.content!==`none`||r.content!==`none`))return t;let i=parseFloat(n.width)||0,a=parseFloat(n.height)||0,o=parseFloat(r.width)||0,s=parseFloat(r.height)||0,c=Math.max(t.width,i,o),l=Math.max(t.height,a,s),u=c-t.width,d=l-t.height;return{left:t.left-u/2,right:t.right+u/2,top:t.top-d/2,bottom:t.bottom+d/2}}function Hh(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=ys(),{ref:i,index:a}=Yc(e),o=n===a,s=v.useRef(null),c=Qa(i,s);return{compositeProps:v.useMemo(()=>({tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}}),[o,r,a,t]),compositeRef:c,index:a}}function Uh(e){let{render:t,className:n,state:r=Wa,props:i=Ua,refs:a=Ua,metadata:o,stateAttributesMapping:s,tag:c=`div`,...l}=e,{compositeProps:u,compositeRef:d}=Hh({metadata:o});return Io(c,e,{state:r,ref:[...a,d],props:[u,...i,l],stateAttributesMapping:s})}function Wh(e){if(Qo(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`)??void 0;if(!ds(e))return Wh(ms(e))}function Gh(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=v.useRef(!1);return v.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,Pd(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:Wa,[t,n,r])}var Kh=2,qh=v.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,id:o,openOnHover:s,delay:c=100,closeDelay:l=0,handle:u,payload:d,...f}=e,p=kc(!0),m=u?.store??p?.store;if(!m)throw Error(uo(85));let h=Go(o),g=m.useState(`isTriggerActive`,h),_=m.useState(`floatingRootContext`),y=m.useState(`isOpenedByTrigger`,h),b=v.useRef(null),x=Yh(),S=ys(!0),C=bd(),w=v.useMemo(()=>C??new gd,[C]),{registerTrigger:T,isMountedByThisTrigger:E}=im(h,b,m,{payload:d,closeDelay:l,parent:x,floatingTreeRoot:w,floatingNodeId:xd(w),floatingParentNodeId:yd(),keyboardEventRelay:S?.relayKeyboardEvent}),D=m.useState(`disabled`),O=i||D||x.type===`menubar`&&x.context.disabled,{getButtonProps:k,buttonRef:A}=xs({disabled:O,native:a});v.useEffect(()=>{!y&&x.type===void 0&&(m.context.allowMouseUpTriggerRef.current=!1)},[m,y,x.type]);let j=v.useRef(null),M=sl(),N=J(e=>{if(!j.current)return;M.clear(),m.context.allowMouseUpTriggerRef.current=!1;let t=e.target;if(Ol(j.current,t)||Ol(m.select(`positionerElement`),t)||t===j.current||t!=null&&Wh(t)===m.select(`rootId`))return;let n=Vh(j.current);e.clientX>=n.left-Kh&&e.clientX<=n.right+Kh&&e.clientY>=n.top-Kh&&e.clientY<=n.bottom+Kh||w.events.emit(`close`,{domEvent:e,reason:Qs})});v.useEffect(()=>{y&&m.select(`lastOpenChangeReason`)===`trigger-hover`&&Pd(j.current).addEventListener(`mouseup`,N,{once:!0})},[y,N,m]);let P=x.type===`menubar`&&x.context.hasSubmenuOpen,F=Tm(_,{enabled:(s??P??!1)&&!O&&x.type!==`context-menu`&&(x.type!==`menubar`||P&&!E),handleClose:Vm({blockPointerEvents:x.type!==`menubar`}),mouseOnly:!0,move:!1,restMs:x.type===void 0?c:void 0,delay:{close:l},triggerElementRef:b,externalTree:w,isActiveTrigger:g}),I=Jh(y,m.select(`lastOpenChangeReason`)),L=lf(_,{enabled:!O&&x.type!==`context-menu`,event:y&&x.type===`menubar`?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:x.type===void 0&&I}),R=hm(_,{enabled:!O&&(x.type!==`menubar`&&y||P)}),z=Gh({open:y,enabled:x.type===`menubar`,mouseDownAction:`open`}),B=Em([L,R]),ee=x.type===`menubar`,V=v.useMemo(()=>({disabled:O,open:y}),[O,y]),H=m.useState(`triggerProps`,E),te=[j,t,A,T,b],U=[B.getReferenceProps(),F??Wa,H,{"aria-haspopup":`menu`,id:h,onMouseDown:e=>{m.select(`open`)||(M.start(200,()=>{m.context.allowMouseUpTriggerRef.current=!0}),Pd(e.currentTarget).addEventListener(`mouseup`,N,{once:!0}))}},ee?{role:`menuitem`}:{},z,f,k],W=v.useRef(null),ne=J(e=>{As.flushSync(()=>{m.setOpen(!1,nc(qs,e.nativeEvent,e.currentTarget))}),dd(W.current)?.focus()}),re=J(e=>{let t=m.select(`positionerElement`);if(t&&fd(e,t))m.context.beforeContentFocusGuardRef.current?.focus();else{As.flushSync(()=>{m.setOpen(!1,nc(qs,e.nativeEvent,e.currentTarget))});let n=ud(b.current);for(;n!==null&&Ol(t,n)||n?.hasAttribute(`aria-hidden`);){let e=n;if(n=sd(n),n===e)break}n?.focus()}}),ie=Io(`button`,e,{enabled:!ee,stateAttributesMapping:Rc,state:V,ref:te,props:U});return ee?(0,K.jsx)(Uh,{tag:`button`,render:n,className:r,state:V,refs:te,props:U,stateAttributesMapping:Rc}):y?(0,K.jsxs)(v.Fragment,{children:[(0,K.jsx)(Fd,{ref:W,onFocus:ne},`${h}-pre-focus-guard`),(0,K.jsx)(v.Fragment,{children:ie},h),(0,K.jsx)(Fd,{ref:m.context.triggerFocusTargetRef,onFocus:re},`${h}-post-focus-guard`)]}):(0,K.jsx)(v.Fragment,{children:ie},h)});function Jh(e,t){let n=sl(),[r,i]=v.useState(!1);return Y(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function Yh(){let e=Vc(!0),t=kc(!0),n=jh(!0);return v.useMemo(()=>n?{type:`menubar`,context:n}:e&&!t?{type:`context-menu`,context:e}:{type:void 0},[e,t,n])}var Xh=v.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,...a}=e;return Io(`div`,e,{state:v.useMemo(()=>({orientation:i}),[i]),ref:t,props:[{role:`separator`,"aria-orientation":i},a]})}),Zh=v.forwardRef(function(e,t){let{render:n,className:r,label:i,id:a,nativeButton:o=!1,openOnHover:s=!0,delay:c=100,closeDelay:l=0,disabled:u=!1,...d}=e,f=Yc(),p=Dc(),{store:m}=kc(),h=Go(a),g=m.useState(`open`),_=m.useState(`floatingRootContext`),y=m.useState(`floatingTreeRoot`),b=rm(h,m),x=v.useCallback(e=>{let t=b(e);return e!==null&&m.select(`open`)&&m.select(`activeTriggerId`)==null&&m.update({activeTriggerId:h,activeTriggerElement:e,closeDelay:l}),t},[b,l,m,h]),S=v.useRef(null),C=v.useCallback(e=>{S.current=e,m.set(`activeTriggerElement`,e)},[m]),w=Rh();if(!w?.parentMenu)throw Error(uo(37));m.useSyncedValue(`closeDelay`,l);let T=w.parentMenu,E=T.useState(`itemProps`),D=T.useState(`isActive`,f.index),O=v.useMemo(()=>({type:`submenu-trigger`,setActive:()=>T.set(`activeIndex`,f.index)}),[T,f.index]),k=m.useState(`disabled`),A=u||k,{getItemProps:j,itemRef:M}=Gc({closeOnClick:!1,disabled:A,highlighted:D,id:h,store:m,nativeButton:o,itemMetadata:O,nodeId:p?.nodeId}),N=m.useState(`hoverEnabled`),P=m.useState(`allowMouseEnter`),F=Tm(_,{enabled:N&&s&&!A,handleClose:Vm({blockPointerEvents:!0}),mouseOnly:!0,move:!0,restMs:P?c:void 0,delay:{open:P?c:10**10,close:l},triggerElementRef:S,externalTree:y}),I=Em([lf(_,{enabled:!A,event:`mousedown`,toggle:!s,ignoreMouse:s,stickIfOpen:!1})]),L=m.useState(`triggerProps`,!0);return delete L.id,Io(`div`,e,{state:v.useMemo(()=>({disabled:A,highlighted:D,open:g}),[A,D,g]),stateAttributesMapping:Lc,props:[I.getReferenceProps(),F,L,E,{tabIndex:g||D?0:-1,onBlur(){D&&T.set(`activeIndex`,null)}},d,j],ref:[t,f.ref,M,x,C]})}),Qh=v.createContext(void 0);function $h(){let e=v.useContext(Qh);if(e===void 0)throw Error(uo(53));return e}var eg=function(e){return e.scrollAreaCornerHeight=`--scroll-area-corner-height`,e.scrollAreaCornerWidth=`--scroll-area-corner-width`,e}({});function tg(e,t,n){if(!e)return 0;let r=getComputedStyle(e),i=n===`x`?`Inline`:`Block`;return n===`x`&&t===`margin`?parseFloat(r[`${t}InlineStart`])*2:parseFloat(r[`${t}${i}Start`])+parseFloat(r[`${t}${i}End`])}var ng=function(e){return e.orientation=`data-orientation`,e.hovering=`data-hovering`,e.scrolling=`data-scrolling`,e.hasOverflowX=`data-has-overflow-x`,e.hasOverflowY=`data-has-overflow-y`,e.overflowXStart=`data-overflow-x-start`,e.overflowXEnd=`data-overflow-x-end`,e.overflowYStart=`data-overflow-y-start`,e.overflowYEnd=`data-overflow-y-end`,e}({}),rg=`base-ui-disable-scrollbar`,ig={className:rg,element:(0,K.jsx)(`style`,{href:rg,precedence:`base-ui:low`,children:`.${rg}{scrollbar-width:none}.${rg}::-webkit-scrollbar{display:none}`})},ag=function(e){return e.hasOverflowX=`data-has-overflow-x`,e.hasOverflowY=`data-has-overflow-y`,e.overflowXStart=`data-overflow-x-start`,e.overflowXEnd=`data-overflow-x-end`,e.overflowYStart=`data-overflow-y-start`,e.overflowYEnd=`data-overflow-y-end`,e}({}),og={hasOverflowX:e=>e?{[ag.hasOverflowX]:``}:null,hasOverflowY:e=>e?{[ag.hasOverflowY]:``}:null,overflowXStart:e=>e?{[ag.overflowXStart]:``}:null,overflowXEnd:e=>e?{[ag.overflowXEnd]:``}:null,overflowYStart:e=>e?{[ag.overflowYStart]:``}:null,overflowYEnd:e=>e?{[ag.overflowYEnd]:``}:null,cornerHidden:()=>null},sg={width:0,height:0},cg={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},lg=v.forwardRef(function(e,t){let{render:n,className:r,overflowEdgeThreshold:i,...a}=e,[o,s]=v.useState(!1),[c,l]=v.useState(!1),[u,d]=v.useState(!1),[f,p]=v.useState(sg),[m,h]=v.useState(sg),[g,_]=v.useState(!1),[y,b]=v.useState(cg),x=Go(),S=v.useRef(null),C=v.useRef(null),w=v.useRef(null),T=v.useRef(null),E=v.useRef(null),D=v.useRef(null),O=v.useRef(null),k=v.useRef(!1),A=v.useRef(0),j=v.useRef(0),M=v.useRef(0),N=v.useRef(0),P=v.useRef(`vertical`),F=sl(),I=sl(),L=v.useRef({x:0,y:0}),[R,z]=v.useState({scrollbarYHidden:!1,scrollbarXHidden:!1,cornerHidden:!1}),B=ug(i),ee=J(e=>{let t=e.x-L.current.x,n=e.y-L.current.y;L.current=e,n!==0&&(d(!0),F.start(500,()=>{d(!1)})),t!==0&&(l(!0),I.start(500,()=>{l(!1)}))}),V=J(e=>{e.button===0&&(k.current=!0,A.current=e.clientY,j.current=e.clientX,P.current=e.currentTarget.getAttribute(ng.orientation),C.current&&(M.current=C.current.scrollTop,N.current=C.current.scrollLeft),E.current&&P.current===`vertical`&&E.current.setPointerCapture(e.pointerId),D.current&&P.current===`horizontal`&&D.current.setPointerCapture(e.pointerId))}),H=J(e=>{if(!k.current)return;let t=e.clientY-A.current,n=e.clientX-j.current;if(C.current){let r=C.current.scrollHeight,i=C.current.clientHeight,a=C.current.scrollWidth,o=C.current.clientWidth;if(E.current&&w.current&&P.current===`vertical`){let n=tg(w.current,`padding`,`y`),a=tg(E.current,`margin`,`y`),o=E.current.offsetHeight,s=t/(w.current.offsetHeight-o-n-a);C.current.scrollTop=M.current+s*(r-i),e.preventDefault(),d(!0),F.start(500,()=>{d(!1)})}if(D.current&&T.current&&P.current===`horizontal`){let t=tg(T.current,`padding`,`x`),r=tg(D.current,`margin`,`x`),i=D.current.offsetWidth,s=n/(T.current.offsetWidth-i-t-r);C.current.scrollLeft=N.current+s*(a-o),e.preventDefault(),l(!0),I.start(500,()=>{l(!1)})}}}),te=J(e=>{k.current=!1,E.current&&P.current===`vertical`&&E.current.releasePointerCapture(e.pointerId),D.current&&P.current===`horizontal`&&D.current.releasePointerCapture(e.pointerId)});function U(e){let t=e.pointerType===`touch`;if(_(t),!t){let t=Ol(S.current,e.target);s(t)}}let W=v.useMemo(()=>({hasOverflowX:!R.scrollbarXHidden,hasOverflowY:!R.scrollbarYHidden,overflowXStart:y.xStart,overflowXEnd:y.xEnd,overflowYStart:y.yStart,overflowYEnd:y.yEnd,cornerHidden:R.cornerHidden}),[R.scrollbarXHidden,R.scrollbarYHidden,R.cornerHidden,y]),ne={role:`presentation`,onPointerEnter:U,onPointerMove:U,onPointerDown({pointerType:e}){_(e===`touch`)},onPointerLeave(){s(!1)},style:{position:`relative`,[eg.scrollAreaCornerHeight]:`${f.height}px`,[eg.scrollAreaCornerWidth]:`${f.width}px`}},re=Io(`div`,e,{state:W,ref:[t,S],props:[ne,a],stateAttributesMapping:og}),ie=v.useMemo(()=>({handlePointerDown:V,handlePointerMove:H,handlePointerUp:te,handleScroll:ee,cornerSize:f,setCornerSize:p,thumbSize:m,setThumbSize:h,touchModality:g,cornerRef:O,scrollingX:c,setScrollingX:l,scrollingY:u,setScrollingY:d,hovering:o,setHovering:s,viewportRef:C,rootRef:S,scrollbarYRef:w,scrollbarXRef:T,thumbYRef:E,thumbXRef:D,rootId:x,hiddenState:R,setHiddenState:z,overflowEdges:y,setOverflowEdges:b,viewportState:W,overflowEdgeThreshold:B}),[V,H,te,ee,f,m,g,O,c,l,u,d,o,s,C,S,w,T,E,D,x,R,y,W,B]);return(0,K.jsxs)(Qh.Provider,{value:ie,children:[ig.element,re]})});function ug(e){if(typeof e==`number`){let t=Math.max(0,e);return{xStart:t,xEnd:t,yStart:t,yEnd:t}}return{xStart:Math.max(0,e?.xStart||0),xEnd:Math.max(0,e?.xEnd||0),yStart:Math.max(0,e?.yStart||0),yEnd:Math.max(0,e?.yEnd||0)}}var dg=v.createContext(void 0);function fg(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}function pg(e,t){if(typeof IntersectionObserver>`u`)return()=>{};let n=new IntersectionObserver(e=>{e.forEach(e=>{e.intersectionRatio>0&&(t(),n.disconnect())})});return n.observe(e),()=>{n.disconnect()}}var mg=function(e){return e.scrollAreaOverflowXStart=`--scroll-area-overflow-x-start`,e.scrollAreaOverflowXEnd=`--scroll-area-overflow-x-end`,e.scrollAreaOverflowYStart=`--scroll-area-overflow-y-start`,e.scrollAreaOverflowYEnd=`--scroll-area-overflow-y-end`,e}({}),hg=!1;function gg(){hg||fl||(typeof CSS<`u`&&`registerProperty`in CSS&&[mg.scrollAreaOverflowXStart,mg.scrollAreaOverflowXEnd,mg.scrollAreaOverflowYStart,mg.scrollAreaOverflowYEnd].forEach(e=>{try{CSS.registerProperty({name:e,syntax:`<length>`,inherits:!1,initialValue:`0px`})}catch{}}),hg=!0)}var _g=v.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{viewportRef:a,scrollbarYRef:o,scrollbarXRef:s,thumbYRef:c,thumbXRef:l,cornerRef:u,setCornerSize:d,setThumbSize:f,rootId:p,setHiddenState:m,hiddenState:h,handleScroll:g,setHovering:_,setOverflowEdges:y,overflowEdges:b,overflowEdgeThreshold:x}=$h(),S=oh(),C=v.useRef(!0),w=sl(),T=sl();function E(){let e=a.current,t=o.current,n=s.current,r=c.current,i=l.current,p=u.current;if(!e)return;let h=e.scrollHeight,g=e.scrollWidth,_=e.clientHeight,v=e.clientWidth,b=e.scrollTop,C=e.scrollLeft;if(h===0||g===0)return;let w=_>=h,T=v>=g,E=v/g,D=_/h,O=Math.max(0,g-v),k=Math.max(0,h-_),A=0,j=0;T||(A=fg(S===`rtl`?-C:C,0,O),j=O-A);let M=w?0:fg(b,0,k),N=w?0:k-M,P=T?0:v,F=w?0:_,I=tg(n,`padding`,`x`),L=tg(t,`padding`,`y`),R=tg(i,`margin`,`x`),z=tg(r,`margin`,`y`),B=P-I-R,ee=F-L-z,V=n?Math.min(n.offsetWidth,B):B,H=t?Math.min(t.offsetHeight,ee):ee,te=Math.max(16,V*E),U=Math.max(16,H*D);if(f(e=>e.height===U&&e.width===te?e:{width:te,height:U}),t&&r){let e=t.offsetHeight-U-L-z,n=h-_,i=n===0?0:b/n,a=Math.min(e,Math.max(0,i*e));r.style.transform=`translate3d(0,${a}px,0)`}if(n&&i){let e=n.offsetWidth-te-I-R,t=g-v,r=t===0?0:C/t,a=S===`rtl`?fg(r*e,-e,0):fg(r*e,0,e);i.style.transform=`translate3d(${a}px,0,0)`}let W=fg(A,0,O),ne=fg(j,0,O),re=fg(M,0,k),ie=fg(N,0,k),ae=[[mg.scrollAreaOverflowXStart,W],[mg.scrollAreaOverflowXEnd,ne],[mg.scrollAreaOverflowYStart,re],[mg.scrollAreaOverflowYEnd,ie]];for(let[t,n]of ae)e.style.setProperty(t,`${n}px`);if(p){if(T||w)d({width:0,height:0});else if(!T&&!w){let e=t?.offsetWidth||0,r=n?.offsetHeight||0;d({width:e,height:r})}}m(e=>{let t=w||T;return e.scrollbarYHidden===w&&e.scrollbarXHidden===T&&e.cornerHidden===t?e:{scrollbarYHidden:w,scrollbarXHidden:T,cornerHidden:t}});let oe={xStart:!T&&W>x.xStart,xEnd:!T&&ne>x.xEnd,yStart:!w&&re>x.yStart,yEnd:!w&&ie>x.yEnd};y(e=>e.xStart===oe.xStart&&e.xEnd===oe.xEnd&&e.yStart===oe.yStart&&e.yEnd===oe.yEnd?e:oe)}let D=J(()=>{As.flushSync(E)});Y(()=>{if(a.current)return gg(),pg(a.current,D)},[D,a]),Y(()=>{queueMicrotask(D)},[D,h,S]),Y(()=>{a.current?.matches(`:hover`)&&_(!0)},[a,_]),v.useEffect(()=>{let e=a.current;if(typeof ResizeObserver>`u`||!e)return;let t=new ResizeObserver(D);return t.observe(e),T.start(0,()=>{Promise.all(e.getAnimations({subtree:!0}).map(e=>e.finished)).then(D).catch(()=>{})}),()=>{t.disconnect(),T.clear()}},[D,a,T]);function O(){C.current=!1}let k={role:`presentation`,...p&&{"data-id":`${p}-viewport`},...(!h.scrollbarXHidden||!h.scrollbarYHidden)&&{tabIndex:0},className:ig.className,style:{overflow:`scroll`},onScroll(){a.current&&(D(),C.current||g({x:a.current.scrollLeft,y:a.current.scrollTop}),w.start(100,()=>{C.current=!0}))},onWheel:O,onTouchMove:O,onPointerMove:O,onPointerEnter:O,onKeyDown:O},A=v.useMemo(()=>({hasOverflowX:!h.scrollbarXHidden,hasOverflowY:!h.scrollbarYHidden,overflowXStart:b.xStart,overflowXEnd:b.xEnd,overflowYStart:b.yStart,overflowYEnd:b.yEnd,cornerHidden:h.cornerHidden}),[h.scrollbarXHidden,h.scrollbarYHidden,h.cornerHidden,b]),j=Io(`div`,e,{ref:[t,a],state:A,props:[k,i],stateAttributesMapping:og}),M=v.useMemo(()=>({computeThumbPosition:D}),[D]);return(0,K.jsx)(dg.Provider,{value:M,children:j})}),vg=v.createContext(void 0);function yg(){let e=v.useContext(vg);if(e===void 0)throw Error(uo(54));return e}var bg=function(e){return e.scrollAreaThumbHeight=`--scroll-area-thumb-height`,e.scrollAreaThumbWidth=`--scroll-area-thumb-width`,e}({}),xg=v.forwardRef(function(e,t){let{render:n,className:r,orientation:i=`vertical`,keepMounted:a=!1,...o}=e,{hovering:s,scrollingX:c,scrollingY:l,hiddenState:u,overflowEdges:d,scrollbarYRef:f,scrollbarXRef:p,viewportRef:m,thumbYRef:h,thumbXRef:g,handlePointerDown:_,handlePointerUp:y,rootId:b,thumbSize:x}=$h(),S=v.useMemo(()=>({hovering:s,scrolling:{horizontal:c,vertical:l}[i],orientation:i,hasOverflowX:!u.scrollbarXHidden,hasOverflowY:!u.scrollbarYHidden,overflowXStart:d.xStart,overflowXEnd:d.xEnd,overflowYStart:d.yStart,overflowYEnd:d.yEnd,cornerHidden:u.cornerHidden}),[s,c,l,i,u,d]),C=oh();v.useEffect(()=>{let e=m.current,t=i===`vertical`?f.current:p.current;if(!t)return;function n(n){if(!(!e||!t||n.ctrlKey)){if(n.preventDefault(),i===`vertical`){if(e.scrollTop===0&&n.deltaY<0)return}else if(e.scrollLeft===0&&n.deltaX<0)return;if(i===`vertical`){if(e.scrollTop===e.scrollHeight-e.clientHeight&&n.deltaY>0)return}else if(e.scrollLeft===e.scrollWidth-e.clientWidth&&n.deltaX>0)return;i===`vertical`?e.scrollTop+=n.deltaY:e.scrollLeft+=n.deltaX}}return t.addEventListener(`wheel`,n,{passive:!1}),()=>{t.removeEventListener(`wheel`,n)}},[i,p,f,m]);let w={...b&&{"data-id":`${b}-scrollbar`},onPointerDown(e){if(e.button===0&&e.currentTarget===e.target&&m.current){if(h.current&&f.current&&i===`vertical`){let t=tg(h.current,`margin`,`y`),n=tg(f.current,`padding`,`y`),r=h.current.offsetHeight,i=f.current.getBoundingClientRect(),a=e.clientY-i.top-r/2-n+t/2,o=m.current.scrollHeight,s=m.current.clientHeight,c=a/(f.current.offsetHeight-r-n-t)*(o-s);m.current.scrollTop=c}if(g.current&&p.current&&i===`horizontal`){let t=tg(g.current,`margin`,`x`),n=tg(p.current,`padding`,`x`),r=g.current.offsetWidth,i=p.current.getBoundingClientRect(),a=e.clientX-i.left-r/2-n+t/2,o=m.current.scrollWidth,s=m.current.clientWidth,c=a/(p.current.offsetWidth-r-n-t),l;C===`rtl`?(l=(1-c)*(o-s),m.current.scrollLeft<=0&&(l=-l)):l=c*(o-s),m.current.scrollLeft=l}_(e)}},onPointerUp:y,style:{position:`absolute`,touchAction:`none`,WebkitUserSelect:`none`,userSelect:`none`,...i===`vertical`&&{top:0,bottom:`var(${eg.scrollAreaCornerHeight})`,insetInlineEnd:0,[bg.scrollAreaThumbHeight]:`${x.height}px`},...i===`horizontal`&&{insetInlineStart:0,insetInlineEnd:`var(${eg.scrollAreaCornerWidth})`,bottom:0,[bg.scrollAreaThumbWidth]:`${x.width}px`}}},T=Io(`div`,e,{ref:[t,i===`vertical`?f:p],state:S,props:[w,o],stateAttributesMapping:og}),E=v.useMemo(()=>({orientation:i}),[i]),D=i===`vertical`?u.scrollbarYHidden:u.scrollbarXHidden;return a||!D?(0,K.jsx)(vg.Provider,{value:E,children:T}):null}),Sg=v.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{thumbYRef:a,thumbXRef:o,handlePointerDown:s,handlePointerMove:c,handlePointerUp:l,setScrollingX:u,setScrollingY:d}=$h(),{orientation:f}=yg(),p=v.useMemo(()=>({orientation:f}),[f]);return Io(`div`,e,{ref:[t,f===`vertical`?a:o],state:p,props:[{onPointerDown:s,onPointerMove:c,onPointerUp(e){f===`vertical`&&d(!1),f===`horizontal`&&u(!1),l(e)},style:{...f===`vertical`&&{height:`var(${bg.scrollAreaThumbHeight})`},...f===`horizontal`&&{width:`var(${bg.scrollAreaThumbWidth})`}}},i]})}),Cg=v.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{cornerRef:a,cornerSize:o,hiddenState:s}=$h(),c=Io(`div`,e,{ref:[t,a],props:[{style:{position:`absolute`,bottom:0,insetInlineEnd:0,width:o.width,height:o.height}},i]});return s.cornerHidden?null:c});function wg({className:e,children:t,viewportRef:n,viewportClassName:r,...i}){return(0,K.jsxs)(lg,{"data-slot":`scroll-area`,className:G(`relative`,e),...i,children:[(0,K.jsx)(_g,{ref:n,"data-slot":`scroll-area-viewport`,className:G(`w-full rounded-[inherit] outline-none`,r??`h-full`),children:t}),(0,K.jsx)(Tg,{}),(0,K.jsx)(Cg,{})]})}function Tg({className:e,...t}){return(0,K.jsx)(xg,{"data-slot":`scroll-area-scrollbar`,orientation:`vertical`,className:G(`flex h-full w-2.5 touch-none select-none border-l border-l-transparent p-px`,e),...t,children:(0,K.jsx)(Sg,{"data-slot":`scroll-area-thumb`,className:`relative flex-1 rounded-full bg-muted-foreground/40 transition-colors hover:bg-muted-foreground/70`})})}var Eg=`min-w-[13rem] rounded-md border border-[var(--color-border)] bg-[var(--color-card)] text-[var(--color-card-foreground)] shadow-md outline-none`;function Dg({children:e}){return(0,K.jsx)(wg,{viewportClassName:`max-h-[var(--available-height)]`,children:(0,K.jsx)(`div`,{className:`p-1`,children:e})})}var Og=`relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none data-[highlighted]:bg-[var(--color-accent)] data-[highlighted]:text-[var(--color-accent-foreground)] data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,kg=zh,Ag=nl,jg=Bh,Mg=`data-[popup-open]:bg-[var(--color-accent)] data-[popup-open]:text-[var(--color-accent-foreground)]`;function Ng({className:e,...t}){return(0,K.jsx)(qh,{className:typeof e==`function`?e:G(Mg,e),...t})}function Pg({className:e,sideOffset:t=6,align:n=`start`,children:r,...i}){return(0,K.jsx)(rh,{children:(0,K.jsx)(xh,{sideOffset:t,align:n,className:`z-50 outline-none`,children:(0,K.jsx)(eh,{className:G(Eg,e),...i,children:(0,K.jsx)(Dg,{children:r})})})})}function Fg({className:e,...t}){return(0,K.jsx)(il,{className:G(Og,e),...t})}function Ig({className:e,children:t,closeOnClick:n=!1,...r}){return(0,K.jsxs)(Qc,{className:G(Og,e),closeOnClick:n,...r,children:[(0,K.jsx)(`span`,{className:`mt-0.5 flex h-3.5 w-3.5 shrink-0 items-center justify-center`,children:(0,K.jsx)($c,{children:(0,K.jsx)(vi,{className:`h-3.5 w-3.5`})})}),t]})}function Lg({className:e,children:t,...n}){return(0,K.jsxs)(Zh,{className:G(Og,`data-[popup-open]:bg-[var(--color-accent)]`,e),...n,children:[t,(0,K.jsx)(bi,{className:`ml-auto h-3.5 w-3.5 shrink-0 opacity-70`})]})}function Rg({className:e,children:t,...n}){return(0,K.jsx)(rh,{children:(0,K.jsx)(xh,{side:`right`,align:`start`,sideOffset:2,className:`z-50 outline-none`,children:(0,K.jsx)(eh,{className:G(Eg,e),...n,children:(0,K.jsx)(Dg,{children:t})})})})}function zg({className:e,...t}){return(0,K.jsx)(Xh,{className:G(`-mx-1 my-1 h-px bg-[var(--color-border)]`,e),...t})}function Bg({className:e,...t}){return(0,K.jsx)(rl,{className:G(`px-2 py-1.5 text-xs font-semibold text-[var(--color-muted-foreground)]`,e),...t})}var Vg=v.createContext(void 0);function Hg(e){let t=v.useContext(Vg);if(t===void 0&&!e)throw Error(uo(72));return t}var Ug={...um,disabled:X(e=>e.disabled),instantType:X(e=>e.instantType),isInstantPhase:X(e=>e.isInstantPhase),trackCursorAxis:X(e=>e.trackCursorAxis),disableHoverablePopup:X(e=>e.disableHoverablePopup),lastOpenChangeReason:X(e=>e.openChangeReason),closeDelay:X(e=>e.closeDelay)},Wg=class e extends em{constructor(e){super({...Gg(),...e},{popupRef:v.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:new sm},Ug)}setOpen=(e,t)=>{let n=t.reason,r=n===Bs,i=e&&n===`trigger-focus`,a=!e&&(n===`trigger-press`||n===`escape-key`);if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;let o=()=>{let r={open:e,openChangeReason:n};i?r.instantType=`focus`:a?r.instantType=`dismiss`:n===`trigger-hover`&&(r.instantType=void 0);let o=t.trigger?.id??null;(o||e)&&(r.activeTriggerId=o,r.activeTriggerElement=t.trigger??null),this.update(r)};r?As.flushSync(o):o()};static useStore(t,n){let r=qa(()=>t??new e(n)).current,i=pm({popupStore:r,onOpenChange:r.setOpen});return r.state.floatingRootContext=i,r}};function Gg(){return{...lm(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeDelay:0}}function Kg(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:c,handle:l,triggerId:u,defaultTriggerId:d=null,children:f}=e,p=Wg.useStore(l?.store,{open:r??n,activeTriggerId:u===void 0?d:u});p.useControlledProp(`open`,r,n),p.useControlledProp(`activeTriggerId`,u,d),p.useContextCallback(`onOpenChange`,s),p.useContextCallback(`onOpenChangeComplete`,c);let m=p.useState(`open`),h=p.useState(`activeTriggerId`),g=p.useState(`payload`);p.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i});let _=!t&&m;Y(()=>{m&&t&&p.setOpen(!1,nc(ec))},[m,t,p]),p.useSyncedValue(`disabled`,t),am(p);let{forceUnmount:y,transitionStatus:b}=om(_,p),x=p.useState(`isInstantPhase`),S=p.useState(`instantType`),C=p.useState(`lastOpenChangeReason`),w=v.useRef(null);Y(()=>{b===`ending`&&C===`none`||b!==`ending`&&x?(S!==`delay`&&(w.current=S),p.set(`instantType`,`delay`)):w.current!==null&&(p.set(`instantType`,w.current),w.current=null)},[b,x,C,S,p]),Y(()=>{_&&(h??p.set(`payload`,void 0))},[p,h,_]);let T=v.useCallback(()=>{p.setOpen(!1,qg(p,tc))},[p]);v.useImperativeHandle(o,()=>({unmount:y,close:T}),[y,T]);let E=p.useState(`floatingRootContext`),{getReferenceProps:D,getFloatingProps:O,getTriggerProps:k}=Em([hm(E,{enabled:!t}),Cp(E,{enabled:!t,referencePress:!0}),ff(E,{enabled:!t&&a!==`none`,axis:a===`none`?void 0:a})]),A=v.useMemo(()=>D(),[D]),j=v.useMemo(()=>k(),[k]),M=v.useMemo(()=>O(),[O]);return p.useSyncedValues({floatingRootContext:E,activeTriggerProps:A,inactiveTriggerProps:j,popupProps:M}),(0,K.jsx)(Vg.Provider,{value:p,children:typeof f==`function`?f({payload:g}):f})}function qg(e,t){let n=nc(t);return n.preventUnmountOnClose=()=>{e.set(`preventUnmountingOnClose`,!0)},n}var Jg=v.createContext(void 0);function Yg(){return v.useContext(Jg)}var Xg=v.forwardRef(function(e,t){let{className:n,render:r,handle:i,payload:a,disabled:o,delay:s,closeDelay:c,id:l,...u}=e,d=Hg(!0),f=i?.store??d;if(!f)throw Error(uo(82));let p=Go(l),m=f.useState(`isTriggerActive`,p),h=f.useState(`floatingRootContext`),g=f.useState(`isOpenedByTrigger`,p),_=v.useRef(null),y=s??600,b=c??0,{registerTrigger:x,isMountedByThisTrigger:S}=im(p,_,f,{payload:a,closeDelay:b}),C=Yg(),{delayRef:w,isInstantPhase:T,hasProvider:E}=Nd(h,{open:g});f.useSyncedValue(`isInstantPhase`,T);let D=f.useState(`disabled`),O=o??D,k=f.useState(`trackCursorAxis`),A=f.useState(`disableHoverablePopup`),j=Tm(h,{enabled:!O,mouseOnly:!0,move:!1,handleClose:!A&&k!==`both`?Vm():null,restMs(){let e=C?.delay,t=typeof w.current==`object`?w.current.open:void 0,n=y;return E&&(n=t===0?0:s??e??y),n},delay(){let e=typeof w.current==`object`?w.current.close:void 0,t=b;return c==null&&E&&(t=e),{close:t}},triggerElementRef:_,isActiveTrigger:m}),M=v.useMemo(()=>({open:g}),[g]),N=f.useState(`triggerProps`,S);return Io(`button`,e,{state:M,ref:[t,x,_],props:[j,N,{id:p},u],stateAttributesMapping:Lc})}),Zg=v.createContext(void 0);function Qg(){let e=v.useContext(Zg);if(e===void 0)throw Error(uo(70));return e}var $g=v.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,...o}=e,{portalNode:s,portalSubtree:c}=Xd({container:r,ref:t,componentProps:e,elementProps:o});return!c&&!s?null:(0,K.jsxs)(v.Fragment,{children:[c,s&&As.createPortal(n,s)]})}),e_=v.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return Hg().useState(`mounted`)||n?(0,K.jsx)(Zg.Provider,{value:n,children:(0,K.jsx)($g,{ref:t,...r})}):null}),t_=v.createContext(void 0);function n_(){let e=v.useContext(t_);if(e===void 0)throw Error(uo(71));return e}var r_=v.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=Po,...g}=e,_=Hg(),y=Qg(),b=_.useState(`open`),x=_.useState(`mounted`),S=_.useState(`trackCursorAxis`),C=_.useState(`disableHoverablePopup`),w=_.useState(`floatingRootContext`),T=_.useState(`instantType`),E=_.useState(`transitionStatus`),D=mh({anchor:i,positionMethod:a,floatingRootContext:w,mounted:x,side:o,sideOffset:c,align:s,alignOffset:l,collisionBoundary:u,collisionPadding:d,sticky:p,arrowPadding:f,disableAnchorTracking:m,keepMounted:y,collisionAvoidance:h,adaptiveOrigin:dh}),O=v.useMemo(()=>{let e={};return(!b||S===`both`||C)&&(e.pointerEvents=`none`),{role:`presentation`,hidden:!x,style:{...D.positionerStyles,...e}}},[b,S,C,x,D.positionerStyles]),k=v.useMemo(()=>({open:b,side:D.side,align:D.align,anchorHidden:D.anchorHidden,instant:S===`none`?T:`tracking-cursor`}),[b,D.side,D.align,D.anchorHidden,S,T]),A=v.useMemo(()=>({...k,arrowRef:D.arrowRef,arrowStyles:D.arrowStyles,arrowUncentered:D.arrowUncentered}),[k,D.arrowRef,D.arrowStyles,D.arrowUncentered]),j=Io(`div`,e,{state:k,props:[O,Qm(E),g],ref:[t,_.useStateSetter(`positionerElement`)],stateAttributesMapping:zc});return(0,K.jsx)(t_.Provider,{value:A,children:j})});function i_(e){let t=fs(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Qo(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r;return(Jl(n)!==a||Jl(r)!==o)&&(n=a,r=o),{width:n,height:r}}var a_=typeof ResizeObserver<`u`,o_=()=>!0;function s_(e){let{popupElement:t,positionerElement:n,content:r,mounted:i,enabled:a=o_,onMeasureLayout:o,onMeasureLayoutComplete:s,side:c,direction:l}=e,u=v.useRef(!0),d=gc(t,!0,!1),f=mc(),p=v.useRef(null),m=J(o),h=J(s),g=v.useMemo(()=>{let e=c===`top`,t=c===`left`;return l===`rtl`?(e||=c===`inline-end`,t||=c===`inline-end`):(e||=c===`inline-start`,t||=c===`inline-start`),e?{position:`absolute`,[c===`top`?`bottom`:`top`]:`0`,[t?`right`:`left`]:`0`}:Wa},[c,l]);Y(()=>{if(!i||!a()||!a_){u.current=!0,p.current=null;return}if(!t||!n)return;Object.entries(g).forEach(([e,n])=>{t.style.setProperty(e,n)});let e=new ResizeObserver(e=>{let t=e[0];t&&(p.current===null?p.current={width:Math.ceil(t.borderBoxSize[0].inlineSize),height:Math.ceil(t.borderBoxSize[0].blockSize)}:(p.current.width=Math.ceil(t.borderBoxSize[0].inlineSize),p.current.height=Math.ceil(t.borderBoxSize[0].blockSize)))});e.observe(t),t.style.setProperty(`--popup-width`,`auto`),t.style.setProperty(`--popup-height`,`auto`);let r=c_(t,`position`,`static`),o=c_(t,`transform`,`none`),s=c_(t,`scale`,`1`),c=c_(n,`--available-width`,`max-content`),l=c_(n,`--available-height`,`max-content`);if(m?.(),u.current||p.current===null){n.style.setProperty(`--positioner-width`,`max-content`),n.style.setProperty(`--positioner-height`,`max-content`);let i=i_(t);return n.style.setProperty(`--positioner-width`,`${i.width}px`),n.style.setProperty(`--positioner-height`,`${i.height}px`),r(),o(),s(),c(),l(),h?.(null,i),u.current=!1,()=>{e.disconnect()}}t.style.setProperty(`--popup-width`,`auto`),t.style.setProperty(`--popup-height`,`auto`),n.style.setProperty(`--positioner-width`,`max-content`),n.style.setProperty(`--positioner-height`,`max-content`);let _=i_(t);t.style.setProperty(`--popup-width`,`${p.current.width}px`),t.style.setProperty(`--popup-height`,`${p.current.height}px`),r(),o(),c(),l(),h?.(p.current,_),n.style.setProperty(`--positioner-width`,`${_.width}px`),n.style.setProperty(`--positioner-height`,`${_.height}px`);let v=new AbortController;return f.request(()=>{t.style.setProperty(`--popup-width`,`${_.width}px`),t.style.setProperty(`--popup-height`,`${_.height}px`),d(()=>{t.style.setProperty(`--popup-width`,`auto`),t.style.setProperty(`--popup-height`,`auto`)},v.signal)}),()=>{e.disconnect(),v.abort(),f.cancel()}},[r,t,n,d,f,a,i,m,h,g])}function c_(e,t,n){let r=e.style.getPropertyValue(t);return e.style.setProperty(t,n),()=>{e.style.setProperty(t,r)}}var l_={...zc,...Sc},u_=v.forwardRef(function(e,t){let{className:n,render:r,...i}=e,a=Hg(),{side:o,align:s}=n_(),c=a.useState(`open`),l=a.useState(`mounted`),u=a.useState(`instantType`),d=a.useState(`transitionStatus`),f=a.useState(`popupProps`),p=a.useState(`payload`),m=a.useState(`popupElement`),h=a.useState(`positionerElement`),g=a.useState(`floatingRootContext`),_=oh();_c({open:c,ref:a.context.popupRef,onComplete(){c&&a.context.onOpenChangeComplete?.(!0)}});function y(){g.context.events.emit(`measure-layout`)}function b(e,t){g.context.events.emit(`measure-layout-complete`,{previousDimensions:e,nextDimensions:t})}s_({popupElement:m,positionerElement:h,mounted:l,content:p,enabled:()=>a.context.triggerElements.size>1,onMeasureLayout:y,onMeasureLayoutComplete:b,side:o,direction:_});let x=a.useState(`disabled`),S=a.useState(`closeDelay`);return xm(g,{enabled:!x,closeDelay:S}),Io(`div`,e,{state:v.useMemo(()=>({open:c,side:o,align:s,instant:u,transitionStatus:d}),[c,o,s,u,d]),ref:[t,a.context.popupRef,a.useStateSetter(`popupElement`)],props:[f,Qm(d),i],stateAttributesMapping:l_})}),d_=function(e){let{delay:t,closeDelay:n,timeout:r=400}=e,i=v.useMemo(()=>({delay:t,closeDelay:n}),[t,n]),a=v.useMemo(()=>({open:t,close:n}),[t,n]);return(0,K.jsx)(Jg.Provider,{value:i,children:(0,K.jsx)(Md,{delay:a,timeoutMs:r,children:e.children})})},Z=Kg;function Q(e){return(0,K.jsx)(Xg,{delay:0,...e})}function f_({className:e,sideOffset:t=6,side:n,align:r,children:i,...a}){return(0,K.jsx)(e_,{children:(0,K.jsx)(r_,{className:`z-50`,sideOffset:t,...n?{side:n}:{},...r?{align:r}:{},children:(0,K.jsx)(u_,{role:`tooltip`,className:G(`rounded-md border border-border bg-card px-2 py-1 text-xs text-card-foreground shadow-md`,e),...a,children:i})})})}function p_(e){switch(e){case`data-sync`:return`The data branch is not syncing`}}function m_({errors:e}){return!e||e.length===0?null:(0,K.jsx)(`div`,{className:`flex flex-col gap-2 border-b border-danger/30 bg-danger/10 px-4 py-3`,children:e.map(e=>(0,K.jsxs)(`div`,{role:`alert`,className:`flex items-start gap-2 text-sm`,children:[(0,K.jsx)(la,{className:`mt-0.5 h-4 w-4 shrink-0 text-danger`,"aria-hidden":!0}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`p`,{className:`font-medium text-danger`,children:[p_(e.code),(0,K.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[` · since `,Ta(e.since)]})]}),(0,K.jsx)(`p`,{className:`break-words text-muted-foreground`,children:e.message})]})]},e.code))})}function h_(e){return Io(e.defaultTagName??`div`,e,e)}function g_({className:e,type:t,...n}){return(0,K.jsx)(`input`,{type:t,"data-slot":`input`,className:G(`flex h-9 w-full min-w-0 rounded-md border border-border bg-transparent px-3 py-1 text-sm shadow-sm outline-none transition-colors`,`placeholder:text-muted-foreground focus-visible:ring-2 focus-visible:ring-[var(--color-primary)]`,`disabled:cursor-not-allowed disabled:opacity-50`,e),...n})}function __({className:e,orientation:t=`horizontal`,...n}){return(0,K.jsx)(Xh,{orientation:t,"data-slot":`separator`,className:G(`shrink-0 bg-border`,t===`horizontal`?`h-px w-full`:`h-full w-px`,e),...n})}var v_=v.createContext(void 0);function y_(e){let t=v.useContext(v_);if(e===!1&&t===void 0)throw Error(uo(27));return t}var b_={...zc,...Sc},x_=v.forwardRef(function(e,t){let{render:n,className:r,forceRender:i=!1,...a}=e,{store:o}=y_(),s=o.useState(`open`),c=o.useState(`nested`),l=o.useState(`mounted`),u=o.useState(`transitionStatus`);return Io(`div`,e,{state:v.useMemo(()=>({open:s,transitionStatus:u}),[s,u]),ref:[o.context.backdropRef,t],stateAttributesMapping:b_,props:[{role:`presentation`,hidden:!l,style:{userSelect:`none`,WebkitUserSelect:`none`}},a],enabled:i||!c})}),S_=v.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,...o}=e,{store:s}=y_(),c=s.useState(`open`);function l(e){c&&s.setOpen(!1,nc(Ws,e.nativeEvent))}let{getButtonProps:u,buttonRef:d}=xs({disabled:i,native:a});return Io(`button`,e,{state:v.useMemo(()=>({disabled:i}),[i]),ref:[t,d],props:[{onClick:l},o,u]})}),C_=v.forwardRef(function(e,t){let{render:n,className:r,id:i,...a}=e,{store:o}=y_(),s=Go(i);return o.useSyncedValueWithCleanup(`descriptionElementId`,s),Io(`p`,e,{ref:t,props:[{id:s},a]})}),w_=function(e){return e.nestedDialogs=`--nested-dialogs`,e}({}),T_=function(e){return e[e.open=Ac.open]=`open`,e[e.closed=Ac.closed]=`closed`,e[e.startingStyle=Ac.startingStyle]=`startingStyle`,e[e.endingStyle=Ac.endingStyle]=`endingStyle`,e.nested=`data-nested`,e.nestedDialogOpen=`data-nested-dialog-open`,e}({}),E_=v.createContext(void 0);function D_(){let e=v.useContext(E_);if(e===void 0)throw Error(uo(26));return e}var O_={...zc,...Sc,nestedDialogOpen(e){return e?{[T_.nestedDialogOpen]:``}:null}},k_=v.forwardRef(function(e,t){let{className:n,finalFocus:r,initialFocus:i,render:a,...o}=e,{store:s}=y_(),c=s.useState(`descriptionElementId`),l=s.useState(`disablePointerDismissal`),u=s.useState(`floatingRootContext`),d=s.useState(`popupProps`),f=s.useState(`modal`),p=s.useState(`mounted`),m=s.useState(`nested`),h=s.useState(`nestedOpenDialogCount`),g=s.useState(`open`),_=s.useState(`openMethod`),y=s.useState(`titleElementId`),b=s.useState(`transitionStatus`),x=s.useState(`role`);D_(),_c({open:g,ref:s.context.popupRef,onComplete(){g&&s.context.onOpenChangeComplete?.(!0)}});function S(e){return e!==`touch`||s.context.popupRef.current}let C=i===void 0?S:i,w=h>0,T=Io(`div`,e,{state:v.useMemo(()=>({open:g,nested:m,transitionStatus:b,nestedDialogOpen:w}),[g,m,b,w]),props:[d,{"aria-labelledby":y??void 0,"aria-describedby":c??void 0,role:x,tabIndex:-1,hidden:!p,onKeyDown(e){Zm.has(e.key)&&e.stopPropagation()},style:{[w_.nestedDialogs]:h}},o],ref:[t,s.context.popupRef,s.useStateSetter(`popupElement`)],stateAttributesMapping:O_});return(0,K.jsx)(cf,{context:u,openInteractionType:_,disabled:!p,closeOnFocusOut:!l,initialFocus:C,returnFocus:r,modal:f!==!1,restoreFocus:`popup`,children:T})}),A_=v.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=y_(),a=i.useState(`mounted`),o=i.useState(`modal`);return a||n?(0,K.jsx)(E_.Provider,{value:n,children:(0,K.jsxs)(Zd,{ref:t,...r,children:[a&&o===!0&&(0,K.jsx)(bh,{ref:i.context.internalBackdropRef,inert:ih(!open)}),e.children]})}):null});function j_(e){let{store:t,parentContext:n,actionsRef:r}=e,i=t.useState(`open`),a=t.useState(`disablePointerDismissal`),o=t.useState(`modal`),s=t.useState(`popupElement`),{openMethod:c,triggerProps:l,reset:u}=Nh(i);am(t);let{forceUnmount:d}=om(i,t,()=>{u()}),f=J(e=>{let n=nc(e);return n.preventUnmountOnClose=()=>{t.set(`preventUnmountingOnClose`,!0)},n}),p=v.useCallback(()=>{t.setOpen(!1,f(tc))},[t,f]);v.useImperativeHandle(r,()=>({unmount:d,close:p}),[d,p]);let m=pm({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[h,g]=v.useState(0),_=h===0,y=Lm(m),b=Cp(m,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?`intentional`:{mouse:o===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(e){if(`button`in e&&e.button!==0||`touches`in e&&e.touches.length!==1)return!1;let n=kl(e);if(_&&!a){let e=n;return o&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===e||t.context.backdropRef.current===e||Ol(e,s)&&!e?.hasAttribute(`data-base-ui-portal`):!0}return!1},escapeKey:_});kh(i&&o===!0,s);let{getReferenceProps:x,getFloatingProps:S,getTriggerProps:C}=Em([y,b]);t.useContextCallback(`onNestedDialogOpen`,e=>{g(e+1)}),t.useContextCallback(`onNestedDialogClose`,()=>{g(0)}),v.useEffect(()=>(n?.onNestedDialogOpen&&i&&n.onNestedDialogOpen(h),n?.onNestedDialogClose&&!i&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&i&&n.onNestedDialogClose()}),[i,n,h]);let w=v.useMemo(()=>x(l),[x,l]),T=v.useMemo(()=>C(l),[C,l]),E=v.useMemo(()=>S(),[S]);t.useSyncedValues({openMethod:c,activeTriggerProps:w,inactiveTriggerProps:T,popupProps:E,floatingRootContext:m,nestedOpenDialogCount:h})}var M_={...um,modal:X(e=>e.modal),nested:X(e=>e.nested),nestedOpenDialogCount:X(e=>e.nestedOpenDialogCount),disablePointerDismissal:X(e=>e.disablePointerDismissal),openMethod:X(e=>e.openMethod),descriptionElementId:X(e=>e.descriptionElementId),titleElementId:X(e=>e.titleElementId),viewportElement:X(e=>e.viewportElement),role:X(e=>e.role)},N_=class extends em{constructor(e){super(P_(e),{popupRef:v.createRef(),backdropRef:v.createRef(),internalBackdropRef:v.createRef(),triggerElements:new sm,onOpenChange:void 0,onOpenChangeComplete:void 0},M_)}setOpen=(e,t)=>{if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;let n={open:e,nativeEvent:t.event,reason:t.reason,nested:this.state.nested};this.state.floatingRootContext.context.events?.emit(`openchange`,n);let r={open:e},i=t.trigger?.id??null;(i||e)&&(r.activeTriggerId=i,r.activeTriggerElement=t.trigger??null),this.update(r)}};function P_(e={}){return{...lm(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:`dialog`,...e}}function F_(e){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,disablePointerDismissal:o=!1,modal:s=!0,actionsRef:c,handle:l,triggerId:u,defaultTriggerId:d=null}=e,f=y_(!0),p=!!f,m=qa(()=>l?.store??new N_({open:n??r,activeTriggerId:u===void 0?d:u,modal:s,disablePointerDismissal:o,nested:p})).current;m.useControlledProp(`open`,n,r),m.useControlledProp(`activeTriggerId`,u,d),m.useSyncedValues({disablePointerDismissal:o,nested:p,modal:s}),m.useContextCallback(`onOpenChange`,i),m.useContextCallback(`onOpenChangeComplete`,a);let h=m.useState(`payload`);j_({store:m,actionsRef:c,parentContext:f?.store.context,onOpenChange:i,triggerIdProp:u});let g=v.useMemo(()=>({store:m}),[m]);return(0,K.jsx)(v_.Provider,{value:g,children:typeof t==`function`?t({payload:h}):t})}var I_=v.forwardRef(function(e,t){let{render:n,className:r,id:i,...a}=e,{store:o}=y_(),s=Go(i);return o.useSyncedValueWithCleanup(`titleElementId`,s),Io(`h2`,e,{ref:t,props:[{id:s},a]})}),L_=v.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,id:o,payload:s,handle:c,...l}=e,u=y_(!0),d=c?.store??u?.store;if(!d)throw Error(uo(79));let f=Go(o),p=d.useState(`floatingRootContext`),m=d.useState(`isOpenedByTrigger`,f),h=v.useRef(null),{registerTrigger:g,isMountedByThisTrigger:_}=im(f,h,d,{payload:s}),{getButtonProps:y,buttonRef:b}=xs({disabled:i,native:a}),x=Em([lf(p,{enabled:p!=null})]),S=v.useMemo(()=>({disabled:i,open:m}),[i,m]),C=d.useState(`triggerProps`,_);return Io(`button`,e,{state:S,ref:[b,t,g,h],props:[x.getReferenceProps(),C,{[Mo]:``,id:f},l,y],stateAttributesMapping:Lc})});function R_(e){return(0,K.jsx)(F_,{...e})}function z_({className:e,children:t,side:n=`left`,...r}){return(0,K.jsxs)(A_,{children:[(0,K.jsx)(x_,{className:`fixed inset-0 z-50 bg-black/40 backdrop-blur-[1px]`}),(0,K.jsx)(k_,{className:G(`fixed inset-y-0 z-50 flex h-full w-3/4 max-w-sm flex-col bg-card text-card-foreground shadow-lg outline-none`,n===`left`?`left-0 border-r border-border`:`right-0 border-l border-border`,e),...r,children:t})]})}function B_({className:e,...t}){return(0,K.jsx)(`div`,{"data-slot":`sheet-header`,className:G(`flex flex-col gap-1 p-4`,e),...t})}function V_({className:e,...t}){return(0,K.jsx)(I_,{className:G(`text-sm font-semibold`,e),...t})}function H_({className:e,...t}){return(0,K.jsx)(C_,{className:G(`text-sm text-muted-foreground`,e),...t})}var U_=768;function W_(){let[e,t]=(0,v.useState)(void 0);return(0,v.useEffect)(()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(max-width: ${U_-1}px)`),n=()=>t(window.innerWidth<U_);return e.addEventListener(`change`,n),t(window.innerWidth<U_),()=>e.removeEventListener(`change`,n)},[]),!!e}var G_=`sidebar_state`,K_=3600*24*7,q_=`16rem`,J_=`18rem`,Y_=`3rem`,X_=`b`,Z_=v.createContext(null);function Q_(){let e=v.useContext(Z_);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function $_({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:i,children:a,...o}){let s=W_(),[c,l]=v.useState(!1),[u,d]=v.useState(e),f=t??u,p=v.useCallback(e=>{let t=typeof e==`function`?e(f):e;n?n(t):d(t),document.cookie=`${G_}=${t}; path=/; max-age=${K_}`},[n,f]),m=v.useCallback(()=>s?l(e=>!e):p(e=>!e),[s,p,l]);v.useEffect(()=>{let e=e=>{e.key===X_&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),m())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[m]);let h=f?`expanded`:`collapsed`,g=v.useMemo(()=>({state:h,open:f,setOpen:p,isMobile:s,openMobile:c,setOpenMobile:l,toggleSidebar:m}),[h,f,p,s,c,l,m]);return(0,K.jsx)(Z_.Provider,{value:g,children:(0,K.jsx)(d_,{delay:0,children:(0,K.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:{"--sidebar-width":q_,"--sidebar-width-icon":Y_,...i},className:G(`group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full`,r),...o,children:a})})})}function ev({side:e=`left`,variant:t=`sidebar`,collapsible:n=`offcanvas`,className:r,children:i,...a}){let{isMobile:o,state:s,openMobile:c,setOpenMobile:l}=Q_();return n===`none`?(0,K.jsx)(`div`,{"data-slot":`sidebar`,className:G(`bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col`,r),...a,children:i}):o?(0,K.jsx)(R_,{open:c,onOpenChange:l,children:(0,K.jsxs)(z_,{"data-sidebar":`sidebar`,"data-slot":`sidebar`,"data-mobile":`true`,className:`bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden`,style:{"--sidebar-width":J_},side:e,children:[(0,K.jsxs)(B_,{className:`sr-only`,children:[(0,K.jsx)(V_,{children:`Sidebar`}),(0,K.jsx)(H_,{children:`Displays the mobile sidebar.`})]}),(0,K.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:i})]})}):(0,K.jsxs)(`div`,{className:`group peer text-sidebar-foreground hidden md:block`,"data-state":s,"data-collapsible":s===`collapsed`?n:``,"data-variant":t,"data-side":e,"data-slot":`sidebar`,children:[(0,K.jsx)(`div`,{"data-slot":`sidebar-gap`,className:G(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,t===`floating`||t===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`)}),(0,K.jsx)(`div`,{"data-slot":`sidebar-container`,className:G(`fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex`,e===`left`?`left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]`:`right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]`,t===`floating`||t===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,r),...a,children:(0,K.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm`,children:i})})]})}function tv({className:e,...t}){return(0,K.jsx)(`div`,{"data-slot":`sidebar-header`,"data-sidebar":`header`,className:G(`flex flex-col gap-2 p-2`,e),...t})}function nv({className:e,...t}){return(0,K.jsx)(`div`,{"data-slot":`sidebar-footer`,"data-sidebar":`footer`,className:G(`flex flex-col gap-2 p-2`,e),...t})}function rv({className:e,...t}){return(0,K.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:G(`flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,e),...t})}function iv({className:e,...t}){return(0,K.jsx)(`div`,{"data-slot":`sidebar-group`,"data-sidebar":`group`,className:G(`relative flex w-full min-w-0 flex-col p-2`,e),...t})}function av({className:e,render:t=(0,K.jsx)(`div`,{}),...n}){return h_({render:t,props:{"data-slot":`sidebar-group-label`,"data-sidebar":`group-label`,className:G(`text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,`group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0`,e),...n}})}function ov({className:e,...t}){return(0,K.jsx)(`div`,{"data-slot":`sidebar-group-content`,"data-sidebar":`group-content`,className:G(`w-full text-sm`,e),...t})}function sv({className:e,...t}){return(0,K.jsx)(`ul`,{"data-slot":`sidebar-menu`,"data-sidebar":`menu`,className:G(`flex w-full min-w-0 flex-col gap-1`,e),...t})}function cv({className:e,...t}){return(0,K.jsx)(`li`,{"data-slot":`sidebar-menu-item`,"data-sidebar":`menu-item`,className:G(`group/menu-item relative`,e),...t})}var lv=[`#e69875`,`#dbbc7f`,`#a7c080`,`#7fbbb3`,`#d699b6`,`#e67e80`],uv=[{d:`M-160 -166.3 A10 10 0 0 0 -175 -174.9 L-234 -140.9 A10 10 0 0 0 -239 -132.2 L-239 34.1 A10 10 0 0 0 -234 42.7 L-72 136.3 A10 10 0 0 0 -62 136.3 L-21 112.6 A10 10 0 0 0 -21 95.3 L-173 7.5 A10 10 0 0 1 -178 -1.2 L-178 -97 A10 10 0 0 1 -173 -105.7 L-165 -110.3 A10 10 0 0 0 -160 -118.9 Z`,axis:[-160,-148.4,-36.5,121.5]},{d:`M64 -221.7 A10 10 0 0 0 64 -239 L5 -273.1 A10 10 0 0 0 -5 -273.1 L-149 -189.9 A10 10 0 0 0 -154 -181.3 L-154 5.8 A10 10 0 0 0 -149 14.4 L-108 38.1 A10 10 0 0 0 -93 29.4 L-93 -146.1 A10 10 0 0 1 -88 -154.7 L-5 -202.6 A10 10 0 0 1 5 -202.6 L13 -198 A10 10 0 0 0 23 -198 Z`,axis:[48.5,-212.8,-123.5,29.2]},{d:`M224 -55.4 A10 10 0 0 0 239 -64.1 L239 -132.2 A10 10 0 0 0 234 -140.9 L90 -224 A10 10 0 0 0 80 -224 L-82 -130.5 A10 10 0 0 0 -87 -121.8 L-87 -74.5 A10 10 0 0 0 -72 -65.8 L80 -153.6 A10 10 0 0 1 90 -153.6 L173 -105.7 A10 10 0 0 1 178 -97 L178 -87.8 A10 10 0 0 0 183 -79.1 Z`,axis:[208.5,-64.4,-87,-92.4]},{d:`M160 166.3 A10 10 0 0 0 175 174.9 L234 140.9 A10 10 0 0 0 239 132.2 L239 -34.1 A10 10 0 0 0 234 -42.7 L72 -136.3 A10 10 0 0 0 62 -136.3 L21 -112.6 A10 10 0 0 0 21 -95.3 L173 -7.5 A10 10 0 0 1 178 1.2 L178 97 A10 10 0 0 1 173 105.7 L165 110.3 A10 10 0 0 0 160 118.9 Z`,axis:[160,148.4,36.5,-121.5]},{d:`M-64 221.7 A10 10 0 0 0 -64 239 L-5 273.1 A10 10 0 0 0 5 273.1 L149 189.9 A10 10 0 0 0 154 181.3 L154 -5.8 A10 10 0 0 0 149 -14.4 L108 -38.1 A10 10 0 0 0 93 -29.4 L93 146.1 A10 10 0 0 1 88 154.7 L5 202.6 A10 10 0 0 1 -5 202.6 L-13 198 A10 10 0 0 0 -23 198 Z`,axis:[-48.5,212.8,123.5,-29.2]},{d:`M-224 55.4 A10 10 0 0 0 -239 64.1 L-239 132.2 A10 10 0 0 0 -234 140.9 L-90 224 A10 10 0 0 0 -80 224 L82 130.5 A10 10 0 0 0 87 121.8 L87 74.5 A10 10 0 0 0 72 65.8 L-80 153.6 A10 10 0 0 1 -90 153.6 L-173 105.7 A10 10 0 0 1 -178 97 L-178 87.8 A10 10 0 0 0 -183 79.1 Z`,axis:[-208.5,64.4,87,92.4]}];function dv(e){return e?`AI is working for you 🚀`:`AI isn't working for you 💤`}function fv(e){return e?`AI is working for you`:`AI isn't working for you`}function pv(e){return lv[(e%lv.length+lv.length)%lv.length]}function mv(e){return lv.map((t,n)=>pv(e+n)).concat(pv(e)).join(`;`)}function hv({className:e,working:t=!1}){let n=dv(t);return(0,K.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`-289 -326 578 651.9`,className:e,role:`img`,"aria-label":fv(t),children:[(0,K.jsx)(`title`,{children:n}),t&&(0,K.jsx)(`defs`,{children:uv.map(({axis:[e,t,n,r]},i)=>(0,K.jsxs)(`linearGradient`,{id:`hexknot-${i}`,gradientUnits:`userSpaceOnUse`,x1:e,y1:t,x2:n,y2:r,children:[(0,K.jsx)(`stop`,{offset:`0`,stopColor:pv(i),children:(0,K.jsx)(`animate`,{attributeName:`stop-color`,dur:`6s`,repeatCount:`indefinite`,values:mv(i)})}),(0,K.jsx)(`stop`,{offset:`1`,stopColor:pv(i-1),children:(0,K.jsx)(`animate`,{attributeName:`stop-color`,dur:`6s`,repeatCount:`indefinite`,values:mv(i-1)})})]},i))}),uv.map(({d:e},n)=>(0,K.jsx)(`path`,{fill:t?`url(#hexknot-${n})`:`var(--logo-${n+1})`,d:e},n))]})}function gv({working:e,onNavigate:t}){return(0,K.jsxs)(`a`,{href:`/`,onClick:e=>{e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button!==0||(e.preventDefault(),t())},className:`flex shrink-0 items-center gap-3 rounded-md transition-opacity hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-primary)]`,children:[(0,K.jsx)(hv,{className:`h-6 w-auto shrink-0`,working:e}),(0,K.jsx)(`span`,{className:`hidden shrink-0 font-semibold sm:inline`,children:`The Framework`})]})}var _v=`fw.devices`,vv=`fw.local-origin`,yv=`http://127.0.0.1:4200`;function bv(){try{return globalThis.localStorage}catch{return}}function xv(e){let t=e;return!!t&&typeof t.id==`string`&&typeof t.label==`string`&&typeof t.url==`string`&&typeof t.token==`string`}function Sv(){try{let e=bv()?.getItem(_v);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(xv):[]}catch{return[]}}function Cv(e){bv()?.setItem(_v,JSON.stringify(e)),Pv()}function wv(e){let t={id:e.url,label:e.label?.trim()||Ev(e.url),url:e.url,token:e.token};return Cv([t,...Sv().filter(e=>e.id!==t.id)]),t}function Tv(e){Cv(Sv().filter(t=>t.id!==e))}function Ev(e){try{return new URL(e).host}catch{return e}}function Dv(e){try{let t=new URL(e.trim());return{url:t.origin,token:t.searchParams.get(`token`)??``}}catch{return null}}function Ov(e,t){_t(t)&&bv()?.setItem(vv,e)}function kv(){return bv()?.getItem(vv)??yv}function Av(){globalThis.location?.assign(kv())}function jv(e,t,n){return _t(n)?{label:`Local`,isLocal:!0}:{label:e.find(e=>e.url===t)?.label??n,isLocal:!1}}var Mv=null,Nv=new Set;function Pv(){Mv=null;for(let e of Nv)e()}function Fv(e){return Nv.add(e),()=>Nv.delete(e)}function Iv(){return Mv??=Sv()}function Lv(){return(0,v.useSyncExternalStore)(Fv,Iv,()=>Rv)}var Rv=[];function zv(e,t,n,r,i=!1){let[a,o]=(0,v.useState)(t),[s,c]=(0,v.useState)(!1),l=(0,v.useRef)(t),u=(0,v.useRef)({live:!1}),d=(0,v.useCallback)((e,t)=>{t().then(t=>{e.live&&(o(t),c(!0))}).catch(()=>{})},[]);return(0,v.useEffect)(()=>{let t={live:!0};if(u.current=t,i||o(l.current),c(!1),!e)return()=>void(t.live=!1);let r=()=>d(t,e);if(r(),n===null)return()=>void(t.live=!1);let a=setInterval(r,n);return()=>{t.live=!1,clearInterval(a)}},r),{value:a,reload:(0,v.useCallback)(()=>{e&&d(u.current,e)},r),loaded:s}}function Bv(e,t,n,r=!1){return zv(e,t,null,n,r).value}function Vv(e,t,n,r,i=!1){return zv(e,t,n,r,i)}var Hv=yt(`checkDevices`),Uv=1e4;function Wv(e){let t=e.filter(e=>e.token).map(e=>({id:e.id,url:e.url,token:e.token})),n=t.map(e=>`${e.id} ${e.token}`).join(`|`),r=Vv((0,v.useMemo)(()=>t.length?()=>Hv(t):null,[n]),{},Uv,[n]).value;return(0,v.useMemo)(()=>{let e={};for(let[t,n]of Object.entries(r))e[t]=n?`online`:`offline`;return e},[r])}var Gv=`fw.pending-draft`;function Kv(){try{return globalThis.sessionStorage}catch{return}}function qv(){if(typeof window>`u`)return;let e=new URL(window.location.href),t=e.searchParams.get(`draft`);t!==null&&(Kv()?.setItem(Gv,t),e.searchParams.delete(`draft`),window.history.replaceState(null,``,e.pathname+e.search+e.hash))}function Jv(e){Kv()?.setItem(Gv,e)}function Yv(){let e=Kv();if(!e)return null;let t=e.getItem(Gv);return t!==null&&e.removeItem(Gv),t}function Xv(){let e=Lv(),t=Wv(e);if((0,v.useEffect)(()=>{typeof window>`u`||(qv(),Ov(window.location.origin,window.location.hostname))},[]),typeof window>`u`)return null;let n=window.location.origin,{label:r,isLocal:i}=jv(e,n,window.location.hostname),a=i?Vi:Yi,o=i||t[e.find(e=>e.url===n)?.id??``]===`online`;return(0,K.jsxs)(Z,{children:[(0,K.jsxs)(Q,{render:(0,K.jsx)(`span`,{className:i?`hidden items-center gap-1.5 rounded-md border border-border px-2 py-1 text-xs text-muted-foreground sm:inline-flex`:`inline-flex items-center gap-1.5 rounded-md border border-[var(--color-primary)]/40 bg-[var(--color-primary)]/10 px-2 py-1 text-xs text-[var(--color-primary)]`}),children:[(0,K.jsx)(`span`,{"aria-hidden":!0,className:G(`h-2 w-2 shrink-0 rounded-full`,o?`bg-success`:`bg-muted-foreground/40`)}),(0,K.jsx)(a,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":!0}),(0,K.jsx)(`span`,{className:`max-w-[10rem] truncate`,children:r})]}),(0,K.jsx)(f_,{children:i?`Connected to this machine`:`Connected to ${r} — the agent runs on that device`})]})}var Zv=[{value:`system`,label:`System`,icon:Xi},{value:`light`,label:`Light`,icon:oa},{value:`dark`,label:`Dark`,icon:Zi}];function Qv(){let e=vn(hn()),t=Zv.find(t=>t.value===e)??Zv[0],n=t.icon;return(0,K.jsxs)(kg,{children:[(0,K.jsxs)(Z,{children:[(0,K.jsx)(Q,{render:(0,K.jsx)(Ng,{className:G(Er({variant:`ghost`,size:`icon-sm`}),`shrink-0 text-muted-foreground`),"aria-label":`Theme`}),children:(0,K.jsx)(n,{className:`h-4 w-4`})}),(0,K.jsxs)(f_,{children:[`Theme: `,t.label]})]}),(0,K.jsx)(Pg,{align:`end`,children:Zv.map(t=>{let n=t.icon;return(0,K.jsxs)(Fg,{closeOnClick:!1,onClick:()=>fn({theme:t.value}),children:[(0,K.jsx)(vi,{className:G(`h-3.5 w-3.5 shrink-0`,t.value===e?`opacity-100`:`opacity-0`)}),(0,K.jsx)(n,{className:`h-3.5 w-3.5 shrink-0 opacity-70`}),t.label]},t.value)})})]})}function $v(){return(0,v.useSyncExternalStore)(ey,()=>typeof Notification>`u`?`unsupported`:Notification.permission,()=>`unsupported`)}function ey(e){let t=setInterval(e,3e3);return()=>clearInterval(t)}var ty=null,ny=null,ry=new Set;function iy(){for(let e of ry)e()}function ay(){return ny||(ny=Et().then(e=>{ty=e,iy()}).catch(()=>{}).finally(()=>{ny=null}),ny)}function oy(){ay()}function sy(){return(0,v.useEffect)(()=>{ty===null&&ay()},[]),(0,v.useSyncExternalStore)(e=>(ry.add(e),()=>ry.delete(e)),()=>ty,()=>null)}function cy({label:e,description:t}){return(0,K.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,K.jsx)(`span`,{className:`leading-tight`,children:e}),t&&(0,K.jsx)(`span`,{className:`text-xs font-normal text-[var(--color-muted-foreground)]`,children:t})]})}var ly={claude:[{value:`fable`,label:`Fable`},{value:`opus`,label:`Opus`},{value:`sonnet`,label:`Sonnet`},{value:`haiku`,label:`Haiku`}],codex:[{value:`gpt-5-codex`,label:`GPT-5 Codex`},{value:`gpt-5`,label:`GPT-5`},{value:`o3`,label:`o3`}]},uy={local:`This machine`,actions:`GitHub Actions`,web:`Claude web`};function dy(e){let t=b(e.driver)?e.driver:`claude`,n=ly[t].find(t=>t.value===e.model)?.label??`the CLI's own default`;return[x[t],n,uy[e.target??`local`]].join(` · `)}function fy({status:e}){return(0,K.jsx)(`span`,{"aria-hidden":!0,className:G(`mt-1.5 h-2 w-2 shrink-0 rounded-full`,e===`online`?`bg-success`:`bg-muted-foreground/40`)})}var py=[{value:`local`,label:uy.local,description:`Run on this machine, as today.`},{value:`actions`,label:uy.actions,description:`Run on a fresh GitHub Actions runner.`},{value:`web`,label:uy.web,description:`Hand off to a Claude Code cloud session, which opens its own PR.`}];function my({control:e,connection:t,busy:n}){let r=!t||t.isLocal,i=t&&r&&t.selectedDeviceId?t.profiles.find(e=>e.id===t.selectedDeviceId):void 0,a=e=>r?i?.id===e.id:!!t&&e.url===t.currentUrl,o=t&&!t.isLocal?t.profiles.find(e=>e.url===t.currentUrl)?.label??`A device`:i?i.label:py.find(t=>t.value===e.value)?.label??py[0].label,s=t=>r&&!i&&t===e.value;return(0,K.jsxs)(jg,{children:[(0,K.jsxs)(Lg,{disabled:n,children:[(0,K.jsx)(`span`,{className:`flex-1`,children:`Run on`}),(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:o})]}),(0,K.jsxs)(Rg,{children:[py.map(n=>(0,K.jsxs)(Fg,{className:`items-start`,onClick:()=>{if(n.value===`local`&&t&&!t.isLocal)return t.onConnectLocal();e.onChange(n.value),t?.onSelectDriver()},children:[(0,K.jsx)(vi,{className:G(`mt-0.5 h-3.5 w-3.5 shrink-0`,s(n.value)?`opacity-100`:`opacity-0`)}),(0,K.jsx)(cy,{label:n.label,description:n.description})]},n.value)),t?.profiles.map(e=>{let n=t.status[e.id],r=n===`offline`;return(0,K.jsxs)(Fg,{className:G(`items-start gap-2`,r&&`opacity-60`),onClick:()=>t.onSelect(e),children:[(0,K.jsx)(vi,{className:G(`mt-0.5 h-3.5 w-3.5 shrink-0`,a(e)?`opacity-100`:`opacity-0`)}),(0,K.jsx)(Yi,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,K.jsx)(fy,{status:n}),(0,K.jsx)(cy,{label:e.label,description:r?`${e.url} (offline)`:e.url}),(0,K.jsxs)(Z,{children:[(0,K.jsx)(Q,{render:(0,K.jsx)(`button`,{type:`button`,onClick:n=>{n.stopPropagation(),t.onRemove(e)},"aria-label":`Remove device ${e.label}`,className:`mt-0.5 rounded p-0.5 text-[var(--color-muted-foreground)] hover:text-danger`}),children:(0,K.jsx)(ua,{className:`h-3.5 w-3.5`,"aria-hidden":!0})}),(0,K.jsxs)(f_,{children:[`Remove `,e.label]})]})]},e.id)}),t&&(0,K.jsxs)(Fg,{className:`items-start`,disabled:n,onClick:()=>t.onAddDevice(),children:[(0,K.jsx)($i,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`,"aria-hidden":!0}),(0,K.jsx)(cy,{label:`Add a device…`,description:`Paste the URL a box prints on its network bind.`})]})]})]})}function hy({row:e,busy:t,indent:n=!1}){return(0,K.jsxs)(Z,{children:[(0,K.jsx)(Q,{render:(0,K.jsx)(Ig,{checked:e.checked,disabled:t||!!e.disabled,onCheckedChange:t=>fn(e.patch(t)),className:n?`items-start pl-8`:`items-start`}),children:(0,K.jsx)(cy,{label:e.label,description:e.disabled&&e.disabledReason?[e.description,`— ${e.disabledReason}`].filter(Boolean).join(` `):e.description})}),(0,K.jsx)(f_,{className:`max-w-[22rem]`,children:e.title})]})}function gy({options:e,busy:t,label:n=`Session options`,agentTarget:r,connection:i}){let a=e.filter(e=>e.checked&&!e.disabled).length;return(0,K.jsxs)(kg,{children:[(0,K.jsxs)(Z,{children:[(0,K.jsxs)(Q,{render:(0,K.jsx)(Ng,{type:`button`,disabled:t,"aria-label":n,className:G(Er({variant:`ghost`,size:`icon-sm`}),`relative h-8 w-8`)}),children:[(0,K.jsx)(na,{className:`h-4 w-4`}),a>0&&(0,K.jsx)(`span`,{className:`absolute -right-0.5 -top-0.5 h-2 w-2 rounded-full bg-[var(--color-primary)]`})]}),(0,K.jsx)(f_,{children:a>0?`${n} — ${a} on`:n})]}),(0,K.jsxs)(Pg,{align:`end`,className:`min-w-[19rem] max-w-[22rem]`,children:[r&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(my,{control:r,connection:i,busy:t}),e.length>0&&(0,K.jsx)(zg,{})]}),e.map(e=>(0,K.jsx)(hy,{row:e,busy:t},e.key))]})]})}function _y(){let e=hn(),t=bn(e),n=xn(e),r=Sn(e),i=Cn(e),a=$v(),o=a!==`unsupported`,s=a===`denied`,c=sy(),l=c===null||c.discordWebhook,u=t&&a===`granted`||n&&l,d=e=>{fn({notifyBrowser:e}),e&&a==="default"&&Notification.requestPermission()},f=s?`Blocked in your browser settings`:t&&a==="default"?`Click to allow browser notifications`:`Desktop notifications while the dashboard is open`;return(0,K.jsxs)(kg,{children:[(0,K.jsxs)(Z,{children:[(0,K.jsxs)(Q,{render:(0,K.jsx)(Ng,{type:`button`,"aria-label":`Notifications`,className:G(`relative rounded-md p-1.5 hover:bg-accent`,u?`text-foreground`:`text-muted-foreground`)}),children:[u?(0,K.jsx)(hi,{className:`h-4 w-4`}):(0,K.jsx)(mi,{className:`h-4 w-4`}),u&&(0,K.jsx)(`span`,{className:`absolute right-1 top-1 h-1.5 w-1.5 rounded-full bg-[var(--color-primary)]`})]}),(0,K.jsx)(f_,{children:u?`Notifications on`:`Notifications`})]}),(0,K.jsxs)(Pg,{align:`end`,className:`min-w-[16rem]`,children:[(0,K.jsxs)(Ag,{children:[(0,K.jsx)(Bg,{children:`Deliver to`}),o&&(0,K.jsx)(Ig,{checked:t,disabled:s,onCheckedChange:d,className:`items-start`,children:(0,K.jsx)(cy,{label:`Browser`,description:f})}),(0,K.jsx)(Ig,{checked:n,onCheckedChange:e=>fn({notifyDiscord:e}),className:`items-start`,children:(0,K.jsx)(cy,{label:`Discord`,description:l?`Reaches you with no dashboard open`:`Not configured — add a webhook in Settings`})})]}),(0,K.jsx)(zg,{}),(0,K.jsxs)(Ag,{children:[(0,K.jsx)(Bg,{children:`Notify me about`}),(0,K.jsx)(Ig,{checked:i,onCheckedChange:e=>fn({notifyHumanIntervention:e}),className:`items-start`,children:(0,K.jsx)(cy,{label:`Human Queue`,description:`An agent awaiting you, or a PR to review`})}),(0,K.jsx)(Ig,{checked:r,onCheckedChange:e=>fn({notifyNewActivity:e}),className:`items-start`,children:(0,K.jsx)(cy,{label:`New activity`,description:`An agent started or finished`})})]})]})]})}function vy({projectId:e,agents:t,selectedAgentId:n,onSelect:r,recentAgents:i,onSelectRecent:a,projects:o=[],onNewAgentInProject:s,onProjectAdded:c,startTick:l=0,startIntent:u=``,followLive:d=!1,working:f=!1,onDashboard:p=()=>{},onSelectProject:m=()=>{},onSettings:h=()=>{},onTickets:g,ticketsActive:_=!1,interventionCount:y=0}){let[b,x]=(0,v.useState)(null);(0,v.useEffect)(()=>{l>0&&x({intent:u,known:new Set(t.map(e=>e.id))})},[l]);let S=t.some(e=>e.status===`running`),C=t.find(e=>e.status===`running`)?.id,w=b!==null&&t.some(e=>!b.known.has(e.id));(0,v.useEffect)(()=>{w&&x(null)},[w]),(0,v.useEffect)(()=>{x(null)},[e]),(0,v.useEffect)(()=>{if(b===null||S)return;let e=setTimeout(()=>x(null),2e4);return()=>clearTimeout(e)},[b,S]);let T=e===null&&i!==void 0,E=!T&&b!==null&&!S&&!w,D=d||n!==null&&!t.some(e=>e.id===n),O=T?i.map(e=>({key:`${e.projectId}:${e.agent.id}`,agent:e.agent,project:e.projectName,active:!1,onClick:()=>a?.(e.projectId,e.agent.id)})):t.map(e=>({key:e.id,agent:e,active:e.id===n||d&&e.id===C,onClick:()=>r(e.id)})),k=e!==null&&n===null&&!d,A=O.length>0||E;return(0,K.jsxs)(ev,{collapsible:`none`,className:`w-(--sidebar-width) border-r border-sidebar-border`,children:[(0,K.jsxs)(tv,{className:`gap-0.5 pb-2`,children:[(0,K.jsx)(`div`,{className:`px-1 pt-1 pb-4`,children:(0,K.jsx)(gv,{working:f,onNavigate:p})}),(0,K.jsx)(Sy,{projectId:e,projects:o,active:k,onNewAgentInProject:s,onSelect:r,onProjectAdded:c}),(0,K.jsx)(by,{active:e===null&&!_,count:y,onClick:p}),g&&(0,K.jsx)(yy,{active:_,onClick:g}),(0,K.jsx)(xy,{projects:o,selectedId:e,onSelect:m,onProjectAdded:c})]}),(0,K.jsx)(rv,{className:`overflow-hidden`,children:(0,K.jsx)(wg,{className:`min-h-0 flex-1`,children:(0,K.jsxs)(iv,{className:`pt-3 pr-3`,children:[(0,K.jsxs)(`div`,{className:`sticky top-0 z-10`,children:[(0,K.jsx)(av,{className:`rounded-none bg-background font-normal tracking-wide text-muted-foreground`,children:`Recent agents`}),(0,K.jsx)(`div`,{"aria-hidden":!0,className:`rail-fade pointer-events-none absolute inset-x-0 top-full h-4 bg-gradient-to-b from-background to-transparent`})]}),(0,K.jsxs)(ov,{children:[(0,K.jsxs)(sv,{className:`gap-0.5`,children:[E&&(0,K.jsx)(cv,{children:(0,K.jsx)(Cy,{status:`running`,intent:b?.intent??void 0,subtitle:`starting…`,active:D,dim:!0,onClick:()=>r(null)})}),O.map(e=>(0,K.jsx)(cv,{children:(0,K.jsx)(Cy,{status:e.agent.status,publishing:va(e.agent),intent:Fa(e.agent),driver:e.agent.driver,subtitle:e.project?`${e.project} · ${Da(e.agent.startedAt)}`:Da(e.agent.startedAt),active:e.active,waiting:e.agent.settledAt!==void 0,remote:e.agent.target===`remote`,cloud:e.agent.target===`web`,...e.agent.remoteLabel?{remoteLabel:e.agent.remoteLabel}:{},onClick:e.onClick})},e.key))]}),!A&&(0,K.jsx)(`p`,{className:`whitespace-nowrap px-2 py-1 text-sm text-muted-foreground`,children:`No agents yet.`})]})]})})}),(0,K.jsx)(nv,{className:`border-t border-sidebar-border`,children:(0,K.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(Xv,{}),(0,K.jsx)(`div`,{className:`min-w-0 flex-1`}),(0,K.jsx)(Qv,{}),(0,K.jsx)(_y,{}),(0,K.jsxs)(Z,{children:[(0,K.jsx)(Q,{render:(0,K.jsx)(q,{variant:`ghost`,size:`sm`,onClick:h,"aria-label":`Settings`}),children:(0,K.jsx)(na,{className:`h-4 w-4`,"aria-hidden":!0})}),(0,K.jsx)(f_,{children:`Settings`})]})]})})]})}function yy({active:e,onClick:t}){return(0,K.jsxs)(`button`,{type:`button`,onClick:t,"aria-current":e?`page`:void 0,className:G(`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors`,e?`bg-sidebar-accent text-sidebar-accent-foreground`:`text-foreground hover:bg-sidebar-accent/60`),children:[(0,K.jsx)(sa,{className:`h-4 w-4 shrink-0`,"aria-hidden":!0}),(0,K.jsx)(`span`,{className:`flex-1 text-left`,children:`Tickets`})]})}function by({active:e,count:t,onClick:n}){return(0,K.jsxs)(`button`,{type:`button`,onClick:n,"aria-current":e?`page`:void 0,className:G(`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors`,e?`bg-sidebar-accent text-sidebar-accent-foreground`:`text-foreground hover:bg-sidebar-accent/60`),children:[(0,K.jsx)(Ui,{className:`h-4 w-4 shrink-0`,"aria-hidden":!0}),(0,K.jsx)(`span`,{className:`flex-1 text-left`,children:`Overview`}),t>0&&(0,K.jsxs)(Z,{children:[(0,K.jsx)(Q,{render:(0,K.jsx)(`span`,{className:`min-w-5 rounded-full bg-primary px-1.5 text-center text-xs font-semibold text-primary-foreground tabular-nums`}),children:t}),(0,K.jsxs)(f_,{children:[t,` item`,t===1?``:`s`,` in your Human Queue`]})]})]})}function xy({projects:e,selectedId:t,onSelect:n,onProjectAdded:r}){let[i,a]=(0,v.useState)(!1),[o,s]=(0,v.useState)(!1);return(0,K.jsxs)(`div`,{className:`flex flex-col`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>a(e=>!e),"aria-expanded":i,className:`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm text-foreground transition-colors hover:bg-sidebar-accent/60`,children:[(0,K.jsx)(ji,{className:`h-4 w-4 shrink-0`,"aria-hidden":!0}),(0,K.jsx)(`span`,{className:`flex-1 text-left`,children:`Projects`}),(0,K.jsx)(yi,{className:G(`h-4 w-4 shrink-0 opacity-70 transition-transform`,i||`-rotate-90`),"aria-hidden":!0})]}),i&&(0,K.jsxs)(`div`,{className:`mt-0.5 ml-4 flex flex-col gap-0.5 border-l border-sidebar-border pl-2`,children:[e.length===0&&(0,K.jsx)(`p`,{className:`px-2 py-1 text-sm text-muted-foreground`,children:`No projects yet`}),e.map(e=>(0,K.jsxs)(`button`,{type:`button`,onClick:()=>n(e.id),"aria-current":e.id===t?`page`:void 0,className:G(`flex h-8 w-full items-center gap-2 rounded-md px-2 text-sm transition-colors`,e.id===t?`bg-sidebar-accent font-medium text-sidebar-accent-foreground`:`text-foreground hover:bg-sidebar-accent/60`),children:[(0,K.jsxs)(Z,{children:[(0,K.jsx)(Q,{render:(0,K.jsx)(`span`,{"aria-hidden":!0,className:G(`h-2 w-2 shrink-0 rounded-full`,e.errors?.length?`bg-danger`:e.activated?`bg-primary`:`bg-muted-foreground`)})}),(0,K.jsx)(f_,{className:`whitespace-pre-line`,children:e.errors?.length?e.errors.map(e=>`${p_(e.code)}: ${e.message}`).join(`
`):e.activated?`activated`:`not activated`})]}),(0,K.jsxs)(`span`,{className:`sr-only`,children:[e.errors?.length?`Error`:e.activated?`Activated`:`Not activated`,`: `]}),(0,K.jsx)(`span`,{className:`flex-1 truncate text-left`,children:e.name})]},e.id)),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>s(!0),className:`flex h-8 w-full items-center gap-2 rounded-md px-2 text-sm text-muted-foreground transition-colors hover:bg-sidebar-accent/60 hover:text-foreground`,children:[(0,K.jsx)($i,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":!0}),(0,K.jsx)(`span`,{children:`Add project`})]})]}),o&&(0,K.jsx)(Tc,{onAdded:()=>r?.(),onClose:()=>s(!1)})]})}function Sy({projectId:e,projects:t,active:n=!1,onNewAgentInProject:r,onSelect:i,onProjectAdded:a}){let[o,s]=(0,v.useState)(!1),c=G(`h-auto w-full justify-start gap-2 px-2 py-1.5 font-normal`,n&&`bg-sidebar-accent text-sidebar-accent-foreground`),l=e=>r?r(e):i(null);if(e!==null||t.length===1){let n=e??t[0].id;return(0,K.jsxs)(q,{variant:`ghost`,className:c,onClick:()=>l(n),children:[(0,K.jsx)($i,{className:`h-4 w-4 shrink-0`}),(0,K.jsx)(`span`,{className:`whitespace-nowrap`,children:`New agent`})]})}return t.length===0?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(Z,{children:[(0,K.jsxs)(Q,{render:(0,K.jsx)(q,{variant:`ghost`,className:c,onClick:()=>s(!0)}),children:[(0,K.jsx)($i,{className:`h-4 w-4 shrink-0`}),(0,K.jsx)(`span`,{className:`whitespace-nowrap`,children:`New agent`})]}),(0,K.jsx)(f_,{children:`Add a project to start an agent`})]}),o&&(0,K.jsx)(Tc,{onAdded:()=>a?.(),onClose:()=>s(!1)})]}):(0,K.jsxs)(kg,{children:[(0,K.jsxs)(Ng,{"aria-label":`New agent`,className:G(Er({variant:`ghost`}),c),children:[(0,K.jsx)($i,{className:`h-4 w-4 shrink-0`}),(0,K.jsx)(`span`,{className:`whitespace-nowrap`,children:`New agent`}),(0,K.jsx)(yi,{className:`ml-auto h-3.5 w-3.5 shrink-0 opacity-70`})]}),(0,K.jsx)(Pg,{align:`start`,className:`w-[13.5rem]`,children:t.map(e=>(0,K.jsxs)(Fg,{onClick:()=>l(e.id),children:[(0,K.jsx)(`span`,{"aria-hidden":!0,className:G(`h-2 w-2 shrink-0 rounded-full`,e.activated?`bg-primary`:`bg-muted-foreground`)}),(0,K.jsx)(`span`,{className:`flex-1 truncate`,children:e.name})]},e.id))})]})}function Cy({status:e,intent:t,subtitle:n,active:r,onClick:i,driver:a,dim:o=!1,waiting:s=!1,publishing:c=!1,remote:l=!1,cloud:u=!1,remoteLabel:d}){let f=s&&e===`running`,p=S(a),m=u&&e===`done`,h=c&&!m,g=(0,v.useRef)(null),[_,y]=(0,v.useState)(!1);(0,v.useEffect)(()=>{let e=g.current;e&&y(e.scrollWidth>e.clientWidth+1)},[t]);let b=t||`New agent`,C=G(`rail-title w-full px-2 text-sm font-normal`,_&&`is-overflowing`);return(0,K.jsxs)(q,{variant:`ghost`,className:G(`rail-row h-auto w-full flex-col items-start gap-0.5 px-0 py-2 text-left`,r&&`bg-accent text-accent-foreground`,o&&`opacity-70`),onClick:i,children:[(0,K.jsxs)(`span`,{className:`flex w-full items-center gap-2 px-2`,children:[e===`running`&&(0,K.jsx)(`span`,{className:G(`inline-block h-2 w-2 shrink-0 rounded-full`,f?`bg-muted-foreground`:`animate-pulse bg-primary`)}),h&&(0,K.jsx)(`span`,{className:`inline-block h-2 w-2 shrink-0 animate-pulse rounded-full bg-success`}),(0,K.jsx)(da,{className:G(`shrink-0 border-transparent px-0 text-[10px] uppercase`,f||h?`text-muted-foreground`:m?`text-primary`:Pa[e]),children:f?`waiting`:m?`in cloud`:h?`publishing…`:e}),(0,K.jsx)(`span`,{className:`truncate text-xs font-normal text-muted-foreground`,children:n}),(l||u||p)&&(0,K.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1.5`,children:[l&&(0,K.jsxs)(Z,{children:[(0,K.jsx)(Q,{render:(0,K.jsx)(`span`,{className:`flex items-center`}),children:(0,K.jsx)(Yi,{className:`h-3 w-3 text-muted-foreground`,"aria-label":d?`Runs on ${d}`:`Runs on a connected device`})}),(0,K.jsx)(f_,{children:d?`Runs on ${d}`:`Runs on a connected device`})]}),u&&(0,K.jsxs)(Z,{children:[(0,K.jsx)(Q,{render:(0,K.jsx)(`span`,{className:`flex items-center`}),children:(0,K.jsx)(wi,{className:`h-3 w-3 text-muted-foreground`,"aria-label":`Runs as a Claude Code cloud session`})}),(0,K.jsx)(f_,{children:`Runs as a Claude Code cloud session; it works and opens its PR over there.`})]}),p&&(0,K.jsxs)(Z,{children:[(0,K.jsx)(Q,{render:(0,K.jsx)(`span`,{className:`flex items-center`,role:`img`,"aria-label":x[p]}),children:(0,K.jsx)(za,{driver:p,className:`h-3 w-3 text-muted-foreground`})}),(0,K.jsx)(f_,{children:x[p]})]})]})]}),_?(0,K.jsxs)(Z,{children:[(0,K.jsx)(Q,{render:(0,K.jsx)(`span`,{ref:g,className:C}),children:b}),(0,K.jsx)(f_,{side:`right`,className:`max-w-96 whitespace-pre-wrap break-words`,children:b})]}):(0,K.jsx)(`span`,{ref:g,className:C,children:b})]})}var wy=null,Ty=new Set;function Ey(e){if(wy!==e){wy=e;for(let e of Ty)e()}}function Dy(){return wy}function Oy(e){return Ty.add(e),()=>Ty.delete(e)}function ky(){return(0,v.useSyncExternalStore)(Oy,Dy,()=>null)}var Ay=yt(`sendStop`),jy=yt(`sendSetHandoff`),My=yt(`sendChoice`),Ny=yt(`sendBridgeAnswer`),Py=yt(`sendBridgeAnswerCancel`),Fy=yt(`sendMessage`),Iy=yt(`sendRemoveWorktree`),Ly=yt(`sendDeleteAgent`),Ry=yt(`sendStart`),zy=yt(`sendOpenInApp`),By=yt(`sendOpenPullRequest`),Vy=yt(`sendMerge`),Hy=yt(`sendReleaseTicketLock`),Uy=yt(`sendQueueTicket`);function Wy(){let{busy:e,error:t,reset:n,run:r}=Ba();return{busy:e,error:t,reset:n,start:async(e,t,n,i,a=`Failed to start the agent.`)=>{let o=await r(async()=>{let r=await Ry(e,t,n,i);return!r.ok&&r.busy?{...r,error:`An agent is already active for this project.`}:r},a);return o?.ok?o:void 0}}}function Gy(e){this.content=e}Gy.prototype={constructor:Gy,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 Gy(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 Gy(n)},addToStart:function(e,t){return new Gy([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new Gy(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 Gy(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=Gy.from(e),e.size?new Gy(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=Gy.from(e),e.size?new Gy(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=Gy.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}},Gy.from=function(e){if(e instanceof Gy)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new Gy(t)};function Ky(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){let e=i.text,t=a.text,r=0;for(;e[r]==t[r];r++)n++;return r&&r<e.length&&r<t.length&&Yy(e.charCodeAt(r-1))&&Jy(e.charCodeAt(r))&&n--,n}if(i.content.size||a.content.size){let e=Ky(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function qy(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=o.text,t=s.text,i=e.length,a=t.length;for(;i>0&&a>0&&e[i-1]==t[a-1];)i--,a--,n--,r--;return i&&a&&i<e.length&&Yy(e.charCodeAt(i-1))&&Jy(e.charCodeAt(i))&&(n++,r++),{a:n,b:r}}if(o.content.size||s.content.size){let e=qy(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}function Jy(e){return e>=56320&&e<57344}function Yy(e){return e>=55296&&e<56320}var $=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 Ky(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return qy(this,e,t,n)}findIndex(e){if(e==0)return Zy(0,e);if(e==this.size)return Zy(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?Zy(t+1,i):Zy(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 e.fromArray(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)`:``))}};$.empty=new $([],0);var Xy={index:0,offset:0};function Zy(e,t){return Xy.index=e,Xy.offset=t,Xy}function Qy(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(!Qy(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!Qy(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var $y=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&&Qy(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}};$y.none=[];var eb=class extends Error{},tb=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=rb(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(nb(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($.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)}};tb.empty=new tb($.empty,0,0);function nb(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(nb(a.content,t-i-1,n-i-1)))}function rb(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=rb(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function ib(e,t,n){if(n.openStart>e.depth)throw new eb(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new eb(`Inconsistent open depths`);return ab(e,t,n,0)}function ab(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=ab(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return ub(a,fb(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return ub(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=pb(n,e);return ub(a,db(e,i,o,t,r))}}function ob(e,t){if(!t.type.compatibleContent(e.type))throw new eb(`Cannot join `+t.type.name+` onto `+e.type.name)}function sb(e,t,n){let r=e.node(n);return ob(r,t.node(n)),r}function cb(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 lb(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&&(cb(e.nodeAfter,r),a++));for(let e=a;e<o;e++)cb(i.child(e),r);t&&t.depth==n&&t.textOffset&&cb(t.nodeBefore,r)}function ub(e,t){if(!e.type.validContent(t))throw new eb(`Invalid content for node `+e.type.name);return e.copy(t)}function db(e,t,n,r,i){let a=e.depth>i&&sb(e,t,i+1),o=r.depth>i&&sb(n,r,i+1),s=[];return lb(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(ob(a,o),cb(ub(a,db(e,t,n,r,i+1)),s)):(a&&cb(ub(a,fb(e,t,i+1)),s),lb(t,n,i,s),o&&cb(ub(o,fb(n,r,i+1)),s)),lb(r,null,i,s),new $(s)}function fb(e,t,n){let r=[];return lb(null,e,n,r),e.depth>n&&cb(ub(sb(e,t,n+1),fb(e,t,n+1)),r),lb(t,null,n,r),new $(r)}function pb(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($.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var mb=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 $y.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 vb(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=_b.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 _b.set(t,r=new hb);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%gb,i}},hb=class{constructor(){this.elts=[],this.i=0}},gb=12,_b=new WeakMap,vb=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)}},yb=Object.create(null),bb=class e{constructor(e,t,n,r=$y.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||$.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&&Qy(this.attrs,t||e.defaultAttrs||yb)&&$y.sameSet(this.marks,n||$y.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 tb.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new tb(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return ib(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 mb.resolveCached(this,e)}resolveNoCache(e){return mb.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()+`)`),Sb(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=$.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=$y.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(!$y.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=$.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};bb.prototype.text=void 0;var xb=class e extends bb{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):Sb(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 Sb(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var Cb=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new wb(t,n);if(r.next==null)return e.empty;let i=Tb(r);r.next&&r.err(`Unexpected trailing text`);let a=Fb(Mb(i));return Ib(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 $.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(`
`)}};Cb.empty=new Cb(!0);var wb=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 Tb(e){let t=[];do t.push(Eb(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function Eb(e){let t=[];do t.push(Db(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function Db(e){let t=jb(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=kb(e,t);else break;return t}function Ob(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function kb(e,t){let n=Ob(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:Ob(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function Ab(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 jb(e){if(e.eat(`(`)){let t=Tb(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=Ab(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 Mb(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 Nb(e,t){return t-e}function Pb(e,t){let n=[];return r(t),n.sort(Nb);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 Fb(e){let t=Object.create(null);return n(Pb(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]);Pb(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new Cb(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(Nb);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function Ib(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 Lb(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 Rb(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 zb(e,t,n,r){for(let i in t)if(!(i in e))throw RangeError(`Unsupported attribute ${i} for ${n} of type ${r}`);for(let n in e)e[n].validate&&e[n].validate(t[n])}function Bb(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new Ub(e,r,t[r]);return n}var Vb=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=Bb(e,n.attrs),this.defaultAttrs=Lb(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==Cb.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:Rb(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new bb(this,this.computeAttrs(e),$.from(t),$y.setFrom(n))}createChecked(e=null,t,n){return t=$.from(t),this.checkContent(t),new bb(this,this.computeAttrs(e),t,$y.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=$.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($.empty,!0);return i?new bb(this,e,t.append(i),$y.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){zb(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:$y.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 Hb(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 Ub=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?Hb(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},Wb=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=Bb(e,r.attrs),this.excluded=null;let i=Lb(this.attrs);this.instance=i?new $y(this,i):null}create(e=null){return!e&&this.instance?this.instance:new $y(this,Rb(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){zb(this.attrs,e,`mark`,this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},Gb=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=Gy.from(e.nodes),t.marks=Gy.from(e.marks||{}),this.nodes=Vb.compile(this.spec.nodes,this),this.marks=Wb.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]=Cb.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?Kb(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==``?[]:Kb(this,n.split(` `))}this.nodeFromJSON=e=>bb.fromJSON(this,e),this.markFromJSON=e=>$y.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 Vb))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 xb(n,n.defaultAttrs,e,$y.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 Kb(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 qb(e){return e.tag!=null}function Jb(e){return e.style!=null}var Yb=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(qb(e))this.tags.push(e);else if(Jb(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 ix(this,t,!1);return n.addAll(e,$y.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new ix(this,t,!0);return n.addAll(e,$y.none,t.from,t.to),tb.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(ox(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=sx(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=sx(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)))}},Xb={address:!0,article:!0,aside:!0,blockquote:!0,body:!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},Zb={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Qb={ol:!0,ul:!0},$b=1,ex=2,tx=4;function nx(e,t,n){return t==null?e&&e.whitespace==`pre`?3:n&-5:(t?$b:0)|(t===`full`?ex:0)}var rx=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=$y.none,this.match=i||(a&tx?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore($.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&$b)){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=$.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore($.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&&!Xb.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},ix=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=nx(null,t.preserveWhitespace,0)|(n?tx:0);i=r?new rx(r.type,r.attrs,$y.none,!0,t.topMatch||r.type.contentMatch,a):n?new rx(null,null,$y.none,!0,null,a):new rx(e.schema.topNodeType,null,$y.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&ex?`full`:this.localPreserveWS||(r.options&$b)>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,`
`);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;Qb.hasOwnProperty(a)&&this.parser.normalizeLists&&ax(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));out:if(s?s.ignore:Zb.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(Xb.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(`
`),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=$y.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):cx(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=nx(e,i,a.options);a.options&tx&&a.content.length==0&&(o|=tx);let s=$y.none;return n=n.filter(t=>(a.type?a.type.allowsMarkType(t.type):cx(t.type,e))?(s=t.addToSet(s),!1):!0),this.nodes.push(new rx(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|=$b);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 ax(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=t.nodeType==1?t.nodeName.toLowerCase():null;e&&Qb.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):e==`li`?n=t:e&&(n=null)}}function ox(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function sx(e){let t={};for(let n in e)t[n]=e[n];return t}function cx(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 lx=class e{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||=dx(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){if(e.isText)return dx(t).createTextNode(e.text);let{dom:n,contentDOM:r}=hx(dx(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&&hx(dx(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return typeof t==`string`?{dom:e.createTextNode(t)}:hx(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=ux(e.nodes);return t.text||=e=>e.text,t}static marksFromSchema(e){return ux(e.marks)}};function ux(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function dx(e){return e.document||window.document}var fx=new WeakMap;function px(e){let t=fx.get(e);return t===void 0&&fx.set(e,t=mx(e)),t}function mx(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 hx(e,t,n,r){if(t.nodeType==1)return{dom:t};if(t.dom&&t.dom.nodeType==1)return t;let i=t[0],a;if(typeof i!=`string`)throw RangeError(`Invalid array passed to renderSpec`);if(r&&(a=px(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 if(typeof a==`string`)c.appendChild(e.createTextNode(a));else{let{dom:t,contentDOM:i}=hx(e,a,n,r);if(c.appendChild(t),i){if(s)throw RangeError(`Multiple content holes`);s=i}}}return{dom:c,contentDOM:s}}var gx=65535,_x=2**16;function vx(e,t){return e+t*_x}function yx(e){return e&gx}function bx(e){return(e-(e&gx))/_x}var xx=1,Sx=2,Cx=4,wx=8,Tx=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&wx)>0}get deletedBefore(){return(this.delInfo&5)>0}get deletedAfter(){return(this.delInfo&6)>0}get deletedAcross(){return(this.delInfo&Cx)>0}},Ex=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=yx(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+bx(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:vx(o/3,e-s),f=e==s?Sx:e==u?xx:Cx;return(t<0?e!=s:e!=u)&&(f|=wx),new Tx(a,f,d)}r+=l-c}return n?e+r:new Tx(e+r,0,null)}touches(e,t){let n=0,r=yx(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])}};Ex.empty=new Ex([]);var Dx=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 Tx(e,r,null)}},Ox=Object.create(null),kx=class{getMap(){return Ex.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError(`Invalid input for Step.fromJSON`);let n=Ox[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in Ox)throw RangeError(`Duplicate use of step JSON ID `+e);return Ox[e]=t,t.prototype.jsonID=e,t}},Ax=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 eb)return e.fail(t.message);throw t}}};function jx(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let a=e.child(i);a.content.size&&(a=a.copy(jx(a.content,t,a))),a.isInline&&(a=t(a,n,i)),r.push(a)}return $.fromArray(r)}var Mx=class e extends kx{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 tb(jx(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 Ax.fromReplace(e,this.from,this.to,i)}invert(){return new Nx(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))}};kx.jsonID(`addMark`,Mx);var Nx=class e extends kx{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 tb(jx(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return Ax.fromReplace(e,this.from,this.to,n)}invert(){return new Mx(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))}};kx.jsonID(`removeMark`,Nx);var Px=class e extends kx{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Ax.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Ax.fromReplace(e,this.pos,this.pos+1,new tb($.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 Fx(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))}};kx.jsonID(`addNodeMark`,Px);var Fx=class e extends kx{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Ax.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return Ax.fromReplace(e,this.pos,this.pos+1,new tb($.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Px(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))}};kx.jsonID(`removeNodeMark`,Fx);var Ix=class e extends kx{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&Rx(e,this.from,this.to)?Ax.fail(`Structure replace would overwrite content`):Ax.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Ex([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?tb.empty:new tb(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?tb.empty:new tb(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,tb.fromJSON(t,n.slice),!!n.structure)}};Ix.MAP_BIAS=1,kx.jsonID(`replace`,Ix);var Lx=class e extends kx{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&&(Rx(e,this.from,this.gapFrom)||Rx(e,this.gapTo,this.to)))return Ax.fail(`Structure gap-replace would overwrite content`);let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Ax.fail(`Gap is not a flat range`);let n=this.slice.insertAt(this.insert,t.content);return n?Ax.fromReplace(e,this.from,this.to,n):Ax.fail(`Content does not fit in gap`)}getMap(){return new Ex([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,tb.fromJSON(t,n.slice),n.insert,!!n.structure)}};kx.jsonID(`replaceAround`,Lx);function Rx(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 zx(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 Nx(l,d,u[e])));s&&s.to==l?s.to=d:a.push(s=new Mx(l,d,r))}}),i.forEach(t=>e.step(t)),a.forEach(t=>e.step(t))}function Bx(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 Wb){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 Nx(t.from,t.to,t.style)))}function Vx(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 Ix(s,l,tb.empty));else{r=u;for(let t=0;t<c.marks.length;t++)n.allowsMarkType(c.marks[t].type)||e.step(new Nx(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 tb($.from(n.schema.text(` `,n.allowedMarks(c.marks))),0,0),o.push(new Ix(s+e.index,s+e.index+e[0].length,r))}}s=l}if(!r.validEnd){let t=r.fillBefore($.empty,!0);e.replace(s,s,new tb(t,0,0))}for(let t=o.length-1;t>=0;t--)e.step(o[t])}function Hx(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function Ux(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||!Hx(a,o,s))break;o&&(r=1),s<a.childCount&&(i=1)}return null}function Wx(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=$.empty,d=0;for(let e=a,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,u=$.from(r.node(e).copy(u)),d++):c--;let f=$.empty,p=0;for(let e=a,t=!1;e>n;e--)t||i.after(e+1)<i.end(e)?(t=!0,f=$.from(i.node(e).copy(f)),p++):l++;e.step(new Lx(c,l,o,s,new tb(u.append(f),d,p),u.size-d,!0))}function Gx(e,t,n=null,r=e){let i=qx(e,t),a=i&&Jx(r,t);return a?i.map(Kx).concat({type:t,attrs:n}).concat(a.map(Kx)):null}function Kx(e){return{type:e,attrs:null}}function qx(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 Jx(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 Yx(e,t,n){let r=$.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=$.from(n[e].type.create(n[e].attrs,r))}let i=t.start,a=t.end;e.step(new Lx(i,a,i,a,new tb(r,0,0),n.length,!0))}function Xx(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)&&$x(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&&Qx(e,t,n,a),Vx(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 Lx(c,l,c+1,l-1,new tb($.from(r.create(o,null,t.marks)),0,0),1,!0)),i===!0&&Zx(e,t,n,a),!1}})}function Zx(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 Qx(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(`
`))}})}function $x(e,t,n){let r=e.resolve(t),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function eS(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 Lx(t,t+a.nodeSize,t+1,t+a.nodeSize-1,new tb($.from(o),0,0),1,!0))}function tS(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 nS(e,t,n=1,r){let i=e.doc.resolve(t),a=$.empty,o=$.empty;for(let e=i.depth,t=i.depth-n,s=n-1;e>t;e--,s--){a=$.from(i.node(e).copy(a));let t=r&&r[s];o=$.from(t?t.type.create(t.attrs,o):i.node(e).copy(o))}e.step(new Ix(t,t,new tb(a.append(o),n,n),!0))}function rS(e,t){let n=e.resolve(t),r=n.index();return aS(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function iS(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 aS(e,t){return!!(e&&t&&!e.isLeaf&&iS(e,t))}function oS(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&&aS(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 sS(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);Qx(e,r.node(),r.before(),s)}o.inlineContent&&Vx(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 Ix(l,c.map(t+n,-1),tb.empty,!0)),r===!0){let t=e.doc.resolve(l);Zx(e,t.node(),t.before(),e.steps.length)}return e}function cS(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 lS(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 uS(e,t,n=t,r=tb.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),a=e.resolve(n);return dS(i,a,r)?new Ix(t,n,r):new fS(i,a,r).fit()}function dS(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}var fS=class{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=$.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=$.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 tb(i,a,o);return e>-1?new Lx(n.pos,e,this.$to.pos,this.$to.end(),s,t):s.size||n.pos!=this.$to.pos?new Ix(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=hS(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($.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=hS(e,t);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new tb(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=hS(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new tb(pS(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new tb(pS(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(gS(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=mS(this.placed,t,$.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?tb.empty:new tb(pS(a.content,e-1,1),e-1,f<0?a.openEnd:e-1):new tb(pS(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||!_S(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=_S(e,t,r,n,i);if(a){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],i=_S(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=mS(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=mS(this.placed,this.depth,$.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore($.empty,!0);e.childCount&&(this.placed=mS(this.placed,this.frontier.length,e))}};function pS(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(pS(e.firstChild.content,t-1,n)))}function mS(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(mS(e.lastChild.content,t-1,n)))}function hS(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function gS(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,gS(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($.empty,!0)))),e.copy(r)}function _S(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&&!vS(n,a.content,o)?s:null}function vS(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}function yS(e){return e.spec.defining||e.spec.definingForContent}function bS(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let i=e.doc.resolve(t),a=e.doc.resolve(n);if(dS(i,a,r))return e.step(new Ix(t,n,r));let o=wS(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=yS(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 tb(xS(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 xS(e,t,n,r,i){if(t<n){let i=e.firstChild;e=e.replaceChild(0,i.copy(xS(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($.empty,!0))}return e}function SS(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let i=cS(e.doc,t,r.type);i!=null&&(t=n=i)}e.replaceRange(t,n,new tb($.from(r),0,0))}function CS(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=wS(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 wS(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 TS=class e extends kx{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 Ax.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 Ax.fromReplace(e,this.pos,this.pos+1,new tb($.from(r),0,+!t.isLeaf))}getMap(){return Ex.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)}};kx.jsonID(`attr`,TS);var ES=class e extends kx{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 Ax.ok(n)}getMap(){return Ex.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)}};kx.jsonID(`docAttr`,ES);var DS=class extends Error{};DS=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},DS.prototype=Object.create(Error.prototype),DS.prototype.constructor=DS,DS.prototype.name=`TransformError`;var OS=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Dx}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new DS(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=tb.empty){let r=uS(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new tb($.from(n),0,0))}delete(e,t){return this.replace(e,t,tb.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return bS(this,e,t,n),this}replaceRangeWith(e,t,n){return SS(this,e,t,n),this}deleteRange(e,t){return CS(this,e,t),this}lift(e,t){return Wx(this,e,t),this}join(e,t=1){return sS(this,e,t),this}wrap(e,t){return Yx(this,e,t),this}setBlockType(e,t=e,n,r=null){return Xx(this,e,t,n,r),this}setNodeMarkup(e,t,n=null,r){return eS(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new TS(e,t,n)),this}setDocAttribute(e,t){return this.step(new ES(e,t)),this}addNodeMark(e,t){return this.step(new Px(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw RangeError(`No node at position `+e);if(t instanceof $y)t.isInSet(n.marks)&&this.step(new Fx(e,t));else{let r=n.marks,i,a=[];for(;i=t.isInSet(r);)a.push(new Fx(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 nS(this,e,t,n),this}addMark(e,t,n){return zx(this,e,t,n),this}removeMark(e,t,n){return Bx(this,e,t,n),this}clearIncompatible(e,t,n){return Vx(this,e,t,n),this}},kS=Object.create(null),AS=class{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new jS(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=tb.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?tb.empty:t),o==0&&VS(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),VS(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new PS(e):BS(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?BS(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):BS(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 RS(e.node(0))}static atStart(e){return BS(e,e,0,0,1)||new RS(e)}static atEnd(e){return BS(e,e,e.content.size,e.childCount,-1)||new RS(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError(`Invalid input for Selection.fromJSON`);let n=kS[t.type];if(!n)throw RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in kS)throw RangeError(`Duplicate use of selection JSON ID `+e);return kS[e]=t,t.prototype.jsonID=e,t}getBookmark(){return PS.between(this.$anchor,this.$head).getBookmark()}};AS.prototype.visible=!0;var jS=class{constructor(e,t){this.$from=e,this.$to=t}},MS=!1;function NS(e){!MS&&!e.parent.inlineContent&&(MS=!0,console.warn(`TextSelection endpoint not pointing into a node with inline content (`+e.parent.type.name+`)`))}var PS=class e extends AS{constructor(e,t=e){NS(e),NS(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 AS.near(r);let i=t.resolve(n.map(this.anchor));return new e(i.parent.inlineContent?i:r,r)}replace(e,t=tb.empty){if(super.replace(e,t),t==tb.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 FS(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=AS.findFrom(n,r,!0)||AS.findFrom(n,-r,!0);if(e)n=e.$head;else return AS.near(n,r)}return t.parent.inlineContent||(i==0?t=n:(t=(AS.findFrom(t,-r,!0)||AS.findFrom(t,r,!0)).$anchor,t.pos<n.pos!=i<0&&(t=n))),new e(t,n)}};AS.jsonID(`text`,PS);var FS=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 PS.between(e.resolve(this.anchor),e.resolve(this.head))}},IS=class e extends AS{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?AS.near(a):new e(a)}content(){return new tb($.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 LS(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}};IS.prototype.visible=!1,AS.jsonID(`node`,IS);var LS=class e{constructor(e){this.anchor=e}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new FS(r,r):new e(r)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&IS.isSelectable(n)?new IS(t):AS.near(t)}},RS=class e extends AS{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=tb.empty){if(t==tb.empty){e.delete(0,e.doc.content.size);let t=AS.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 zS}};AS.jsonID(`all`,RS);var zS={map(){return this},resolve(e){return new RS(e)}};function BS(e,t,n,r,i,a=!1){if(t.inlineContent)return PS.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=BS(e,r,n+i,i<0?r.childCount:0,i,a);if(t)return t}else if(!a&&IS.isSelectable(r))return IS.create(e,n-(i<0?r.nodeSize:0));n+=r.nodeSize*i}return null}function VS(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof Ix||i instanceof Lx))return;let a=e.mapping.maps[r],o;a.forEach((e,t,n,r)=>{o??=r}),e.setSelection(AS.near(e.doc.resolve(o),n))}var HS=1,US=2,WS=4,GS=class extends OS{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|HS)&-3,this.storedMarks=null,this}get selectionSet(){return(this.updated&HS)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=US,this}ensureMarks(e){return $y.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&US)>0}addStep(e,t){super.addStep(e,t),this.updated&=-3,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)||$y.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(AS.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|=WS,this}get scrolledIntoView(){return(this.updated&WS)>0}};function KS(e,t){return!t||!e?e:e.bind(t)}var qS=class{constructor(e,t,n){this.name=e,this.init=KS(t.init,n),this.apply=KS(t.apply,n)}},JS=[new qS(`doc`,{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new qS(`selection`,{init(e,t){return e.selection||AS.atStart(t.doc)},apply(e){return e.selection}}),new qS(`storedMarks`,{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new qS(`scrollToSelection`,{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})],YS=class{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=JS.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 qS(e.key,e.spec.state,e))})}},XS=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 GS(this)}static create(t){let n=new YS(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 YS(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 YS(t.schema,t.plugins),a=new e(i);return i.fields.forEach(e=>{if(e.name==`doc`)a.doc=bb.fromJSON(t.schema,n.doc);else if(e.name==`selection`)a.selection=AS.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 ZS(e,t,n){for(let r in e){let i=e[r];i instanceof Function?i=i.bind(t):r==`handleDOMEvents`&&(i=ZS(i,t,{})),n[r]=i}return n}var QS=class{constructor(e){this.spec=e,this.props={},e.props&&ZS(e.props,this,this.props),this.key=e.key?e.key.key:eC(`plugin`)}getState(e){return e[this.key]}},$S=Object.create(null);function eC(e){return e in $S?e+`$`+ ++$S[e]:($S[e]=0,e+`$`)}var tC=class{constructor(e=`key`){this.key=eC(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}},nC=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},rC=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t},iC=null,aC=function(e,t,n){let r=iC||=document.createRange();return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},oC=function(){iC=null},sC=function(e,t,n,r){return n&&(lC(e,t,n,r,-1)||lC(e,t,n,r,1))},cC=/^(img|br|input|textarea|hr)$/i;function lC(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:uC(e))){let n=e.parentNode;if(!n||n.nodeType!=1||mC(e)||cC.test(e.nodeName)||e.contentEditable==`false`)return!1;t=nC(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?uC(e):0}else return!1}}function uC(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function dC(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=uC(e)}else if(e.parentNode&&!mC(e))t=nC(e),e=e.parentNode;else return null}}function fC(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&&!mC(e))t=nC(e)+1,e=e.parentNode;else return null}}function pC(e,t,n){for(let r=t==0,i=t==uC(e);r||i;){if(e==n)return!0;let t=nC(e);if(e=e.parentNode,!e)return!1;r&&=t==0,i&&=t==uC(e)}}function mC(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 hC=function(e){return e.focusNode&&sC(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function gC(e,t){let n=document.createEvent(`Event`);return n.initEvent(`keydown`,!0,!0),n.keyCode=e,n.key=n.code=t,n}function _C(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function vC(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(uC(r.offsetNode),r.offset)}}catch{}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(uC(r.startContainer),r.startOffset)}}}var yC=typeof navigator<`u`?navigator:null,bC=typeof document<`u`?document:null,xC=yC&&yC.userAgent||``,SC=/Edge\/(\d+)/.exec(xC),CC=/MSIE \d/.exec(xC),wC=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(xC),TC=!!(CC||wC||SC),EC=CC?document.documentMode:wC?+wC[1]:SC?+SC[1]:0,DC=!TC&&/gecko\/(\d+)/i.test(xC);DC&&+(/Firefox\/(\d+)/.exec(xC)||[0,0])[1];var OC=!TC&&/Chrome\/(\d+)/.exec(xC),kC=!!OC,AC=OC?+OC[1]:0,jC=!TC&&!!yC&&/Apple Computer/.test(yC.vendor),MC=jC&&(/Mobile\/\w+/.test(xC)||!!yC&&yC.maxTouchPoints>2),NC=MC||(yC?/Mac/.test(yC.platform):!1),PC=yC?/Win/.test(yC.platform):!1,FC=/Android \d/.test(xC),IC=!!bC&&`webkitFontSmoothing`in bC.documentElement.style,LC=IC?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function RC(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 zC(e,t){return typeof e==`number`?e:e[t]}function BC(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 VC(e,t,n){if(!nw(t)&&t.left==0)return;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=rC(o);continue}let e=o,n=e==a.body,s=n?RC(a):BC(e),c=0,l=0;if(t.top<s.top+zC(r,`top`)?l=-(s.top-t.top+zC(i,`top`)):t.bottom>s.bottom-zC(r,`bottom`)&&(l=t.bottom-t.top>s.bottom-s.top?t.top+zC(i,`top`)-s.top:t.bottom-s.bottom+zC(i,`bottom`)),t.left<s.left+zC(r,`left`)?c=-(s.left-t.left+zC(i,`left`)):t.right>s.right-zC(r,`right`)&&(c=t.right-s.right+zC(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:rC(o)}}function HC(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:UC(e.dom)}}function UC(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=rC(r));return t}function WC({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;GC(n,r==0?0:r-t)}function GC(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 KC=null;function qC(e){if(e.setActive)return e.setActive();if(KC)return e.focus(KC);let t=UC(e);e.focus(KC==null?{get preventScroll(){return KC={preventScroll:!0},!0}}:void 0),KC||(KC=!1,GC(t,0))}function JC(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=aC(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?YC(n,i):!n||r&&n.nodeType==1?{node:e,offset:a}:JC(n,i)}function YC(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=rw(r,1);if(n.top!=n.bottom&&XC(t,n)){i={node:e,offset:a+ +(t.left>=(n.left+n.right)/2)};break}}return r.detach(),i||{node:e,offset:0}}function XC(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function ZC(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function QC(e,t,n){let{node:r,offset:i}=JC(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 $C(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 ew(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(XC(t,i))return ew(n,t,i)}}if((a=(a+1)%r)==i)break}return e}function tw(e,t){let n=e.dom.ownerDocument,r,i=0,a=vC(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(!XC(t,n)||(o=ew(e.dom,t,n),!o))return null}if(jC)for(let e=o;r&&e;e=rC(e))e.draggable&&(r=void 0);if(o=ZC(o,t),r){if(DC&&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;IC&&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=$C(e,r,i,t))}s??=QC(e,o,t);let c=e.docView.nearestDesc(o,!0);return{pos:s,inside:c?c.posAtStart-c.border:-1}}function nw(e){return e.top<e.bottom||e.left<e.right}function rw(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(nw(e))return e}return Array.prototype.find.call(n,nw)||e.getBoundingClientRect()}var iw=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function aw(e,t,n){let{node:r,offset:i,atom:a}=e.docView.domFromPos(t,n<0?-1:1),o=IC||DC;if(r.nodeType==3)if(o&&(iw.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let e=rw(aC(r,i,i),n);if(DC&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let t=rw(aC(r,i-1,i-1),-1);if(t.top==e.top){let n=rw(aC(r,i,i+1),-1);if(n.top!=e.top)return ow(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++,ow(rw(aC(r,e,t),a),a<0)}if(!e.state.doc.resolve(t-(a||0)).parent.inlineContent){if(a==null&&i&&(n<0||i==uC(r))){let e=r.childNodes[i-1];if(e.nodeType==1)return sw(e.getBoundingClientRect(),!1)}if(a==null&&i<uC(r)){let e=r.childNodes[i];if(e.nodeType==1)return sw(e.getBoundingClientRect(),!0)}return sw(r.getBoundingClientRect(),n>=0)}if(a==null&&i&&(n<0||i==uC(r))){let e=r.childNodes[i-1],t=e.nodeType==3?aC(e,uC(e)-+!o):e.nodeType==1&&(e.nodeName!=`BR`||!e.nextSibling)?e:null;if(t)return ow(rw(t,1),!1)}if(a==null&&i<uC(r)){let e=r.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?e.nodeType==3?aC(e,0,+!o):e.nodeType==1?e:null:null;if(t)return ow(rw(t,-1),!0)}return ow(rw(r.nodeType==3?aC(r):r,-n),n>=0)}function ow(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 sw(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 cw(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 lw(e,t,n){let r=t.selection,i=n==`up`?r.$from:r.$to;return cw(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=aw(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=aC(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 uw=/[\u0590-\u08ac]/;function dw(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?!uw.test(r.parent.textContent)||!s.modify?n==`left`||n==`backward`?a:o:cw(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 fw=null,pw=null,mw=!1;function hw(e,t,n){return fw==t&&pw==n?mw:(fw=t,pw=n,mw=n==`up`||n==`down`?lw(e,t,n):dw(e,t,n))}var gw=0,_w=1,vw=2,yw=3,bw=class{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=gw,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>nC(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 Dw){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 xw&&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?nC(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?nC(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=nC(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=nC(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((DC||jC)&&e==t){let{node:e,offset:t}=o;if(e.nodeType==3){if(u=!!(t&&e.nodeValue[t-1]==`
`),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:nC(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(DC&&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&&jC)&&sC(o.node,o.offset,l.anchorNode,l.anchorOffset)&&sC(s.node,s.offset,l.focusNode,l.focusOffset))return;let d=!1;if((c.extend||e==t)&&!(u&&DC)){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?vw:_w,e==r&&t==o&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=yw:i.markDirty(e-r,t-r);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?vw:yw}n=a}this.dirty=vw}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=e==1?vw:_w;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}},xw=class extends bw{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==gw&&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}},Sw=class extends bw{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}},Cw=class e extends bw{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=lx.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&yw||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=yw&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=gw){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=gw}}slice(t,n,r){let i=e.create(this.parent,this.mark,!0,r),a=this.children,o=this.size;n<o&&(a=Ww(a,n,o,r)),t>0&&(a=Ww(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()}},ww=class e extends bw{constructor(e,t,n,r,i,a,o){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=lx.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=Fw(u,r,n),l?c=new Ow(t,n,r,i,u,d||null,f,l):n.isText?new Ew(t,n,r,i,u,f):new e(t,n,r,i,u,d||null,f)}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=()=>$.empty)}return e}matchesNode(e,t,n){return this.dirty==gw&&e.eq(this.node)&&Iw(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 Rw(this,a&&a.node,e);Vw(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?$y.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==vw)&&(a&&this.protectLocalComposition(e,a),kw(this.contentDOM,this.children,e),MC&&Hw(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof PS)||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=Uw(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 Sw(this,i,t,r);e.input.compositionNodes.push(a),this.children=Ww(this.children,n,n+r.length,e,a)}update(e,t,n,r){return this.dirty==yw||!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=gw}updateOuterDeco(e){if(Iw(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,n=this.dom;this.dom=Nw(this.dom,this.nodeDOM,Mw(this.outerDeco,this.node,t),Mw(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 Tw(e,t,n,r,i){Fw(r,t,e);let a=new ww(void 0,e,t,n,r,r,r);return a.contentDOM&&a.updateChildren(i,0),a}var Ew=class e extends ww{constructor(e,t,n,r,i,a){super(e,t,n,r,i,null,a)}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==yw||this.dirty!=gw&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=gw||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=gw,!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)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=yw)}get domAtom(){return!1}isText(e){return this.node.text==e}},Dw=class extends bw{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==gw&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName==`IMG`}},Ow=class extends ww{constructor(e,t,n,r,i,a,o,s){super(e,t,n,r,i,a,o),this.spec=s}update(e,t,n,r){if(this.dirty==yw)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 kw(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=Lw(r),i=!0;r=r.nextSibling}else i=!0,e.insertBefore(s,r);if(o instanceof Cw){let t=r?r.previousSibling:e.lastChild;kw(o.contentDOM,o.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=Lw(r),i=!0;i&&n.trackWrites==e&&(n.trackWrites=null)}var Aw=function(e){e&&(this.nodeName=e)};Aw.prototype=Object.create(null);var jw=[new Aw];function Mw(e,t,n){if(e.length==0)return jw;let r=n?jw[0]:new Aw,i=[r];for(let a=0;a<e.length;a++){let o=e[a].type.attrs;if(o){o.nodeName&&i.push(r=new Aw(o.nodeName));for(let e in o){let a=o[e];a!=null&&(n&&i.length==1&&i.push(r=new Aw(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 Nw(e,t,n,r){if(n==jw&&r==jw)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=jw[0],i=t)}Pw(i,o||jw[0],a)}return i}function Pw(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 Fw(e,t,n){return Nw(e,e,jw,Mw(t,n,e.nodeType!=1))}function Iw(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 Lw(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}var Rw=class{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=zw(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=gw,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<0&&this.index<this.top.children.length){let t=this.top.children[this.index];t instanceof Cw&&t.dirty!=yw&&t.mark.type==e[a].type&&t.spec.update&&!this.isLocked(t.dom)&&t.spec.update(e[a])&&(t.mark=e[a],i=this.index,this.changed=!0)}if(i>-1)i>this.index&&(this.changed=!0,this.destroyBetween(this.index,i)),this.top=this.top.children[this.index];else{let r=Cw.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==yw&&a.dom==a.contentDOM&&(a.dirty=vw),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 ww){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!=yw&&Iw(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=vw,u.updateChildren(r,a+1),u.dirty=gw),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)||!Iw(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let o=ww.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=ww.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 xw(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 Cw;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Ew)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((jC||kC)&&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 Dw(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 zw(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 Cw)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 Bw(e,t){return e.type.side-t.type.side}function Vw(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(Bw);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 Hw(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 Uw(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 Ww(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 Gw(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(hC(n)){for(c=o;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&IS.isSelectable(e)&&i.parent&&!(e.isInline&&pC(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;l=new IS(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=nT(e,u,s,n)}return l}function Kw(e){return e.editable?e.hasFocus():iT(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function qw(e,t=!1){let n=e.state.selection;if(eT(e,n),!Kw(e))return;let r=e.input.mouseDown;if(!t&&kC&&r){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&sC(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset)&&r.delaySelUpdate()){e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)$w(e);else{let{anchor:r,head:i}=n,a,o;Jw&&!(n instanceof PS)&&(n.$from.parent.inlineContent||(a=Yw(e,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=Yw(e,n.to))),e.docView.setSelection(r,i,e,t),Jw&&(a&&Zw(a),o&&Zw(o)),n.visible?e.dom.classList.remove(`ProseMirror-hideselection`):(e.dom.classList.add(`ProseMirror-hideselection`),`onselectionchange`in document&&Qw(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}var Jw=jC||kC&&AC<63;function Yw(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(jC&&i&&i.contentEditable==`false`)return Xw(i);if((!i||i.contentEditable==`false`)&&(!a||a.contentEditable==`false`)){if(i)return Xw(i);if(a)return Xw(a)}}function Xw(e){return e.contentEditable=`true`,jC&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function Zw(e){e.contentEditable=`false`,e.wasDraggable&&=(e.draggable=!0,null)}function Qw(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(()=>{(!Kw(e)||e.state.selection.visible)&&e.dom.classList.remove(`ProseMirror-hideselection`)},20))})}function $w(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r=n.nodeName==`IMG`;r?t.collapse(n.parentNode,nC(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&TC&&EC<=11&&(n.disabled=!0,n.disabled=!1)}function eT(e,t){if(t instanceof IS){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(tT(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else tT(e)}function tT(e){e.lastSelectedViewDesc&&=(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),void 0)}function nT(e,t,n,r){return e.someProp(`createSelectionBetween`,r=>r(e,t,n))||PS.between(t,n,r)}function rT(e){return e.editable&&!e.hasFocus()?!1:iT(e)}function iT(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 aT(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return sC(t.node,t.offset,n.anchorNode,n.anchorOffset)}function oT(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&&AS.findFrom(a,t)}function sT(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function cT(e,t,n){let r=e.state.selection;if(r instanceof PS){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 sT(e,new PS(r.$anchor,a))}else if(!r.empty)return!1;else if(e.endOfTextblock(t>0?`forward`:`backward`)){let n=oT(e.state,t);return n&&n instanceof IS?sT(e,n):!1}else if(!(NC&&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?IS.isSelectable(i)?sT(e,new IS(t<0?e.state.doc.resolve(n.pos-i.nodeSize):n)):IC?sT(e,new PS(e.state.doc.resolve(t<0?o:o+i.nodeSize))):!1:!1}}else if(r instanceof IS&&r.node.isInline)return sT(e,new PS(t>0?r.$to:r.$from));else{let n=oT(e.state,t);return n?sT(e,n):!1}}function lT(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function uT(e,t){let n=e.pmViewDesc;return n&&n.size==0&&(t<0||e.nextSibling||e.nodeName!=`BR`)}function dT(e,t){return t<0?fT(e):pT(e)}function fT(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,a,o=!1;for(DC&&n.nodeType==1&&r<lT(n)&&uT(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let e=n.childNodes[r-1];if(uT(e,-1))i=n,a=--r;else if(e.nodeType==3)n=e,r=n.nodeValue.length;else break}}else if(mT(n))break;else{let t=n.previousSibling;for(;t&&uT(t,-1);)i=n.parentNode,a=nC(t),t=t.previousSibling;if(t)n=t,r=lT(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}o?_T(e,n,r):i&&_T(e,i,a)}function pT(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i=lT(n),a,o;for(;;)if(r<i){if(n.nodeType!=1)break;let e=n.childNodes[r];if(uT(e,1))a=n,o=++r;else break}else if(mT(n))break;else{let t=n.nextSibling;for(;t&&uT(t,1);)a=t.parentNode,o=nC(t)+1,t=t.nextSibling;if(t)n=t,r=0,i=lT(n);else{if(n=n.parentNode,n==e.dom)break;r=i=0}}a&&_T(e,a,o)}function mT(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function hT(e,t){for(;e&&t==e.childNodes.length&&!mC(e);)t=nC(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 gT(e,t){for(;e&&!t&&!mC(e);)t=nC(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 _T(e,t,n){if(t.nodeType!=3){let e,r;(r=hT(t,n))?(t=r,n=0):(e=gT(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(hC(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&&qw(e)},50)}function vT(e,t){let n=e.state.doc.resolve(t);if(!(kC||PC)&&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 yT(e,t,n){let r=e.state.selection;if(r instanceof PS&&!r.empty||n.indexOf(`s`)>-1||NC&&n.indexOf(`m`)>-1)return!1;let{$from:i,$to:a}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?`up`:`down`)){let n=oT(e.state,t);if(n&&n instanceof IS)return sT(e,n)}if(!i.parent.inlineContent){let n=t<0?i:a,o=r instanceof RS?AS.near(n,t):AS.findFrom(n,t);return o?sT(e,o):!1}return!1}function bT(e,t){if(!(e.state.selection instanceof PS))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 xT(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function ST(e){if(!jC||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;xT(e,n,`true`),setTimeout(()=>xT(e,n,`false`),20)}return!1}function CT(e){let t=``;return e.ctrlKey&&(t+=`c`),e.metaKey&&(t+=`m`),e.altKey&&(t+=`a`),e.shiftKey&&(t+=`s`),t}function wT(e,t){let n=t.keyCode,r=CT(t);if(n==8||NC&&n==72&&r==`c`)return bT(e,-1)||dT(e,-1);if(n==46&&!t.shiftKey||NC&&n==68&&r==`c`)return bT(e,1)||dT(e,1);if(n==13||n==27)return!0;if(n==37||NC&&n==66&&r==`c`){let t=n==37?vT(e,e.state.selection.from)==`ltr`?-1:1:-1;return cT(e,t,r)||dT(e,t)}else if(n==39||NC&&n==70&&r==`c`){let t=n==39?vT(e,e.state.selection.from)==`ltr`?1:-1:1;return cT(e,t,r)||dT(e,t)}else if(n==38||NC&&n==80&&r==`c`)return yT(e,-1,r)||dT(e,-1);else if(n==40||NC&&n==78&&r==`c`)return ST(e)||yT(e,1,r)||dT(e,1);else if(r==(NC?`m`:`c`)&&(n==66||n==73||n==89||n==90))return!0;return!1}function TT(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`)||lx.fromSchema(e.state.schema),s=FT(),c=s.createElement(`div`);c.appendChild(o.serializeFragment(r,{document:s}));let l=c.firstChild,u,d=0;for(;l&&l.nodeType==1&&(u=PT[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,`
`),slice:t}}function ET(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 tb($.from(e.state.schema.text(t.replace(/\r\n?/g,`
`))),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=lx.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=RT(n),IC&&zT(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`)||Yb.fromSchema(e.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||u),context:i,ruleFromNode(e){return e.nodeName==`BR`&&!e.nextSibling&&e.parentNode&&!DT.test(e.parentNode.nodeName)?{ignore:!0}:null}}),u)s=BT(NT(s,+u[1],+u[2]),u[4]);else if(s=tb.maxOpen(OT(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=NT(s,e,t)}return e.someProp(`transformPasted`,t=>{s=t(s,e,c)}),s}var DT=/^(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 OT(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&&AT(t,i,e,a[a.length-1],0))a[a.length-1]=n;else{a.length&&(a[a.length-1]=jT(a[a.length-1],i.length));let n=kT(e,t);a.push(n),r=r.matchType(n.type),i=t}}),a)return $.from(a)}return e}function kT(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,$.from(e));return e}function AT(e,t,n,r,i){if(i<e.length&&i<t.length&&e[i]==t[i]){let a=AT(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($.from(kT(n,e,i+1))))}}function jT(e,t){if(t==0)return e;let n=e.content.replaceChild(e.childCount-1,jT(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore($.empty,!0);return e.copy(n.append(r))}function MT(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=MT(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($.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,o.copy(s))}function NT(e,t,n){return t<e.openStart&&(e=new tb(MT(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new tb(MT(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}var PT={thead:[`table`],tbody:[`table`],tfoot:[`table`],caption:[`table`],colgroup:[`table`],col:[`table`,`colgroup`],tr:[`table`,`tbody`],td:[`table`,`tbody`,`tr`],th:[`table`,`tbody`,`tr`]};function FT(){return document.implementation.createHTMLDocument(`title`)}var IT=null;function LT(e){let t=window.trustedTypes;return t?(IT||=t.defaultPolicy||t.createPolicy(`ProseMirrorClipboard`,{createHTML:e=>e}),IT.createHTML(e)):e}function RT(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=FT(),r=n.body,i=/<([a-z][^>\s]+)/i.exec(e),a;if((a=i&&PT[i[1].toLowerCase()])&&(e=a.map(e=>`<`+e+`>`).join(``)+e+a.map(e=>`</`+e+`>`).reverse().join(``)),r.innerHTML=LT(e),a)for(let e=0;e<a.length;e++)r=r.querySelector(a[e])||r;for(let e=0;e<n.styleSheets.length;e++){let t=n.styleSheets[e];for(let e=0;e<t.rules.length;e++){let n=t.rules[e];if(n instanceof CSSStyleRule){let e=r.querySelectorAll(n.selectorText);for(let t=0;t<e.length;t++)e[t].style.cssText+=n.style.cssText}}}return r}function zT(e){let t=e.querySelectorAll(kC?`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 BT(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=$.from(t.create(r[e+1],i)),a++,o++}return new tb(i,a,o)}var VT={},HT={},UT={touchstart:!0,touchmove:!0},WT=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 GT(e){for(let t in VT){let n=VT[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{XT(e,t)&&!YT(e,t)&&(e.editable||!(t.type in HT))&&n(e,t)},UT[t]?{passive:!0}:void 0)}jC&&e.dom.addEventListener(`input`,()=>null),JT(e)}function KT(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function qT(e){e.input.mouseDown&&e.input.mouseDown.done(),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 JT(e){e.someProp(`handleDOMEvents`,t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>YT(e,t))})}function YT(e,t){return e.someProp(`handleDOMEvents`,n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function XT(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 ZT(e,t){!YT(e,t)&&VT[t.type]&&(e.editable||!(t.type in HT))&&VT[t.type](e,t)}HT.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!mE(e)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(FC&&kC&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),MC&&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,gC(13,`Enter`))),e.input.lastIOSEnter=0)},200)}else e.someProp(`handleKeyDown`,t=>t(e,n))||wT(e,n)?n.preventDefault():KT(e,`key`)},HT.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)},HT.keypress=(e,t)=>{let n=t;if(mE(e)||!n.charCode||n.ctrlKey&&!n.altKey||NC&&n.metaKey)return;if(e.someProp(`handleKeyPress`,t=>t(e,n))){n.preventDefault();return}let r=e.state.selection;if(!(r instanceof PS)||!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 QT(e){return{left:e.clientX,top:e.clientY}}function $T(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function eE(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 tE(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 nE(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&IS.isSelectable(r)?(tE(e,new IS(n),`pointer`),!0):!1}function rE(e,t){if(t==-1)return!1;let n=e.state.selection,r,i;n instanceof IS&&(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(IS.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:(tE(e,IS.create(e.state.doc,i),`pointer`),!0)}function iE(e,t,n,r,i){return eE(e,`handleClickOn`,t,n,r)||e.someProp(`handleClick`,n=>n(e,t,r))||(i?rE(e,n):nE(e,n))}function aE(e,t,n,r){return eE(e,`handleDoubleClickOn`,t,n,r)||e.someProp(`handleDoubleClick`,n=>n(e,t,r))}function oE(e,t,n,r){return eE(e,`handleTripleClickOn`,t,n,r)||e.someProp(`handleTripleClick`,n=>n(e,t,r))||sE(e,n,r)}function sE(e,t,n){if(n.button!=0)return!1;let r=cE(e,t,!0),i=e.state.doc;return r?(tE(e,r,`pointer`),r instanceof PS&&i.eq(e.state.doc)&&(e.input.mouseDown=new pE(e,r)),!0):!1}function cE(e,t,n){let r=e.state.doc;if(t==-1)return r.inlineContent?PS.create(r,0,r.content.size):null;let i=r.resolve(t);for(let e=i.depth+1;e>0;e--){let t=e>i.depth?i.nodeAfter:i.node(e),a=i.before(e);if(t.inlineContent)return PS.create(r,a+1,a+1+t.content.size);if(n&&IS.isSelectable(t))return IS.create(r,a)}return null}function lE(e){return bE(e)}var uE=NC?`metaKey`:`ctrlKey`;VT.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=lE(e),i=Date.now(),a=`singleClick`;i-e.input.lastClick.time<500&&$T(n,e.input.lastClick)&&!n[uE]&&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},e.input.mouseDown&&e.input.mouseDown.done();let o=e.posAtCoords(QT(n));o&&(a==`singleClick`?e.input.mouseDown=new fE(e,o,n,!!r):(a==`doubleClick`?aE:oE)(e,o.pos,o.inside,n)?n.preventDefault():KT(e,`pointer`))};var dE=class{constructor(e){this.view=e,this.mightDrag=null,e.root.addEventListener(`mouseup`,this.up=this.up.bind(this)),e.root.addEventListener(`mousemove`,this.move=this.move.bind(this))}up(e){this.done()}move(e){e.buttons==0&&this.done()}done(){this.view.root.removeEventListener(`mouseup`,this.up),this.view.root.removeEventListener(`mousemove`,this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}},fE=class extends dE{constructor(e,t,n,r){super(e),this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!n[uE],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 IS&&c.from<=a&&c.to>a)&&(this.mightDrag={node:i,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&DC&&!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()),KT(e,`pointer`)}done(){super.done(),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(()=>{this.view.isDestroyed||qw(this.view)})}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(QT(e))),this.updateAllowDefault(e),this.allowDefault||!t?KT(this.view,`pointer`):iE(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||jC&&this.mightDrag&&!this.mightDrag.node.isAtom||kC&&!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)?(tE(this.view,AS.near(this.view.state.doc.resolve(t.pos)),`pointer`),e.preventDefault()):KT(this.view,`pointer`)}move(e){this.updateAllowDefault(e),KT(this.view,`pointer`),super.move(e)}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}},pE=class extends dE{constructor(e,t){super(e),this.startSelection=t,this.startDoc=e.state.doc}move(e){if(e.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}e.preventDefault(),KT(this.view,`pointer`);let t=this.view.posAtCoords(QT(e)),n=t&&cE(this.view,t.inside,!1);if(!n)return;let{doc:r}=this.view.state,i=this.startSelection,[a,o]=n.from<i.from?[i.to,n.from]:[i.from,n.to];tE(this.view,PS.create(r,a,o),`pointer`)}};VT.touchstart=e=>{e.input.lastTouch=Date.now(),lE(e),KT(e,`pointer`)},VT.touchmove=e=>{e.input.lastTouch=Date.now(),KT(e,`pointer`)},VT.contextmenu=e=>lE(e);function mE(e,t){return e.composing?!0:jC&&Math.abs(Date.now()-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}var hE=FC?5e3:-1;HT.compositionstart=HT.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof PS&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>e.type.spec.inclusive===!1)||kC&&PC&&gE(e)))e.markCursor=e.state.storedMarks||n.marks(),bE(e,!0),e.markCursor=null;else if(bE(e,!t.selection.empty),DC&&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}_E(e,hE)};function gE(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`}HT.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now(),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++,_E(e,20))};function _E(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>bE(e),t))}function vE(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function yE(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=dC(t.focusNode,t.focusOffset),r=fC(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 bE(e,t=!1){if(!(FC&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),vE(e),t||e.docView&&e.docView.dirty){let n=Gw(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 xE(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 SE=TC&&EC<15||MC&&LC<604;VT.copy=HT.cut=(e,t)=>{let n=t,r=e.state.selection,i=n.type==`cut`;if(r.empty)return;let a=SE?null:n.clipboardData,{dom:o,text:s}=TT(e,r.content());a?(n.preventDefault(),a.clearData(),a.setData(`text/html`,o.innerHTML),a.setData(`text/plain`,s)):xE(e,o),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta(`uiEvent`,`cut`))};function CE(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function wE(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?TE(e,r.value,null,i,t):TE(e,r.textContent,r.innerHTML,i,t)},50)}function TE(e,t,n,r,i){let a=ET(e,t,n,r,e.state.selection.$from);if(e.someProp(`handlePaste`,t=>t(e,i,a||tb.empty)))return!0;if(!a)return!1;let o=CE(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 EE(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,` `):``}HT.paste=(e,t)=>{let n=t;if(e.composing&&!FC)return;let r=SE?null:n.clipboardData,i=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&TE(e,EE(r),r.getData(`text/html`),i,n)?n.preventDefault():wE(e,n)};var DE=class{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}},OE=NC?`altKey`:`ctrlKey`;function kE(e,t){let n;return e.someProp(`dragCopies`,e=>{n||=e(t)}),n==null?!t[OE]:!n}VT.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(QT(n)),o;if(!(a&&a.pos>=i.from&&a.pos<=(i instanceof IS?i.to-1:i.to))){if(r&&r.mightDrag)o=IS.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=IS.create(e.state.doc,t.posBefore))}}let{dom:s,text:c,slice:l}=TT(e,(o||e.state.selection).content());(!n.dataTransfer.files.length||!kC||AC>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(SE?`Text`:`text/html`,s.innerHTML),n.dataTransfer.effectAllowed=`copyMove`,SE||n.dataTransfer.setData(`text/plain`,c),e.dragging=new DE(l,kE(e,n),o)},VT.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},HT.dragover=HT.dragenter=(e,t)=>t.preventDefault(),HT.drop=(e,t)=>{try{AE(e,t,e.dragging)}finally{e.dragging=null}};function AE(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(QT(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=ET(e,EE(t.dataTransfer),SE?null:t.dataTransfer.getData(`text/html`),!1,i);let o=!!(n&&kE(e,t));if(e.someProp(`handleDrop`,n=>n(e,t,a||tb.empty,o))){t.preventDefault();return}if(!a)return;t.preventDefault();let s=a?lS(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&&IS.isSelectable(a.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(a.content.firstChild))c.setSelection(new IS(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(nT(e,f,c.doc.resolve(t)))}e.focus(),e.dispatch(c.setMeta(`uiEvent`,`drop`))}VT.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())&&qw(e)},20))},VT.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)},VT.beforeinput=(e,t)=>{if(kC&&FC&&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,gC(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 HT)VT[e]=HT[e];function jE(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 ME=class e{constructor(e,t){this.toDOM=e,this.spec=t||LE,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 FE(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&&jE(this.spec,t.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},NE=class e{constructor(e,t){this.attrs=e,this.spec=t||LE}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 FE(i,a,this)}valid(e,t){return t.from<t.to}eq(t){return this==t||t instanceof e&&jE(this.attrs,t.attrs)&&jE(this.spec,t.spec)}static is(t){return t.type instanceof e}destroy(){}},PE=class e{constructor(e,t){this.attrs=e,this.spec=t||LE}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 FE(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&&jE(this.attrs,t.attrs)&&jE(this.spec,t.spec)}destroy(){}},FE=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 ME(n,r))}static inline(t,n,r,i){return new e(t,n,new NE(r,i))}static node(t,n,r,i){return new e(t,n,new PE(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof NE}get widget(){return this.type instanceof ME}},IE=[],LE={},RE=class e{constructor(e,t){this.local=e.length?e:IE,this.children=t.length?t:IE}static create(e,t){return t.length?KE(t,e,0,LE):zE}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==zE||e.maps.length==0?this:this.mapInner(e,t,0,0,n||LE)}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?VE(this.children,o||[],t,n,r,i,a):o?new e(o.sort(qE),IE):zE}add(t,n){return n.length?this==zE?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=WE(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,KE(s,e,o+1,LE)),a+=3}});let o=HE(a?GE(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(qE):this.local,i||this.children)}remove(e){return e.length==0||this==zE?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==zE?(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):zE}forChild(t,n){if(this==zE)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 NE){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(qE),IE);return r?new BE([t,r]):t}return r||zE}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 JE(this.localsInner(e))}localsInner(e){if(this==zE)return IE;if(e.inlineContent||!this.local.some(NE.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof NE||t.push(this.local[e]);return t}forEachSet(e){e(this)}};RE.empty=new RE([],[]),RE.removeOverlap=JE;var zE=RE.empty,BE=class e{constructor(e){this.members=e}map(t,n){let r=this.members.map(e=>e.map(t,n,LE));return e.from(r)}forChild(t,n){if(n.isLeaf)return RE.empty;let r=[];for(let i=0;i<this.members.length;i++){let a=this.members[i].forChild(t,n);a!=zE&&(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?JE(n?t:t.sort(qE)):IE}static from(t){switch(t.length){case 0:return zE;case 1:return t[0];default:return new e(t.every(e=>e instanceof RE)?t:t.reduce((e,t)=>e.concat(t instanceof RE?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}};function VE(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==zE?(s[t+1]=-2,c=!0):(s[t]=u,s[t+1]=d,s[t+2]=r)}else c=!0}if(c){let c=KE(UE(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 RE(t.sort(qE),s)}function HE(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 FE(i.from+t,i.to+t,i.type))}return n}function UE(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 WE(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 GE(e){let t=[];for(let n=0;n<e.length;n++)e[n]!=null&&t.push(e[n]);return t}function KE(e,t,n,r){let i=[],a=!1;t.forEach((t,o)=>{let s=WE(e,t,o+n);if(s){a=!0;let e=KE(s,t,n+o+1,r);e!=zE&&i.push(o,o+t.nodeSize,e)}});let o=HE(a?GE(e):e,-n).sort(qE);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 RE(o,i):zE}function qE(e,t){return e.from-t.from||e.to-t.to}function JE(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),YE(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),YE(t,i,r.copy(a.from,r.to)));break}}}return t}function YE(e,t,n){for(;t<e.length&&qE(n,e[t])>0;)t++;e.splice(t,0,n)}function XE(e){let t=[];return e.someProp(`decorations`,n=>{let r=n(e.state);r&&r!=zE&&t.push(r)}),e.cursorWrapper&&t.push(RE.create(e.state.doc,[e.cursorWrapper.deco])),BE.from(t)}var ZE={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},QE=TC&&EC<=11,$E=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}},eD=class{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new $E,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]);TC&&EC<=11&&t.some(e=>e.type==`childList`&&e.removedNodes.length||e.type==`characterData`&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():jC&&e.composing&&t.some(e=>e.type==`childList`&&e.target.nodeName==`TR`)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),QE&&(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,ZE)),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(rT(this.view)){if(this.suppressingSelectionUpdates)return qw(this.view);if(TC&&EC<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&sC(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=rC(n))t.add(n);for(let r=e.anchorNode;r;r=rC(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)&&rT(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||kC&&(e.composing||e.input.compositionEndedAt>Date.now()-50)&&t.some(e=>e.type==`childList`&&e.removedNodes.length))){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(DC&&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||oD(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&&hC(n)&&(c=Gw(e))&&c.eq(AS.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,qw(e),this.currentSelection.set(n),e.scrollToSelection()):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,a),rD(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,sD(e,s)),this.handleDOMChange(i,a,o,s),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||qw(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(TC&&EC<=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?nC(r)+1:0,o=n.localPosFromDOM(e.target,a,-1),s=i&&i.parentNode==e.target?nC(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}}},tD=new WeakMap,nD=!1;function rD(e){if(!tD.has(e)&&(tD.set(e,null),[`normal`,`nowrap`,`pre-line`].indexOf(getComputedStyle(e.dom).whiteSpace)!==-1)){if(e.requiresGeckoHackNode=DC,nD)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.`),nD=!0}}function iD(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,a=t.endOffset,o=e.domAtPos(e.state.selection.anchor);return sC(o.node,o.offset,i,a)&&([n,r,i,a]=[i,a,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}}function aD(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return iD(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?iD(e,n):null}function oD(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 sD(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 cD(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}],hC(c)||l.push({node:c.focusNode,offset:c.focusOffset})),kC&&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`)||Yb.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`,findPositions:l,ruleFromNode:lD,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 lD(e){let t=e.pmViewDesc;if(t)return t.parseRule();if(e.nodeName==`BR`&&e.parentNode){if(jC&&/^(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||jC&&/^(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 uD=/^(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 dD(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=Gw(e,t);if(n&&!e.state.selection.eq(n)){if(kC&&FC&&e.input.lastKeyCode===13&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp(`handleKeyDown`,t=>t(e,gC(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=cD(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=gD(d.content,l.doc.content,l.from,f,p);if(m&&e.input.domChangeCount++,(MC&&e.input.lastIOSEnter>Date.now()-225||FC)&&i.some(e=>e.nodeType==1&&!uD.test(e.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp(`handleKeyDown`,t=>t(e,gC(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(!m)if(r&&c instanceof PS&&!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=fD(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 PS&&(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)),TC&&EC<=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((MC&&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,gC(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&mD(u,m.start,m.endA,h,g)&&e.someProp(`handleKeyDown`,t=>t(e,gC(8,`Backspace`)))){FC&&kC&&e.domObserver.suppressSelectionUpdates();return}kC&&m.endB==m.start&&(e.input.lastChromeDelete=Date.now()),FC&&!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,gC(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=fD(e,n.doc,l.sel);t&&!(kC&&e.composing&&t.empty&&(m.start!=m.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==y||t.head==n.mapping.map(b)-1)||TC&&t.empty&&t.head==y)&&n.setSelection(t)}return a&&n.setMeta(`composition`,a),n.scrollIntoView()},S;if(v)if(h.pos==g.pos){TC&&EC<=11&&h.parentOffset==0&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>qw(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=pD(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 fD(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:nT(e,t.resolve(n.anchor),t.resolve(n.head))}function pD(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($.from(l).eq(e))return{mark:s,type:o}}function mD(e,t,n,r,i){if(n-t<=i.pos-r.pos||hD(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(hD(a,!0,!0));return!o.parent.isTextblock||o.pos>n||hD(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function hD(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 gD(e,t,n,r,i){let a=e.findDiffStart(t,n),o=n+e.size,s=n+t.size;if(a==null)return null;let{a:c,b:l}=e.findDiffEnd(t,o,s);if(i==`end`){let e=Math.max(0,a-Math.min(c,l));r-=c+e-a}if(c<a&&o<s){let e=r<=a&&r>=c?a-r:0;a-=e,l=a+(l-c),c=a}else if(l<a){let e=r<=a&&r>=l?a-r:0;a-=e,c=a+(c-l),l=a}return{start:a,endA:c,endB:l}}var _D=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 WT,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(wD),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=bD(this),yD(this),this.nodeViews=SD(this),this.docView=Tw(this.state.doc,vD(this),XE(this),this.dom,this),this.domObserver=new eD(this,(e,t,n,r)=>dD(this,e,t,n,r)),this.domObserver.start(),GT(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&&JT(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(wD),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&&(vE(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=SD(this);CD(e,this.nodeViews)&&(this.nodeViews=e,r=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&JT(this),this.editable=bD(this),yD(this);let o=XE(this),s=vD(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&&HC(this);if(i){this.domObserver.stop();let t=l&&(TC||kC)&&!this.composing&&!n.selection.empty&&!e.selection.empty&&xD(n.selection,e.selection);if(l){let n=kC?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=yE(this)),(r||!this.docView.update(e.doc,s,o,this))&&(this.docView.updateOuterDeco(s),this.docView.destroy(),this.docView=Tw(e.doc,s,o,this.dom,this)),n&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(t=!0)}let i=this.input.mouseDown;t||!(i&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&aT(this)&&i.delaySelUpdate())?qw(this,t):(eT(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&&WC(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 IS){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&VC(this,t.getBoundingClientRect(),e)}else VC(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 DE(e.slice,e.move,r<0?void 0:IS.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(TC){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&&qC(this.dom),qw(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 tw(this,e)}coordsAtPos(e,t=1){return aw(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 hw(this,t||this.state,e)}pasteHTML(e,t){return TE(this,``,e,!1,t||new ClipboardEvent(`paste`))}pasteText(e,t){return TE(this,e,null,!0,t||new ClipboardEvent(`paste`))}serializeForClipboard(e){return TT(this,e)}destroy(){this.docView&&(qT(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],XE(this),this),this.dom.textContent=``):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,oC())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return ZT(this,e)}domSelectionRange(){let e=this.domSelection();return e?jC&&this.root.nodeType===11&&_C(this.dom.ownerDocument)==this.dom&&aD(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};_D.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};function vD(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`,[FE.node(0,e.state.doc.content.size,t)]}function yD(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:FE.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function bD(e){return!e.someProp(`editable`,t=>t(e.state)===!1)}function xD(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 SD(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 CD(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 wD(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 TD={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:`'`},ED={48:`)`,49:`!`,50:`@`,51:`#`,52:`$`,53:`%`,54:`^`,55:`&`,56:`*`,57:`(`,59:`:`,61:`+`,173:`_`,186:`:`,187:`+`,188:`<`,189:`_`,190:`>`,191:`?`,192:`~`,219:`{`,220:`|`,221:`}`,222:`"`},DD=typeof navigator<`u`&&/Mac/.test(navigator.platform),OD=typeof navigator<`u`&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),kD=0;kD<10;kD++)TD[48+kD]=TD[96+kD]=String(kD);for(var kD=1;kD<=24;kD++)TD[kD+111]=`F`+kD;for(var kD=65;kD<=90;kD++)TD[kD]=String.fromCharCode(kD+32),ED[kD]=String.fromCharCode(kD);for(var AD in TD)ED.hasOwnProperty(AD)||(ED[AD]=TD[AD]);function jD(e){var t=!(DD&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||OD&&e.shiftKey&&e.key&&e.key.length==1||e.key==`Unidentified`)&&e.key||(e.shiftKey?ED:TD)[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 MD=typeof navigator<`u`&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),ND=typeof navigator<`u`&&/Win/.test(navigator.platform);function PD(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))MD?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 FD(e){let t=Object.create(null);for(let n in e)t[PD(n)]=e[n];return t}function ID(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 LD(e){return new QS({props:{handleKeyDown:RD(e)}})}function RD(e){let t=FD(e);return function(e,n){let r=jD(n),i,a=t[ID(r,n)];if(a&&a(e.state,e.dispatch,e))return!0;if(r.length==1&&r!=` `){if(n.shiftKey){let i=t[ID(r,n,!1)];if(i&&i(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(ND&&n.ctrlKey&&n.altKey)&&(i=TD[n.keyCode])&&i!=r){let r=t[ID(i,n)];if(r&&r(e.state,e.dispatch,e))return!0}}return!1}}var zD=(e,t)=>e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function BD(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`backward`,e):n.parentOffset>0)?null:n}var VD=(e,t,n)=>{let r=BD(e,n);if(!r)return!1;let i=qD(r);if(!i){let n=r.blockRange(),i=n&&Ux(n);return i==null?!1:(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)}let a=i.nodeBefore;if(dO(e,i,t,-1))return!0;if(r.parent.content.size==0&&(GD(a,`end`)||IS.isSelectable(a)))for(let n=r.depth;;n--){let o=uS(e.doc,r.before(n),r.after(n),tb.empty);if(o&&o.slice.size<o.to-o.from){if(t){let n=e.tr.step(o);n.setSelection(GD(a,`end`)?AS.findFrom(n.doc.resolve(n.mapping.map(i.pos,-1)),-1):IS.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},HD=(e,t,n)=>{let r=BD(e,n);if(!r)return!1;let i=qD(r);return i?WD(e,i,t):!1},UD=(e,t,n)=>{let r=JD(e,n);if(!r)return!1;let i=ZD(r);return i?WD(e,i,t):!1};function WD(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=uS(e.doc,i,o,tb.empty);if(!s||s.from!=i||s instanceof Ix&&s.slice.size>=o-i)return!1;if(n){let t=e.tr.step(s);t.setSelection(PS.create(t.doc,i)),n(t.scrollIntoView())}return!0}function GD(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 KD=(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=qD(r)}let o=a&&a.nodeBefore;return!o||!IS.isSelectable(o)?!1:(t&&t(e.tr.setSelection(IS.create(e.doc,a.pos-o.nodeSize)).scrollIntoView()),!0)};function qD(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 JD(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`forward`,e):n.parentOffset<n.parent.content.size)?null:n}var YD=(e,t,n)=>{let r=JD(e,n);if(!r)return!1;let i=ZD(r);if(!i)return!1;let a=i.nodeAfter;if(dO(e,i,t,1))return!0;if(r.parent.content.size==0&&(GD(a,`start`)||IS.isSelectable(a))){let n=uS(e.doc,r.before(),r.after(),tb.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(GD(a,`start`)?AS.findFrom(r.doc.resolve(r.mapping.map(i.pos)),1):IS.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},XD=(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=ZD(r)}let o=a&&a.nodeAfter;return!o||!IS.isSelectable(o)?!1:(t&&t(e.tr.setSelection(IS.create(e.doc,a.pos)).scrollIntoView()),!0)};function ZD(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 QD=(e,t)=>{let n=e.selection,r=n instanceof IS,i;if(r){if(n.node.isTextblock||!rS(e.doc,n.from))return!1;i=n.from}else if(i=oS(e.doc,n.from,-1),i==null)return!1;if(t){let n=e.tr.join(i);r&&n.setSelection(IS.create(n.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(n.scrollIntoView())}return!0},$D=(e,t)=>{let n=e.selection,r;if(n instanceof IS){if(n.node.isTextblock||!rS(e.doc,n.to))return!1;r=n.to}else if(r=oS(e.doc,n.to,1),r==null)return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0},eO=(e,t)=>{let{$from:n,$to:r}=e.selection,i=n.blockRange(r),a=i&&Ux(i);return a==null?!1:(t&&t(e.tr.lift(i,a).scrollIntoView()),!0)},tO=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(`
`).scrollIntoView()),!0)};function nO(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 rO=(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=nO(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(AS.near(i.doc.resolve(r),1)),t(i.scrollIntoView())}return!0},iO=(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof RS||r.parent.inlineContent||i.parent.inlineContent)return!1;let a=nO(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(PS.create(o.doc,n+1)),t(o.scrollIntoView())}return!0},aO=(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(tS(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),i=r&&Ux(r);return i==null?!1:(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)};function oO(e){return(t,n)=>{let{$from:r,$to:i}=t.selection;if(t.selection instanceof IS&&t.selection.node.isBlock)return!r.parentOffset||!tS(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=nO(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 PS||t.selection instanceof RS)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=tS(u.doc,d,a.length,a);if(f||=(a[0]=s?{type:s}:null,tS(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 sO=oO(),cO=(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(IS.create(e.doc,i))),!0)},lO=(e,t)=>(t&&t(e.tr.setSelection(new RS(e.doc))),!0);function uO(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||rS(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function dO(e,t,n,r){let i=t.nodeBefore,a=t.nodeAfter,o,s,c=i.type.spec.isolating||a.type.spec.isolating;if(!c&&uO(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=$.empty;for(let e=o.length-1;e>=0;e--)s=$.from(o[e].create(null,s));s=$.from(i.copy(s));let c=e.tr.step(new Lx(t.pos-1,r,t.pos,r,new tb(s,1,0),o.length,!0)),l=c.doc.resolve(r+2*o.length);l.nodeAfter&&l.nodeAfter.type==i.type&&rS(c.doc,l.pos)&&c.join(l.pos),n(c.scrollIntoView())}return!0}let u=a.type.spec.isolating||r>0&&c?null:AS.findFrom(t,1),d=u&&u.$from.blockRange(u.$to),f=d&&Ux(d);if(f!=null&&f>=t.depth)return n&&n(e.tr.lift(d,f).scrollIntoView()),!0;if(l&&GD(a,`start`,!0)&&GD(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=$.empty;for(let e=o.length-1;e>=0;e--)r=$.from(o[e].copy(r));n(e.tr.step(new Lx(t.pos-o.length,t.pos+a.nodeSize,t.pos+c,t.pos+a.nodeSize-c,new tb(r,o.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function fO(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(PS.create(t.doc,e<0?i.start(a):i.end(a)))),!0):!1}}var pO=fO(-1),mO=fO(1);function hO(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a),s=o&&Gx(o,e,t);return s?(r&&r(n.tr.wrap(o,s).scrollIntoView()),!0):!1}}function gO(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 _O(...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 vO=_O(zD,VD,KD),yO=_O(zD,YD,XD),bO={Enter:_O(tO,iO,aO,sO),"Mod-Enter":rO,Backspace:vO,"Mod-Backspace":vO,"Shift-Backspace":vO,Delete:yO,"Mod-Delete":yO,"Mod-a":lO},xO={"Ctrl-h":bO.Backspace,"Alt-Backspace":bO[`Mod-Backspace`],"Ctrl-d":bO.Delete,"Ctrl-Alt-Backspace":bO[`Mod-Delete`],"Alt-Delete":bO[`Mod-Delete`],"Alt-d":bO[`Mod-Delete`],"Ctrl-a":pO,"Ctrl-e":mO};for(let e in bO)xO[e]=bO[e];typeof navigator<`u`?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<`u`&&os.platform&&os.platform();function SO(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 CO(s,o,e,t)?(r&&r(s.scrollIntoView()),!0):!1}}function CO(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 vb(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new vb(t.$from,o.resolve(t.$to.end(t.depth)),t.depth)),i=!0}let s=Gx(a,n,r,t);return s?(e&&wO(e,t,s,i,n),!0):!1}function wO(e,t,n,r,i){let a=$.empty;for(let e=n.length-1;e>=0;e--)a=$.from(n[e].type.create(n[e].attrs,a));e.step(new Lx(t.start-(r?2:0),t.end,t.start,t.end,new tb(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&&tS(e.doc,c,s)&&(e.split(c,s),c+=2*s),c+=l.child(n).nodeSize;return e}function TO(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?EO(t,n,e,a):DO(t,n,a):!0:!1}}function EO(e,t,n,r){let i=e.tr,a=r.end,o=r.$to.end(r.depth);a<o&&(i.step(new Lx(a-1,o,a,o,new tb($.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new vb(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));let s=Ux(r);if(s==null)return!1;i.lift(r,s);let c=i.doc.resolve(i.mapping.map(a,-1)-1);return rS(i.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&i.join(c.pos),t(i.scrollIntoView()),!0}function DO(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?$.empty:$.from(i))))return!1;let d=a.pos,f=d+o.nodeSize;return r.step(new Lx(d-+!!s,f+ +!!c,d+1,f-1,new tb((s?$.empty:$.from(i.copy($.empty))).append(c?$.empty:$.from(i.copy($.empty))),+!s,+!c),+!s)),t(r.scrollIntoView()),!0}function OO(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=$.from(r?e.create():null),o=new tb($.from(e.create(null,$.from(s.type.create(null,i)))),r?3:1,0),l=a.start,u=a.end;n(t.tr.step(new Lx(l-(r?3:1),u,l,u,o,1,!0)).scrollIntoView())}return!0}}function kO(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 AO=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:kO({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}},jO=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={}}};function MO(e,t,n){return e.config[t]===void 0&&e.parent?MO(e.parent,t,n):typeof e.config[t]==`function`?e.config[t].bind({...n,parent:e.parent?MO(e.parent,t,n):null}):e.config[t]}function NO(e){return{baseExtensions:e.filter(e=>e.type===`extension`),nodeExtensions:e.filter(e=>e.type===`node`),markExtensions:e.filter(e=>e.type===`mark`)}}function PO(e){let t=[],{nodeExtensions:n,markExtensions:r}=NO(e),i=[...n,...r],a={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return e.forEach(e=>{let n=MO(e,`addGlobalAttributes`,{name:e.name,options:e.options,storage:e.storage,extensions:i});n&&n().forEach(e=>{e.types.forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...a,...r}})})})})}),i.forEach(e=>{let n=MO(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 FO(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}function IO(...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=t?t.split(`;`).map(e=>e.trim()).filter(Boolean):[],i=n[e]?n[e].split(`;`).map(e=>e.trim()).filter(Boolean):[],a=new Map;i.forEach(e=>{let[t,n]=e.split(`:`).map(e=>e.trim());a.set(t,n)}),r.forEach(e=>{let[t,n]=e.split(`:`).map(e=>e.trim());a.set(t,n)}),n[e]=Array.from(a.entries()).map(([e,t])=>`${e}: ${t}`).join(`; `)}else n[e]=t}),n},{})}function LO(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)=>IO(e,t),{})}function RO(e){return typeof e==`function`}function zO(e,t=void 0,...n){return RO(e)?t?e.bind(t)(...n):e(...n):e}function BO(e={}){return Object.keys(e).length===0&&e.constructor===Object}function VO(e){return typeof e==`string`?e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e===`true`||e!==`false`&&e:e}function HO(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):VO(n.getAttribute(t.name));return r==null?e:{...e,[t.name]:r}},{});return{...r,...i}}}}function UO(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>e===`attrs`&&BO(t)?!1:t!=null))}function WO(e,t){let n=PO(e),{nodeExtensions:r,markExtensions:i}=NO(e);return new Gb({topNode:r.find(e=>MO(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=UO({...e.reduce((e,t)=>{let n=MO(t,`extendNodeSchema`,a);return{...e,...n?n(r):{}}},{}),content:zO(MO(r,`content`,a)),marks:zO(MO(r,`marks`,a)),group:zO(MO(r,`group`,a)),inline:zO(MO(r,`inline`,a)),atom:zO(MO(r,`atom`,a)),selectable:zO(MO(r,`selectable`,a)),draggable:zO(MO(r,`draggable`,a)),code:zO(MO(r,`code`,a)),whitespace:zO(MO(r,`whitespace`,a)),linebreakReplacement:zO(MO(r,`linebreakReplacement`,a)),defining:zO(MO(r,`defining`,a)),isolating:zO(MO(r,`isolating`,a)),attrs:Object.fromEntries(i.map(e=>[e.name,{default:e?.attribute?.default}]))}),s=zO(MO(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>HO(e,i)));let c=MO(r,`renderHTML`,a);c&&(o.toDOM=e=>c({node:e,HTMLAttributes:LO(e,i)}));let l=MO(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=UO({...e.reduce((e,t)=>{let n=MO(t,`extendMarkSchema`,a);return{...e,...n?n(r):{}}},{}),inclusive:zO(MO(r,`inclusive`,a)),excludes:zO(MO(r,`excludes`,a)),group:zO(MO(r,`group`,a)),spanning:zO(MO(r,`spanning`,a)),code:zO(MO(r,`code`,a)),attrs:Object.fromEntries(i.map(e=>[e.name,{default:e?.attribute?.default}]))}),s=zO(MO(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>HO(e,i)));let c=MO(r,`renderHTML`,a);return c&&(o.toDOM=e=>c({mark:e,HTMLAttributes:LO(e,i)})),[r.name,o]}))})}function GO(e,t){return t.nodes[e]||t.marks[e]||null}function KO(e,t){return Array.isArray(t)?t.some(t=>(typeof t==`string`?t:t.name)===e.name):t}function qO(e,t){let n=lx.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement(`div`);return r.appendChild(n),r.innerHTML}var JO=(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 YO(e){return Object.prototype.toString.call(e)===`[object RegExp]`}var XO=class{constructor(e){this.find=e.find,this.handler=e.handler}},ZO=(e,t)=>{if(YO(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 QO(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=JO(c)+i;return a.forEach(e=>{if(l)return;let a=ZO(u,e.find);if(!a)return;let c=s.state.tr,d=kO({state:s.state,transaction:c}),f={from:n-(a[0].length-i.length),to:r},{commands:p,chain:m,can:h}=new AO({editor:t,state:d});e.handler({state:d,range:f,match:a,commands:p,chain:m,can:h})===null||!c.steps.length||(c.setMeta(o,{transform:c,from:n,to:r,text:i}),s.dispatch(c),l=!0)}),l}function $O(e){let{editor:t,rules:n}=e,r=new QS({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:qO($.from(e),a.schema);let{from:i}=s,o=i+e.length;QO({editor:t,from:i,to:o,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:i}},props:{handleTextInput(e,i,a,o){return QO({editor:t,from:i,to:a,text:o,rules:n,plugin:r})},handleDOMEvents:{compositionend:e=>(setTimeout(()=>{let{$cursor:i}=e.state.selection;i&&QO({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?QO({editor:t,from:a.pos,to:a.pos,text:`
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function ek(e){return Object.prototype.toString.call(e).slice(8,-1)}function tk(e){return ek(e)===`Object`&&e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function nk(e,t){let n={...e};return tk(e)&&tk(t)&&Object.keys(t).forEach(r=>{tk(t[r])&&tk(e[r])?n[r]=nk(e[r],t[r]):n[r]=t[r]}),n}var rk=class e{constructor(e={}){this.type=`mark`,this.name=`mark`,this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=zO(MO(this,`addOptions`,{name:this.name}))),this.storage=zO(MO(this,`addStorage`,{name:this.name,options:this.options}))||{}}static create(t={}){return new e(t)}configure(e={}){let t=this.extend({...this.config,addOptions:()=>nk(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(t={}){let n=new e(t);return n.parent=this,this.child=n,n.name=t.name?t.name:n.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=zO(MO(n,`addOptions`,{name:n.name})),n.storage=zO(MO(n,`addStorage`,{name:n.name,options:n.options})),n}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}};function ik(e){return typeof e==`number`}var ak=class{constructor(e){this.find=e.find,this.handler=e.handler}},ok=(e,t,n)=>{if(YO(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 sk(e){let{editor:t,state:n,from:r,to:i,rule:a,pasteEvent:o,dropEvent:s}=e,{commands:c,chain:l,can:u}=new AO({editor:t,state:n}),d=[];return n.doc.nodesBetween(r,i,(e,t)=>{if(!e.isTextblock||e.type.spec.code)return;let f=Math.max(r,t),p=Math.min(i,t+e.content.size);ok(e.textBetween(f-t,p-t,void 0,``),a.find,o).forEach(e=>{if(e.index===void 0)return;let t=f+e.index+1,r=t+e[0].length,i={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},p=a.handler({state:n,range:i,match:e,commands:c,chain:l,can:u,pasteEvent:o,dropEvent:s});d.push(p)})}),d.every(e=>e!==null)}var ck=null,lk=e=>{var t;let n=new ClipboardEvent(`paste`,{clipboardData:new DataTransfer});return(t=n.clipboardData)==null||t.setData(`text/html`,e),n};function uk(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,l=kO({state:e,transaction:c});if(!(!sk({editor:t,state:l,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 QS({view(e){let n=n=>{r=e.dom.parentElement?.contains(n.target)?e.dom.parentElement:null,r&&(ck=t)},i=()=>{ck&&=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=ck;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:qO($.from(t),r.schema);let{from:n}=d,i=n+t.length,a=lk(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(!(!ik(p)||!m||p===m.b))return c({rule:e,state:r,from:p,to:m,pasteEvt:o})}}))}function dk(e){let t=e.filter((t,n)=>e.indexOf(t)!==n);return Array.from(new Set(t))}var fk=class e{constructor(t,n){this.splittableMarks=[],this.editor=n,this.extensions=e.resolve(t),this.schema=WO(this.extensions,n),this.setupExtensions()}static resolve(t){let n=e.sort(e.flatten(t)),r=dk(n.map(e=>e.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(e=>`'${e}'`).join(`, `)}]. This can lead to issues.`),n}static flatten(e){return e.map(e=>{let t=MO(e,`addExtensions`,{name:e.name,options:e.options,storage:e.storage});return t?[e,...this.flatten(t())]:e}).flat(10)}static sort(e){return e.sort((e,t)=>{let n=MO(e,`priority`)||100,r=MO(t,`priority`)||100;return n>r?-1:+(n<r)})}get commands(){return this.extensions.reduce((e,t)=>{let n=MO(t,`addCommands`,{name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:GO(t.name,this.schema)});return n?{...e,...n()}:e},{})}get plugins(){let{editor:t}=this,n=e.sort([...this.extensions].reverse()),r=[],i=[],a=n.map(e=>{let n={name:e.name,options:e.options,storage:e.storage,editor:t,type:GO(e.name,this.schema)},a=[],o=MO(e,`addKeyboardShortcuts`,n),s={};if(e.type===`mark`&&MO(e,`exitable`,n)&&(s.ArrowRight=()=>rk.handleExit({editor:t,mark:e})),o){let e=Object.fromEntries(Object.entries(o()).map(([e,n])=>[e,()=>n({editor:t})]));s={...s,...e}}let c=LD(s);a.push(c);let l=MO(e,`addInputRules`,n);KO(e,t.options.enableInputRules)&&l&&r.push(...l());let u=MO(e,`addPasteRules`,n);KO(e,t.options.enablePasteRules)&&u&&i.push(...u());let d=MO(e,`addProseMirrorPlugins`,n);if(d){let e=d();a.push(...e)}return a}).flat();return[$O({editor:t,rules:r}),...uk({editor:t,rules:i}),...a]}get attributes(){return PO(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=NO(this.extensions);return Object.fromEntries(t.filter(e=>!!MO(e,`addNodeView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=MO(t,`addNodeView`,{name:t.name,options:t.options,storage:t.storage,editor:e,type:FO(t.name,this.schema)});return r?[t.name,(i,a,o,s,c)=>{let l=LO(i,n);return r()({node:i,view:a,getPos:o,decorations:s,innerDecorations:c,editor:e,extension:t,HTMLAttributes:l})}]:[]}))}setupExtensions(){this.extensions.forEach(e=>{this.editor.extensionStorage[e.name]=e.storage;let t={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:GO(e.name,this.schema)};e.type===`mark`&&(zO(MO(e,`keepOnSplit`,t))??!0)&&this.splittableMarks.push(e.name);let n=MO(e,`onBeforeCreate`,t),r=MO(e,`onCreate`,t),i=MO(e,`onUpdate`,t),a=MO(e,`onSelectionUpdate`,t),o=MO(e,`onTransaction`,t),s=MO(e,`onFocus`,t),c=MO(e,`onBlur`,t),l=MO(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)})}},pk=class e{constructor(e={}){this.type=`extension`,this.name=`extension`,this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=zO(MO(this,`addOptions`,{name:this.name}))),this.storage=zO(MO(this,`addStorage`,{name:this.name,options:this.options}))||{}}static create(t={}){return new e(t)}configure(e={}){let t=this.extend({...this.config,addOptions:()=>nk(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(t={}){let n=new e({...this.config,...t});return n.parent=this,this.child=n,n.name=t.name?t.name:n.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=zO(MO(n,`addOptions`,{name:n.name})),n.storage=zO(MO(n,`addStorage`,{name:n.name,options:n.options})),n}};function mk(e,t,n){let{from:r,to:i}=t,{blockSeparator:a=`
`,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 hk(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}var gk=pk.create({name:`clipboardTextSerializer`,addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new QS({key:new tC(`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=hk(n);return mk(r,{from:o,to:s},{...this.options.blockSeparator===void 0?{}:{blockSeparator:this.options.blockSeparator},textSerializers:c})}}})]}}),_k=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),vk=(e=!1)=>({commands:t})=>t.setContent(``,e),yk=()=>({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=Ux(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},bk=e=>t=>e(t),xk=()=>({state:e,dispatch:t})=>iO(e,t),Sk=(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 PS(r.doc.resolve(Math.max(o-1,0)))),!0},Ck=()=>({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},wk=e=>({tr:t,state:n,dispatch:r})=>{let i=FO(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},Tk=e=>({tr:t,dispatch:n})=>{let{from:r,to:i}=e;return n&&t.delete(r,i),!0},Ek=()=>({state:e,dispatch:t})=>zD(e,t),Dk=()=>({commands:e})=>e.keyboardShortcut(`Enter`),Ok=()=>({state:e,dispatch:t})=>rO(e,t);function kk(e,t,n={strict:!0}){let r=Object.keys(t);return!r.length||r.every(r=>n.strict?t[r]===e[r]:YO(t[r])?t[r].test(e[r]):t[r]===e[r])}function Ak(e,t,n={}){return e.find(e=>e.type===t&&kk(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function jk(e,t,n={}){return!!Ak(e,t,n)}function Mk(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)||(n||=r.node.marks[0]?.attrs,!Ak([...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&&jk([...e.parent.child(i-1).marks],t,n);)--i,a-=e.parent.child(i).nodeSize;for(;o<e.parent.childCount&&jk([...e.parent.child(o).marks],t,n);)s+=e.parent.child(o).nodeSize,o+=1;return{from:a,to:s}}function Nk(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 Pk=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let a=Nk(e,r.schema),{doc:o,selection:s}=n,{$from:c,from:l,to:u}=s;if(i){let e=Mk(c,a,t);if(e&&e.from<=l&&e.to>=u){let t=PS.create(o,e.from,e.to);n.setSelection(t)}}return!0},Fk=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 Ik(e){return e instanceof PS}function Lk(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function Rk(e,t=null){if(!t)return null;let n=AS.atStart(e),r=AS.atEnd(e);if(t===`start`||t===!0)return n;if(t===`end`)return r;let i=n.from,a=r.to;return t===`all`?PS.create(e,Lk(0,i,a),Lk(e.content.size,i,a)):PS.create(e,Lk(t,i,a),Lk(t,i,a))}function zk(){return navigator.platform===`Android`||/android/i.test(navigator.userAgent)}function Bk(){return[`iPad Simulator`,`iPhone Simulator`,`iPod Simulator`,`iPad`,`iPhone`,`iPod`].includes(navigator.platform)||navigator.userAgent.includes(`Mac`)&&`ontouchend`in document}function Vk(){return typeof navigator<`u`&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}var Hk=(e=null,t={})=>({editor:n,view:r,tr:i,dispatch:a})=>{t={scrollIntoView:!0,...t};let o=()=>{(Bk()||zk())&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),Vk()&&!Bk()&&!zk()&&r.dom.focus({preventScroll:!0}))})};if(r.hasFocus()&&e===null||e===!1)return!0;if(a&&e===null&&!Ik(n.state.selection))return o(),!0;let s=Rk(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},Uk=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),Wk=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),Gk=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&&Gk(r)}return e};function Kk(e){let t=`<body>${e}</body>`,n=new window.DOMParser().parseFromString(t,`text/html`).body;return Gk(n)}function qk(e,t,n){if(e instanceof bb||e instanceof $)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 $.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),qk(``,t,n)}if(i){if(n.errorOnInvalidContent){let r=!1,i=``,a=new Gb({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?Yb.fromSchema(a).parseSlice(Kk(e),n.parseOptions):Yb.fromSchema(a).parse(Kk(e),n.parseOptions),n.errorOnInvalidContent&&r)throw Error(`[tiptap error]: Invalid HTML content`,{cause:Error(`Invalid element found: ${i}`)})}let r=Yb.fromSchema(t);return n.slice?r.parseSlice(Kk(e),n.parseOptions).content:r.parse(Kk(e),n.parseOptions)}return qk(``,t,n)}function Jk(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof Ix||i instanceof Lx))return;let a=e.mapping.maps[r],o=0;a.forEach((e,t,n,r)=>{o===0&&(o=r)}),e.setSelection(AS.near(e.doc.resolve(o),n))}var Yk=e=>!(`type`in e),Xk=(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:()=>{a.storage.collaboration&&(a.storage.collaboration.isDisabled=!0)}})},s={preserveWhitespace:`full`,...n.parseOptions};if(!n.errorOnInvalidContent&&!a.options.enableContentCheck&&a.options.emitContentError)try{qk(t,a.schema,{parseOptions:s,errorOnInvalidContent:!0})}catch(e){o(e)}try{i=qk(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((Yk(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 $){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,r.replaceWith(c,l,f);n.updateSelection&&Jk(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},Zk=()=>({state:e,dispatch:t})=>QD(e,t),Qk=()=>({state:e,dispatch:t})=>$D(e,t),$k=()=>({state:e,dispatch:t})=>VD(e,t),eA=()=>({state:e,dispatch:t})=>YD(e,t),tA=()=>({state:e,dispatch:t,tr:n})=>{try{let r=oS(e.doc,e.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},nA=()=>({state:e,dispatch:t,tr:n})=>{try{let r=oS(e.doc,e.selection.$from.pos,1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},rA=()=>({state:e,dispatch:t})=>HD(e,t),iA=()=>({state:e,dispatch:t})=>UD(e,t);function aA(){return typeof navigator<`u`&&/Mac/.test(navigator.platform)}function oA(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))Bk()||aA()?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 sA=e=>({editor:t,view:n,tr:r,dispatch:i})=>{let a=oA(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 cA(e,t,n={}){let{from:r,to:i,empty:a}=e.selection,o=t?FO(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).filter(e=>kk(e.node.attrs,n,{strict:!1}));return a?!!l.length:l.reduce((e,t)=>e+t.to-t.from,0)>=c}var lA=(e,t={})=>({state:n,dispatch:r})=>cA(n,FO(e,n.schema),t)?eO(n,r):!1,uA=()=>({state:e,dispatch:t})=>aO(e,t),dA=e=>({state:t,dispatch:n})=>TO(FO(e,t.schema))(t,n),fA=()=>({state:e,dispatch:t})=>tO(e,t);function pA(e,t){return t.nodes[e]?`node`:t.marks[e]?`mark`:null}function mA(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 hA=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=pA(typeof e==`string`?e:e.name,r.schema);return s?(s===`node`&&(a=FO(e,r.schema)),s===`mark`&&(o=Nk(e,r.schema)),i&&n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{a&&a===e.type&&n.setNodeMarkup(r,void 0,mA(e.attrs,t)),o&&e.marks.length&&e.marks.forEach(i=>{o===i.type&&n.addMark(r,r+e.nodeSize,o.create(mA(i.attrs,t)))})})}),!0):!1},gA=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),_A=()=>({tr:e,dispatch:t})=>{if(t){let t=new RS(e.doc);e.setSelection(t)}return!0},vA=()=>({state:e,dispatch:t})=>KD(e,t),yA=()=>({state:e,dispatch:t})=>XD(e,t),bA=()=>({state:e,dispatch:t})=>cO(e,t),xA=()=>({state:e,dispatch:t})=>mO(e,t),SA=()=>({state:e,dispatch:t})=>pO(e,t);function CA(e,t,n={},r={}){return qk(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var wA=(e,t=!1,n={},r={})=>({editor:i,tr:a,dispatch:o,commands:s})=>{let{doc:c}=a;if(n.preserveWhitespace!==`full`){let s=CA(e,i.schema,n,{errorOnInvalidContent:r.errorOnInvalidContent??i.options.enableContentCheck});return o&&a.replaceWith(0,c.content.size,s).setMeta(`preventUpdate`,!t),!0}return o&&a.setMeta(`preventUpdate`,!t),s.insertContentAt({from:0,to:c.content.size},e,{parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent??i.options.enableContentCheck})};function TA(e,t){let n=Nk(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 EA(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 DA(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 OA(e){return t=>DA(t.$from,e)}function kA(e,t){return mk(e,{from:0,to:e.content.size},t)}function AA(e,t){let n=FO(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 jA(e,t){let n=pA(typeof t==`string`?t:t.name,e.schema);return n===`node`?AA(e,t):n===`mark`?TA(e,t):{}}function MA(e,t,n){let r=[];return e===t?n.resolve(e).marks().forEach(t=>{let i=Mk(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}function NA(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}))}function PA(e,t,n={}){let{empty:r,ranges:i}=e.selection,a=t?Nk(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>!a||a.name===e.type.name).find(e=>kk(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(!e.isText&&!e.marks.length)return;let n=Math.max(r,t),a=Math.min(i,t+e.nodeSize),c=a-n;o+=c,s.push(...e.marks.map(e=>({mark:e,from:n,to:a})))})}),o===0)return!1;let c=s.filter(e=>!a||a.name===e.mark.type.name).filter(e=>kk(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)).reduce((e,t)=>e+t.to-t.from,0);return(c>0?c+l:c)>=o}function FA(e,t,n={}){if(!t)return cA(e,null,n)||PA(e,null,n);let r=pA(t,e.schema);return r===`node`?cA(e,t,n):r===`mark`&&PA(e,t,n)}function IA(e,t){let{nodeExtensions:n}=NO(t),r=n.find(t=>t.name===e);if(!r)return!1;let i=zO(MO(r,`group`,{name:r.name,options:r.options,storage:r.storage}));return typeof i==`string`&&i.split(` `).includes(`list`)}function LA(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){if(n){if(e.type.name===`hardBreak`)return!0;if(e.isText)return/^\s*$/m.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&&(LA(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}function RA(e){return e instanceof IS}function zA(e,t,n){let{selection:r}=t,i=null;if(Ik(r)&&(i=r.$cursor),i){let t=e.storedMarks??i.marks();return!!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);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 BA=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=n,{empty:o,ranges:s}=a,c=Nk(e,r.schema);if(i)if(o){let e=TA(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 zA(r,n,c)},VA=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),HA=(e,t={})=>({state:n,dispatch:r,chain:i})=>{let a=FO(e,n.schema),o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),a.isTextblock?i().command(({commands:e})=>gO(a,{...o,...t})(n)?!0:e.clearNodes()).command(({state:e})=>gO(a,{...o,...t})(e,r)).run():(console.warn(`[tiptap warn]: Currently "setNode()" only supports text block nodes.`),!1)},UA=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,r=Lk(e,0,n.content.size),i=IS.create(n,r);t.setSelection(i)}return!0},WA=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,{from:r,to:i}=typeof e==`number`?{from:e,to:e}:e,a=PS.atStart(n).from,o=PS.atEnd(n).to,s=Lk(r,a,o),c=Lk(i,a,o),l=PS.create(n,s,c);t.setSelection(l)}return!0},GA=e=>({state:t,dispatch:n})=>OO(FO(e,t.schema))(t,n);function KA(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 qA=({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=NA(l,s.node().type.name,s.node().attrs);if(a instanceof IS&&a.node.isBlock)return!s.parentOffset||!tS(o,s.pos)?!1:(r&&(e&&KA(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:EA(s.node(-1).contentMatchAt(s.indexAfter(-1))),p=d&&f?[{type:f,attrs:u}]:void 0,m=tS(t.doc,t.mapping.map(s.pos),1,p);if(!p&&!m&&tS(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 PS&&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&&KA(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return m},JA=(e,t={})=>({tr:n,state:r,dispatch:i,editor:a})=>{let o=FO(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=$.empty,r=s.index(-1)?1:s.index(-2)?2:3;for(let t=s.depth-r;t>=s.depth-3;--t)e=$.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={...NA(d,s.node().type.name,s.node().attrs),...t},c=o.contentMatch.defaultType?.createAndFill(a)||void 0;e=e.append($.from(o.createAndFill(null,c)||void 0));let l=s.before(s.depth-(r-1));n.replace(l,s.after(-i),new tb(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(PS.near(n.doc.resolve(u))),n.scrollIntoView()}return!0}let f=c.pos===s.end()?u.contentMatchAt(0).defaultType:null,p={...NA(d,u.type.name,u.attrs),...t},m={...NA(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(!tS(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},YA=(e,t)=>{let n=OA(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&&rS(e.doc,n.pos)&&e.join(n.pos),!0},XA=(e,t)=>{let n=OA(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&&rS(e.doc,r)&&e.join(r),!0},ZA=Object.freeze({__proto__:null,blur:_k,clearContent:vk,clearNodes:yk,command:bk,createParagraphNear:xk,cut:Sk,deleteCurrentNode:Ck,deleteNode:wk,deleteRange:Tk,deleteSelection:Ek,enter:Dk,exitCode:Ok,extendMarkRange:Pk,first:Fk,focus:Hk,forEach:Uk,insertContent:Wk,insertContentAt:Xk,joinBackward:$k,joinDown:Qk,joinForward:eA,joinItemBackward:tA,joinItemForward:nA,joinTextblockBackward:rA,joinTextblockForward:iA,joinUp:Zk,keyboardShortcut:sA,lift:lA,liftEmptyBlock:uA,liftListItem:dA,newlineInCode:fA,resetAttributes:hA,scrollIntoView:gA,selectAll:_A,selectNodeBackward:vA,selectNodeForward:yA,selectParentNode:bA,selectTextblockEnd:xA,selectTextblockStart:SA,setContent:wA,setMark:BA,setMeta:VA,setNode:HA,setNodeSelection:UA,setTextSelection:WA,sinkListItem:GA,splitBlock:qA,splitListItem:JA,toggleList:(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=FO(e,o.schema),m=FO(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=OA(e=>IA(e.type.name,d))(h);if(y.depth>=1&&x&&y.depth-x.depth<=1){if(x.node.type===p)return l.liftListItem(m);if(IA(x.node.type.name,d)&&p.validContent(x.node.content)&&s)return c().command(()=>(a.setNodeMarkup(x.pos,p),!0)).command(()=>YA(a,p)).command(()=>XA(a,p)).run()}return!n||!b||!s?c().command(()=>u().wrapInList(p,r)?!0:l.clearNodes()).wrapInList(p,r).command(()=>YA(a,p)).command(()=>XA(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(()=>YA(a,p)).command(()=>XA(a,p)).run()},toggleMark:(e,t={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:a=!1}=n,o=Nk(e,r.schema);return PA(r,o,t)?i.unsetMark(o,{extendEmptyMarkRange:a}):i.setMark(o,t)},toggleNode:(e,t,n={})=>({state:r,commands:i})=>{let a=FO(e,r.schema),o=FO(t,r.schema),s=cA(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})},toggleWrap:(e,t={})=>({state:n,commands:r})=>{let i=FO(e,n.schema);return cA(n,i,t)?r.lift(i):r.wrapIn(i,t)},undoInputRule:()=>({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},unsetAllMarks:()=>({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},unsetMark:(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{extendEmptyMarkRange:a=!1}=t,{selection:o}=n,s=Nk(e,r.schema),{$from:c,empty:l,ranges:u}=o;if(!i)return!0;if(l&&a){let{from:e,to:t}=o,r=Mk(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},updateAttributes:(e,t={})=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=pA(typeof e==`string`?e:e.name,r.schema);return s?(s===`node`&&(a=FO(e,r.schema)),s===`mark`&&(o=Nk(e,r.schema)),i&&n.selection.ranges.forEach(e=>{let i=e.$from.pos,s=e.$to.pos,c,l,u,d;n.selection.empty?r.doc.nodesBetween(i,s,(e,t)=>{a&&a===e.type&&(u=Math.max(t,i),d=Math.min(t+e.nodeSize,s),c=t,l=e)}):r.doc.nodesBetween(i,s,(e,r)=>{r<i&&a&&a===e.type&&(u=Math.max(r,i),d=Math.min(r+e.nodeSize,s),c=r,l=e),r>=i&&r<=s&&(a&&a===e.type&&n.setNodeMarkup(r,void 0,{...e.attrs,...t}),o&&e.marks.length&&e.marks.forEach(a=>{if(o===a.type){let c=Math.max(r,i),l=Math.min(r+e.nodeSize,s);n.addMark(c,l,o.create({...a.attrs,...t}))}}))}),l&&(c!==void 0&&n.setNodeMarkup(c,void 0,{...l.attrs,...t}),o&&l.marks.length&&l.marks.forEach(e=>{o===e.type&&n.addMark(u,d,o.create({...e.attrs,...t}))}))}),!0):!1},wrapIn:(e,t={})=>({state:n,dispatch:r})=>hO(FO(e,n.schema),t)(n,r),wrapInList:(e,t={})=>({state:n,dispatch:r})=>SO(FO(e,n.schema),t)(n,r)}),QA=pk.create({name:`commands`,addCommands(){return{...ZA}}}),$A=pk.create({name:`drop`,addProseMirrorPlugins(){return[new QS({key:new tC(`tiptapDrop`),props:{handleDrop:(e,t,n,r)=>{this.editor.emit(`drop`,{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),ej=pk.create({name:`editable`,addProseMirrorPlugins(){return[new QS({key:new tC(`editable`),props:{editable:()=>this.editor.options.editable}})]}}),tj=new tC(`focusEvents`),nj=pk.create({name:`focusEvents`,addProseMirrorPlugins(){let{editor:e}=this;return[new QS({key:tj,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}}}})]}}),rj=pk.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:AS.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 Bk()||aA()?i:r},addProseMirrorPlugins(){return[new QS({key:new tC(`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=AS.atStart(t.doc).from,l=AS.atEnd(t.doc).to;if(a||!(o===c&&s===l)||!LA(n.doc))return;let u=n.tr,d=kO({state:n,transaction:u}),{commands:f}=new AO({editor:this.editor,state:d});if(f.clearNodes(),u.steps.length)return u}})]}}),ij=pk.create({name:`paste`,addProseMirrorPlugins(){return[new QS({key:new tC(`tiptapPaste`),props:{handlePaste:(e,t,n)=>{this.editor.emit(`paste`,{editor:this.editor,event:t,slice:n})}}})]}}),aj=pk.create({name:`tabindex`,addProseMirrorPlugins(){return[new QS({key:new tC(`tabindex`),props:{attributes:()=>this.editor.isEditable?{tabindex:`0`}:{}}})]}}),oj=Object.freeze({__proto__:null,ClipboardTextSerializer:gk,Commands:QA,Drop:$A,Editable:ej,FocusEvents:nj,Keymap:rj,Paste:ij,Tabindex:aj,focusEventsPluginKey:tj}),sj=class e{get name(){return this.node.type.name}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 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’t 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),n=this.resolvedPos.doc.resolve(t);return new e(n,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=this.pos+r+ +!a;if(o<0||o>this.resolvedPos.doc.nodeSize-2)return;let s=this.resolvedPos.doc.resolve(o);if(!i&&s.depth<=this.depth)return;let c=new e(s,this.editor,i,i?n:null);i&&(c.actualDepth=this.depth+1),t.push(new e(s,this.editor,i,i?n:null))}),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)}},cj=`.ProseMirror {
position: relative;
}
.ProseMirror {
word-wrap: break-word;
white-space: pre-wrap;
white-space: break-spaces;
-webkit-font-variant-ligatures: none;
font-variant-ligatures: none;
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
}
.ProseMirror [contenteditable="false"] {
white-space: normal;
}
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
white-space: pre-wrap;
}
.ProseMirror pre {
white-space: pre-wrap;
}
img.ProseMirror-separator {
display: inline !important;
border: none !important;
margin: 0 !important;
width: 0 !important;
height: 0 !important;
}
.ProseMirror-gapcursor {
display: none;
pointer-events: none;
position: absolute;
margin: 0;
}
.ProseMirror-gapcursor:after {
content: "";
display: block;
position: absolute;
top: -2px;
width: 20px;
border-top: 1px solid black;
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
}
@keyframes ProseMirror-cursor-blink {
to {
visibility: hidden;
}
}
.ProseMirror-hideselection *::selection {
background: transparent;
}
.ProseMirror-hideselection *::-moz-selection {
background: transparent;
}
.ProseMirror-hideselection * {
caret-color: transparent;
}
.ProseMirror-focused .ProseMirror-gapcursor {
display: block;
}
.tippy-box[data-animation=fade][data-state=hidden] {
opacity: 0
}`;function lj(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 uj=class extends jO{constructor(e={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement(`div`),content:``,injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on(`beforeCreate`,this.options.onBeforeCreate),this.emit(`beforeCreate`,{editor:this}),this.on(`contentError`,this.options.onContentError),this.createView(),this.injectCSS(),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)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit(`create`,{editor:this}),this.isInitialized=!0)},0)}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&&document&&(this.css=lj(cj,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.view||!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})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,t){let n=RO(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?[ej,gk.configure({blockSeparator:this.options.coreExtensionOptions?.clipboardTextSerializer?.blockSeparator}),QA,nj,rj,aj,$A,ij].filter(e=>typeof this.options.enableCoreExtensions!=`object`||this.options.enableCoreExtensions[e.name]!==!1):[],...this.options.extensions].filter(e=>[`extension`,`node`,`mark`].includes(e?.type));this.extensionManager=new fk(e,this)}createCommandManager(){this.commandManager=new AO({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){let e;try{e=CA(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:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(e=>e.name!==`collaboration`),this.createExtensionManager()}}),e=CA(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}let t=Rk(e,this.options.autofocus);this.view=new _D(this.options.element,{...this.options.editorProps,attributes:{role:`textbox`,...this.options.editorProps?.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:XS.create({doc:e,selection:t||void 0})});let n=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(n),this.createNodeViews(),this.prependClass();let r=this.view.dom;r.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${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 t=this.state.apply(e),n=!this.state.selection.eq(t.selection);this.emit(`beforeTransaction`,{editor:this,transaction:e,nextState:t}),this.view.updateState(t),this.emit(`transaction`,{editor:this,transaction:e}),n&&this.emit(`selectionUpdate`,{editor:this,transaction:e});let r=e.getMeta(`focus`),i=e.getMeta(`blur`);r&&this.emit(`focus`,{editor:this,event:r.event,transaction:e}),i&&this.emit(`blur`,{editor:this,event:i.event,transaction:e}),!(!e.docChanged||e.getMeta(`preventUpdate`))&&this.emit(`update`,{editor:this,transaction:e})}getAttributes(e){return jA(this.state,e)}isActive(e,t){let n=typeof e==`string`?e:null,r=typeof e==`string`?t:e;return FA(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return qO(this.state.doc.content,this.schema)}getText(e){let{blockSeparator:t=`
`,textSerializers:n={}}=e||{};return kA(this.state.doc,{blockSeparator:t,textSerializers:{...hk(this.schema),...n}})}get isEmpty(){return LA(this.state.doc)}getCharacterCount(){return console.warn(`[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.`),this.state.doc.content.size-2}destroy(){if(this.emit(`destroy`),this.view){let e=this.view.dom;e&&e.editor&&delete e.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){return!this.view?.docView}$node(e,t){return this.$doc?.querySelector(e,t)||null}$nodes(e,t){return this.$doc?.querySelectorAll(e,t)||null}$pos(e){return new sj(this.state.doc.resolve(e),this)}get $doc(){return this.$pos(0)}};function dj(e){return new XO({find:e.find,handler:({state:t,range:n,match:r})=>{let i=zO(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(MA(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)}}})}function fj(e){return new XO({find:e.find,handler:({state:t,range:n,match:r})=>{let i=zO(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()}})}function pj(e){return new XO({find:e.find,handler:({state:t,range:n,match:r})=>{let i=t.doc.resolve(n.from),a=zO(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)}})}function mj(e){return new XO({find:e.find,handler:({state:t,range:n,match:r,chain:i})=>{let a=zO(e.getAttributes,void 0,r)||{},o=t.tr.delete(n.from,n.to),s=o.doc.resolve(n.from).blockRange(),c=s&&Gx(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&&rS(o.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,l))&&o.join(n.from-1)}})}var hj=class e{constructor(e={}){this.type=`node`,this.name=`node`,this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=zO(MO(this,`addOptions`,{name:this.name}))),this.storage=zO(MO(this,`addStorage`,{name:this.name,options:this.options}))||{}}static create(t={}){return new e(t)}configure(e={}){let t=this.extend({...this.config,addOptions:()=>nk(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(t={}){let n=new e(t);return n.parent=this,this.child=n,n.name=t.name?t.name:n.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=zO(MO(n,`addOptions`,{name:n.name})),n.storage=zO(MO(n,`addStorage`,{name:n.name,options:n.options})),n}};function gj(e){return new ak({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:i})=>{let a=zO(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 r=c.search(/\S/),i=n.from+c.indexOf(s),u=i+s.length;if(MA(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>i).length)return null;u<n.to&&o.delete(u,n.to),i>n.from&&o.delete(n.from+r,i),l=n.from+r+s.length,o.addMark(n.from+r,l,e.type.create(a||{})),o.removeStoredMark(e.type)}}})}function _j(e,t){let{selection:n}=e,{$from:r}=n;if(n instanceof IS){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}function vj(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,`\\$&`)}function yj(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var bj={exports:{}},xj={},Sj;function Cj(){if(Sj)return xj;Sj=1;var e=v.default;function t(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var n=typeof Object.is==`function`?Object.is:t,r=e.useState,i=e.useEffect,a=e.useLayoutEffect,o=e.useDebugValue;function s(e,t){var n=t(),s=r({inst:{value:n,getSnapshot:t}}),l=s[0].inst,u=s[1];return a(function(){l.value=n,l.getSnapshot=t,c(l)&&u({inst:l})},[e,n,t]),i(function(){return c(l)&&u({inst:l}),e(function(){c(l)&&u({inst:l})})},[e]),o(n),n}function c(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!n(e,r)}catch{return!0}}function l(e,t){return t()}var u=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?l:s;return xj.useSyncExternalStore=e.useSyncExternalStore===void 0?u:e.useSyncExternalStore,xj}bj.exports=Cj();var wj=bj.exports,Tj=(...e)=>t=>{e.forEach(e=>{typeof e==`function`?e(t):e&&(e.current=t)})},Ej=({contentComponent:e})=>{let t=wj.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot);return v.createElement(v.Fragment,null,Object.values(t))};function Dj(){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]:As.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 Oj=class extends v.Component{constructor(e){super(e),this.editorContentRef=v.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!e.editor?.contentComponent}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){let e=this.props.editor;if(e&&!e.isDestroyed&&e.options.element){if(e.contentComponent)return;let t=this.editorContentRef.current;t.append(...e.options.element.childNodes),e.setOptions({element:t}),e.contentComponent=Dj(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(e=>e.hasContentComponentInitialized?e:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){let e=this.props.editor;if(!e||(this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null,!e.options.element.firstChild))return;let t=document.createElement(`div`);t.append(...e.options.element.childNodes),e.setOptions({element:t})}render(){let{editor:e,innerRef:t,...n}=this.props;return v.createElement(v.Fragment,null,v.createElement(`div`,{ref:Tj(t,this.editorContentRef),...n}),e?.contentComponent&&v.createElement(Ej,{contentComponent:e.contentComponent}))}},kj=(0,v.forwardRef)((e,t)=>{let n=v.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return v.createElement(Oj,{key:n,innerRef:t,...e})}),Aj=v.memo(kj),jj=yj(function e(t,n){if(t===n)return!0;if(t&&n&&typeof t==`object`&&typeof n==`object`){if(t.constructor!==n.constructor)return!1;var r,i,a;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!e(t[i],n[i]))return!1;return!0}if(t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(i of t.entries())if(!n.has(i[0]))return!1;for(i of t.entries())if(!e(i[1],n.get(i[0])))return!1;return!0}if(t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(i of t.entries())if(!n.has(i[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(n)){if(r=t.length,r!=n.length)return!1;for(i=r;i--!==0;)if(t[i]!==n[i])return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(a=Object.keys(t),r=a.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,a[i]))return!1;for(i=r;i--!==0;){var o=a[i];if(!(o===`_owner`&&t.$$typeof)&&!e(t[o],n[o]))return!1}return!0}return t!==t&&n!==n}),Mj={exports:{}},Nj={},Pj;function Fj(){if(Pj)return Nj;Pj=1;var e=v.default,t=wj;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.useSyncExternalStore,a=e.useRef,o=e.useEffect,s=e.useMemo,c=e.useDebugValue;return Nj.useSyncExternalStoreWithSelector=function(e,t,n,l,u){var d=a(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=s(function(){function e(e){if(!i){if(i=!0,a=e,e=l(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return o=t}return o=e}if(t=o,r(a,e))return t;var n=l(e);return u!==void 0&&u(t,n)?t:(a=e,o=n)}var i=!1,a,o,s=n===void 0?null:n;return[function(){return e(t())},s===null?void 0:function(){return e(s())}]},[t,n,l,u]);var p=i(e,d[0],d[1]);return o(function(){f.hasValue=!0,f.value=p},[p]),c(p),p},Nj}Mj.exports=Fj();var Ij=Mj.exports,Lj=typeof window<`u`?v.useLayoutEffect:v.useEffect,Rj=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 zj(e){let[t]=(0,v.useState)(()=>new Rj(e.editor)),n=Ij.useSyncExternalStoreWithSelector(t.subscribe,t.getSnapshot,t.getServerSnapshot,e.selector,e.equalityFn??jj);return Lj(()=>t.watch(e.editor),[e.editor,t]),(0,v.useDebugValue)(n),n}var Bj=typeof window>`u`,Vj=Bj||!!(typeof window<`u`&&window.next),Hj=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(){return this.options.current.immediatelyRender===void 0?Bj||Vj?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){return new uj({...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)}})}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]):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 Uj(e={},t=[]){let n=(0,v.useRef)(e);n.current=e;let[r]=(0,v.useState)(()=>new Hj(n)),i=wj.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return(0,v.useDebugValue)(i),(0,v.useEffect)(r.onRender(t)),zj({editor:i,selector:({transactionNumber:t})=>e.shouldRerenderOnTransaction===!1?null:e.immediatelyRender&&t===0?0:t+1}),i}(0,v.createContext)({editor:null}).Consumer;var Wj=(0,v.createContext)({onDragStart:void 0}),Gj=()=>(0,v.useContext)(Wj);v.forwardRef((e,t)=>{let{onDragStart:n}=Gj(),r=e.as||`div`;return v.createElement(r,{...e,ref:t,"data-node-view-wrapper":``,onDragStart:n,style:{whiteSpace:`normal`,...e.style}})});var Kj=/^\s*>\s$/,qj=hj.create({name:`blockquote`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,group:`block`,defining:!0,parseHTML(){return[{tag:`blockquote`}]},renderHTML({HTMLAttributes:e}){return[`blockquote`,IO(this.options.HTMLAttributes,e),0]},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[mj({find:Kj,type:this.type})]}}),Jj=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Yj=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,Xj=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,Zj=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Qj=rk.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[`strong`,IO(this.options.HTMLAttributes,e),0]},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[dj({find:Jj,type:this.type}),dj({find:Xj,type:this.type})]},addPasteRules(){return[gj({find:Yj,type:this.type}),gj({find:Zj,type:this.type})]}}),$j=`listItem`,eM=`textStyle`,tM=/^\s*([-+*])\s$/,nM=hj.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`,IO(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes($j,this.editor.getAttributes(eM)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=mj({find:tM,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=mj({find:tM,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(eM),editor:this.editor})),[e]}}),rM=/(^|[^`])`([^`]+)`(?!`)/,iM=/(^|[^`])`([^`]+)`(?!`)/g,aM=rk.create({name:`code`,addOptions(){return{HTMLAttributes:{}}},excludes:`_`,code:!0,exitable:!0,parseHTML(){return[{tag:`code`}]},renderHTML({HTMLAttributes:e}){return[`code`,IO(this.options.HTMLAttributes,e),0]},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[dj({find:rM,type:this.type})]},addPasteRules(){return[gj({find:iM,type:this.type})]}}),oM=/^```([a-z]+)?[\s\n]$/,sM=/^~~~([a-z]+)?[\s\n]$/,cM=hj.create({name:`codeBlock`,addOptions(){return{languageClassPrefix:`language-`,exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,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[...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`,IO(this.options.HTMLAttributes,t),[`code`,{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},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},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(`
`);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(AS.near(r.resolve(o))),!0)):e.commands.exitCode()}}},addInputRules(){return[pj({find:oM,type:this.type,getAttributes:e=>({language:e[1]})}),pj({find:sM,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new QS({key:new tC(`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,`
`));return a.replaceSelectionWith(this.type.create({language:i},s)),a.selection.$from.parent.type!==this.type&&a.setSelection(PS.near(a.doc.resolve(Math.max(0,a.selection.from-2)))),a.setMeta(`paste`,!0),e.dispatch(a),!0}}})]}}),lM=hj.create({name:`doc`,topNode:!0,content:`block+`});function uM(e={}){return new QS({view(t){return new dM(t,e)}})}var dM=class{constructor(e,t){this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,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){if(this.cursorPos!=null&&t.doc!=e.state.doc)if(this.lastDragEvent){let e=this.computeTarget(this.lastDragEvent);e==this.cursorPos?this.updateOverlay():this.setCursor(e)}else 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)}computeTarget(e){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)return null;let a=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let e=lS(this.editorView.state.doc,a,this.editorView.dragging.slice);e!=null&&(a=e)}return a}dragover(e){if(!this.editorView.editable)return;this.lastDragEvent=e;let t=this.computeTarget(e);t!=null&&(this.setCursor(t),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}},fM=pk.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[uM(this.options)]}}),pM=class e extends AS{constructor(e){super(e,e)}map(t,n){let r=t.resolve(n.map(this.head));return e.valid(r)?new e(r):AS.near(r)}content(){return tb.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 mM(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!gM(e)||!_M(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&&!IS.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}}};pM.prototype.visible=!1,pM.findFrom=pM.findGapCursorFrom,AS.jsonID(`gapcursor`,pM);var mM=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 pM.valid(t)?new pM(t):AS.near(t)}};function hM(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function gM(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||hM(e.type))return!0;if(e.inlineContent)return!1}}return!0}function _M(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||hM(e.type))return!0;if(e.inlineContent)return!1}}return!0}function vM(){return new QS({props:{decorations:CM,createSelectionBetween(e,t,n){return t.pos==n.pos&&pM.valid(n)?new pM(n):null},handleClick:xM,handleKeyDown:yM,handleDOMEvents:{beforeinput:SM}}})}var yM=RD({ArrowLeft:bM(`horiz`,-1),ArrowRight:bM(`horiz`,1),ArrowUp:bM(`vert`,-1),ArrowDown:bM(`vert`,1)});function bM(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 PS){if(!i.endOfTextblock(n)||o.depth==0)return!1;s=!1,o=e.doc.resolve(t>0?o.after():o.before())}let c=pM.findGapCursorFrom(o,t,s);return c?(r&&r(e.tr.setSelection(new pM(c))),!0):!1}}function xM(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!pM.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&IS.isSelectable(e.state.doc.nodeAt(i.inside))?!1:(e.dispatch(e.state.tr.setSelection(new pM(r))),!0)}function SM(e,t){if(t.inputType!=`insertCompositionText`||!(e.state.selection instanceof pM))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=$.empty;for(let e=r.length-1;e>=0;e--)i=$.from(r[e].createAndFill(null,i));let a=e.state.tr.replace(n.pos,n.pos,new tb(i,0,0));return a.setSelection(PS.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function CM(e){if(!(e.selection instanceof pM))return null;let t=document.createElement(`div`);return t.className=`ProseMirror-gapcursor`,RE.create(e.doc,[FE.widget(e.selection.head,t,{key:`gapcursor`})])}var wM=pk.create({name:`gapCursor`,addProseMirrorPlugins(){return[vM()]},extendNodeSchema(e){return{allowGapCursor:zO(MO(e,`allowGapCursor`,{name:e.name,options:e.options,storage:e.storage}))??null}}}),TM=hj.create({name:`hardBreak`,addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:`inline`,selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:`br`}]},renderHTML({HTMLAttributes:e}){return[`br`,IO(this.options.HTMLAttributes,e)]},renderText(){return`
`},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()}}}),EM=hj.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]}`,IO(this.options.HTMLAttributes,t),0]},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=>pj({find:RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),DM=200,OM=function(){};OM.prototype.append=function(e){return e.length?(e=OM.from(e),!this.length&&e||e.length<DM&&this.leafAppend(e)||this.length<DM&&e.leafPrepend(this)||this.appendInner(e)):this},OM.prototype.prepend=function(e){return e.length?OM.from(e).append(this):this},OM.prototype.appendInner=function(e){return new AM(this,e)},OM.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?OM.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},OM.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},OM.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)},OM.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},OM.from=function(e){return e instanceof OM?e:e&&e.length?new kM(e):OM.empty};var kM=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<=DM)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=DM)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}(OM);OM.empty=new kM([]);var AM=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}(OM),jM=500,MM=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 PM(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 PM(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 PM(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>IM&&(s=NM(s,l),o-=l),new e(s.append(a),o)}remapping(e,t){let n=new Dx;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 PM(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 PM(i,o,l))}else r.push(new PM(i))},i);let l=[];for(let e=n;e<o;e++)l.push(new PM(a.maps[e]));let u=this.items.slice(0,i).append(l).append(r),d=new e(u,s);return d.emptyItemCount()>jM&&(d=d.compress(this.items.length-r.length)),d}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 PM(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(OM.from(i.reverse()),a)}};MM.empty=new MM(OM.empty,0);function NM(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&t--==0)return n=r,!1}),e.slice(n)}var PM=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)}}},FM=class{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}},IM=20;function LM(e,t,n,r){let i=n.getMeta(GM),a;if(i)return i.historyState;n.getMeta(KM)&&(e=new FM(e.done,e.undone,null,0,-1));let o=n.getMeta(`appendedTransaction`);if(n.steps.length==0)return e;if(o&&o.getMeta(GM))return o.getMeta(GM).redo?new FM(e.done.addTransform(n,void 0,r,WM(t)),e.undone,zM(n.mapping.maps),e.prevTime,e.prevComposition):new FM(e.done,e.undone.addTransform(n,void 0,r,WM(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||!RM(n,e.prevRanges)),s=o?BM(e.prevRanges,n.mapping):zM(n.mapping.maps);return new FM(e.done.addTransform(n,a?t.selection.getBookmark():void 0,r,WM(t)),MM.empty,s,n.time,i??e.prevComposition)}else if(a=n.getMeta(`rebased`))return new FM(e.done.rebased(n,a),e.undone.rebased(n,a),BM(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);else return new FM(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),BM(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function RM(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 zM(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 BM(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 VM(e,t,n){let r=WM(t),i=GM.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 FM(n?s:a.remaining,n?a.remaining:s,null,0,-1);return a.transform.setSelection(o).setMeta(GM,{redo:n,historyState:c})}var HM=!1,UM=null;function WM(e){let t=e.plugins;if(UM!=t){HM=!1,UM=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){HM=!0;break}}return HM}var GM=new tC(`history`),KM=new tC(`closeHistory`);function qM(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new QS({key:GM,state:{init(){return new FM(MM.empty,MM.empty,null,0,-1)},apply(t,n,r){return LM(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r=n==`historyUndo`?YM:n==`historyRedo`?XM:null;return!r||!e.editable?!1:(t.preventDefault(),r(e.state,e.dispatch))}}}})}function JM(e,t){return(n,r)=>{let i=GM.getState(n);if(!i||(e?i.undone:i.done).eventCount==0)return!1;if(r){let a=VM(i,n,e);a&&r(t?a.scrollIntoView():a)}return!0}}var YM=JM(!1,!0),XM=JM(!0,!0),ZM=pk.create({name:`history`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>YM(e,t),redo:()=>({state:e,dispatch:t})=>XM(e,t)}},addProseMirrorPlugins(){return[qM(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()}}}),QM=hj.create({name:`horizontalRule`,addOptions(){return{HTMLAttributes:{}}},group:`block`,parseHTML(){return[{tag:`hr`}]},renderHTML({HTMLAttributes:e}){return[`hr`,IO(this.options.HTMLAttributes,e)]},addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!_j(t,t.schema.nodes[this.name]))return!1;let{selection:n}=t,{$from:r,$to:i}=n,a=e();return r.parentOffset===0?a.insertContentAt({from:Math.max(r.pos-1,0),to:i.pos},{type:this.name}):RA(n)?a.insertContentAt(i.pos,{type:this.name}):a.insertContent({type:this.name}),a.command(({tr:e,dispatch:t})=>{if(t){let{$to:t}=e.selection,n=t.end();if(t.nodeAfter)t.nodeAfter.isTextblock?e.setSelection(PS.create(e.doc,t.pos+1)):t.nodeAfter.isBlock?e.setSelection(IS.create(e.doc,t.pos)):e.setSelection(PS.create(e.doc,t.pos));else{let r=t.parent.type.contentMatch.defaultType?.create();r&&(e.insert(n,r),e.setSelection(PS.create(e.doc,n+1)))}e.scrollIntoView()}return!0}).run()}}},addInputRules(){return[fj({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),$M=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,eN=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,tN=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,nN=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,rN=rk.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`,IO(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)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[dj({find:$M,type:this.type}),dj({find:tN,type:this.type})]},addPasteRules(){return[gj({find:eN,type:this.type}),gj({find:nN,type:this.type})]}}),iN=hj.create({name:`listItem`,addOptions(){return{HTMLAttributes:{},bulletListTypeName:`bulletList`,orderedListTypeName:`orderedList`}},content:`paragraph block*`,defining:!0,parseHTML(){return[{tag:`li`}]},renderHTML({HTMLAttributes:e}){return[`li`,IO(this.options.HTMLAttributes,e),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),aN=`listItem`,oN=`textStyle`,sN=/^(\d+)\.\s$/,cN=hj.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`,IO(this.options.HTMLAttributes,n),0]:[`ol`,IO(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(aN,this.editor.getAttributes(oN)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=mj({find:sN,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=mj({find:sN,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(oN)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[e]}}),lN=hj.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,IO(this.options.HTMLAttributes,e),0]},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),uN=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,dN=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,fN=rk.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`,IO(this.options.HTMLAttributes,e),0]},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[dj({find:uN,type:this.type})]},addPasteRules(){return[gj({find:dN,type:this.type})]}}),pN=hj.create({name:`text`,group:`inline`}),mN=pk.create({name:`starterKit`,addExtensions(){let e=[];return this.options.bold!==!1&&e.push(Qj.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(qj.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(nM.configure(this.options.bulletList)),this.options.code!==!1&&e.push(aM.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(cM.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(lM.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(fM.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(wM.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(TM.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(EM.configure(this.options.heading)),this.options.history!==!1&&e.push(ZM.configure(this.options.history)),this.options.horizontalRule!==!1&&e.push(QM.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(rN.configure(this.options.italic)),this.options.listItem!==!1&&e.push(iN.configure(this.options.listItem)),this.options.orderedList!==!1&&e.push(cN.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(lN.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(fN.configure(this.options.strike)),this.options.text!==!1&&e.push(pN.configure(this.options.text)),e}}),hN={};function gN(e){let t=hN[e];if(t)return t;t=hN[e]=[];for(let e=0;e<128;e++){let n=String.fromCharCode(e);t.push(n)}for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t[r]=`%`+(`0`+r.toString(16).toUpperCase()).slice(-2)}return t}function _N(e,t){typeof t!=`string`&&(t=_N.defaultChars);let n=gN(t);return e.replace(/(%[a-f0-9]{2})+/gi,function(e){let t=``;for(let r=0,i=e.length;r<i;r+=3){let a=parseInt(e.slice(r+1,r+3),16);if(a<128){t+=n[a];continue}if((a&224)==192&&r+3<i){let n=parseInt(e.slice(r+4,r+6),16);if((n&192)==128){let e=a<<6&1984|n&63;e<128?t+=`��`:t+=String.fromCharCode(e),r+=3;continue}}if((a&240)==224&&r+6<i){let n=parseInt(e.slice(r+4,r+6),16),i=parseInt(e.slice(r+7,r+9),16);if((n&192)==128&&(i&192)==128){let e=a<<12&61440|n<<6&4032|i&63;e<2048||e>=55296&&e<=57343?t+=`���`:t+=String.fromCharCode(e),r+=6;continue}}if((a&248)==240&&r+9<i){let n=parseInt(e.slice(r+4,r+6),16),i=parseInt(e.slice(r+7,r+9),16),o=parseInt(e.slice(r+10,r+12),16);if((n&192)==128&&(i&192)==128&&(o&192)==128){let e=a<<18&1835008|n<<12&258048|i<<6&4032|o&63;e<65536||e>1114111?t+=`����`:(e-=65536,t+=String.fromCharCode(55296+(e>>10),56320+(e&1023))),r+=9;continue}}t+=`�`}return t})}_N.defaultChars=`;/?:@&=+$,#`,_N.componentChars=``;var vN={};function yN(e){let t=vN[e];if(t)return t;t=vN[e]=[];for(let e=0;e<128;e++){let n=String.fromCharCode(e);/^[0-9a-z]$/i.test(n)?t.push(n):t.push(`%`+(`0`+e.toString(16).toUpperCase()).slice(-2))}for(let n=0;n<e.length;n++)t[e.charCodeAt(n)]=e[n];return t}function bN(e,t,n){typeof t!=`string`&&(n=t,t=bN.defaultChars),n===void 0&&(n=!0);let r=yN(t),i=``;for(let t=0,a=e.length;t<a;t++){let o=e.charCodeAt(t);if(n&&o===37&&t+2<a&&/^[0-9a-f]{2}$/i.test(e.slice(t+1,t+3))){i+=e.slice(t,t+3),t+=2;continue}if(o<128){i+=r[o];continue}if(o>=55296&&o<=57343){if(o>=55296&&o<=56319&&t+1<a){let n=e.charCodeAt(t+1);if(n>=56320&&n<=57343){i+=encodeURIComponent(e[t]+e[t+1]),t++;continue}}i+=`%EF%BF%BD`;continue}i+=encodeURIComponent(e[t])}return i}bN.defaultChars=`;/?:@&=+$,-_.!~*'()#`,bN.componentChars=`-_.!~*'()`;function xN(e){let t=``;return t+=e.protocol||``,t+=e.slashes?`//`:``,t+=e.auth?e.auth+`@`:``,e.hostname&&e.hostname.indexOf(`:`)!==-1?t+=`[`+e.hostname+`]`:t+=e.hostname||``,t+=e.port?`:`+e.port:``,t+=e.pathname||``,t+=e.search||``,t+=e.hash||``,t}function SN(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}var CN=/^([a-z0-9.+-]+:)/i,wN=/:[0-9]*$/,TN=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,EN=[`%`,`/`,`?`,`;`,`#`,`'`,`{`,`}`,`|`,`\\`,`^`,"`",`<`,`>`,`"`,"`",` `,`\r`,`
`,` `],DN=[`/`,`?`,`#`],ON=255,kN=/^[+a-z0-9A-Z_-]{0,63}$/,AN=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,jN={javascript:!0,"javascript:":!0},MN={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function NN(e,t){if(e&&e instanceof SN)return e;let n=new SN;return n.parse(e,t),n}SN.prototype.parse=function(e,t){let n,r,i,a=e;if(a=a.trim(),!t&&e.split(`#`).length===1){let e=TN.exec(a);if(e)return this.pathname=e[1],e[2]&&(this.search=e[2]),this}let o=CN.exec(a);if(o&&(o=o[0],n=o.toLowerCase(),this.protocol=o,a=a.substr(o.length)),(t||o||a.match(/^\/\/[^@\/]+@[^@\/]+/))&&(i=a.substr(0,2)===`//`,i&&!(o&&jN[o])&&(a=a.substr(2),this.slashes=!0)),!jN[o]&&(i||o&&!MN[o])){let e=-1;for(let t=0;t<DN.length;t++)r=a.indexOf(DN[t]),r!==-1&&(e===-1||r<e)&&(e=r);let t,n;n=e===-1?a.lastIndexOf(`@`):a.lastIndexOf(`@`,e),n!==-1&&(t=a.slice(0,n),a=a.slice(n+1),this.auth=t),e=-1;for(let t=0;t<EN.length;t++)r=a.indexOf(EN[t]),r!==-1&&(e===-1||r<e)&&(e=r);e===-1&&(e=a.length),a[e-1]===`:`&&e--;let i=a.slice(0,e);a=a.slice(e),this.parseHost(i),this.hostname=this.hostname||``;let o=this.hostname[0]===`[`&&this.hostname[this.hostname.length-1]===`]`;if(!o){let e=this.hostname.split(/\./);for(let t=0,n=e.length;t<n;t++){let n=e[t];if(n&&!n.match(kN)){let r=``;for(let e=0,t=n.length;e<t;e++)n.charCodeAt(e)>127?r+=`x`:r+=n[e];if(!r.match(kN)){let r=e.slice(0,t),i=e.slice(t+1),o=n.match(AN);o&&(r.push(o[1]),i.unshift(o[2])),i.length&&(a=i.join(`.`)+a),this.hostname=r.join(`.`);break}}}}this.hostname.length>ON&&(this.hostname=``),o&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}let s=a.indexOf(`#`);s!==-1&&(this.hash=a.substr(s),a=a.slice(0,s));let c=a.indexOf(`?`);return c!==-1&&(this.search=a.substr(c),a=a.slice(0,c)),a&&(this.pathname=a),MN[n]&&this.hostname&&!this.pathname&&(this.pathname=``),this},SN.prototype.parseHost=function(e){let t=wN.exec(e);t&&(t=t[0],t!==`:`&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)};var PN=s({decode:()=>_N,encode:()=>bN,format:()=>xN,parse:()=>NN}),FN=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,IN=/[\0-\x1F\x7F-\x9F]/,LN=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/,RN=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/,zN=/[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC2\uFD40-\uFD4F\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF76\uDF7B-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC5\uDECE-\uDEDB\uDEE0-\uDEE8\uDEF0-\uDEF8\uDF00-\uDF92\uDF94-\uDFCA]/,BN=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,VN=s({Any:()=>FN,Cc:()=>IN,Cf:()=>LN,P:()=>RN,S:()=>zN,Z:()=>BN}),HN=new Uint16Array(`ᵁ<Õıʊҝջאٵ۞ޢߖࠏઑඡ༉༦ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲϏϢϸontourIntegraìȹoɴ\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲy;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱còJTabcdfgorstרׯؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ߂ߐĀiyޱrc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣসে্ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४ĀnrࢃgleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpwਖਛgȀLRlr৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼અઋp;椅y;䐜Ādl੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑඞcy;䐊cute;䅃ƀaeyહાron;䅇dil;䅅;䐝ƀgswે૰ativeƀMTV૨ediumSpace;怋hiĀcn૦ëeryThiîtedĀGLଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷreak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪௫ఄ಄ದൡඅ櫬Āoungruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater;EFGLSTஶஷ扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨setĀ;Eೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂෛ෧ขภยา฿ไlig;䅒cute耻Ó䃓Āiyීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲcr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬืde耻Õ䃕es;樷ml耻Ö䃖erĀBP๋Āar๐๓r;怾acĀek๚;揞et;掴arenthesis;揜ҀacfhilorsງຊຏຒດຝະrtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ檻cedesȀ;EST່້扺qual;檯lantEqual;扼ilde;找me;怳Ādpuct;戏ortionĀ;aȥl;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL憒ar;懥eftArrow;懄eiling;按oǵ\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄቕቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHcቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗ĀeiቻDzኀ\0ኇefore;戴a;䎘ĀcnኘkSpace;쀀 Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtèa;䎖r;愨pf;愤cr;쀀𝒵ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒;Eaeiopᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;eᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;eᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰᝃᝈ០៦ᠹᡐᜍ᥈ᥰot;櫭ĀcrᛶkȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;tbrk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯᝳ;䎲;愶een;扬r;쀀𝔟gcostuvwឍឝឳេ៕៛ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀakoᠦᠵĀcn៲ᠣkƀlst֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ;敛;敘;攘;攔;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģbar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;elƀ;bhᥨᥩᥫ䁜;槅sub;柈ŬᥴlĀ;e怢t»pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭒\0᯽\0ᰌƀcprᦲute;䄇̀;abcdsᦿᧀᧄ᧕᧙戩nd;橄rcup;橉Āau᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r;Ecefms᩠ᩢᩫ᪤᪪旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ\0\0aĀ;t䀬;䁀ƀ;fl戁îᅠeĀmxent»eóɍǧ\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯delprvw᭠᭬᭷ᮂᮬᯔarrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;pᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰻᰿ᱝᱩᱵᲞᲬᲷᴍᵻᶑᶫᶻ᷆᷍ròar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂᳖᳜᳠mƀ;oș᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄĀDoḆᴴoôĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»ṺƀaeiἒἚls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧\0耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₥₰₴⃰℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽ƀ;qsؾٌlanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqrⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0proør;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼ròòΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonóquigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roøurĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻\xA0ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨íistĀ;sடr;쀀𝔫ȀEest⩦⩹⩼ƀ;qs⩭ƀ;qs⩴lanôií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast⭕⭚⭟lleìl;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖchimpqu⮽⯍⯙⬄⯤⯯Ȁ;cerല⯆ഷ⯉uå;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭ååഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñĀ;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;cⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācrir;榿;쀀𝔬ͯ\0\0\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕⶥⶨrò᪀Āirⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔǒr;榷rp;榹;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ\0\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ脀¶;l䂶leìЃɩ\0\0m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳ᤈ⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t⾴ïrel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⋢⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔ABHabcdefhilmnoprstuxけさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstwガクシスゼゾダッデナp;極Ā;fゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ìâヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘rrowĀ;tㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowóarpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓ròaòՑ;怏oustĀ;a㈞掱che»mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì耻䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;qኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫwar;椪lig耻ß䃟㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rëƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproøim»ኬsðኞĀas㚺㚮ðrn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈadempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xôheadĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roðtré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜtré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌`.split(``).map(e=>e.charCodeAt(0))),UN=new Uint16Array(`Ȁaglq \x1Bɭ\0\0p;䀦os;䀧t;䀾t;䀼uot;䀢`.split(``).map(e=>e.charCodeAt(0))),WN=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),GN=String.fromCodePoint??function(e){let t=``;return e>65535&&(e-=65536,t+=String.fromCharCode(e>>>10&1023|55296),e=56320|e&1023),t+=String.fromCharCode(e),t};function KN(e){return e>=55296&&e<=57343||e>1114111?65533:WN.get(e)??e}var qN;(function(e){e[e.NUM=35]=`NUM`,e[e.SEMI=59]=`SEMI`,e[e.EQUALS=61]=`EQUALS`,e[e.ZERO=48]=`ZERO`,e[e.NINE=57]=`NINE`,e[e.LOWER_A=97]=`LOWER_A`,e[e.LOWER_F=102]=`LOWER_F`,e[e.LOWER_X=120]=`LOWER_X`,e[e.LOWER_Z=122]=`LOWER_Z`,e[e.UPPER_A=65]=`UPPER_A`,e[e.UPPER_F=70]=`UPPER_F`,e[e.UPPER_Z=90]=`UPPER_Z`})(qN||={});var JN=32,YN;(function(e){e[e.VALUE_LENGTH=49152]=`VALUE_LENGTH`,e[e.BRANCH_LENGTH=16256]=`BRANCH_LENGTH`,e[e.JUMP_TABLE=127]=`JUMP_TABLE`})(YN||={});function XN(e){return e>=qN.ZERO&&e<=qN.NINE}function ZN(e){return e>=qN.UPPER_A&&e<=qN.UPPER_F||e>=qN.LOWER_A&&e<=qN.LOWER_F}function QN(e){return e>=qN.UPPER_A&&e<=qN.UPPER_Z||e>=qN.LOWER_A&&e<=qN.LOWER_Z||XN(e)}function $N(e){return e===qN.EQUALS||QN(e)}var eP;(function(e){e[e.EntityStart=0]=`EntityStart`,e[e.NumericStart=1]=`NumericStart`,e[e.NumericDecimal=2]=`NumericDecimal`,e[e.NumericHex=3]=`NumericHex`,e[e.NamedEntity=4]=`NamedEntity`})(eP||={});var tP;(function(e){e[e.Legacy=0]=`Legacy`,e[e.Strict=1]=`Strict`,e[e.Attribute=2]=`Attribute`})(tP||={});var nP=class{constructor(e,t,n){this.decodeTree=e,this.emitCodePoint=t,this.errors=n,this.state=eP.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=tP.Strict}startEntity(e){this.decodeMode=e,this.state=eP.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,t){switch(this.state){case eP.EntityStart:return e.charCodeAt(t)===qN.NUM?(this.state=eP.NumericStart,this.consumed+=1,this.stateNumericStart(e,t+1)):(this.state=eP.NamedEntity,this.stateNamedEntity(e,t));case eP.NumericStart:return this.stateNumericStart(e,t);case eP.NumericDecimal:return this.stateNumericDecimal(e,t);case eP.NumericHex:return this.stateNumericHex(e,t);case eP.NamedEntity:return this.stateNamedEntity(e,t)}}stateNumericStart(e,t){return t>=e.length?-1:(e.charCodeAt(t)|JN)===qN.LOWER_X?(this.state=eP.NumericHex,this.consumed+=1,this.stateNumericHex(e,t+1)):(this.state=eP.NumericDecimal,this.stateNumericDecimal(e,t))}addToNumericResult(e,t,n,r){if(t!==n){let i=n-t;this.result=this.result*r**+i+parseInt(e.substr(t,i),r),this.consumed+=i}}stateNumericHex(e,t){let n=t;for(;t<e.length;){let r=e.charCodeAt(t);if(XN(r)||ZN(r))t+=1;else return this.addToNumericResult(e,n,t,16),this.emitNumericEntity(r,3)}return this.addToNumericResult(e,n,t,16),-1}stateNumericDecimal(e,t){let n=t;for(;t<e.length;){let r=e.charCodeAt(t);if(XN(r))t+=1;else return this.addToNumericResult(e,n,t,10),this.emitNumericEntity(r,2)}return this.addToNumericResult(e,n,t,10),-1}emitNumericEntity(e,t){var n;if(this.consumed<=t)return(n=this.errors)==null||n.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===qN.SEMI)this.consumed+=1;else if(this.decodeMode===tP.Strict)return 0;return this.emitCodePoint(KN(this.result),this.consumed),this.errors&&(e!==qN.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,t){let{decodeTree:n}=this,r=n[this.treeIndex],i=(r&YN.VALUE_LENGTH)>>14;for(;t<e.length;t++,this.excess++){let a=e.charCodeAt(t);if(this.treeIndex=iP(n,r,this.treeIndex+Math.max(1,i),a),this.treeIndex<0)return this.result===0||this.decodeMode===tP.Attribute&&(i===0||$N(a))?0:this.emitNotTerminatedNamedEntity();if(r=n[this.treeIndex],i=(r&YN.VALUE_LENGTH)>>14,i!==0){if(a===qN.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==tP.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;let{result:t,decodeTree:n}=this,r=(n[t]&YN.VALUE_LENGTH)>>14;return this.emitNamedEntityData(t,r,this.consumed),(e=this.errors)==null||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,t,n){let{decodeTree:r}=this;return this.emitCodePoint(t===1?r[e]&~YN.VALUE_LENGTH:r[e+1],n),t===3&&this.emitCodePoint(r[e+2],n),n}end(){var e;switch(this.state){case eP.NamedEntity:return this.result!==0&&(this.decodeMode!==tP.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case eP.NumericDecimal:return this.emitNumericEntity(0,2);case eP.NumericHex:return this.emitNumericEntity(0,3);case eP.NumericStart:return(e=this.errors)==null||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case eP.EntityStart:return 0}}};function rP(e){let t=``,n=new nP(e,e=>t+=GN(e));return function(e,r){let i=0,a=0;for(;(a=e.indexOf(`&`,a))>=0;){t+=e.slice(i,a),n.startEntity(r);let o=n.write(e,a+1);if(o<0){i=a+n.end();break}i=a+o,a=o===0?i+1:i}let o=t+e.slice(i);return t=``,o}}function iP(e,t,n,r){let i=(t&YN.BRANCH_LENGTH)>>7,a=t&YN.JUMP_TABLE;if(i===0)return a!==0&&r===a?n:-1;if(a){let t=r-a;return t<0||t>=i?-1:e[n+t]-1}let o=n,s=o+i-1;for(;o<=s;){let t=o+s>>>1,n=e[t];if(n<r)o=t+1;else if(n>r)s=t-1;else return e[t+i]}return-1}var aP=rP(HN);rP(UN);function oP(e,t=tP.Legacy){return aP(e,t)}function sP(e){return aP(e,tP.Strict)}var cP=s({arrayReplaceAt:()=>mP,asciiTrim:()=>LP,assign:()=>pP,escapeHtml:()=>DP,escapeRE:()=>kP,fromCodePoint:()=>gP,has:()=>fP,isMdAsciiPunct:()=>PP,isPunctChar:()=>MP,isPunctCharCode:()=>NP,isSpace:()=>AP,isString:()=>uP,isValidEntityCode:()=>hP,isWhiteSpace:()=>jP,lib:()=>RP,normalizeReference:()=>FP,unescapeAll:()=>SP,unescapeMd:()=>xP});function lP(e){return Object.prototype.toString.call(e)}function uP(e){return lP(e)===`[object String]`}var dP=Object.prototype.hasOwnProperty;function fP(e,t){return dP.call(e,t)}function pP(e){return Array.prototype.slice.call(arguments,1).forEach(function(t){if(t){if(typeof t!=`object`)throw TypeError(t+`must be object`);Object.keys(t).forEach(function(n){e[n]=t[n]})}}),e}function mP(e,t,n){return[].concat(e.slice(0,t),n,e.slice(t+1))}function hP(e){return!(e>=55296&&e<=57343||e>=64976&&e<=65007||(e&65535)==65535||(e&65535)==65534||e>=0&&e<=8||e===11||e>=14&&e<=31||e>=127&&e<=159||e>1114111)}function gP(e){if(e>65535){e-=65536;let t=55296+(e>>10),n=56320+(e&1023);return String.fromCharCode(t,n)}return String.fromCharCode(e)}var _P=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,vP=RegExp(_P.source+`|&([a-z#][a-z0-9]{1,31});`,`gi`),yP=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function bP(e,t){if(t.charCodeAt(0)===35&&yP.test(t)){let n=t[1].toLowerCase()===`x`?parseInt(t.slice(2),16):parseInt(t.slice(1),10);return hP(n)?gP(n):e}let n=oP(e);return n===e?e:n}function xP(e){return e.indexOf(`\\`)<0?e:e.replace(_P,`$1`)}function SP(e){return e.indexOf(`\\`)<0&&e.indexOf(`&`)<0?e:e.replace(vP,function(e,t,n){return t||bP(e,n)})}var CP=/[&<>"]/,wP=/[&<>"]/g,TP={"&":`&`,"<":`<`,">":`>`,'"':`"`};function EP(e){return TP[e]}function DP(e){return CP.test(e)?e.replace(wP,EP):e}var OP=/[.?*+^$[\]\\(){}|-]/g;function kP(e){return e.replace(OP,`\\$&`)}function AP(e){switch(e){case 9:case 32:return!0}return!1}function jP(e){if(e>=8192&&e<=8202)return!0;switch(e){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}function MP(e){return RN.test(e)||zN.test(e)}function NP(e){return MP(gP(e))}function PP(e){switch(e){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function FP(e){return e=e.trim().replace(/\s+/g,` `),e.toLowerCase().toUpperCase()}function IP(e){return e===32||e===9||e===10||e===13}function LP(e){let t=0;for(;t<e.length&&IP(e.charCodeAt(t));t++);let n=e.length-1;for(;n>=t&&IP(e.charCodeAt(n));n--);return e.slice(t,n+1)}var RP={mdurl:PN,ucmicro:VN};function zP(e,t,n){let r,i,a,o,s=e.posMax,c=e.pos;for(e.pos=t+1,r=1;e.pos<s;){if(a=e.src.charCodeAt(e.pos),a===93&&(r--,r===0)){i=!0;break}if(o=e.pos,e.md.inline.skipToken(e),a===91){if(o===e.pos-1)r++;else if(n)return e.pos=c,-1}}let l=-1;return i&&(l=e.pos),e.pos=c,l}function BP(e,t,n){let r,i=t,a={ok:!1,pos:0,str:``};if(e.charCodeAt(i)===60){for(i++;i<n;){if(r=e.charCodeAt(i),r===10||r===60)return a;if(r===62)return a.pos=i+1,a.str=SP(e.slice(t+1,i)),a.ok=!0,a;if(r===92&&i+1<n){i+=2;continue}i++}return a}let o=0;for(;i<n&&(r=e.charCodeAt(i),!(r===32||r<32||r===127));){if(r===92&&i+1<n){if(e.charCodeAt(i+1)===32)break;i+=2;continue}if(r===40&&(o++,o>32))return a;if(r===41){if(o===0)break;o--}i++}return t===i||o!==0?a:(a.str=SP(e.slice(t,i)),a.pos=i,a.ok=!0,a)}function VP(e,t,n,r){let i,a=t,o={ok:!1,can_continue:!1,pos:0,str:``,marker:0};if(r)o.str=r.str,o.marker=r.marker;else{if(a>=n)return o;let r=e.charCodeAt(a);if(r!==34&&r!==39&&r!==40)return o;t++,a++,r===40&&(r=41),o.marker=r}for(;a<n;){if(i=e.charCodeAt(a),i===o.marker)return o.pos=a+1,o.str+=SP(e.slice(t,a)),o.ok=!0,o;if(i===40&&o.marker===41)return o;i===92&&a+1<n&&a++,a++}return o.can_continue=!0,o.str+=SP(e.slice(t,a)),o}var HP=s({parseLinkDestination:()=>BP,parseLinkLabel:()=>zP,parseLinkTitle:()=>VP}),UP={};UP.code_inline=function(e,t,n,r,i){let a=e[t];return`<code`+i.renderAttrs(a)+`>`+DP(a.content)+`</code>`},UP.code_block=function(e,t,n,r,i){let a=e[t];return`<pre`+i.renderAttrs(a)+`><code>`+DP(e[t].content)+`</code></pre>
`},UP.fence=function(e,t,n,r,i){let a=e[t],o=a.info?SP(a.info).trim():``,s=``,c=``;if(o){let e=o.split(/(\s+)/g);s=e[0],c=e.slice(2).join(``)}let l;if(l=n.highlight&&n.highlight(a.content,s,c)||DP(a.content),l.indexOf(`<pre`)===0)return l+`
`;if(o){let e=a.attrIndex(`class`),t=a.attrs?a.attrs.slice():[];e<0?t.push([`class`,n.langPrefix+s]):(t[e]=t[e].slice(),t[e][1]+=` `+n.langPrefix+s);let r={attrs:t};return`<pre><code${i.renderAttrs(r)}>${l}</code></pre>\n`}return`<pre><code${i.renderAttrs(a)}>${l}</code></pre>\n`},UP.image=function(e,t,n,r,i){let a=e[t];return a.attrs[a.attrIndex(`alt`)][1]=i.renderInlineAsText(a.children,n,r),i.renderToken(e,t,n)},UP.hardbreak=function(e,t,n){return n.xhtmlOut?`<br />
`:`<br>
`},UP.softbreak=function(e,t,n){return n.breaks?n.xhtmlOut?`<br />
`:`<br>
`:`
`},UP.text=function(e,t){return DP(e[t].content)},UP.html_block=function(e,t){return e[t].content},UP.html_inline=function(e,t){return e[t].content};function WP(){this.rules=pP({},UP)}WP.prototype.renderAttrs=function(e){let t,n,r;if(!e.attrs)return``;for(r=``,t=0,n=e.attrs.length;t<n;t++)r+=` `+DP(e.attrs[t][0])+`="`+DP(e.attrs[t][1])+`"`;return r},WP.prototype.renderToken=function(e,t,n){let r=e[t],i=``;if(r.hidden)return``;r.block&&r.nesting!==-1&&t&&e[t-1].hidden&&(i+=`
`),i+=(r.nesting===-1?`</`:`<`)+r.tag,i+=this.renderAttrs(r),r.nesting===0&&n.xhtmlOut&&(i+=` /`);let a=!1;if(r.block&&(a=!0,r.nesting===1&&t+1<e.length)){let n=e[t+1];(n.type===`inline`||n.hidden||n.nesting===-1&&n.tag===r.tag)&&(a=!1)}return i+=a?`>
`:`>`,i},WP.prototype.renderInline=function(e,t,n){let r=``,i=this.rules;for(let a=0,o=e.length;a<o;a++){let o=e[a].type;i[o]===void 0?r+=this.renderToken(e,a,t):r+=i[o](e,a,t,n,this)}return r},WP.prototype.renderInlineAsText=function(e,t,n){let r=``;for(let i=0,a=e.length;i<a;i++)switch(e[i].type){case`text`:r+=e[i].content;break;case`image`:r+=this.renderInlineAsText(e[i].children,t,n);break;case`html_inline`:case`html_block`:r+=e[i].content;break;case`softbreak`:case`hardbreak`:r+=`
`;break;default:}return r},WP.prototype.render=function(e,t,n){let r=``,i=this.rules;for(let a=0,o=e.length;a<o;a++){let o=e[a].type;o===`inline`?r+=this.renderInline(e[a].children,t,n):i[o]===void 0?r+=this.renderToken(e,a,t,n):r+=i[o](e,a,t,n,this)}return r};function GP(){this.__rules__=[],this.__cache__=null}GP.prototype.__find__=function(e){for(let t=0;t<this.__rules__.length;t++)if(this.__rules__[t].name===e)return t;return-1},GP.prototype.__compile__=function(){let e=this,t=[``];e.__rules__.forEach(function(e){e.enabled&&e.alt.forEach(function(e){t.indexOf(e)<0&&t.push(e)})}),e.__cache__={},t.forEach(function(t){e.__cache__[t]=[],e.__rules__.forEach(function(n){n.enabled&&(t&&n.alt.indexOf(t)<0||e.__cache__[t].push(n.fn))})})},GP.prototype.at=function(e,t,n){let r=this.__find__(e),i=n||{};if(r===-1)throw Error(`Parser rule not found: `+e);this.__rules__[r].fn=t,this.__rules__[r].alt=i.alt||[],this.__cache__=null},GP.prototype.before=function(e,t,n,r){let i=this.__find__(e),a=r||{};if(i===-1)throw Error(`Parser rule not found: `+e);this.__rules__.splice(i,0,{name:t,enabled:!0,fn:n,alt:a.alt||[]}),this.__cache__=null},GP.prototype.after=function(e,t,n,r){let i=this.__find__(e),a=r||{};if(i===-1)throw Error(`Parser rule not found: `+e);this.__rules__.splice(i+1,0,{name:t,enabled:!0,fn:n,alt:a.alt||[]}),this.__cache__=null},GP.prototype.push=function(e,t,n){let r=n||{};this.__rules__.push({name:e,enabled:!0,fn:t,alt:r.alt||[]}),this.__cache__=null},GP.prototype.enable=function(e,t){Array.isArray(e)||(e=[e]);let n=[];return e.forEach(function(e){let r=this.__find__(e);if(r<0){if(t)return;throw Error(`Rules manager: invalid rule name `+e)}this.__rules__[r].enabled=!0,n.push(e)},this),this.__cache__=null,n},GP.prototype.enableOnly=function(e,t){Array.isArray(e)||(e=[e]),this.__rules__.forEach(function(e){e.enabled=!1}),this.enable(e,t)},GP.prototype.disable=function(e,t){Array.isArray(e)||(e=[e]);let n=[];return e.forEach(function(e){let r=this.__find__(e);if(r<0){if(t)return;throw Error(`Rules manager: invalid rule name `+e)}this.__rules__[r].enabled=!1,n.push(e)},this),this.__cache__=null,n},GP.prototype.getRules=function(e){return this.__cache__===null&&this.__compile__(),this.__cache__[e]||[]};function KP(e,t,n){this.type=e,this.tag=t,this.attrs=null,this.map=null,this.nesting=n,this.level=0,this.children=null,this.content=``,this.markup=``,this.info=``,this.meta=null,this.block=!1,this.hidden=!1}KP.prototype.attrIndex=function(e){if(!this.attrs)return-1;let t=this.attrs;for(let n=0,r=t.length;n<r;n++)if(t[n][0]===e)return n;return-1},KP.prototype.attrPush=function(e){this.attrs?this.attrs.push(e):this.attrs=[e]},KP.prototype.attrSet=function(e,t){let n=this.attrIndex(e),r=[e,t];n<0?this.attrPush(r):this.attrs[n]=r},KP.prototype.attrGet=function(e){let t=this.attrIndex(e),n=null;return t>=0&&(n=this.attrs[t][1]),n},KP.prototype.attrJoin=function(e,t){let n=this.attrIndex(e);n<0?this.attrPush([e,t]):this.attrs[n][1]=this.attrs[n][1]+` `+t};function qP(e,t,n){this.src=e,this.env=n,this.tokens=[],this.inlineMode=!1,this.md=t}qP.prototype.Token=KP;var JP=/\r\n?|\n/g,YP=/\0/g;function XP(e){let t;t=e.src.replace(JP,`
`),t=t.replace(YP,`�`),e.src=t}function ZP(e){let t;e.inlineMode?(t=new e.Token(`inline`,``,0),t.content=e.src,t.map=[0,1],t.children=[],e.tokens.push(t)):e.md.block.parse(e.src,e.md,e.env,e.tokens)}function QP(e){let t=e.tokens;for(let n=0,r=t.length;n<r;n++){let r=t[n];r.type===`inline`&&e.md.inline.parse(r.content,e.md,e.env,r.children)}}function $P(e){return/^<a[>\s]/i.test(e)}function eF(e){return/^<\/a\s*>/i.test(e)}function tF(e){let t=e.tokens;if(e.md.options.linkify)for(let n=0,r=t.length;n<r;n++){if(t[n].type!==`inline`||!e.md.linkify.pretest(t[n].content))continue;let r=t[n].children,i=0;for(let a=r.length-1;a>=0;a--){let o=r[a];if(o.type===`link_close`){for(a--;r[a].level!==o.level&&r[a].type!==`link_open`;)a--;continue}if(o.type===`html_inline`&&($P(o.content)&&i>0&&i--,eF(o.content)&&i++),!(i>0)&&o.type===`text`&&e.md.linkify.test(o.content)){let i=o.content,s=e.md.linkify.match(i),c=[],l=o.level,u=0;s.length>0&&s[0].index===0&&a>0&&r[a-1].type===`text_special`&&(s=s.slice(1));for(let t=0;t<s.length;t++){let n=s[t].url,r=e.md.normalizeLink(n);if(!e.md.validateLink(r))continue;let a=s[t].text;a=s[t].schema?s[t].schema===`mailto:`&&!/^mailto:/i.test(a)?e.md.normalizeLinkText(`mailto:`+a).replace(/^mailto:/,``):e.md.normalizeLinkText(a):e.md.normalizeLinkText(`http://`+a).replace(/^http:\/\//,``);let o=s[t].index;if(o>u){let t=new e.Token(`text`,``,0);t.content=i.slice(u,o),t.level=l,c.push(t)}let d=new e.Token(`link_open`,`a`,1);d.attrs=[[`href`,r]],d.level=l++,d.markup=`linkify`,d.info=`auto`,c.push(d);let f=new e.Token(`text`,``,0);f.content=a,f.level=l,c.push(f);let p=new e.Token(`link_close`,`a`,-1);p.level=--l,p.markup=`linkify`,p.info=`auto`,c.push(p),u=s[t].lastIndex}if(u<i.length){let t=new e.Token(`text`,``,0);t.content=i.slice(u),t.level=l,c.push(t)}t[n].children=r=mP(r,a,c)}}}}var nF=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,rF=/\((c|tm|r)\)/i,iF=/\((c|tm|r)\)/gi,aF={c:`©`,r:`®`,tm:`™`};function oF(e,t){return aF[t.toLowerCase()]}function sF(e){let t=0;for(let n=e.length-1;n>=0;n--){let r=e[n];r.type===`text`&&!t&&(r.content=r.content.replace(iF,oF)),r.type===`link_open`&&r.info===`auto`&&t--,r.type===`link_close`&&r.info===`auto`&&t++}}function cF(e){let t=0;for(let n=e.length-1;n>=0;n--){let r=e[n];r.type===`text`&&!t&&nF.test(r.content)&&(r.content=r.content.replace(/\+-/g,`±`).replace(/\.{2,}/g,`…`).replace(/([?!])…/g,`$1..`).replace(/([?!]){4,}/g,`$1$1$1`).replace(/,{2,}/g,`,`).replace(/(^|[^-])---(?=[^-]|$)/gm,`$1—`).replace(/(^|\s)--(?=\s|$)/gm,`$1–`).replace(/(^|[^-\s])--(?=[^-\s]|$)/gm,`$1–`)),r.type===`link_open`&&r.info===`auto`&&t--,r.type===`link_close`&&r.info===`auto`&&t++}}function lF(e){let t;if(e.md.options.typographer)for(t=e.tokens.length-1;t>=0;t--)e.tokens[t].type===`inline`&&(rF.test(e.tokens[t].content)&&sF(e.tokens[t].children),nF.test(e.tokens[t].content)&&cF(e.tokens[t].children))}var uF=/['"]/,dF=/['"]/g,fF=`’`;function pF(e,t,n,r){e[t]||(e[t]=[]),e[t].push({pos:n,ch:r})}function mF(e,t){let n=``,r=0;t.sort((e,t)=>e.pos-t.pos);for(let i=0;i<t.length;i++){let a=t[i];n+=e.slice(r,a.pos)+a.ch,r=a.pos+1}return n+e.slice(r)}function hF(e,t){let n,r=[],i={};for(let a=0;a<e.length;a++){let o=e[a],s=e[a].level;for(n=r.length-1;n>=0&&!(r[n].level<=s);n--);if(r.length=n+1,o.type!==`text`)continue;let c=o.content,l=0,u=c.length;OUTER:for(;l<u;){dF.lastIndex=l;let o=dF.exec(c);if(!o)break;let d=!0,f=!0;l=o.index+1;let p=o[0]===`'`,m=32;if(o.index-1>=0)m=c.charCodeAt(o.index-1);else for(n=a-1;n>=0&&!(e[n].type===`softbreak`||e[n].type===`hardbreak`);n--)if(e[n].content){m=e[n].content.charCodeAt(e[n].content.length-1);break}let h=32;if(l<u)h=c.charCodeAt(l);else for(n=a+1;n<e.length&&!(e[n].type===`softbreak`||e[n].type===`hardbreak`);n++)if(e[n].content){h=e[n].content.charCodeAt(0);break}let g=PP(m)||NP(m),_=PP(h)||NP(h),v=jP(m),y=jP(h);if(y?d=!1:_&&(v||g||(d=!1)),v?f=!1:g&&(y||_||(f=!1)),h===34&&o[0]===`"`&&m>=48&&m<=57&&(f=d=!1),d&&f&&(d=g,f=_),!d&&!f){p&&pF(i,a,o.index,fF);continue}if(f)for(n=r.length-1;n>=0;n--){let e=r[n];if(r[n].level<s)break;if(e.single===p&&r[n].level===s){e=r[n];let s,c;p?(s=t.md.options.quotes[2],c=t.md.options.quotes[3]):(s=t.md.options.quotes[0],c=t.md.options.quotes[1]),pF(i,a,o.index,c),pF(i,e.token,e.pos,s),r.length=n;continue OUTER}}d?r.push({token:a,pos:o.index,single:p,level:s}):f&&p&&pF(i,a,o.index,fF)}}Object.keys(i).forEach(function(t){e[t].content=mF(e[t].content,i[t])})}function gF(e){if(e.md.options.typographer)for(let t=e.tokens.length-1;t>=0;t--)e.tokens[t].type!==`inline`||!uF.test(e.tokens[t].content)||hF(e.tokens[t].children,e)}function _F(e){let t,n,r=e.tokens,i=r.length;for(let e=0;e<i;e++){if(r[e].type!==`inline`)continue;let i=r[e].children,a=i.length;for(t=0;t<a;t++)i[t].type===`text_special`&&(i[t].type=`text`);for(t=n=0;t<a;t++)i[t].type===`text`&&t+1<a&&i[t+1].type===`text`?i[t+1].content=i[t].content+i[t+1].content:(t!==n&&(i[n]=i[t]),n++);t!==n&&(i.length=n)}}var vF=[[`normalize`,XP],[`block`,ZP],[`inline`,QP],[`linkify`,tF],[`replacements`,lF],[`smartquotes`,gF],[`text_join`,_F]];function yF(){this.ruler=new GP;for(let e=0;e<vF.length;e++)this.ruler.push(vF[e][0],vF[e][1])}yF.prototype.process=function(e){let t=this.ruler.getRules(``);for(let n=0,r=t.length;n<r;n++)t[n](e)},yF.prototype.State=qP;function bF(e,t,n,r){this.src=e,this.md=t,this.env=n,this.tokens=r,this.bMarks=[],this.eMarks=[],this.tShift=[],this.sCount=[],this.bsCount=[],this.blkIndent=0,this.line=0,this.lineMax=0,this.tight=!1,this.ddIndent=-1,this.listIndent=-1,this.parentType=`root`,this.level=0;let i=this.src;for(let e=0,t=0,n=0,r=0,a=i.length,o=!1;t<a;t++){let s=i.charCodeAt(t);if(!o)if(AP(s)){n++,s===9?r+=4-r%4:r++;continue}else o=!0;(s===10||t===a-1)&&(s!==10&&t++,this.bMarks.push(e),this.eMarks.push(t),this.tShift.push(n),this.sCount.push(r),this.bsCount.push(0),o=!1,n=0,r=0,e=t+1)}this.bMarks.push(i.length),this.eMarks.push(i.length),this.tShift.push(0),this.sCount.push(0),this.bsCount.push(0),this.lineMax=this.bMarks.length-1}bF.prototype.push=function(e,t,n){let r=new KP(e,t,n);return r.block=!0,n<0&&this.level--,r.level=this.level,n>0&&this.level++,this.tokens.push(r),r},bF.prototype.isEmpty=function(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]},bF.prototype.skipEmptyLines=function(e){for(let t=this.lineMax;e<t&&!(this.bMarks[e]+this.tShift[e]<this.eMarks[e]);e++);return e},bF.prototype.skipSpaces=function(e){for(let t=this.src.length;e<t&&AP(this.src.charCodeAt(e));e++);return e},bF.prototype.skipSpacesBack=function(e,t){if(e<=t)return e;for(;e>t;)if(!AP(this.src.charCodeAt(--e)))return e+1;return e},bF.prototype.skipChars=function(e,t){for(let n=this.src.length;e<n&&this.src.charCodeAt(e)===t;e++);return e},bF.prototype.skipCharsBack=function(e,t,n){if(e<=n)return e;for(;e>n;)if(t!==this.src.charCodeAt(--e))return e+1;return e},bF.prototype.getLines=function(e,t,n,r){if(e>=t)return``;let i=Array(t-e);for(let a=0,o=e;o<t;o++,a++){let e=0,s=this.bMarks[o],c=s,l;for(l=o+1<t||r?this.eMarks[o]+1:this.eMarks[o];c<l&&e<n;){let t=this.src.charCodeAt(c);if(AP(t))t===9?e+=4-(e+this.bsCount[o])%4:e++;else if(c-s<this.tShift[o])e++;else break;c++}e>n?i[a]=Array(e-n+1).join(` `)+this.src.slice(c,l):i[a]=this.src.slice(c,l)}return i.join(``)},bF.prototype.Token=KP;var xF=65536;function SF(e,t){let n=e.bMarks[t]+e.tShift[t],r=e.eMarks[t];return e.src.slice(n,r)}function CF(e){let t=[],n=e.length,r=0,i=e.charCodeAt(r),a=!1,o=0,s=``;for(;r<n;)i===124&&(a?(s+=e.substring(o,r-1),o=r):(t.push(s+e.substring(o,r)),s=``,o=r+1)),a=i===92,r++,i=e.charCodeAt(r);return t.push(s+e.substring(o)),t}function wF(e,t,n,r){if(t+2>n)return!1;let i=t+1;if(e.sCount[i]<e.blkIndent||e.sCount[i]-e.blkIndent>=4)return!1;let a=e.bMarks[i]+e.tShift[i];if(a>=e.eMarks[i])return!1;let o=e.src.charCodeAt(a++);if(o!==124&&o!==45&&o!==58||a>=e.eMarks[i])return!1;let s=e.src.charCodeAt(a++);if(s!==124&&s!==45&&s!==58&&!AP(s)||o===45&&AP(s))return!1;for(;a<e.eMarks[i];){let t=e.src.charCodeAt(a);if(t!==124&&t!==45&&t!==58&&!AP(t))return!1;a++}let c=SF(e,t+1),l=c.split(`|`),u=[];for(let e=0;e<l.length;e++){let t=l[e].trim();if(!t){if(e===0||e===l.length-1)continue;return!1}if(!/^:?-+:?$/.test(t))return!1;t.charCodeAt(t.length-1)===58?u.push(t.charCodeAt(0)===58?`center`:`right`):t.charCodeAt(0)===58?u.push(`left`):u.push(``)}if(c=SF(e,t).trim(),c.indexOf(`|`)===-1||e.sCount[t]-e.blkIndent>=4)return!1;l=CF(c),l.length&&l[0]===``&&l.shift(),l.length&&l[l.length-1]===``&&l.pop();let d=l.length;if(d===0||d!==u.length)return!1;if(r)return!0;let f=e.parentType;e.parentType=`table`;let p=e.md.block.ruler.getRules(`blockquote`),m=e.push(`table_open`,`table`,1),h=[t,0];m.map=h;let g=e.push(`thead_open`,`thead`,1);g.map=[t,t+1];let _=e.push(`tr_open`,`tr`,1);_.map=[t,t+1];for(let t=0;t<l.length;t++){let n=e.push(`th_open`,`th`,1);u[t]&&(n.attrs=[[`style`,`text-align:`+u[t]]]);let r=e.push(`inline`,``,0);r.content=l[t].trim(),r.children=[],e.push(`th_close`,`th`,-1)}e.push(`tr_close`,`tr`,-1),e.push(`thead_close`,`thead`,-1);let v,y=0;for(i=t+2;i<n&&!(e.sCount[i]<e.blkIndent);i++){let r=!1;for(let t=0,a=p.length;t<a;t++)if(p[t](e,i,n,!0)){r=!0;break}if(r||(c=SF(e,i).trim(),!c)||e.sCount[i]-e.blkIndent>=4||(l=CF(c),l.length&&l[0]===``&&l.shift(),l.length&&l[l.length-1]===``&&l.pop(),y+=d-l.length,y>xF))break;if(i===t+2){let n=e.push(`tbody_open`,`tbody`,1);n.map=v=[t+2,0]}let a=e.push(`tr_open`,`tr`,1);a.map=[i,i+1];for(let t=0;t<d;t++){let n=e.push(`td_open`,`td`,1);u[t]&&(n.attrs=[[`style`,`text-align:`+u[t]]]);let r=e.push(`inline`,``,0);r.content=l[t]?l[t].trim():``,r.children=[],e.push(`td_close`,`td`,-1)}e.push(`tr_close`,`tr`,-1)}return v&&(e.push(`tbody_close`,`tbody`,-1),v[1]=i),e.push(`table_close`,`table`,-1),h[1]=i,e.parentType=f,e.line=i,!0}function TF(e,t,n){if(e.sCount[t]-e.blkIndent<4)return!1;let r=t+1,i=r;for(;r<n;){if(e.isEmpty(r)){r++;continue}if(e.sCount[r]-e.blkIndent>=4){r++,i=r;continue}break}e.line=i;let a=e.push(`code_block`,`code`,0);return a.content=e.getLines(t,i,4+e.blkIndent,!1)+`
`,a.map=[t,e.line],!0}function EF(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||i+3>a)return!1;let o=e.src.charCodeAt(i);if(o!==126&&o!==96)return!1;let s=i;i=e.skipChars(i,o);let c=i-s;if(c<3)return!1;let l=e.src.slice(s,i),u=e.src.slice(i,a);if(o===96&&u.indexOf(String.fromCharCode(o))>=0)return!1;if(r)return!0;let d=t,f=!1;for(;d++,!(d>=n||(i=s=e.bMarks[d]+e.tShift[d],a=e.eMarks[d],i<a&&e.sCount[d]<e.blkIndent));)if(e.src.charCodeAt(i)===o&&!(e.sCount[d]-e.blkIndent>=4)&&(i=e.skipChars(i,o),!(i-s<c)&&(i=e.skipSpaces(i),!(i<a)))){f=!0;break}c=e.sCount[t],e.line=d+ +!!f;let p=e.push(`fence`,`code`,0);return p.info=u,p.content=e.getLines(t+1,d,c,!0),p.markup=l,p.map=[t,e.line],!0}function DF(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t],o=e.lineMax;if(e.sCount[t]-e.blkIndent>=4||e.src.charCodeAt(i)!==62)return!1;if(r)return!0;let s=[],c=[],l=[],u=[],d=e.md.block.ruler.getRules(`blockquote`),f=e.parentType;e.parentType=`blockquote`;let p=!1,m;for(m=t;m<n;m++){let t=e.sCount[m]<e.blkIndent;if(i=e.bMarks[m]+e.tShift[m],a=e.eMarks[m],i>=a)break;if(e.src.charCodeAt(i++)===62&&!t){let t=e.sCount[m]+1,n,r;e.src.charCodeAt(i)===32?(i++,t++,r=!1,n=!0):e.src.charCodeAt(i)===9?(n=!0,(e.bsCount[m]+t)%4==3?(i++,t++,r=!1):r=!0):n=!1;let o=t;for(s.push(e.bMarks[m]),e.bMarks[m]=i;i<a;){let t=e.src.charCodeAt(i);if(AP(t))t===9?o+=4-(o+e.bsCount[m]+ +!!r)%4:o++;else break;i++}p=i>=a,c.push(e.bsCount[m]),e.bsCount[m]=e.sCount[m]+1+ +!!n,l.push(e.sCount[m]),e.sCount[m]=o-t,u.push(e.tShift[m]),e.tShift[m]=i-e.bMarks[m];continue}if(p)break;let r=!1;for(let t=0,i=d.length;t<i;t++)if(d[t](e,m,n,!0)){r=!0;break}if(r){e.lineMax=m,e.blkIndent!==0&&(s.push(e.bMarks[m]),c.push(e.bsCount[m]),u.push(e.tShift[m]),l.push(e.sCount[m]),e.sCount[m]-=e.blkIndent);break}s.push(e.bMarks[m]),c.push(e.bsCount[m]),u.push(e.tShift[m]),l.push(e.sCount[m]),e.sCount[m]=-1}let h=e.blkIndent;e.blkIndent=0;let g=e.push(`blockquote_open`,`blockquote`,1);g.markup=`>`;let _=[t,0];g.map=_,e.md.block.tokenize(e,t,m);let v=e.push(`blockquote_close`,`blockquote`,-1);v.markup=`>`,e.lineMax=o,e.parentType=f,_[1]=e.line;for(let n=0;n<u.length;n++)e.bMarks[n+t]=s[n],e.tShift[n+t]=u[n],e.sCount[n+t]=l[n],e.bsCount[n+t]=c[n];return e.blkIndent=h,!0}function OF(e,t,n,r){let i=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let a=e.bMarks[t]+e.tShift[t],o=e.src.charCodeAt(a++);if(o!==42&&o!==45&&o!==95)return!1;let s=1;for(;a<i;){let t=e.src.charCodeAt(a++);if(t!==o&&!AP(t))return!1;t===o&&s++}if(s<3)return!1;if(r)return!0;e.line=t+1;let c=e.push(`hr`,`hr`,0);return c.map=[t,e.line],c.markup=Array(s+1).join(String.fromCharCode(o)),!0}function kF(e,t){let n=e.eMarks[t],r=e.bMarks[t]+e.tShift[t],i=e.src.charCodeAt(r++);return i!==42&&i!==45&&i!==43||r<n&&!AP(e.src.charCodeAt(r))?-1:r}function AF(e,t){let n=e.bMarks[t]+e.tShift[t],r=e.eMarks[t],i=n;if(i+1>=r)return-1;let a=e.src.charCodeAt(i++);if(a<48||a>57)return-1;for(;;){if(i>=r)return-1;if(a=e.src.charCodeAt(i++),a>=48&&a<=57){if(i-n>=10)return-1;continue}if(a===41||a===46)break;return-1}return i<r&&(a=e.src.charCodeAt(i),!AP(a))?-1:i}function jF(e,t){let n=e.level+2;for(let r=t+2,i=e.tokens.length-2;r<i;r++)e.tokens[r].level===n&&e.tokens[r].type===`paragraph_open`&&(e.tokens[r+2].hidden=!0,e.tokens[r].hidden=!0,r+=2)}function MF(e,t,n,r){let i,a,o,s,c=t,l=!0;if(e.sCount[c]-e.blkIndent>=4||e.listIndent>=0&&e.sCount[c]-e.listIndent>=4&&e.sCount[c]<e.blkIndent)return!1;let u=!1;r&&e.parentType===`paragraph`&&e.sCount[c]>=e.blkIndent&&(u=!0);let d,f,p;if((p=AF(e,c))>=0){if(d=!0,o=e.bMarks[c]+e.tShift[c],f=Number(e.src.slice(o,p-1)),u&&f!==1)return!1}else if((p=kF(e,c))>=0)d=!1;else return!1;if(u&&e.skipSpaces(p)>=e.eMarks[c])return!1;if(r)return!0;let m=e.src.charCodeAt(p-1),h=e.tokens.length;d?(s=e.push(`ordered_list_open`,`ol`,1),f!==1&&(s.attrs=[[`start`,f]])):s=e.push(`bullet_list_open`,`ul`,1);let g=[c,0];s.map=g,s.markup=String.fromCharCode(m);let _=!1,v=e.md.block.ruler.getRules(`list`),y=e.parentType;for(e.parentType=`list`;c<n;){a=p,i=e.eMarks[c];let t=e.sCount[c]+p-(e.bMarks[c]+e.tShift[c]),r=t;for(;a<i;){let t=e.src.charCodeAt(a);if(t===9)r+=4-(r+e.bsCount[c])%4;else if(t===32)r++;else break;a++}let u=a,f;f=u>=i?1:r-t,f>4&&(f=1);let h=t+f;s=e.push(`list_item_open`,`li`,1),s.markup=String.fromCharCode(m);let g=[c,0];s.map=g,d&&(s.info=e.src.slice(o,p-1));let y=e.tight,b=e.tShift[c],x=e.sCount[c],S=e.listIndent;if(e.listIndent=e.blkIndent,e.blkIndent=h,e.tight=!0,e.tShift[c]=u-e.bMarks[c],e.sCount[c]=r,u>=i&&e.isEmpty(c+1)?e.line=Math.min(e.line+2,n):e.md.block.tokenize(e,c,n,!0),(!e.tight||_)&&(l=!1),_=e.line-c>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=S,e.tShift[c]=b,e.sCount[c]=x,e.tight=y,s=e.push(`list_item_close`,`li`,-1),s.markup=String.fromCharCode(m),c=e.line,g[1]=c,c>=n||e.sCount[c]<e.blkIndent||e.sCount[c]-e.blkIndent>=4)break;let C=!1;for(let t=0,r=v.length;t<r;t++)if(v[t](e,c,n,!0)){C=!0;break}if(C)break;if(d){if(p=AF(e,c),p<0)break;o=e.bMarks[c]+e.tShift[c]}else if(p=kF(e,c),p<0)break;if(m!==e.src.charCodeAt(p-1))break}return s=d?e.push(`ordered_list_close`,`ol`,-1):e.push(`bullet_list_close`,`ul`,-1),s.markup=String.fromCharCode(m),g[1]=c,e.line=c,e.parentType=y,l&&jF(e,h),!0}function NF(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t],o=t+1;if(e.sCount[t]-e.blkIndent>=4||e.src.charCodeAt(i)!==91)return!1;function s(t){let n=e.lineMax;if(t>=n||e.isEmpty(t))return null;let r=!1;if(e.sCount[t]-e.blkIndent>3&&(r=!0),e.sCount[t]<0&&(r=!0),!r){let r=e.md.block.ruler.getRules(`reference`),i=e.parentType;e.parentType=`reference`;let a=!1;for(let i=0,o=r.length;i<o;i++)if(r[i](e,t,n,!0)){a=!0;break}if(e.parentType=i,a)return null}let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];return e.src.slice(i,a+1)}let c=e.src.slice(i,a+1);a=c.length;let l=-1;for(i=1;i<a;i++){let e=c.charCodeAt(i);if(e===91)return!1;if(e===93){l=i;break}else if(e===10){let e=s(o);e!==null&&(c+=e,a=c.length,o++)}else if(e===92&&(i++,i<a&&c.charCodeAt(i)===10)){let e=s(o);e!==null&&(c+=e,a=c.length,o++)}}if(l<0||c.charCodeAt(l+1)!==58)return!1;for(i=l+2;i<a;i++){let e=c.charCodeAt(i);if(e===10){let e=s(o);e!==null&&(c+=e,a=c.length,o++)}else if(!AP(e))break}let u=e.md.helpers.parseLinkDestination(c,i,a);if(!u.ok)return!1;let d=e.md.normalizeLink(u.str);if(!e.md.validateLink(d))return!1;i=u.pos;let f=i,p=o,m=i;for(;i<a;i++){let e=c.charCodeAt(i);if(e===10){let e=s(o);e!==null&&(c+=e,a=c.length,o++)}else if(!AP(e))break}let h=e.md.helpers.parseLinkTitle(c,i,a);for(;h.can_continue;){let t=s(o);if(t===null)break;c+=t,i=a,a=c.length,o++,h=e.md.helpers.parseLinkTitle(c,i,a,h)}let g;for(i<a&&m!==i&&h.ok?(g=h.str,i=h.pos):(g=``,i=f,o=p);i<a&&AP(c.charCodeAt(i));)i++;if(i<a&&c.charCodeAt(i)!==10&&g)for(g=``,i=f,o=p;i<a&&AP(c.charCodeAt(i));)i++;if(i<a&&c.charCodeAt(i)!==10)return!1;let _=FP(c.slice(1,l));return _?r?!0:(e.env.references===void 0&&(e.env.references={}),e.env.references[_]===void 0&&(e.env.references[_]={title:g,href:d}),e.line=o,!0):!1}var PF=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),FF=RegExp(`^(?:<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^"'=<>\`\\x00-\\x20]+|'[^']*'|"[^"]*"))?)*\\s*\\/?>|<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>|<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->|<[?][\\s\\S]*?[?]>|<![A-Za-z][^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>)`),IF=RegExp(`^(?:<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^"'=<>\`\\x00-\\x20]+|'[^']*'|"[^"]*"))?)*\\s*\\/?>|<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>)`),LF=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[RegExp(`^</?(`+PF.join(`|`)+`)(?=(\\s|/?>|$))`,`i`),/^$/,!0],[RegExp(IF.source+`\\s*$`),/^$/,!1]];function RF(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||!e.md.options.html||e.src.charCodeAt(i)!==60)return!1;let o=e.src.slice(i,a),s=0;for(;s<LF.length&&!LF[s][0].test(o);s++);if(s===LF.length)return!1;if(r)return LF[s][2];let c=t+1,l=LF[s][1].test(``);if(!LF[s][1].test(o)){for(;c<n&&!(e.sCount[c]<e.blkIndent&&(l||!e.isEmpty(c)));c++)if(i=e.bMarks[c]+e.tShift[c],a=e.eMarks[c],o=e.src.slice(i,a),LF[s][1].test(o)){o.length!==0&&c++;break}}e.line=c;let u=e.push(`html_block`,``,0);return u.map=[t,c],u.content=e.getLines(t,c,e.blkIndent,!0),!0}function zF(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let o=e.src.charCodeAt(i);if(o!==35||i>=a)return!1;let s=1;for(o=e.src.charCodeAt(++i);o===35&&i<a&&s<=6;)s++,o=e.src.charCodeAt(++i);if(s>6||i<a&&!AP(o))return!1;if(r)return!0;a=e.skipSpacesBack(a,i);let c=e.skipCharsBack(a,35,i);c>i&&AP(e.src.charCodeAt(c-1))&&(a=c),e.line=t+1;let l=e.push(`heading_open`,`h`+String(s),1);l.markup=`########`.slice(0,s),l.map=[t,e.line];let u=e.push(`inline`,``,0);u.content=LP(e.src.slice(i,a)),u.map=[t,e.line],u.children=[];let d=e.push(`heading_close`,`h`+String(s),-1);return d.markup=`########`.slice(0,s),!0}function BF(e,t,n){let r=e.md.block.ruler.getRules(`paragraph`);if(e.sCount[t]-e.blkIndent>=4)return!1;let i=e.parentType;e.parentType=`paragraph`;let a=0,o,s=t+1;for(;s<n&&!e.isEmpty(s);s++){if(e.sCount[s]-e.blkIndent>3)continue;if(e.sCount[s]>=e.blkIndent){let t=e.bMarks[s]+e.tShift[s],n=e.eMarks[s];if(t<n&&(o=e.src.charCodeAt(t),(o===45||o===61)&&(t=e.skipChars(t,o),t=e.skipSpaces(t),t>=n))){a=o===61?1:2;break}}if(e.sCount[s]<0)continue;let t=!1;for(let i=0,a=r.length;i<a;i++)if(r[i](e,s,n,!0)){t=!0;break}if(t)break}if(!a)return e.parentType=i,!1;let c=LP(e.getLines(t,s,e.blkIndent,!1));e.line=s+1;let l=e.push(`heading_open`,`h`+String(a),1);l.markup=String.fromCharCode(o),l.map=[t,e.line];let u=e.push(`inline`,``,0);u.content=c,u.map=[t,e.line-1],u.children=[];let d=e.push(`heading_close`,`h`+String(a),-1);return d.markup=String.fromCharCode(o),e.parentType=i,!0}function VF(e,t,n){let r=e.md.block.ruler.getRules(`paragraph`),i=e.parentType,a=t+1;for(e.parentType=`paragraph`;a<n&&!e.isEmpty(a);a++){if(e.sCount[a]-e.blkIndent>3||e.sCount[a]<0)continue;let t=!1;for(let i=0,o=r.length;i<o;i++)if(r[i](e,a,n,!0)){t=!0;break}if(t)break}let o=LP(e.getLines(t,a,e.blkIndent,!1));e.line=a;let s=e.push(`paragraph_open`,`p`,1);s.map=[t,e.line];let c=e.push(`inline`,``,0);return c.content=o,c.map=[t,e.line],c.children=[],e.push(`paragraph_close`,`p`,-1),e.parentType=i,!0}var HF=[[`table`,wF,[`paragraph`,`reference`]],[`code`,TF],[`fence`,EF,[`paragraph`,`reference`,`blockquote`,`list`]],[`blockquote`,DF,[`paragraph`,`reference`,`blockquote`,`list`]],[`hr`,OF,[`paragraph`,`reference`,`blockquote`,`list`]],[`list`,MF,[`paragraph`,`reference`,`blockquote`]],[`reference`,NF],[`html_block`,RF,[`paragraph`,`reference`,`blockquote`]],[`heading`,zF,[`paragraph`,`reference`,`blockquote`]],[`lheading`,BF],[`paragraph`,VF]];function UF(){this.ruler=new GP;for(let e=0;e<HF.length;e++)this.ruler.push(HF[e][0],HF[e][1],{alt:(HF[e][2]||[]).slice()})}UF.prototype.tokenize=function(e,t,n){let r=this.ruler.getRules(``),i=r.length,a=e.md.options.maxNesting,o=t,s=!1;for(;o<n&&(e.line=o=e.skipEmptyLines(o),!(o>=n||e.sCount[o]<e.blkIndent));){if(e.level>=a){e.line=n;break}let t=e.line,c=!1;for(let a=0;a<i;a++)if(c=r[a](e,o,n,!1),c){if(t>=e.line)throw Error(`block rule didn't increment state.line`);break}if(!c)throw Error(`none of the block rules matched`);e.tight=!s,e.isEmpty(e.line-1)&&(s=!0),o=e.line,o<n&&e.isEmpty(o)&&(s=!0,o++,e.line=o)}},UF.prototype.parse=function(e,t,n,r){if(!e)return;let i=new this.State(e,t,n,r);this.tokenize(i,i.line,i.lineMax)},UF.prototype.State=bF;function WF(e,t,n,r){this.src=e,this.env=n,this.md=t,this.tokens=r,this.tokens_meta=Array(r.length),this.pos=0,this.posMax=this.src.length,this.level=0,this.pending=``,this.pendingLevel=0,this.cache={},this.delimiters=[],this._prev_delimiters=[],this.backticks={},this.backticksScanned=!1,this.linkLevel=0}WF.prototype.pushPending=function(){let e=new KP(`text`,``,0);return e.content=this.pending,e.level=this.pendingLevel,this.tokens.push(e),this.pending=``,e},WF.prototype.push=function(e,t,n){this.pending&&this.pushPending();let r=new KP(e,t,n),i=null;return n<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),r.level=this.level,n>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],i={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(r),this.tokens_meta.push(i),r},WF.prototype.scanDelims=function(e,t){let n=this.posMax,r=this.src.charCodeAt(e),i;if(e===0)i=32;else if(e===1)i=this.src.charCodeAt(0),(i&63488)==55296&&(i=65533);else if(i=this.src.charCodeAt(e-1),(i&64512)==56320){let t=this.src.charCodeAt(e-2);i=(t&64512)==55296?65536+(t-55296<<10)+(i-56320):65533}else(i&64512)==55296&&(i=65533);let a=e;for(;a<n&&this.src.charCodeAt(a)===r;)a++;let o=a-e,s=a<n?this.src.charCodeAt(a):32;if((s&64512)==55296){let e=this.src.charCodeAt(a+1);s=(e&64512)==56320?65536+(s-55296<<10)+(e-56320):65533}else(s&64512)==56320&&(s=65533);let c=PP(i)||NP(i),l=PP(s)||NP(s),u=jP(i),d=jP(s),f=!d&&(!l||u||c),p=!u&&(!c||d||l);return{can_open:f&&(t||!p||c),can_close:p&&(t||!f||l),length:o}},WF.prototype.Token=KP;function GF(e){switch(e){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!0;default:return!1}}function KF(e,t){let n=e.pos;for(;n<e.posMax&&!GF(e.src.charCodeAt(n));)n++;return n===e.pos?!1:(t||(e.pending+=e.src.slice(e.pos,n)),e.pos=n,!0)}var qF=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;function JF(e,t){if(!e.md.options.linkify||e.linkLevel>0)return!1;let n=e.pos,r=e.posMax;if(n+3>r||e.src.charCodeAt(n)!==58||e.src.charCodeAt(n+1)!==47||e.src.charCodeAt(n+2)!==47)return!1;let i=e.pending.match(qF);if(!i)return!1;let a=i[1],o=e.md.linkify.matchAtStart(e.src.slice(n-a.length));if(!o)return!1;let s=o.url;if(s.length<=a.length)return!1;let c=s.length;for(;c>0&&s.charCodeAt(c-1)===42;)c--;c!==s.length&&(s=s.slice(0,c));let l=e.md.normalizeLink(s);if(!e.md.validateLink(l))return!1;if(!t){e.pending=e.pending.slice(0,-a.length);let t=e.push(`link_open`,`a`,1);t.attrs=[[`href`,l]],t.markup=`linkify`,t.info=`auto`;let n=e.push(`text`,``,0);n.content=e.md.normalizeLinkText(s);let r=e.push(`link_close`,`a`,-1);r.markup=`linkify`,r.info=`auto`}return e.pos+=s.length-a.length,!0}function YF(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==10)return!1;let r=e.pending.length-1,i=e.posMax;if(!t)if(r>=0&&e.pending.charCodeAt(r)===32)if(r>=1&&e.pending.charCodeAt(r-1)===32){let t=r-1;for(;t>=1&&e.pending.charCodeAt(t-1)===32;)t--;e.pending=e.pending.slice(0,t),e.push(`hardbreak`,`br`,0)}else e.pending=e.pending.slice(0,-1),e.push(`softbreak`,`br`,0);else e.push(`softbreak`,`br`,0);for(n++;n<i&&AP(e.src.charCodeAt(n));)n++;return e.pos=n,!0}var XF=[];for(let e=0;e<256;e++)XF.push(0);`\\!"#$%&'()*+,./:;<=>?@[]^_\`{|}~-`.split(``).forEach(function(e){XF[e.charCodeAt(0)]=1});function ZF(e,t){let n=e.pos,r=e.posMax;if(e.src.charCodeAt(n)!==92||(n++,n>=r))return!1;let i=e.src.charCodeAt(n);if(i===10){for(t||e.push(`hardbreak`,`br`,0),n++;n<r&&(i=e.src.charCodeAt(n),AP(i));)n++;return e.pos=n,!0}if(i===32){if(!t){let t=e.push(`text_special`,``,0);t.content=`\\`,t.markup=`\\`,t.info=`escape`}return e.pos=n,!0}let a=e.src[n];if(i>=55296&&i<=56319&&n+1<r){let t=e.src.charCodeAt(n+1);t>=56320&&t<=57343&&(a+=e.src[n+1],n++)}let o=`\\`+a;if(!t){let t=e.push(`text_special`,``,0);i<256&&XF[i]!==0?t.content=a:t.content=o,t.markup=o,t.info=`escape`}return e.pos=n+1,!0}function QF(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==96)return!1;let r=n;n++;let i=e.posMax;for(;n<i&&e.src.charCodeAt(n)===96;)n++;let a=e.src.slice(r,n),o=a.length;if(e.backticksScanned&&(e.backticks[o]||0)<=r)return t||(e.pending+=a),e.pos+=o,!0;let s=n,c;for(;(c=e.src.indexOf("`",s))!==-1;){for(s=c+1;s<i&&e.src.charCodeAt(s)===96;)s++;let r=s-c;if(r===o){if(!t){let t=e.push(`code_inline`,`code`,0);t.markup=a,t.content=e.src.slice(n,c).replace(/\n/g,` `).replace(/^ (.+) $/,`$1`)}return e.pos=s,!0}e.backticks[r]=c}return e.backticksScanned=!0,t||(e.pending+=a),e.pos+=o,!0}function $F(e,t){let n=e.pos,r=e.src.charCodeAt(n);if(t||r!==126)return!1;let i=e.scanDelims(e.pos,!0),a=i.length,o=String.fromCharCode(r);if(a<2)return!1;let s;a%2&&(s=e.push(`text`,``,0),s.content=o,a--);for(let t=0;t<a;t+=2)s=e.push(`text`,``,0),s.content=o+o,e.delimiters.push({marker:r,length:0,token:e.tokens.length-1,end:-1,open:i.can_open,close:i.can_close});return e.pos+=i.length,!0}function eI(e,t){let n,r=[],i=t.length;for(let a=0;a<i;a++){let i=t[a];if(i.marker!==126||i.end===-1)continue;let o=t[i.end];n=e.tokens[i.token],n.type=`s_open`,n.tag=`s`,n.nesting=1,n.markup=`~~`,n.content=``,n=e.tokens[o.token],n.type=`s_close`,n.tag=`s`,n.nesting=-1,n.markup=`~~`,n.content=``,e.tokens[o.token-1].type===`text`&&e.tokens[o.token-1].content===`~`&&r.push(o.token-1)}for(;r.length;){let t=r.pop(),i=t+1;for(;i<e.tokens.length&&e.tokens[i].type===`s_close`;)i++;i--,t!==i&&(n=e.tokens[i],e.tokens[i]=e.tokens[t],e.tokens[t]=n)}}function tI(e){let t=e.tokens_meta,n=e.tokens_meta.length;eI(e,e.delimiters);for(let r=0;r<n;r++)t[r]&&t[r].delimiters&&eI(e,t[r].delimiters)}var nI={tokenize:$F,postProcess:tI};function rI(e,t){let n=e.pos,r=e.src.charCodeAt(n);if(t||r!==95&&r!==42)return!1;let i=e.scanDelims(e.pos,r===42);for(let t=0;t<i.length;t++){let t=e.push(`text`,``,0);t.content=String.fromCharCode(r),e.delimiters.push({marker:r,length:i.length,token:e.tokens.length-1,end:-1,open:i.can_open,close:i.can_close})}return e.pos+=i.length,!0}function iI(e,t){let n=t.length;for(let r=n-1;r>=0;r--){let n=t[r];if(n.marker!==95&&n.marker!==42||n.end===-1)continue;let i=t[n.end],a=r>0&&t[r-1].end===n.end+1&&t[r-1].marker===n.marker&&t[r-1].token===n.token-1&&t[n.end+1].token===i.token+1,o=String.fromCharCode(n.marker),s=e.tokens[n.token];s.type=a?`strong_open`:`em_open`,s.tag=a?`strong`:`em`,s.nesting=1,s.markup=a?o+o:o,s.content=``;let c=e.tokens[i.token];c.type=a?`strong_close`:`em_close`,c.tag=a?`strong`:`em`,c.nesting=-1,c.markup=a?o+o:o,c.content=``,a&&(e.tokens[t[r-1].token].content=``,e.tokens[t[n.end+1].token].content=``,r--)}}function aI(e){let t=e.tokens_meta,n=e.tokens_meta.length;iI(e,e.delimiters);for(let r=0;r<n;r++)t[r]&&t[r].delimiters&&iI(e,t[r].delimiters)}var oI={tokenize:rI,postProcess:aI};function sI(e,t){let n,r,i,a,o=``,s=``,c=e.pos,l=!0;if(e.src.charCodeAt(e.pos)!==91)return!1;let u=e.pos,d=e.posMax,f=e.pos+1,p=e.md.helpers.parseLinkLabel(e,e.pos,!0);if(p<0)return!1;let m=p+1;if(m<d&&e.src.charCodeAt(m)===40){for(l=!1,m++;m<d&&(n=e.src.charCodeAt(m),!(!AP(n)&&n!==10));m++);if(m>=d)return!1;if(c=m,i=e.md.helpers.parseLinkDestination(e.src,m,e.posMax),i.ok){for(o=e.md.normalizeLink(i.str),e.md.validateLink(o)?m=i.pos:o=``,c=m;m<d&&(n=e.src.charCodeAt(m),!(!AP(n)&&n!==10));m++);if(i=e.md.helpers.parseLinkTitle(e.src,m,e.posMax),m<d&&c!==m&&i.ok)for(s=i.str,m=i.pos;m<d&&(n=e.src.charCodeAt(m),!(!AP(n)&&n!==10));m++);}(m>=d||e.src.charCodeAt(m)!==41)&&(l=!0),m++}if(l){if(e.env.references===void 0)return!1;if(m<d&&e.src.charCodeAt(m)===91?(c=m+1,m=e.md.helpers.parseLinkLabel(e,m),m>=0?r=e.src.slice(c,m++):m=p+1):m=p+1,r||=e.src.slice(f,p),a=e.env.references[FP(r)],!a)return e.pos=u,!1;o=a.href,s=a.title}if(!t){e.pos=f,e.posMax=p;let t=e.push(`link_open`,`a`,1),n=[[`href`,o]];t.attrs=n,s&&n.push([`title`,s]),e.linkLevel++,e.md.inline.tokenize(e),e.linkLevel--,e.push(`link_close`,`a`,-1)}return e.pos=m,e.posMax=d,!0}function cI(e,t){let n,r,i,a,o,s,c,l,u=``,d=e.pos,f=e.posMax;if(e.src.charCodeAt(e.pos)!==33||e.src.charCodeAt(e.pos+1)!==91)return!1;let p=e.pos+2,m=e.md.helpers.parseLinkLabel(e,e.pos+1,!1);if(m<0)return!1;if(a=m+1,a<f&&e.src.charCodeAt(a)===40){for(a++;a<f&&(n=e.src.charCodeAt(a),!(!AP(n)&&n!==10));a++);if(a>=f)return!1;for(l=a,s=e.md.helpers.parseLinkDestination(e.src,a,e.posMax),s.ok&&(u=e.md.normalizeLink(s.str),e.md.validateLink(u)?a=s.pos:u=``),l=a;a<f&&(n=e.src.charCodeAt(a),!(!AP(n)&&n!==10));a++);if(s=e.md.helpers.parseLinkTitle(e.src,a,e.posMax),a<f&&l!==a&&s.ok)for(c=s.str,a=s.pos;a<f&&(n=e.src.charCodeAt(a),!(!AP(n)&&n!==10));a++);else c=``;if(a>=f||e.src.charCodeAt(a)!==41)return e.pos=d,!1;a++}else{if(e.env.references===void 0)return!1;if(a<f&&e.src.charCodeAt(a)===91?(l=a+1,a=e.md.helpers.parseLinkLabel(e,a),a>=0?i=e.src.slice(l,a++):a=m+1):a=m+1,i||=e.src.slice(p,m),o=e.env.references[FP(i)],!o)return e.pos=d,!1;u=o.href,c=o.title}if(!t){r=e.src.slice(p,m);let t=[];e.md.inline.parse(r,e.md,e.env,t);let n=e.push(`image`,`img`,0),i=[[`src`,u],[`alt`,``]];n.attrs=i,n.children=t,n.content=r,c&&i.push([`title`,c])}return e.pos=a,e.posMax=f,!0}var lI=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,uI=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function dI(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==60)return!1;let r=e.pos,i=e.posMax;for(;;){if(++n>=i)return!1;let t=e.src.charCodeAt(n);if(t===60)return!1;if(t===62)break}let a=e.src.slice(r+1,n);if(uI.test(a)){let n=e.md.normalizeLink(a);if(!e.md.validateLink(n))return!1;if(!t){let t=e.push(`link_open`,`a`,1);t.attrs=[[`href`,n]],t.markup=`autolink`,t.info=`auto`;let r=e.push(`text`,``,0);r.content=e.md.normalizeLinkText(a);let i=e.push(`link_close`,`a`,-1);i.markup=`autolink`,i.info=`auto`}return e.pos+=a.length+2,!0}if(lI.test(a)){let n=e.md.normalizeLink(`mailto:`+a);if(!e.md.validateLink(n))return!1;if(!t){let t=e.push(`link_open`,`a`,1);t.attrs=[[`href`,n]],t.markup=`autolink`,t.info=`auto`;let r=e.push(`text`,``,0);r.content=e.md.normalizeLinkText(a);let i=e.push(`link_close`,`a`,-1);i.markup=`autolink`,i.info=`auto`}return e.pos+=a.length+2,!0}return!1}function fI(e){return/^<a[>\s]/i.test(e)}function pI(e){return/^<\/a\s*>/i.test(e)}function mI(e){let t=e|32;return t>=97&&t<=122}function hI(e,t){if(!e.md.options.html)return!1;let n=e.posMax,r=e.pos;if(e.src.charCodeAt(r)!==60||r+2>=n)return!1;let i=e.src.charCodeAt(r+1);if(i!==33&&i!==63&&i!==47&&!mI(i))return!1;let a=e.src.slice(r).match(FF);if(!a)return!1;if(!t){let t=e.push(`html_inline`,``,0);t.content=a[0],fI(t.content)&&e.linkLevel++,pI(t.content)&&e.linkLevel--}return e.pos+=a[0].length,!0}var gI=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,_I=/^&([a-z][a-z0-9]{1,31});/i;function vI(e,t){let n=e.pos,r=e.posMax;if(e.src.charCodeAt(n)!==38||n+1>=r)return!1;if(e.src.charCodeAt(n+1)===35){let r=e.src.slice(n).match(gI);if(r){if(!t){let t=r[1][0].toLowerCase()===`x`?parseInt(r[1].slice(1),16):parseInt(r[1],10),n=e.push(`text_special`,``,0);n.content=hP(t)?gP(t):gP(65533),n.markup=r[0],n.info=`entity`}return e.pos+=r[0].length,!0}}else{let r=e.src.slice(n).match(_I);if(r){let n=sP(r[0]);if(n!==r[0]){if(!t){let t=e.push(`text_special`,``,0);t.content=n,t.markup=r[0],t.info=`entity`}return e.pos+=r[0].length,!0}}}return!1}function yI(e){let t={},n=e.length;if(!n)return;let r=0,i=-2,a=[];for(let o=0;o<n;o++){let n=e[o];if(a.push(0),(e[r].marker!==n.marker||i!==n.token-1)&&(r=o),i=n.token,n.length=n.length||0,!n.close)continue;t.hasOwnProperty(n.marker)||(t[n.marker]=[-1,-1,-1,-1,-1,-1]);let s=t[n.marker][(n.open?3:0)+n.length%3],c=r-a[r]-1,l=c;for(;c>s;c-=a[c]+1){let t=e[c];if(t.marker===n.marker&&t.open&&t.end<0){let r=!1;if((t.close||n.open)&&(t.length+n.length)%3==0&&(t.length%3!=0||n.length%3!=0)&&(r=!0),!r){let r=c>0&&!e[c-1].open?a[c-1]+1:0;a[o]=o-c+r,a[c]=r,n.open=!1,t.end=o,t.close=!1,l=-1,i=-2;break}}}l!==-1&&(t[n.marker][(n.open?3:0)+(n.length||0)%3]=l)}}function bI(e){let t=e.tokens_meta,n=e.tokens_meta.length;yI(e.delimiters);for(let e=0;e<n;e++)t[e]&&t[e].delimiters&&yI(t[e].delimiters)}function xI(e){let t,n,r=0,i=e.tokens,a=e.tokens.length;for(t=n=0;t<a;t++)i[t].nesting<0&&r--,i[t].level=r,i[t].nesting>0&&r++,i[t].type===`text`&&t+1<a&&i[t+1].type===`text`?i[t+1].content=i[t].content+i[t+1].content:(t!==n&&(i[n]=i[t]),n++);t!==n&&(i.length=n)}var SI=[[`text`,KF],[`linkify`,JF],[`newline`,YF],[`escape`,ZF],[`backticks`,QF],[`strikethrough`,nI.tokenize],[`emphasis`,oI.tokenize],[`link`,sI],[`image`,cI],[`autolink`,dI],[`html_inline`,hI],[`entity`,vI]],CI=[[`balance_pairs`,bI],[`strikethrough`,nI.postProcess],[`emphasis`,oI.postProcess],[`fragments_join`,xI]];function wI(){this.ruler=new GP;for(let e=0;e<SI.length;e++)this.ruler.push(SI[e][0],SI[e][1]);this.ruler2=new GP;for(let e=0;e<CI.length;e++)this.ruler2.push(CI[e][0],CI[e][1])}wI.prototype.skipToken=function(e){let t=e.pos,n=this.ruler.getRules(``),r=n.length,i=e.md.options.maxNesting,a=e.cache;if(a[t]!==void 0){e.pos=a[t];return}let o=!1;if(e.level<i){for(let i=0;i<r;i++)if(e.level++,o=n[i](e,!0),e.level--,o){if(t>=e.pos)throw Error(`inline rule didn't increment state.pos`);break}}else e.pos=e.posMax;o||e.pos++,a[t]=e.pos},wI.prototype.tokenize=function(e){let t=this.ruler.getRules(``),n=t.length,r=e.posMax,i=e.md.options.maxNesting;for(;e.pos<r;){let a=e.pos,o=!1;if(e.level<i){for(let r=0;r<n;r++)if(o=t[r](e,!1),o){if(a>=e.pos)throw Error(`inline rule didn't increment state.pos`);break}}if(o){if(e.pos>=r)break;continue}e.pending+=e.src[e.pos++]}e.pending&&e.pushPending()},wI.prototype.parse=function(e,t,n,r){let i=new this.State(e,t,n,r);this.tokenize(i);let a=this.ruler2.getRules(``),o=a.length;for(let e=0;e<o;e++)a[e](i)},wI.prototype.State=WF;function TI(e){let t={};e||={},t.src_Any=FN.source,t.src_Cc=IN.source,t.src_Z=BN.source,t.src_P=RN.source,t.src_ZPCc=[t.src_Z,t.src_P,t.src_Cc].join(`|`),t.src_ZCc=[t.src_Z,t.src_Cc].join(`|`);let n=`[><|]`;return t.src_pseudo_letter=`(?:(?!${n}|${t.src_ZPCc})${t.src_Any})`,t.src_ip4=`(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)`,t.src_auth=`(?:(?:(?!${t.src_ZCc}|[@/\\[\\]()]).){1,50}@)?`,t.src_port=`(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?`,t.src_host_terminator=`(?=$|${n}|${t.src_ZPCc})(?!${e[`---`]?`-(?!--)|`:`-|`}_|:\\d|\\.-|\\.(?!$|${t.src_ZPCc}))`,t.src_path=`(?:[/?#](?:(?!${t.src_ZCc}|${n}|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!${t.src_ZCc}|\\]).)*\\]|\\((?:(?!${t.src_ZCc}|[)]).)*\\)|\\{(?:(?!${t.src_ZCc}|[}]).)*\\}|\\"(?:(?!${t.src_ZCc}|["]).)+\\"|\\'(?:(?!${t.src_ZCc}|[']).)+\\'|\\'(?=${t.src_pseudo_letter}|[-])|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!${t.src_ZCc}|[.]|$)|`+(e[`---`]?`\\-(?!--(?:[^-]|$))(?:-*)|`:`\\-+|`)+`,(?!${t.src_ZCc}|$)|;(?!${t.src_ZCc}|$)|\\!+(?!${t.src_ZCc}|[!]|$)|\\?(?!${t.src_ZCc}|[?]|$))+|\\/)?`,t.src_email_name=`[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]{0,63}`,t.src_xn=`xn--[a-z0-9\\-]{1,59}`,t.src_domain_root=`(?:`+t.src_xn+`|${t.src_pseudo_letter}{1,63})`,t.src_domain=`(?:`+t.src_xn+`|(?:${t.src_pseudo_letter})|(?:${t.src_pseudo_letter}(?:-|${t.src_pseudo_letter}){0,61}${t.src_pseudo_letter}))`,t.src_host=`(?:(?:(?:(?:${t.src_domain})\\.)*${t.src_domain}))`,t.tpl_host_fuzzy=`(?:`+t.src_ip4+`|(?:(?:(?:${t.src_domain})\\.)+(?:%TLDS%)))`,t.tpl_host_no_ip_fuzzy=`(?:(?:(?:${t.src_domain})\\.)+(?:%TLDS%))`,t.src_host_strict=t.src_host+t.src_host_terminator,t.tpl_host_fuzzy_strict=t.tpl_host_fuzzy+t.src_host_terminator,t.src_host_port_strict=t.src_host+t.src_port+t.src_host_terminator,t.tpl_host_port_fuzzy_strict=t.tpl_host_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_port_no_ip_fuzzy_strict=t.tpl_host_no_ip_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_fuzzy_test=`localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:${t.src_ZPCc}|>|$))`,t.tpl_email_fuzzy=`(^|${n}|"|\\(|${t.src_ZCc})(${t.src_email_name}@${t.tpl_host_fuzzy_strict})`,t.tpl_link_fuzzy=`(^|(?![.:/\\-_@])(?:[$+<=>^\`|\uff5c]|${t.src_ZPCc}))((?![$+<=>^\`|\uff5c])${t.tpl_host_port_fuzzy_strict}${t.src_path})`,t.tpl_link_no_ip_fuzzy=`(^|(?![.:/\\-_@])(?:[$+<=>^\`|\uff5c]|${t.src_ZPCc}))((?![$+<=>^\`|\uff5c])${t.tpl_host_port_no_ip_fuzzy_strict}${t.src_path})`,t}function EI(e){return Array.prototype.slice.call(arguments,1).forEach(function(t){t&&Object.keys(t).forEach(function(n){e[n]=t[n]})}),e}function DI(e){return Object.prototype.toString.call(e)}function OI(e){return DI(e)===`[object String]`}function kI(e){return DI(e)===`[object Object]`}function AI(e){return DI(e)===`[object RegExp]`}function jI(e){return DI(e)===`[object Function]`}function MI(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,`\\$&`)}var NI={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function PI(e){return Object.keys(e||{}).reduce(function(e,t){return e||NI.hasOwnProperty(t)},!1)}var FI={"http:":{validate:function(e,t,n){let r=e.slice(t);return n.re.http||(n.re.http=RegExp(`^\\/\\/${n.re.src_auth}${n.re.src_host_port_strict}${n.re.src_path}`,`i`)),n.re.http.test(r)?r.match(n.re.http)[0].length:0}},"https:":`http:`,"ftp:":`http:`,"//":{validate:function(e,t,n){let r=e.slice(t);return n.re.no_http||(n.re.no_http=RegExp(`^`+n.re.src_auth+`(?:localhost|(?:(?:${n.re.src_domain})\\.)+${n.re.src_domain_root})`+n.re.src_port+n.re.src_host_terminator+n.re.src_path,`i`)),n.re.no_http.test(r)?t>=3&&e[t-3]===`:`||t>=3&&e[t-3]===`/`?0:r.match(n.re.no_http)[0].length:0}},"mailto:":{validate:function(e,t,n){let r=e.slice(t);return n.re.mailto||(n.re.mailto=RegExp(`^${n.re.src_email_name}@${n.re.src_host_strict}`,`i`)),n.re.mailto.test(r)?r.match(n.re.mailto)[0].length:0}}},II=`a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]`,LI=`biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф`.split(`|`);function RI(e){return function(t,n){let r=t.slice(n);return e.test(r)?r.match(e)[0].length:0}}function zI(){return function(e,t){t.normalize(e)}}function BI(e){let t=e.re=TI(e.__opts__),n=e.__tlds__.slice();e.onCompile(),e.__tlds_replaced__||n.push(II),n.push(t.src_xn),t.src_tlds=n.join(`|`);function r(e){return e.replace(`%TLDS%`,t.src_tlds)}t.email_fuzzy=RegExp(r(t.tpl_email_fuzzy),`i`),t.email_fuzzy_global=RegExp(r(t.tpl_email_fuzzy),`ig`),t.link_fuzzy=RegExp(r(t.tpl_link_fuzzy),`i`),t.link_fuzzy_global=RegExp(r(t.tpl_link_fuzzy),`ig`),t.link_no_ip_fuzzy=RegExp(r(t.tpl_link_no_ip_fuzzy),`i`),t.link_no_ip_fuzzy_global=RegExp(r(t.tpl_link_no_ip_fuzzy),`ig`),t.host_fuzzy_test=RegExp(r(t.tpl_host_fuzzy_test),`i`);let i=[];e.__compiled__={};function a(e,t){throw Error(`(LinkifyIt) Invalid schema "${e}": ${t}`)}Object.keys(e.__schemas__).forEach(function(t){let n=e.__schemas__[t];if(n===null)return;let r={validate:null,link:null};if(e.__compiled__[t]=r,kI(n)){AI(n.validate)?r.validate=RI(n.validate):jI(n.validate)?r.validate=n.validate:a(t,n),jI(n.normalize)?r.normalize=n.normalize:n.normalize?a(t,n):r.normalize=zI();return}if(OI(n)){i.push(t);return}a(t,n)}),i.forEach(function(t){e.__compiled__[e.__schemas__[t]]&&(e.__compiled__[t].validate=e.__compiled__[e.__schemas__[t]].validate,e.__compiled__[t].normalize=e.__compiled__[e.__schemas__[t]].normalize)}),e.__compiled__[``]={validate:null,normalize:zI()};let o=Object.keys(e.__compiled__).filter(function(t){return t.length>0&&e.__compiled__[t]}).map(MI).join(`|`);e.re.schema_test=RegExp(`(^|(?!_)(?:[><\uff5c]|${t.src_ZPCc}))(${o})`,`i`),e.re.schema_search=RegExp(`(^|(?!_)(?:[><\uff5c]|${t.src_ZPCc}))(${o})`,`ig`),e.re.schema_at_start=RegExp(`^${e.re.schema_search.source}`,`i`),e.re.pretest=RegExp(`(${e.re.schema_test.source})|(${e.re.host_fuzzy_test.source})|@`,`i`)}function VI(e,t,n,r){let i=e.slice(n,r);this.schema=t.toLowerCase(),this.index=n,this.lastIndex=r,this.raw=i,this.text=i,this.url=i}function HI(e,t){if(!(this instanceof HI))return new HI(e,t);t||PI(e)&&(t=e,e={}),this.__opts__=EI({},NI,t),this.__schemas__=EI({},FI,e),this.__compiled__={},this.__tlds__=LI,this.__tlds_replaced__=!1,this.re={},BI(this)}HI.prototype.add=function(e,t){return this.__schemas__[e]=t,BI(this),this},HI.prototype.set=function(e){return this.__opts__=EI(this.__opts__,e),this},HI.prototype.test=function(e){if(!e.length)return!1;let t,n;if(this.re.schema_test.test(e)){for(n=this.re.schema_search,n.lastIndex=0;(t=n.exec(e))!==null;)if(this.testSchemaAt(e,t[2],n.lastIndex))return!0}return!!(this.__opts__.fuzzyLink&&this.__compiled__[`http:`]&&e.search(this.re.host_fuzzy_test)>=0&&e.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy)!==null||this.__opts__.fuzzyEmail&&this.__compiled__[`mailto:`]&&e.indexOf(`@`)>=0&&e.match(this.re.email_fuzzy)!==null)},HI.prototype.pretest=function(e){return this.re.pretest.test(e)},HI.prototype.testSchemaAt=function(e,t,n){return this.__compiled__[t.toLowerCase()]?this.__compiled__[t.toLowerCase()].validate(e,n,this):0},HI.prototype.match=function(e){let t=[],n=[],r=[],i=[],a,o,s;function c(e,t){return e?t?e.index===t.index?e.lastIndex>=t.lastIndex?e:t:e.index<t.index?e:t:e:t}if(!e.length)return null;if(this.re.schema_test.test(e))for(s=this.re.schema_search,s.lastIndex=0;(a=s.exec(e))!==null;)o=this.testSchemaAt(e,a[2],s.lastIndex),o&&n.push({schema:a[2],index:a.index+a[1].length,lastIndex:a.index+a[0].length+o});if(this.__opts__.fuzzyLink&&this.__compiled__[`http:`])for(s=this.__opts__.fuzzyIP?this.re.link_fuzzy_global:this.re.link_no_ip_fuzzy_global,s.lastIndex=0;(a=s.exec(e))!==null;)r.push({schema:``,index:a.index+a[1].length,lastIndex:a.index+a[0].length});if(this.__opts__.fuzzyEmail&&this.__compiled__[`mailto:`])for(s=this.re.email_fuzzy_global,s.lastIndex=0;(a=s.exec(e))!==null;)i.push({schema:`mailto:`,index:a.index+a[1].length,lastIndex:a.index+a[0].length});let l=[0,0,0],u=0;for(;;){let a=[n[l[0]],i[l[1]],r[l[2]]],o=c(c(a[0],a[1]),a[2]);if(!o)break;if(o===a[0]?l[0]++:o===a[1]?l[1]++:l[2]++,o.index<u)continue;let s=new VI(e,o.schema,o.index,o.lastIndex);this.__compiled__[s.schema].normalize(s,this),t.push(s),u=o.lastIndex}return t.length?t:null},HI.prototype.matchAtStart=function(e){if(!e.length)return null;let t=this.re.schema_at_start.exec(e);if(!t)return null;let n=this.testSchemaAt(e,t[2],t[0].length);if(!n)return null;let r=new VI(e,t[2],t.index+t[1].length,t.index+t[0].length+n);return this.__compiled__[r.schema].normalize(r,this),r},HI.prototype.tlds=function(e,t){return e=Array.isArray(e)?e:[e],t?(this.__tlds__=this.__tlds__.concat(e).sort().filter(function(e,t,n){return e!==n[t-1]}).reverse(),BI(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,BI(this),this)},HI.prototype.normalize=function(e){e.schema||(e.url=`http://${e.url}`),e.schema===`mailto:`&&!/^mailto:/i.test(e.url)&&(e.url=`mailto:${e.url}`)},HI.prototype.onCompile=function(){};var UI=2147483647,WI=36,GI=1,KI=26,qI=38,JI=700,YI=72,XI=128,ZI=`-`,QI=/^xn--/,$I=/[^\0-\x7F]/,eL=/[\x2E\u3002\uFF0E\uFF61]/g,tL={overflow:`Overflow: input needs wider integers to process`,"not-basic":`Illegal input >= 0x80 (not a basic code point)`,"invalid-input":`Invalid input`},nL=WI-GI,rL=Math.floor,iL=String.fromCharCode;function aL(e){throw RangeError(tL[e])}function oL(e,t){let n=[],r=e.length;for(;r--;)n[r]=t(e[r]);return n}function sL(e,t){let n=e.split(`@`),r=``;n.length>1&&(r=n[0]+`@`,e=n[1]),e=e.replace(eL,`.`);let i=oL(e.split(`.`),t).join(`.`);return r+i}function cL(e){let t=[],n=0,r=e.length;for(;n<r;){let i=e.charCodeAt(n++);if(i>=55296&&i<=56319&&n<r){let r=e.charCodeAt(n++);(r&64512)==56320?t.push(((i&1023)<<10)+(r&1023)+65536):(t.push(i),n--)}else t.push(i)}return t}var lL=e=>String.fromCodePoint(...e),uL=function(e){return e>=48&&e<58?26+(e-48):e>=65&&e<91?e-65:e>=97&&e<123?e-97:WI},dL=function(e,t){return e+22+75*(e<26)-((t!=0)<<5)},fL=function(e,t,n){let r=0;for(e=n?rL(e/JI):e>>1,e+=rL(e/t);e>455;r+=WI)e=rL(e/nL);return rL(r+36*e/(e+qI))},pL=function(e){let t=[],n=e.length,r=0,i=XI,a=YI,o=e.lastIndexOf(ZI);o<0&&(o=0);for(let n=0;n<o;++n)e.charCodeAt(n)>=128&&aL(`not-basic`),t.push(e.charCodeAt(n));for(let s=o>0?o+1:0;s<n;){let o=r;for(let t=1,i=WI;;i+=WI){s>=n&&aL(`invalid-input`);let o=uL(e.charCodeAt(s++));o>=WI&&aL(`invalid-input`),o>rL((UI-r)/t)&&aL(`overflow`),r+=o*t;let c=i<=a?GI:i>=a+KI?KI:i-a;if(o<c)break;let l=WI-c;t>rL(UI/l)&&aL(`overflow`),t*=l}let c=t.length+1;a=fL(r-o,c,o==0),rL(r/c)>UI-i&&aL(`overflow`),i+=rL(r/c),r%=c,t.splice(r++,0,i)}return String.fromCodePoint(...t)},mL=function(e){let t=[];e=cL(e);let n=e.length,r=XI,i=0,a=YI;for(let n of e)n<128&&t.push(iL(n));let o=t.length,s=o;for(o&&t.push(ZI);s<n;){let n=UI;for(let t of e)t>=r&&t<n&&(n=t);let c=s+1;n-r>rL((UI-i)/c)&&aL(`overflow`),i+=(n-r)*c,r=n;for(let n of e)if(n<r&&++i>UI&&aL(`overflow`),n===r){let e=i;for(let n=WI;;n+=WI){let r=n<=a?GI:n>=a+KI?KI:n-a;if(e<r)break;let i=e-r,o=WI-r;t.push(iL(dL(r+i%o,0))),e=rL(i/o)}t.push(iL(dL(e,0))),a=fL(i,c,s===o),i=0,++s}++i,++r}return t.join(``)},hL={version:`2.3.1`,ucs2:{decode:cL,encode:lL},decode:pL,encode:mL,toASCII:function(e){return sL(e,function(e){return $I.test(e)?`xn--`+mL(e):e})},toUnicode:function(e){return sL(e,function(e){return QI.test(e)?pL(e.slice(4).toLowerCase()):e})}},gL={default:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`“”‘’`,highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},zero:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`“”‘’`,highlight:null,maxNesting:20},components:{core:{rules:[`normalize`,`block`,`inline`,`text_join`]},block:{rules:[`paragraph`]},inline:{rules:[`text`],rules2:[`balance_pairs`,`fragments_join`]}}},commonmark:{options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`“”‘’`,highlight:null,maxNesting:20},components:{core:{rules:[`normalize`,`block`,`inline`,`text_join`]},block:{rules:[`blockquote`,`code`,`fence`,`heading`,`hr`,`html_block`,`lheading`,`list`,`reference`,`paragraph`]},inline:{rules:[`autolink`,`backticks`,`emphasis`,`entity`,`escape`,`html_inline`,`image`,`link`,`newline`,`text`],rules2:[`balance_pairs`,`emphasis`,`fragments_join`]}}}},_L=/^(vbscript|javascript|file|data):/,vL=/^data:image\/(gif|png|jpeg|webp);/;function yL(e){let t=e.trim().toLowerCase();return!_L.test(t)||vL.test(t)}var bL=[`http:`,`https:`,`mailto:`];function xL(e){let t=NN(e,!0);if(t.hostname&&(!t.protocol||bL.indexOf(t.protocol)>=0))try{t.hostname=hL.toASCII(t.hostname)}catch{}return bN(xN(t))}function SL(e){let t=NN(e,!0);if(t.hostname&&(!t.protocol||bL.indexOf(t.protocol)>=0))try{t.hostname=hL.toUnicode(t.hostname)}catch{}return _N(xN(t),_N.defaultChars+`%`)}function CL(e,t){if(!(this instanceof CL))return new CL(e,t);t||uP(e)||(t=e||{},e=`default`),this.inline=new wI,this.block=new UF,this.core=new yF,this.renderer=new WP,this.linkify=new HI,this.validateLink=yL,this.normalizeLink=xL,this.normalizeLinkText=SL,this.utils=cP,this.helpers=pP({},HP),this.options={},this.configure(e),t&&this.set(t)}CL.prototype.set=function(e){return pP(this.options,e),this},CL.prototype.configure=function(e){let t=this;if(uP(e)){let t=e;if(e=gL[t],!e)throw Error('Wrong `markdown-it` preset "'+t+`", check name`)}if(!e)throw Error("Wrong `markdown-it` preset, can't be empty");return e.options&&t.set(e.options),e.components&&Object.keys(e.components).forEach(function(n){e.components[n].rules&&t[n].ruler.enableOnly(e.components[n].rules),e.components[n].rules2&&t[n].ruler2.enableOnly(e.components[n].rules2)}),this},CL.prototype.enable=function(e,t){let n=[];Array.isArray(e)||(e=[e]),[`core`,`block`,`inline`].forEach(function(t){n=n.concat(this[t].ruler.enable(e,!0))},this),n=n.concat(this.inline.ruler2.enable(e,!0));let r=e.filter(function(e){return n.indexOf(e)<0});if(r.length&&!t)throw Error(`MarkdownIt. Failed to enable unknown rule(s): `+r);return this},CL.prototype.disable=function(e,t){let n=[];Array.isArray(e)||(e=[e]),[`core`,`block`,`inline`].forEach(function(t){n=n.concat(this[t].ruler.disable(e,!0))},this),n=n.concat(this.inline.ruler2.disable(e,!0));let r=e.filter(function(e){return n.indexOf(e)<0});if(r.length&&!t)throw Error(`MarkdownIt. Failed to disable unknown rule(s): `+r);return this},CL.prototype.use=function(e){let t=[this].concat(Array.prototype.slice.call(arguments,1));return e.apply(e,t),this},CL.prototype.parse=function(e,t){if(typeof e!=`string`)throw Error(`Input data should be a String`);let n=new this.core.State(e,this,t);return this.core.process(n),n.tokens},CL.prototype.render=function(e,t){return t||={},this.renderer.render(this.parse(e,t),this.options,t)},CL.prototype.parseInline=function(e,t){let n=new this.core.State(e,this,t);return n.inlineMode=!0,this.core.process(n),n.tokens},CL.prototype.renderInline=function(e,t){return t||={},this.renderer.render(this.parseInline(e,t),this.options,t)};var wL=new Gb({nodes:{doc:{content:`block+`},paragraph:{content:`inline*`,group:`block`,parseDOM:[{tag:`p`}],toDOM(){return[`p`,0]}},blockquote:{content:`block+`,group:`block`,parseDOM:[{tag:`blockquote`}],toDOM(){return[`blockquote`,0]}},horizontal_rule:{group:`block`,parseDOM:[{tag:`hr`}],toDOM(){return[`div`,[`hr`]]}},heading:{attrs:{level:{default:1}},content:`(text | image)*`,group:`block`,defining:!0,parseDOM:[{tag:`h1`,attrs:{level:1}},{tag:`h2`,attrs:{level:2}},{tag:`h3`,attrs:{level:3}},{tag:`h4`,attrs:{level:4}},{tag:`h5`,attrs:{level:5}},{tag:`h6`,attrs:{level:6}}],toDOM(e){return[`h`+e.attrs.level,0]}},code_block:{content:`text*`,group:`block`,code:!0,defining:!0,marks:``,attrs:{params:{default:``}},parseDOM:[{tag:`pre`,preserveWhitespace:`full`,getAttrs:e=>({params:e.getAttribute(`data-params`)||``})}],toDOM(e){return[`pre`,e.attrs.params?{"data-params":e.attrs.params}:{},[`code`,0]]}},ordered_list:{content:`list_item+`,group:`block`,attrs:{order:{default:1},tight:{default:!1}},parseDOM:[{tag:`ol`,getAttrs(e){return{order:e.hasAttribute(`start`)?+e.getAttribute(`start`):1,tight:e.hasAttribute(`data-tight`)}}}],toDOM(e){return[`ol`,{start:e.attrs.order==1?null:e.attrs.order,"data-tight":e.attrs.tight?`true`:null},0]}},bullet_list:{content:`list_item+`,group:`block`,attrs:{tight:{default:!1}},parseDOM:[{tag:`ul`,getAttrs:e=>({tight:e.hasAttribute(`data-tight`)})}],toDOM(e){return[`ul`,{"data-tight":e.attrs.tight?`true`:null},0]}},list_item:{content:`block+`,defining:!0,parseDOM:[{tag:`li`}],toDOM(){return[`li`,0]}},text:{group:`inline`},image:{inline:!0,attrs:{src:{},alt:{default:null},title:{default:null}},group:`inline`,draggable:!0,parseDOM:[{tag:`img[src]`,getAttrs(e){return{src:e.getAttribute(`src`),title:e.getAttribute(`title`),alt:e.getAttribute(`alt`)}}}],toDOM(e){return[`img`,e.attrs]}},hard_break:{inline:!0,group:`inline`,selectable:!1,parseDOM:[{tag:`br`}],toDOM(){return[`br`]}}},marks:{em:{parseDOM:[{tag:`i`},{tag:`em`},{style:`font-style=italic`},{style:`font-style=normal`,clearMark:e=>e.type.name==`em`}],toDOM(){return[`em`]}},strong:{parseDOM:[{tag:`strong`},{tag:`b`,getAttrs:e=>e.style.fontWeight!=`normal`&&null},{style:`font-weight=400`,clearMark:e=>e.type.name==`strong`},{style:`font-weight`,getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}],toDOM(){return[`strong`]}},link:{attrs:{href:{},title:{default:null}},inclusive:!1,parseDOM:[{tag:`a[href]`,getAttrs(e){return{href:e.getAttribute(`href`),title:e.getAttribute(`title`)}}}],toDOM(e){return[`a`,e.attrs]}},code:{code:!0,parseDOM:[{tag:`code`}],toDOM(){return[`code`]}}}});function TL(e,t){if(e.isText&&t.isText&&$y.sameSet(e.marks,t.marks))return e.withText(e.text+t.text)}var EL=class{constructor(e,t){this.schema=e,this.tokenHandlers=t,this.stack=[{type:e.topNodeType,attrs:null,content:[],marks:$y.none}]}top(){return this.stack[this.stack.length-1]}push(e){this.stack.length&&this.top().content.push(e)}addText(e){if(!e)return;let t=this.top(),n=t.content,r=n[n.length-1],i=this.schema.text(e,t.marks),a;r&&(a=TL(r,i))?n[n.length-1]=a:n.push(i)}openMark(e){let t=this.top();t.marks=e.addToSet(t.marks)}closeMark(e){let t=this.top();t.marks=e.removeFromSet(t.marks)}parseTokens(e){for(let t=0;t<e.length;t++){let n=e[t],r=this.tokenHandlers[n.type];if(!r)throw Error("Token type `"+n.type+"` not supported by Markdown parser");r(this,n,e,t)}}addNode(e,t,n){let r=this.top(),i=e.createAndFill(t,n,r?r.marks:[]);return i?(this.push(i),i):null}openNode(e,t){this.stack.push({type:e,attrs:t,content:[],marks:$y.none})}closeNode(){let e=this.stack.pop();return this.addNode(e.type,e.attrs,e.content)}};function DL(e,t,n,r){return e.getAttrs?e.getAttrs(t,n,r):e.attrs instanceof Function?e.attrs(t):e.attrs}function OL(e,t){return e.noCloseToken||t==`code_inline`||t==`code_block`||t==`fence`}function kL(e){return e[e.length-1]==`
`?e.slice(0,e.length-1):e}function AL(){}function jL(e,t){let n=Object.create(null);for(let r in t){let i=t[r];if(i.block){let t=e.nodeType(i.block);OL(i,r)?n[r]=(e,n,r,a)=>{e.openNode(t,DL(i,n,r,a)),e.addText(kL(n.content)),e.closeNode()}:(n[r+`_open`]=(e,n,r,a)=>e.openNode(t,DL(i,n,r,a)),n[r+`_close`]=e=>e.closeNode())}else if(i.node){let t=e.nodeType(i.node);n[r]=(e,n,r,a)=>e.addNode(t,DL(i,n,r,a))}else if(i.mark){let t=e.marks[i.mark];OL(i,r)?n[r]=(e,n,r,a)=>{e.openMark(t.create(DL(i,n,r,a))),e.addText(kL(n.content)),e.closeMark(t)}:(n[r+`_open`]=(e,n,r,a)=>e.openMark(t.create(DL(i,n,r,a))),n[r+`_close`]=e=>e.closeMark(t))}else if(i.ignore)OL(i,r)?n[r]=AL:(n[r+`_open`]=AL,n[r+`_close`]=AL);else throw RangeError(`Unrecognized parsing spec `+JSON.stringify(i))}return n.text=(e,t)=>e.addText(t.content),n.inline=(e,t)=>e.parseTokens(t.children),n.softbreak=n.softbreak||(e=>e.addText(` `)),n}var ML=class{constructor(e,t,n){this.schema=e,this.tokenizer=t,this.tokens=n,this.tokenHandlers=jL(e,n)}parse(e,t={}){let n=new EL(this.schema,this.tokenHandlers),r;n.parseTokens(this.tokenizer.parse(e,t));do r=n.closeNode();while(n.stack.length);return r||this.schema.topNodeType.createAndFill()}};function NL(e,t){for(;++t<e.length;)if(e[t].type!=`list_item_open`)return e[t].hidden;return!1}new ML(wL,CL(`commonmark`,{html:!1}),{blockquote:{block:`blockquote`},paragraph:{block:`paragraph`},list_item:{block:`list_item`},bullet_list:{block:`bullet_list`,getAttrs:(e,t,n)=>({tight:NL(t,n)})},ordered_list:{block:`ordered_list`,getAttrs:(e,t,n)=>({order:+e.attrGet(`start`)||1,tight:NL(t,n)})},heading:{block:`heading`,getAttrs:e=>({level:+e.tag.slice(1)})},code_block:{block:`code_block`,noCloseToken:!0},fence:{block:`code_block`,getAttrs:e=>({params:e.info||``}),noCloseToken:!0},hr:{node:`horizontal_rule`},image:{node:`image`,getAttrs:e=>({src:e.attrGet(`src`),title:e.attrGet(`title`)||null,alt:e.children[0]&&e.children[0].content||null})},hardbreak:{node:`hard_break`},em:{mark:`em`},strong:{mark:`strong`},link:{mark:`link`,getAttrs:e=>({href:e.attrGet(`href`),title:e.attrGet(`title`)||null})},code_inline:{mark:`code`,noCloseToken:!0}});var PL={open:``,close:``,mixable:!0},FL=new class{constructor(e,t,n={}){this.nodes=e,this.marks=t,this.options=n}serialize(e,t={}){t=Object.assign({},this.options,t);let n=new RL(this.nodes,this.marks,t);return n.renderContent(e),n.out}}({blockquote(e,t){e.wrapBlock(`> `,null,t,()=>e.renderContent(t))},code_block(e,t){let n=t.textContent.match(/`{3,}/gm),r=n?n.sort().slice(-1)[0]+"`":"```";e.write(r+(t.attrs.params||``)+`
`),e.text(t.textContent,!1),e.write(`
`),e.write(r),e.closeBlock(t)},heading(e,t){e.write(e.repeat(`#`,t.attrs.level)+` `),e.renderInline(t,!1),e.closeBlock(t)},horizontal_rule(e,t){e.write(t.attrs.markup||`---`),e.closeBlock(t)},bullet_list(e,t){e.renderList(t,` `,()=>(t.attrs.bullet||`*`)+` `)},ordered_list(e,t){let n=t.attrs.order??1,r=String(n+t.childCount-1).length,i=e.repeat(` `,r+2);e.renderList(t,i,t=>{let i=String(n+t);return e.repeat(` `,r-i.length)+i+`. `})},list_item(e,t){e.renderContent(t)},paragraph(e,t){e.renderInline(t),e.closeBlock(t)},image(e,t){e.write(`]/g,`\\$&`)+(t.attrs.title?` "`+t.attrs.title.replace(/"/g,`\\"`)+`"`:``)+`)`)},hard_break(e,t,n,r){for(let i=r+1;i<n.childCount;i++)if(n.child(i).type!=t.type){e.write(`\\
`);return}},text(e,t){e.text(t.text,!e.inAutolink)}},{em:{open:`*`,close:`*`,mixable:!0,expelEnclosingWhitespace:!0},strong:{open:`**`,close:`**`,mixable:!0,expelEnclosingWhitespace:!0},link:{open(e,t,n,r){return e.inAutolink=LL(t,n,r),e.inAutolink?`<`:`[`},close(e,t,n,r){let{inAutolink:i}=e;return e.inAutolink=void 0,i?`>`:`](`+t.attrs.href.replace(/[\(\)"]/g,`\\$&`)+(t.attrs.title?` "${t.attrs.title.replace(/"/g,`\\"`)}"`:``)+`)`},mixable:!0},code:{open(e,t,n,r){return IL(n.child(r),-1)},close(e,t,n,r){return IL(n.child(r-1),1)},escape:!1}});function IL(e,t){let n=/`+/g,r,i=0;if(e.isText)for(;r=n.exec(e.text);)i=Math.max(i,r[0].length);let a=i>0&&t>0?" `":"`";for(let e=0;e<i;e++)a+="`";return i>0&&t<0&&(a+=` `),a}function LL(e,t,n){if(e.attrs.title||!/^\w+:/.test(e.attrs.href))return!1;let r=t.child(n);return!r.isText||r.text!=e.attrs.href||r.marks[r.marks.length-1]!=e?!1:n==t.childCount-1||!e.isInSet(t.child(n+1).marks)}var RL=class{constructor(e,t,n){this.nodes=e,this.marks=t,this.options=n,this.delim=``,this.out=``,this.closed=null,this.inAutolink=void 0,this.atBlockStart=!1,this.inTightList=!1,this.options.tightLists===void 0&&(this.options.tightLists=!1),this.options.hardBreakNodeName===void 0&&(this.options.hardBreakNodeName=`hard_break`)}flushClose(e=2){if(this.closed){if(this.atBlank()||(this.out+=`
`),e>1){let t=this.delim,n=/\s+$/.exec(t);n&&(t=t.slice(0,t.length-n[0].length));for(let n=1;n<e;n++)this.out+=t+`
`}this.closed=null}}getMark(e){let t=this.marks[e];if(!t){if(this.options.strict!==!1)throw Error(`Mark type \`${e}\` not supported by Markdown renderer`);t=PL}return t}wrapBlock(e,t,n,r){let i=this.delim;this.write(t??e),this.delim+=e,r(),this.delim=i,this.closeBlock(n)}atBlank(){return/(^|\n)$/.test(this.out)}ensureNewLine(){this.atBlank()||(this.out+=`
`)}write(e){this.flushClose(),this.delim&&this.atBlank()&&(this.out+=this.delim),e&&(this.out+=e)}closeBlock(e){this.closed=e}text(e,t=!0){let n=e.split(`
`);for(let e=0;e<n.length;e++)this.write(),!t&&n[e][0]==`[`&&/(^|[^\\])\!$/.test(this.out)&&(this.out=this.out.slice(0,this.out.length-1)+`\\!`),this.out+=t?this.esc(n[e],this.atBlockStart):n[e],e!=n.length-1&&(this.out+=`
`)}render(e,t,n){if(this.nodes[e.type.name])this.nodes[e.type.name](this,e,t,n);else if(this.options.strict!==!1)throw Error("Token type `"+e.type.name+"` not supported by Markdown renderer");else e.type.isLeaf||(e.type.inlineContent?this.renderInline(e):this.renderContent(e),e.isBlock&&this.closeBlock(e))}renderContent(e){e.forEach((t,n,r)=>this.render(t,e,r))}renderInline(e,t=!0){this.atBlockStart=t;let n=[],r=``,i=(t,i,a)=>{let o=t?t.marks:[];t&&t.type.name===this.options.hardBreakNodeName&&(o=o.filter(t=>{if(a+1==e.childCount)return!1;let n=e.child(a+1);return t.isInSet(n.marks)&&(!n.isText||/\S/.test(n.text))}));let s=r;if(r=``,t&&t.isText&&o.some(e=>{let t=this.getMark(e.type.name);return t&&t.expelEnclosingWhitespace&&!e.isInSet(n)})){let[e,r,i]=/^(\s*)(.*)$/m.exec(t.text);r&&(s+=r,t=i?t.withText(i):null,t||(o=n))}if(t&&t.isText&&o.some(t=>{let n=this.getMark(t.type.name);return n&&n.expelEnclosingWhitespace&&!this.isMarkAhead(e,a+1,t)})){let[e,i,a]=/^(.*?)(\s*)$/m.exec(t.text);a&&(r=a,t=i?t.withText(i):null,t||(o=n))}let c=o.length?o[o.length-1]:null,l=c&&this.getMark(c.type.name).escape===!1,u=o.length-+!!l;outer:for(let e=0;e<u;e++){let t=o[e];if(!this.getMark(t.type.name).mixable)break;for(let r=0;r<n.length;r++){let i=n[r];if(!this.getMark(i.type.name).mixable)break;if(t.eq(i)){e>r?o=o.slice(0,r).concat(t).concat(o.slice(r,e)).concat(o.slice(e+1,u)):r>e&&(o=o.slice(0,e).concat(o.slice(e+1,r)).concat(t).concat(o.slice(r,u)));continue outer}}}let d=0;for(;d<Math.min(n.length,u)&&o[d].eq(n[d]);)++d;for(;d<n.length;)this.text(this.markString(n.pop(),!1,e,a),!1);if(s&&this.text(s),t){for(;n.length<u;){let t=o[n.length];n.push(t),this.text(this.markString(t,!0,e,a),!1),this.atBlockStart=!1}l&&t.isText?this.text(this.markString(c,!0,e,a)+t.text+this.markString(c,!1,e,a+1),!1):this.render(t,e,a),this.atBlockStart=!1}t?.isText&&t.nodeSize>0&&(this.atBlockStart=!1)};e.forEach(i),i(null,0,e.childCount),this.atBlockStart=!1}renderList(e,t,n){this.closed&&this.closed.type==e.type?this.flushClose(3):this.inTightList&&this.flushClose(1);let r=e.attrs.tight===void 0?this.options.tightLists:e.attrs.tight,i=this.inTightList;this.inTightList=r,e.forEach((i,a,o)=>{o&&r&&this.flushClose(1),this.wrapBlock(t,n(o),e,()=>this.render(i,e,o))}),this.inTightList=i}esc(e,t=!1){return e=e.replace(/[`*\\~\[\]_]/g,(t,n)=>t==`_`&&n>0&&n+1<e.length&&e[n-1].match(/\w/)&&e[n+1].match(/\w/)?t:`\\`+t),t&&(e=e.replace(/^(\+[ ]|[\-*>])/,`\\$&`).replace(/^(\s*)(#{1,6})(\s|$)/,`$1\\$2$3`).replace(/^(\s*\d+)\.\s/,`$1\\. `)),this.options.escapeExtraCharacters&&(e=e.replace(this.options.escapeExtraCharacters,`\\$&`)),e}quote(e){let t=e.indexOf(`"`)==-1?`""`:e.indexOf(`'`)==-1?`''`:`()`;return t[0]+e+t[1]}repeat(e,t){let n=``;for(let r=0;r<t;r++)n+=e;return n}markString(e,t,n,r){let i=this.getMark(e.type.name),a=t?i.open:i.close;return typeof a==`string`?a:a(this,e,n,r)}getEnclosingWhitespace(e){return{leading:(e.match(/^(\s+)/)||[void 0])[0],trailing:(e.match(/(\s+)$/)||[void 0])[0]}}isMarkAhead(e,t,n){for(;;t++){if(t>=e.childCount)return!1;let r=e.child(t);if(r.type.name!=this.options.hardBreakNodeName)return n.isInSet(r.marks);t++}}},zL=l(o(((e,t)=>{var n=!0,r=!1,i=!1;t.exports=function(e,t){t&&(n=!t.enabled,r=!!t.label,i=!!t.labelAfter),e.core.ruler.after(`inline`,`github-task-lists`,function(e){for(var t=e.tokens,r=2;r<t.length;r++)s(t,r)&&(c(t[r],e.Token),a(t[r-2],`class`,`task-list-item`+(n?``:` enabled`)),a(t[o(t,r-2)],`class`,`contains-task-list`))})};function a(e,t,n){var r=e.attrIndex(t),i=[t,n];r<0?e.attrPush(i):e.attrs[r]=i}function o(e,t){for(var n=e[t].level-1,r=t-1;r>=0;r--)if(e[r].level===n)return r;return-1}function s(e,t){return p(e[t])&&m(e[t-1])&&h(e[t-2])&&g(e[t])}function c(e,t){if(e.children.unshift(l(e,t)),e.children[1].content=e.children[1].content.slice(3),e.content=e.content.slice(3),r)if(i){e.children.pop();var n=`task-item-`+Math.ceil(1e4*1e3*Math.random()-1e3);e.children[0].content=e.children[0].content.slice(0,-1)+` id="`+n+`">`,e.children.push(f(e.content,n,t))}else e.children.unshift(u(t)),e.children.push(d(t))}function l(e,t){var r=new t(`html_inline`,``,0),i=n?` disabled="" `:``;return e.content.indexOf(`[ ] `)===0?r.content=`<input class="task-list-item-checkbox"`+i+`type="checkbox">`:(e.content.indexOf(`[x] `)===0||e.content.indexOf(`[X] `)===0)&&(r.content=`<input class="task-list-item-checkbox" checked=""`+i+`type="checkbox">`),r}function u(e){var t=new e(`html_inline`,``,0);return t.content=`<label>`,t}function d(e){var t=new e(`html_inline`,``,0);return t.content=`</label>`,t}function f(e,t,n){var r=new n(`html_inline`,``,0);return r.content=`<label class="task-list-item-label" for="`+t+`">`+e+`</label>`,r.attrs=[{for:t}],r}function p(e){return e.type===`inline`}function m(e){return e.type===`paragraph_open`}function h(e){return e.type===`list_item_open`}function g(e){return e.content.indexOf(`[ ] `)===0||e.content.indexOf(`[x] `)===0||e.content.indexOf(`[X] `)===0}}))(),1),BL=Object.defineProperty,VL=(e,t,n)=>t in e?BL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,HL=(e,t,n)=>(VL(e,typeof t==`symbol`?t:t+``,n),n),UL=pk.create({name:`markdownTightLists`,addOptions:()=>({tight:!0,tightClass:`tight`,listTypes:[`bulletList`,`orderedList`]}),addGlobalAttributes(){return[{types:this.options.listTypes,attributes:{tight:{default:this.options.tight,parseHTML:e=>e.getAttribute(`data-tight`)===`true`||!e.querySelector(`p`),renderHTML:e=>({class:e.tight?this.options.tightClass:null,"data-tight":e.tight?`true`:null})}}}]},addCommands(){var e=this;return{toggleTight:function(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return n=>{let{editor:r,commands:i}=n;function a(e){if(!r.isActive(e))return!1;let n=r.getAttributes(e);return i.updateAttributes(e,{tight:t??!(n!=null&&n.tight)})}return e.options.listTypes.some(e=>a(e))}}}}}),WL=CL();function GL(e,t){return WL.inline.State.prototype.scanDelims.call({src:e,posMax:e.length}),new WL.inline.State(e,null,null,[]).scanDelims(t,!0)}function KL(e,t,n,r){let i=e.substring(0,n)+e.substring(n+t.length);return i=i.substring(0,n+r)+t+i.substring(n+r),i}function qL(e,t,n,r){let i=n,a=e;for(;i<r&&!GL(a,i).can_open;)a=KL(a,t,i,1),i++;return{text:a,from:i,to:r}}function JL(e,t,n,r){let i=r,a=e;for(;i>n&&!GL(a,i).can_close;)a=KL(a,t,i,-1),i--;return{text:a,from:n,to:i}}function YL(e,t,n,r){let i={text:e,from:n,to:r};return i=qL(i.text,t,i.from,i.to),i=JL(i.text,t,i.from,i.to),i.to-i.from<t.length+1&&(i.text=i.text.substring(0,i.from)+i.text.substring(i.to+t.length)),i.text}var XL=class extends RL{constructor(e,t,n){super(e,t,n??{}),HL(this,`inTable`,!1),this.inlines=[]}render(e,t,n){super.render(e,t,n);let r=this.inlines[this.inlines.length-1];if(r!=null&&r.start&&r!=null&&r.end){let{delimiter:e,start:t,end:n}=this.normalizeInline(r);this.out=YL(this.out,e,t,n),this.inlines.pop()}}markString(e,t,n,r){let i=this.marks[e.type.name];if(i.expelEnclosingWhitespace)if(t)this.inlines.push({start:this.out.length,delimiter:i.open});else{let e=this.inlines.pop();this.inlines.push({...e,end:this.out.length})}return super.markString(e,t,n,r)}normalizeInline(e){let{start:t,end:n}=e;for(;this.out.charAt(t).match(/\s/);)t++;return{...e,start:t}}},ZL=rk.create({name:`markdownHTMLMark`,addStorage(){return{markdown:{serialize:{open(e,t){return this.editor.storage.markdown.options.html?QL(t)?.[0]??``:(console.warn(`Tiptap Markdown: "${t.type.name}" mark is only available in html mode`),``)},close(e,t){return this.editor.storage.markdown.options.html?QL(t)?.[1]??``:``}},parse:{}}}}});function QL(e){let t=e.type.schema,n=t.text(` `,[e]),r=qO($.from(n),t).match(/^(<.*?>) (<\/.*?>)$/);return r?[r[1],r[2]]:null}function $L(e){let t=`<body>${e}</body>`;return new window.DOMParser().parseFromString(t,`text/html`).body}function eR(e){return e?.replace(/</g,`<`).replace(/>/g,`>`)}function tR(e){let t=e.parentElement,n=t.cloneNode();for(;t.firstChild&&t.firstChild!==e;)n.appendChild(t.firstChild);n.childNodes.length>0&&t.parentElement.insertBefore(n,t),t.parentElement.insertBefore(e,t),t.childNodes.length===0&&t.remove()}function nR(e){let t=e.parentNode;for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}var rR=hj.create({name:`markdownHTMLNode`,addStorage(){return{markdown:{serialize(e,t,n){this.editor.storage.markdown.options.html?e.write(iR(t,n)):(console.warn(`Tiptap Markdown: "${t.type.name}" node is only available in html mode`),e.write(`[${t.type.name}]`)),t.isBlock&&e.closeBlock(t)},parse:{}}}}});function iR(e,t){let n=e.type.schema,r=qO($.from(e),n);return e.isBlock&&(t instanceof $||t.type.name===n.topNodeType.name)?aR(r):r}function aR(e){let t=$L(e).firstElementChild;return t.innerHTML=t.innerHTML.trim()?`
${t.innerHTML}
`:`
`,t.outerHTML}var oR=hj.create({name:`blockquote`}).extend({addStorage(){return{markdown:{serialize:FL.nodes.blockquote,parse:{}}}}}),sR=hj.create({name:`bulletList`}).extend({addStorage(){return{markdown:{serialize(e,t){return e.renderList(t,` `,()=>(this.editor.storage.markdown.options.bulletListMarker||`-`)+` `)},parse:{}}}}}),cR=hj.create({name:`codeBlock`}).extend({addStorage(){return{markdown:{serialize(e,t){e.write("```"+(t.attrs.language||``)+`
`),e.text(t.textContent,!1),e.ensureNewLine(),e.write("```"),e.closeBlock(t)},parse:{setup(e){e.set({langPrefix:this.options.languageClassPrefix??`language-`})},updateDOM(e){e.innerHTML=e.innerHTML.replace(/\n<\/code><\/pre>/g,`</code></pre>`)}}}}}}),lR=hj.create({name:`hardBreak`}).extend({addStorage(){return{markdown:{serialize(e,t,n,r){for(let i=r+1;i<n.childCount;i++)if(n.child(i).type!=t.type){e.write(e.inTable?rR.storage.markdown.serialize.call(this,e,t,n):`\\
`);return}},parse:{}}}}}),uR=hj.create({name:`heading`}).extend({addStorage(){return{markdown:{serialize:FL.nodes.heading,parse:{}}}}}),dR=hj.create({name:`horizontalRule`}).extend({addStorage(){return{markdown:{serialize:FL.nodes.horizontal_rule,parse:{}}}}}),fR=hj.create({name:`image`}).extend({addStorage(){return{markdown:{serialize:FL.nodes.image,parse:{}}}}}),pR=hj.create({name:`listItem`}).extend({addStorage(){return{markdown:{serialize:FL.nodes.list_item,parse:{}}}}}),mR=hj.create({name:`orderedList`});function hR(e,t,n){let r=0;for(;n-r>0&&t.child(n-r-1).type.name===e.type.name;r++);return r}var gR=mR.extend({addStorage(){return{markdown:{serialize(e,t,n,r){let i=t.attrs.start||1,a=String(i+t.childCount-1).length,o=e.repeat(` `,a+2),s=hR(t,n,r)%2?`) `:`. `;e.renderList(t,o,t=>{let n=String(i+t);return e.repeat(` `,a-n.length)+n+s})},parse:{}}}}}),_R=hj.create({name:`paragraph`}).extend({addStorage(){return{markdown:{serialize:FL.nodes.paragraph,parse:{}}}}});function vR(e){var t;return(e==null||(t=e.content)==null?void 0:t.content)??[]}var yR=hj.create({name:`table`}).extend({addStorage(){return{markdown:{serialize(e,t,n){if(!xR(t)){rR.storage.markdown.serialize.call(this,e,t,n);return}e.inTable=!0,t.forEach((t,n,r)=>{if(e.write(`| `),t.forEach((t,n,r)=>{r&&e.write(` | `);let i=t.firstChild;i.textContent.trim()&&e.renderInline(i)}),e.write(` |`),e.ensureNewLine(),!r){let n=Array.from({length:t.childCount}).map(()=>`---`).join(` | `);e.write(`| ${n} |`),e.ensureNewLine()}}),e.closeBlock(t),e.inTable=!1},parse:{}}}}});function bR(e){return e.attrs.colspan>1||e.attrs.rowspan>1}function xR(e){let t=vR(e),n=t[0],r=t.slice(1);return!(vR(n).some(e=>e.type.name!==`tableHeader`||bR(e)||e.childCount>1)||r.some(e=>vR(e).some(e=>e.type.name===`tableHeader`||bR(e)||e.childCount>1)))}var SR=[oR,sR,cR,lR,uR,dR,rR,fR,pR,gR,_R,yR,hj.create({name:`taskItem`}).extend({addStorage(){return{markdown:{serialize(e,t){let n=t.attrs.checked?`[x]`:`[ ]`;e.write(`${n} `),e.renderContent(t)},parse:{updateDOM(e){[...e.querySelectorAll(`.task-list-item`)].forEach(e=>{let t=e.querySelector(`input`);e.setAttribute(`data-type`,`taskItem`),t&&(e.setAttribute(`data-checked`,t.checked),t.remove())})}}}}}}),hj.create({name:`taskList`}).extend({addStorage(){return{markdown:{serialize:sR.storage.markdown.serialize,parse:{setup(e){e.use(zL.default)},updateDOM(e){[...e.querySelectorAll(`.contains-task-list`)].forEach(e=>{e.setAttribute(`data-type`,`taskList`)})}}}}}}),hj.create({name:`text`}).extend({addStorage(){return{markdown:{serialize(e,t){e.text(eR(t.text))},parse:{}}}}}),rk.create({name:`bold`}).extend({addStorage(){return{markdown:{serialize:FL.marks.strong,parse:{}}}}}),rk.create({name:`code`}).extend({addStorage(){return{markdown:{serialize:FL.marks.code,parse:{}}}}}),ZL,rk.create({name:`italic`}).extend({addStorage(){return{markdown:{serialize:FL.marks.em,parse:{}}}}}),rk.create({name:`link`}).extend({addStorage(){return{markdown:{serialize:FL.marks.link,parse:{}}}}}),rk.create({name:`strike`}).extend({addStorage(){return{markdown:{serialize:{open:`~~`,close:`~~`,expelEnclosingWhitespace:!0},parse:{}}}}})];function CR(e){let t=e.storage?.markdown,n=SR.find(t=>t.name===e.name)?.storage.markdown;return t||n?{...n,...t}:null}var wR=class{constructor(e){HL(this,`editor`,null),this.editor=e}serialize(e){let t=new XL(this.nodes,this.marks,{hardBreakNodeName:lR.name});return t.renderContent(e),t.out}get nodes(){return{...Object.fromEntries(Object.keys(this.editor.schema.nodes).map(e=>[e,this.serializeNode(rR)])),...Object.fromEntries(this.editor.extensionManager.extensions.filter(e=>e.type===`node`&&this.serializeNode(e)).map(e=>[e.name,this.serializeNode(e)])??[])}}get marks(){return{...Object.fromEntries(Object.keys(this.editor.schema.marks).map(e=>[e,this.serializeMark(ZL)])),...Object.fromEntries(this.editor.extensionManager.extensions.filter(e=>e.type===`mark`&&this.serializeMark(e)).map(e=>[e.name,this.serializeMark(e)])??[])}}serializeNode(e){var t;return(t=CR(e))==null||(t=t.serialize)==null?void 0:t.bind({editor:this.editor,options:e.options})}serializeMark(e){let t=CR(e)?.serialize;return t?{...t,open:typeof t.open==`function`?t.open.bind({editor:this.editor,options:e.options}):t.open,close:typeof t.close==`function`?t.close.bind({editor:this.editor,options:e.options}):t.close}:null}},TR=class{constructor(e,t){HL(this,`editor`,null),HL(this,`md`,null);let{html:n,linkify:r,breaks:i}=t;this.editor=e,this.md=this.withPatchedRenderer(CL({html:n,linkify:r,breaks:i}))}parse(e){let{inline:t}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(typeof e==`string`){this.editor.extensionManager.extensions.forEach(e=>{var t;return(t=CR(e))==null||(t=t.parse)==null||(t=t.setup)==null?void 0:t.call({editor:this.editor,options:e.options},this.md)});let n=$L(this.md.render(e));return this.editor.extensionManager.extensions.forEach(e=>{var t;return(t=CR(e))==null||(t=t.parse)==null||(t=t.updateDOM)==null?void 0:t.call({editor:this.editor,options:e.options},n)}),this.normalizeDOM(n,{inline:t,content:e}),n.innerHTML}return e}normalizeDOM(e,t){let{inline:n,content:r}=t;return this.normalizeBlocks(e),e.querySelectorAll(`*`).forEach(e=>{e.nextSibling?.nodeType===Node.TEXT_NODE&&!e.closest(`pre`)&&(e.nextSibling.textContent=e.nextSibling.textContent.replace(/^\n/,``))}),n&&this.normalizeInline(e,r),e}normalizeBlocks(e){let t=Object.values(this.editor.schema.nodes).filter(e=>e.isBlock).map(e=>e.spec.parseDOM?.map(e=>e.tag)).flat().filter(Boolean).join(`,`);t&&[...e.querySelectorAll(t)].forEach(e=>{e.parentElement.matches(`p`)&&tR(e)})}normalizeInline(e,t){var n;if((n=e.firstElementChild)!=null&&n.matches(`p`)){let n=e.firstElementChild,{nextElementSibling:r}=n,i=t.match(/^\s+/)?.[0]??``,a=r?``:t.match(/\s+$/)?.[0]??``;if(t.match(/^\n\n/)){n.innerHTML=`${n.innerHTML}${a}`;return}nR(n),e.innerHTML=`${i}${e.innerHTML}${a}`}}withPatchedRenderer(e){let t=e=>function(){let t=e(...arguments);return t===`
`?t:t[t.length-1]===`
`?t.slice(0,-1):t};return e.renderer.rules.hardbreak=t(e.renderer.rules.hardbreak),e.renderer.rules.softbreak=t(e.renderer.rules.softbreak),e.renderer.rules.fence=t(e.renderer.rules.fence),e.renderer.rules.code_block=t(e.renderer.rules.code_block),e.renderer.renderToken=t(e.renderer.renderToken.bind(e.renderer)),e}},ER=pk.create({name:`markdownClipboard`,addOptions(){return{transformPastedText:!1,transformCopiedText:!1}},addProseMirrorPlugins(){return[new QS({key:new tC(`markdownClipboard`),props:{clipboardTextParser:(e,t,n)=>{if(n||!this.options.transformPastedText)return null;let r=this.editor.storage.markdown.parser.parse(e,{inline:!0});return Yb.fromSchema(this.editor.schema).parseSlice($L(r),{preserveWhitespace:!0,context:t})},clipboardTextSerializer:e=>this.options.transformCopiedText?this.editor.storage.markdown.serializer.serialize(e.content):null}})]}}),DR=pk.create({name:`markdown`,priority:50,addOptions(){return{html:!0,tightLists:!0,tightListClass:`tight`,bulletListMarker:`-`,linkify:!1,breaks:!1,transformPastedText:!1,transformCopiedText:!1}},addCommands(){let e=oj.Commands.config.addCommands();return{setContent:(t,n,r)=>i=>e.setContent(i.editor.storage.markdown.parser.parse(t),n,r)(i),insertContentAt:(t,n,r)=>i=>e.insertContentAt(t,i.editor.storage.markdown.parser.parse(n,{inline:!0}),r)(i)}},onBeforeCreate(){this.editor.storage.markdown={options:{...this.options},parser:new TR(this.editor,this.options),serializer:new wR(this.editor),getMarkdown:()=>this.editor.storage.markdown.serializer.serialize(this.editor.state.doc)},this.editor.options.initialContent=this.editor.options.content,this.editor.options.content=this.editor.storage.markdown.parser.parse(this.editor.options.content)},onCreate(){this.editor.options.content=this.editor.options.initialContent,delete this.editor.options.initialContent},addStorage(){return{}},addExtensions(){return[UL.configure({tight:this.options.tightLists,tightClass:this.options.tightListClass}),ER.configure({transformPastedText:this.options.transformPastedText,transformCopiedText:this.options.transformCopiedText})]}}),OR=[{kind:`macro`,label:`AWAIT`,text:`<AWAIT>`,hint:`Stop and wait for the user`},{kind:`macro`,label:`REVIEW_FILE`,text:`<REVIEW_FILE>`,hint:`The review scratch file`},{kind:`macro`,label:`TODO_FILE`,text:`<TODO_FILE>`,hint:`The session TODO file`},{kind:`macro`,label:`PLAN_FILE`,text:`<PLAN_FILE>`,hint:`The session plan file`},{kind:`macro`,label:`SESSION_NAME`,text:`<SESSION_NAME>`,hint:`The sanitized branch slug`},{kind:`macro`,label:`FUNCTION`,text:`<FUNCTION>`,hint:`A function placeholder`}],kR=[{kind:`action`,label:`showChoices()`,text:`showChoices()`,hint:`Single-select gate`},{kind:`action`,label:`showMultiSelect()`,text:`showMultiSelect()`,hint:`Multi-select gate`},{kind:`action`,label:`showMarkdown()`,text:`showMarkdown()`,hint:`Push a markdown view`}],AR=/<[A-Z][A-Z0-9_]*>|show[A-Za-z]+\(\)/g;function jR(e){return[...OR,...kR].find(t=>t.text.toLowerCase()===e.toLowerCase())||(e.endsWith(`()`)?{kind:`action`,label:e,text:e}:{kind:`macro`,label:e.replace(/^<|>$/g,``),text:e})}var MR=hj.create({name:`token`,group:`inline`,inline:!0,atom:!0,selectable:!0,addAttributes(){return{kind:{default:`macro`},label:{default:``},text:{default:``}}},parseHTML(){return[{tag:`span[data-token]`}]},renderHTML({node:e,HTMLAttributes:t}){return[`span`,IO(t,{"data-token":e.attrs.kind,class:`pe-token`}),e.attrs.label||e.attrs.text]},renderText({node:e}){return e.attrs.text},addInputRules(){let e=e=>{let t=jR(e[0]);return{kind:t.kind,label:t.label,text:t.text}};return[fj({find:/<[A-Za-z][A-Za-z0-9_]*>$/,type:this.type,getAttributes:e}),fj({find:/show[A-Za-z]+\(\)$/,type:this.type,getAttributes:e})]},addStorage(){return{markdown:{serialize(e,t){e.write(t.attrs.text)},parse:{}}}}});function NR(e){let{char:t,allowSpaces:n,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:a,$position:o}=e,s=n&&!r,c=vj(t),l=RegExp(`\\s${c}$`),u=a?`^`:``,d=r?``:c,f=RegExp(s?`${u}${c}.*?(?=\\s${d}|$)`:`${u}(?:^)?${c}[^\\s${d}]*`,`gm`),p=o.nodeBefore?.isText&&o.nodeBefore.text;if(!p)return null;let m=o.pos-p.length,h=Array.from(p.matchAll(f)).pop();if(!h||h.input===void 0||h.index===void 0)return null;let g=h.input.slice(Math.max(0,h.index-1),h.index),_=RegExp(`^[${i?.join(``)}\0]?$`).test(g);if(i!==null&&!_)return null;let v=m+h.index,y=v+h[0].length;return s&&l.test(p.slice(y-1,y+1))&&(h[0]+=` `,y+=1),v<o.pos&&y>=o.pos?{range:{from:v,to:y},query:h[0].slice(t.length),text:h[0]}:null}var PR=new tC(`suggestion`);function FR({pluginKey:e=PR,editor:t,char:n=`@`,allowSpaces:r=!1,allowToIncludeChar:i=!1,allowedPrefixes:a=[` `],startOfLine:o=!1,decorationTag:s=`span`,decorationClass:c=`suggestion`,decorationContent:l=``,decorationEmptyClass:u=`is-empty`,command:d=()=>null,items:f=()=>[],render:p=()=>({}),allow:m=()=>!0,findSuggestionMatch:h=NR}){let g,_=p?.(),v=new QS({key:e,view(){return{update:async(e,n)=>{var r,i,a,o,s;let c=this.key?.getState(n),l=this.key?.getState(e.state),u=c.active&&l.active&&c.range.from!==l.range.from,p=!c.active&&l.active,m=c.active&&!l.active,h=!p&&!m&&c.query!==l.query,v=p||u&&h,y=h||u,b=m||u&&h;if(!v&&!y&&!b)return;let x=b&&!v?c:l,S=e.dom.querySelector(`[data-decoration-id="${x.decorationId}"]`);g={editor:t,range:x.range,query:x.query,text:x.text,items:[],command:e=>d({editor:t,range:x.range,props:e}),decorationNode:S,clientRect:S?()=>{let{decorationId:n}=this.key?.getState(t.state);return e.dom.querySelector(`[data-decoration-id="${n}"]`)?.getBoundingClientRect()||null}:null},v&&((r=_?.onBeforeStart)==null||r.call(_,g)),y&&((i=_?.onBeforeUpdate)==null||i.call(_,g)),(y||v)&&(g.items=await f({editor:t,query:x.query})),b&&((a=_?.onExit)==null||a.call(_,g)),y&&((o=_?.onUpdate)==null||o.call(_,g)),v&&((s=_?.onStart)==null||s.call(_,g))},destroy:()=>{var e;g&&((e=_?.onExit)==null||e.call(_,g))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(e,s,c,l){let{isEditable:u}=t,{composing:d}=t.view,{selection:f}=e,{empty:p,from:g}=f,_={...s};if(_.composing=d,u&&(p||t.view.composing)){(g<s.range.from||g>s.range.to)&&!d&&!s.composing&&(_.active=!1);let e=h({char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:a,startOfLine:o,$position:f.$from}),c=`id_${Math.floor(Math.random()*4294967295)}`;e&&m({editor:t,state:l,range:e.range,isActive:s.active})?(_.active=!0,_.decorationId=s.decorationId?s.decorationId:c,_.range=e.range,_.query=e.query,_.text=e.text):_.active=!1}else _.active=!1;return _.active||(_.decorationId=null,_.range={from:0,to:0},_.query=null,_.text=null),_}},props:{handleKeyDown(e,t){let{active:n,range:r}=v.getState(e.state);return n&&(_?.onKeyDown)?.call(_,{view:e,event:t,range:r})||!1},decorations(e){let{active:t,range:n,decorationId:r,query:i}=v.getState(e);if(!t)return null;let a=!i?.length,o=[c];return a&&o.push(u),RE.create(e.doc,[FE.inline(n.from,n.to,{nodeName:s,class:o.join(` `),"data-decoration-id":r,"data-decoration-content":l})])}}});return v}function IR(e){return`prompt-suggestion-option-${e}`}var LR=(0,v.forwardRef)(function({items:e,command:t,emptyNote:n,onActiveChange:r},i){let[a,o]=(0,v.useState)(0);return(0,v.useEffect)(()=>o(0),[e]),(0,v.useEffect)(()=>{r?.(e.length>0?IR(a):null)},[e,a,r]),(0,v.useImperativeHandle)(i,()=>({onKeyDown:n=>{if(e.length===0)return!1;if(n.key===`ArrowDown`)return o(t=>(t+1)%e.length),!0;if(n.key===`ArrowUp`)return o(t=>(t-1+e.length)%e.length),!0;if(n.key===`Enter`||n.key===`Tab`){let n=e[a];return n&&t(n),!0}return!1}})),e.length===0?(0,K.jsx)(`div`,{role:`status`,className:`w-64 rounded-md border border-border bg-card p-2 text-sm text-muted-foreground shadow-md`,children:n??`No matches`}):(0,K.jsx)(`div`,{role:`listbox`,"aria-label":`Suggestions`,className:`max-h-72 w-64 overflow-y-auto rounded-md border border-border bg-card p-1 text-sm shadow-md`,children:e.map((n,r)=>(0,K.jsxs)(`div`,{children:[n.group&&(r===0||e[r-1]?.group!==n.group)&&(0,K.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/70`,children:n.group}),(0,K.jsxs)(`button`,{type:`button`,id:IR(r),role:`option`,"aria-selected":r===a,...n.title?{title:n.title}:{},onMouseDown:e=>{e.preventDefault(),t(n)},onMouseEnter:()=>o(r),className:G(`flex w-full items-center gap-2 rounded px-2 py-1.5 text-left`,r===a?`bg-accent text-accent-foreground`:`hover:bg-accent/60`),children:[(0,K.jsx)(`span`,{className:`truncate font-medium`,children:n.label}),n.hint&&(0,K.jsx)(`span`,{className:`ml-auto truncate text-xs text-muted-foreground`,children:n.hint})]})]},n.id))})});function RR(e,t){if(!t)return;let n=window.innerHeight-t.bottom;e.style.left=`${t.left}px`,n<320?(e.style.top=``,e.style.bottom=`${window.innerHeight-t.top+4}px`):(e.style.bottom=``,e.style.top=`${t.bottom+4}px`)}function zR(e){let t=null,n=null,r=null,i=null,a=null,o=e=>{a&&(e?a.setAttribute(`aria-activedescendant`,e):a.removeAttribute(`aria-activedescendant`))},s=i=>{let{items:s,command:c}=i,l=s.length===0&&!i.query?e.emptyNote:void 0,u=s.length>0||!!l;t&&(t.style.display=u?``:`none`),a?.setAttribute(`aria-expanded`,u?`true`:`false`),u||o(null),n?.render((0,v.createElement)(LR,{items:s,command:c,emptyNote:l,onActiveChange:o,ref:e=>{r=e}}))},c=()=>{t&&RR(t,i?.()??null)};return{onStart(e){t=document.createElement(`div`),t.style.position=`fixed`,t.style.zIndex=`50`,document.body.appendChild(t),n=(0,_.createRoot)(t),i=e.clientRect??null,a=e.editor?.view.dom??null,c(),s(e),window.addEventListener(`scroll`,c,!0),window.addEventListener(`resize`,c)},onUpdate(e){i=e.clientRect??null,c(),s(e)},onKeyDown(e){return e.event.key===`Escape`?!1:r?.onKeyDown(e.event)??!1},onExit(){window.removeEventListener(`scroll`,c,!0),window.removeEventListener(`resize`,c),a?.setAttribute(`aria-expanded`,`false`),o(null),a=null,n?.unmount(),t?.remove(),n=null,t=null,r=null,i=null}}}function BR(e){return pk.create({name:`suggestion-${e.key}`,addProseMirrorPlugins(){return[FR({editor:this.editor,char:e.char,pluginKey:new tC(e.key),items:({query:t})=>e.items(t.toLowerCase()),command:({editor:t,range:n,props:r})=>e.onSelect(r,{editor:t,range:n}),render:()=>zR(e)})]}})}function VR(e){let t=e.schema.nodes.token;if(!t)return;let n=[];if(e.state.doc.descendants((e,t)=>{if(!(!e.isText||!e.text)&&!e.marks.some(e=>e.type.name===`code`))for(let r of e.text.matchAll(AR)){let e=t+(r.index??0);n.push({from:e,to:e+r[0].length,text:r[0]})}}),n.length===0)return;let r=e.state.tr;for(let e of n.reverse()){let n=jR(e.text);r.replaceWith(e.from,e.to,t.create({kind:n.kind,label:n.label,text:n.text}))}e.view.dispatch(r)}function HR(e,t,n){e.chain().focus().deleteRange(t).insertContent([{type:`token`,attrs:{kind:n.kind,label:n.label,text:n.text}},{type:`text`,text:` `}]).run()}function UR(e,t){e.commands.setContent(t),VR(e),e.commands.focus(`end`)}var WR=(0,v.forwardRef)(function({onChange:e,onSubmit:t,onPreset:n,onMentionProject:r,onMentionFile:i,onMentionRemoved:a,projects:o,files:s=[],presets:c,customPresets:l=[],projectPresets:u=[],onNewPreset:d,disabled:f=!1,placeholder:p=`Describe what to build… ( / commands · < tags · @ projects · # files )`,initialText:m,compact:h=!1},g){let[_,y]=(0,v.useState)(!0),b=(0,v.useRef)(o),x=(0,v.useRef)(s),S=(0,v.useRef)(c),C=(0,v.useRef)(l),w=(0,v.useRef)(u),T=(0,v.useRef)(d),E=(0,v.useRef)(n),D=(0,v.useRef)(r),O=(0,v.useRef)(i),k=(0,v.useRef)(a),A=(0,v.useRef)(e),j=(0,v.useRef)(t);(0,v.useEffect)(()=>{b.current=o,x.current=s,S.current=c,C.current=l,w.current=u,T.current=d,E.current=n,D.current=r,O.current=i,k.current=a,A.current=e,j.current=t});let M=(0,v.useRef)(new Set),N=e=>{let t=new Set;e.state.doc.descendants(e=>(e.type.name===`token`&&(e.attrs.kind===`project`||e.attrs.kind===`file`)&&t.add(String(e.attrs.text)),!0));for(let e of M.current)if(!t.has(e)){if(e.startsWith(`#`))k.current?.(e.slice(1));else if(e.startsWith(`@`)){let t=b.current.find(t=>t.name===e.slice(1));t&&k.current?.(t.path)}}M.current=t},P=(e,t)=>{let n=!e.isEmpty;return UR(e,t),y(e.isEmpty),A.current(e.storage.markdown.getMarkdown()),N(e),n},F=Uj({immediatelyRender:!1,extensions:[mN,DR.configure({html:!1,linkify:!1,breaks:!0,transformPastedText:!0}),MR,BR({char:`/`,key:`slash`,items:e=>{let t=e.toLowerCase(),n=S.current.filter(n=>n.id.includes(e)||n.label.toLowerCase().includes(t)).map(e=>({id:`preset:${e.id}`,label:`/${e.id}`,hint:e.label,group:`Presets`,...e.tooltip?{title:e.tooltip}:{}})),r=C.current.filter(e=>e.label.toLowerCase().includes(t)).map(e=>({id:`custom-preset:${e.id}`,label:e.label,hint:`saved preset`,group:`Presets`})),i=w.current.filter(e=>e.label.toLowerCase().includes(t)).map(e=>({id:`project-preset:${e.id}`,label:e.label,hint:`project preset`,group:`Presets`})),a=T.current&&`new preset`.includes(t)?[{id:`new-preset`,label:`New preset…`,hint:`save the current prompt`,group:`Presets`}]:[],o=kR.filter(e=>e.label.toLowerCase().includes(t)).map(e=>({id:`action:${e.text}`,label:e.label,hint:e.hint,group:`Actions`}));return[...n,...r,...i,...a,...o]},onSelect:(e,{editor:t,range:n})=>{if(e.id.startsWith(`preset:`)){let r=S.current.find(t=>`preset:${t.id}`===e.id);if(r){t.chain().focus().deleteRange(n).run();let e=P(t,r.render());E.current?.(r.label,e,r.newAgent)}return}if(e.id.startsWith(`custom-preset:`)){let r=C.current.find(t=>`custom-preset:${t.id}`===e.id);if(r){t.chain().focus().deleteRange(n).run();let e=P(t,r.prompt);E.current?.(r.label,e)}return}if(e.id.startsWith(`project-preset:`)){let r=w.current.find(t=>`project-preset:${t.id}`===e.id);if(r){t.chain().focus().deleteRange(n).run();let e=P(t,r.prompt);E.current?.(r.label,e)}return}if(e.id===`new-preset`){t.chain().focus().deleteRange(n).run(),T.current?.();return}let r=kR.find(t=>`action:${t.text}`===e.id);r&&HR(t,n,r)}}),BR({char:`<`,key:`tag`,items:e=>OR.filter(t=>t.label.toLowerCase().includes(e)).map(e=>({id:`macro:${e.text}`,label:e.label,hint:e.hint,group:`Tags`})),onSelect:(e,{editor:t,range:n})=>{let r=OR.find(t=>`macro:${t.text}`===e.id);r&&HR(t,n,r)}}),BR({char:`@`,key:`at`,emptyNote:`No projects to reference yet.`,items:e=>b.current.filter(t=>t.name.toLowerCase().includes(e)).slice(0,8).map(e=>({id:`project:${e.id}`,label:`@${e.name}`,hint:`project`,group:`Projects`})),onSelect:(e,{editor:t,range:n})=>{let r=b.current.find(t=>`project:${t.id}`===e.id);r&&(HR(t,n,{kind:`project`,label:`@${r.name}`,text:`@${r.name}`}),D.current?.(r.path))}}),BR({char:`#`,key:`hash`,emptyNote:`No files indexed here yet.`,items:e=>x.current.filter(t=>t.toLowerCase().includes(e.toLowerCase())).slice(0,8).map(e=>({id:`file:${e}`,label:`#${e}`,hint:`file`,group:`Files`})),onSelect:(e,{editor:t,range:n})=>{let r=e.id.slice(5);HR(t,n,{kind:`file`,label:`#${r}`,text:`#${r}`}),O.current?.(r)}})],editorProps:{attributes:{class:`pe-prose focus:outline-none`,role:`textbox`,"aria-multiline":`true`,"aria-label":`Prompt`,"aria-placeholder":p},handleKeyDown:(e,t)=>(t.metaKey||t.ctrlKey)&&t.key===`Enter`?(t.preventDefault(),j.current(),!0):t.key===`Enter`&&!t.shiftKey&&!t.altKey&&!t.isComposing?e.dom.getAttribute(`aria-expanded`)===`true`||e.state.selection.$from.parent.type.name===`codeBlock`?!1:(t.preventDefault(),j.current(),!0):!1},onUpdate:({editor:e})=>{y(e.isEmpty),A.current(e.storage.markdown.getMarkdown()),N(e)}});(0,v.useImperativeHandle)(g,()=>({clear:()=>{F?.commands.clearContent(),y(!0),A.current(``),F&&N(F)},focus:()=>F?.commands.focus(`end`),loadTemplate:e=>F?P(F,e):!1})),(0,v.useEffect)(()=>{F?.setEditable(!f)},[F,f]);let I=(0,v.useRef)(!1);(0,v.useEffect)(()=>{!F||I.current||!m||(I.current=!0,P(F,m))},[F,m]);let L=h?`px-2 py-1.5`:`px-4 pt-4 pb-3`,R=h?`left-2 top-1.5`:`left-4 top-4`;return(0,K.jsxs)(`div`,{className:`relative`,children:[(0,K.jsx)(wg,{className:h?`rounded-md border border-border focus-within:ring-2 focus-within:ring-[var(--color-primary)]`:``,viewportClassName:h?`max-h-32 min-h-8`:`max-h-64 min-h-[2.75rem]`,children:(0,K.jsx)(Aj,{editor:F,className:`w-full bg-transparent text-sm ${L}`})}),_&&(0,K.jsx)(`span`,{className:`pointer-events-none absolute text-sm text-muted-foreground ${R}`,children:p})]})});function GR({open:e,onOpenChange:t,title:n,children:r}){return(0,K.jsx)(F_,{open:e,onOpenChange:t,children:(0,K.jsxs)(A_,{children:[(0,K.jsx)(x_,{className:`fixed inset-0 z-50 bg-black/40 backdrop-blur-[1px]`}),(0,K.jsxs)(k_,{className:`fixed left-1/2 top-1/2 z-50 w-[min(34rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 rounded-lg border border-border bg-card p-4 text-card-foreground shadow-lg outline-none`,children:[(0,K.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,K.jsx)(I_,{className:`text-sm font-semibold`,children:n}),(0,K.jsx)(S_,{"aria-label":`Close`,className:`rounded p-0.5 text-muted-foreground outline-none hover:text-foreground`,children:(0,K.jsx)(ua,{className:`h-4 w-4`,"aria-hidden":!0})})]}),r]})]})})}var KR=80;function qR(){return typeof crypto<`u`&&crypto.randomUUID?crypto.randomUUID():`p-${Date.now()}`}function JR({currentPrompt:e,busy:t,canSaveToProject:n,onSave:r,onCancel:i}){let[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)(e),[l,u]=(0,v.useState)(`user`),d=()=>{let e=a.trim(),t=s.trim();!e||!t||r({id:qR(),label:e,prompt:t},n?l:`user`)};return(0,K.jsx)(GR,{open:!0,onOpenChange:e=>{e||i()},title:`New preset`,children:(0,K.jsxs)(`div`,{className:`flex w-full flex-col gap-2`,onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),d())},children:[(0,K.jsx)(`input`,{type:`text`,value:a,maxLength:KR,placeholder:`Preset name`,disabled:t,autoFocus:!0,onChange:e=>o(e.target.value),className:`w-full rounded-md border border-border bg-background px-2 py-1 text-sm text-foreground`}),(0,K.jsx)(`textarea`,{value:s,placeholder:`The prompt this preset runs…`,disabled:t,rows:5,onChange:e=>c(e.target.value),className:`w-full resize-y rounded-md border border-border bg-background px-2 py-1 font-mono text-xs text-foreground`}),n&&(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-[var(--color-muted-foreground)]`,children:[(0,K.jsx)(`span`,{children:`Save to`}),(0,K.jsx)(`div`,{className:`inline-flex overflow-hidden rounded-md border border-border`,children:[`user`,`project`].map(e=>(0,K.jsx)(`button`,{type:`button`,disabled:t,onClick:()=>u(e),"aria-pressed":l===e,className:l===e?`bg-foreground px-2 py-0.5 text-background`:`px-2 py-0.5 text-foreground hover:bg-[var(--color-muted)]`,children:e===`user`?`Just me`:`This project`},e))}),(0,K.jsx)(`span`,{className:`truncate`,children:l===`project`?`Committed to the repo, shared with your team`:`Private to you, on every project`})]}),(0,K.jsxs)(`div`,{className:`mt-1 flex items-center justify-end gap-2`,children:[(0,K.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,onClick:i,children:`Cancel`}),(0,K.jsx)(q,{type:`button`,size:`sm`,disabled:t||!a.trim()||!s.trim(),onClick:d,children:`Save preset`})]})]})})}function YR({preset:e,busy:t,onLoad:n,onDelete:r}){return(0,K.jsxs)(Fg,{disabled:t,onClick:()=>n(e.prompt,e.label),className:`items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`flex-1 truncate`,children:e.label}),(0,K.jsxs)(Z,{children:[(0,K.jsx)(Q,{render:(0,K.jsx)(`button`,{type:`button`,disabled:t,onClick:t=>{t.stopPropagation(),r(e.id)},"aria-label":`Delete preset ${e.label}`,className:`rounded p-0.5 text-[var(--color-muted-foreground)] hover:text-danger`}),children:(0,K.jsx)(ua,{className:`h-3.5 w-3.5`,"aria-hidden":!0})}),(0,K.jsxs)(f_,{children:[`Delete "`,e.label,`"`]})]})]})}function XR({presets:e,customPresets:t,projectPresets:n,busy:r,onLoad:i,onNew:a,onDelete:o,onDeleteProject:s}){return(0,K.jsxs)(kg,{children:[(0,K.jsxs)(Z,{children:[(0,K.jsx)(Q,{render:(0,K.jsx)(Ng,{type:`button`,disabled:r,"aria-label":`Presets`,className:G(Er({variant:`ghost`,size:`icon-sm`}),`h-8 w-8`)}),children:(0,K.jsx)(ia,{className:`h-4 w-4`,"aria-hidden":!0})}),(0,K.jsx)(f_,{children:`Load a preset prompt — also available by typing / in the editor`})]}),(0,K.jsxs)(Pg,{align:`start`,className:`min-w-[16rem] max-w-[20rem]`,children:[(0,K.jsxs)(Ag,{children:[(0,K.jsx)(Bg,{children:`Presets`}),e.map(e=>{let t={disabled:r,onClick:()=>i(e.render(),e.label,e.newAgent),className:`items-start`},n=(0,K.jsx)(cy,{label:e.label,description:`/${e.id}`});return e.tooltip?(0,K.jsxs)(Z,{children:[(0,K.jsx)(Q,{render:(0,K.jsx)(Fg,{...t}),children:n}),(0,K.jsx)(f_,{className:`max-w-[22rem]`,children:e.tooltip})]},e.id):(0,K.jsx)(Fg,{...t,children:n},e.id)})]}),t.length>0&&(0,K.jsxs)(Ag,{children:[(0,K.jsx)(zg,{}),(0,K.jsx)(Bg,{children:`Your presets`}),t.map(e=>(0,K.jsx)(YR,{preset:e,busy:r,onLoad:i,onDelete:o},e.id))]}),n.length>0&&(0,K.jsxs)(Ag,{children:[(0,K.jsx)(zg,{}),(0,K.jsx)(Bg,{children:`Project presets`}),n.map(e=>(0,K.jsx)(YR,{preset:e,busy:r,onLoad:i,onDelete:s},e.id))]}),a&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(zg,{}),(0,K.jsxs)(Fg,{disabled:r,onClick:a,children:[(0,K.jsx)($i,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),`New preset…`]})]})]})]})}function ZR(e,t){return e.find(e=>e.value===t)??e[0]}function QR(e,t){return e?.models.find(e=>e.value===t)?.label}function $R({drivers:e,driver:t,model:n,onChange:r,busy:i}){let a=ZR(e,t),o=QR(a,n),s=`Driver: ${a?.label??``} · Model: ${o??`the CLI's own default`}`;return(0,K.jsxs)(kg,{children:[(0,K.jsxs)(Z,{children:[(0,K.jsxs)(Q,{render:(0,K.jsx)(Ng,{type:`button`,disabled:i,"aria-label":s,className:G(Er({variant:`ghost`,size:`sm`}),`gap-1.5 px-2 font-normal`)}),children:[a?.icon?(0,K.jsx)(`span`,{className:`flex h-4 w-4 items-center justify-center`,children:a.icon}):a?.label,o,(0,K.jsx)(yi,{className:`h-3.5 w-3.5 opacity-70`})]}),(0,K.jsx)(f_,{children:s})]}),(0,K.jsx)(Pg,{align:`end`,children:e.map(e=>(0,K.jsxs)(jg,{children:[(0,K.jsxs)(Lg,{children:[(0,K.jsx)(vi,{className:G(`h-3.5 w-3.5 shrink-0`,e.value===t?`opacity-100`:`opacity-0`)}),e.icon&&(0,K.jsx)(`span`,{className:`flex h-4 w-4 items-center justify-center`,children:e.icon}),(0,K.jsx)(`span`,{className:`flex-1`,children:e.label})]}),(0,K.jsx)(Rg,{children:e.models.map(i=>(0,K.jsxs)(Fg,{onClick:()=>r(e.value,i.value),children:[(0,K.jsx)(vi,{className:G(`h-3.5 w-3.5 shrink-0`,e.value===t&&i.value===n?`opacity-100`:`opacity-0`)}),i.label]},i.value))})]},e.value))})]})}function ez(e){let t=e.transparent??!1,n=e.vanilla??!1,r=e.onBeforeMergeableQuality??!1,i=e.browser??!1,a=dt(e),o=e.driver??`claude`,s=x[y.includes(o)?o:`claude`];return{main:[{...tz(`transparent`),label:`Transparent`,description:`Raw ${s} — turns the whole framework off.`,title:`Fully transparent (#625): run the agent exactly like plain ${s}, with no framework system prompt, controls, dashboard, guard, or TODO loop. Overrides the options below.`,checked:t},{...tz(`vanilla`),label:`Disable system prompt`,description:`Drops the added system prompt; keeps the agent controls.`,title:`Remove the built-in system prompt but keep the framework's own controls. For a fully raw agent, use Transparent. Expand 'Enhanced System Prompt' to read what it removes.`,checked:n&&!t,...nz(t)},{...tz(`onBeforeMergeableQuality`),label:`Post-merge cleanup`,description:`Runs quality passes once it is ready to merge.`,title:`When the agent signals it's ready for merge, run maintainability, readability, and security-audit passes`,checked:r&&!t,...nz(t)},{key:`push`,label:`Push branch`,description:`Pushes the agent branch when it finishes.`,title:`Push the agent's branch to the remote when it finishes. The bottom rung: with this off the agent publishes nothing, and neither PR nor merge can run`,checked:ct(a,`push`),patch:e=>({handoff:e?`push`:`local`})},{key:`pr`,label:`Open PR`,description:`Opens a draft pull request when it finishes.`,title:`Open a draft pull request when the agent finishes, pushing the branch on the way. Draft, so it does not request review; it still shows on the needs-you queue`,checked:ct(a,`pr`),patch:e=>({handoff:e?`pr`:`push`}),...ct(a,`push`)?{}:{disabled:!0,disabledReason:`nothing to open while Push branch is off`}},{key:`merge`,label:`Auto-merge`,description:`Merges the pull request once it is opened.`,title:`Merge the pull request the agent opens: GitHub auto-merge where the repo allows it, so it lands when checks pass; merged directly otherwise`,checked:ct(a,`merge`),patch:e=>({handoff:e?`merge`:`pr`}),...ct(a,`pr`)?{}:{disabled:!0,disabledReason:`nothing to merge while Open PR is off`}},{...tz(`browser`),label:`Browser`,description:`Gives the agent a real browser to inspect pages.`,title:`Give the agent a real browser via chrome-devtools-mcp: navigate pages, read console + network, inspect the DOM, and screenshot`,checked:i&&!t&&o===`claude`,...t||o!==`claude`?{disabled:!0,disabledReason:t?`off while Transparent is on`:`only on Claude Code — the browser is wired through its MCP config`}:{}}]}}function tz(e){return{key:e,patch:t=>({[e]:t})}}function nz(e){return e?{disabled:!0,disabledReason:`off while Transparent is on`}:{}}var rz=new Set([`push`,`pr`,`merge`,`browser`]);function iz(e){return ez(e).main.filter(e=>rz.has(e.key))}function az({onClose:e,onAdded:t}){let[n,r]=(0,v.useState)(``),[i,a]=(0,v.useState)(``),o=Dv(n),s=o!==null&&o.token!==``,c=()=>{!o||!s||(wv({url:o.url,token:o.token,...i.trim()?{label:i}:{}}),t(),e())};return(0,K.jsx)(GR,{open:!0,onOpenChange:t=>{t||e()},title:`Add a device`,children:(0,K.jsxs)(`div`,{className:`flex w-full flex-col gap-2`,onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),c())},children:[(0,K.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Paste the URL the box printed on its network bind (it looks like `,(0,K.jsx)(`code`,{children:`http://host:port/?token=…`}),`).`]}),(0,K.jsx)(`input`,{type:`text`,value:n,placeholder:`http://host:port/?token=…`,autoFocus:!0,onChange:e=>r(e.target.value),className:`w-full rounded-md border border-border bg-background px-2 py-1 font-mono text-xs text-foreground`}),(0,K.jsx)(`input`,{type:`text`,value:i,maxLength:60,placeholder:o?`Name (optional) — defaults to ${new URL(o.url).host}`:`Name (optional)`,onChange:e=>a(e.target.value),className:`w-full rounded-md border border-border bg-background px-2 py-1 text-sm text-foreground`}),n.trim()!==``&&!s&&(0,K.jsx)(`p`,{className:`text-xs text-warning`,children:o===null?`That is not a valid URL.`:`This URL has no token, so the box could not authenticate you.`}),(0,K.jsxs)(`div`,{className:`mt-1 flex items-center justify-end gap-2`,children:[(0,K.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,onClick:e,children:`Cancel`}),(0,K.jsx)(q,{type:`button`,size:`sm`,disabled:!s,onClick:c,children:`Add device`})]})]})})}function oz({options:e,sources:t}){let n=e.filter(e=>e.checked&&!e.disabled).map(e=>({key:e.key,label:e.label,repo:t[e.key]===`repo`}));return n.length?(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 text-[11px] text-muted-foreground`,children:[(0,K.jsx)(`span`,{className:`mr-0.5`,children:`Settings:`}),n.map(e=>(0,K.jsxs)(Z,{children:[(0,K.jsxs)(Q,{render:(0,K.jsx)(`span`,{className:e.repo?`rounded border border-dashed border-border px-1.5 py-0.5`:`rounded border border-transparent bg-muted px-1.5 py-0.5`}),children:[e.label,e.repo&&(0,K.jsx)(`span`,{className:`ml-1 opacity-70`,children:`repo`})]}),(0,K.jsx)(f_,{children:e.repo?`From this repo’s the-framework.yml, committed for everyone who clones it`:`Your setting, from the options gear`})]},e.key))]}):null}var sz={claude:{icon:(0,K.jsx)(Ia,{className:`h-4 w-4`})},codex:{icon:(0,K.jsx)(La,{className:`h-4 w-4`})}},cz=y.map(e=>({value:e,label:x[e],models:ly[e],...sz[e]})),lz=(0,v.forwardRef)(function({files:e,addContext:t,removeContext:n,onSubmit:r,onPromptChange:i,onPreset:a,busy:o,submitLabel:s,submitBusyLabel:c,placeholder:l,compact:u=!1,showDriverModel:d=!0,inAgent:f=!1,agentEnded:p=!1,sessionName:m,contextControl:h,resolvedRowStart:g,idleControl:_},y){let[b,x]=(0,v.useState)(``),[S,C]=(0,v.useState)(`build`),[w,T]=(0,v.useState)(!1),[E,D]=(0,v.useState)(!1),[O,k]=(0,v.useState)(!1),A=(0,v.useRef)(null),j=Lv(),M=Wv(j),N=ky(),P=N?j.find(e=>e.id===N):void 0,F=!!N&&M[N]===`offline`,I=typeof window>`u`?null:window.location.origin,L=typeof window>`u`||_t(window.location.hostname),R=Bv(Ot,[],[]),z=hn(),B=gn();z.vanilla;let ee=(0,v.useMemo)(()=>Je.map(e=>({id:e.name,label:e.label,...e.tooltip?{tooltip:e.tooltip}:{},render:()=>e.render(void 0,{session_name:m}),...e.newAgent?{newAgent:!0}:{}})),[m]);z.transparent,z.browser;let V=z.model??``,H=z.driver??`claude`,te=z.target??`local`,U=z.customPresets??[],W=ln(),ne=mn();vn(z),(0,v.useImperativeHandle)(y,()=>({clear:()=>{A.current?.clear(),x(``),C(`build`)},focus:()=>A.current?.focus()}));let[re,ie]=(0,v.useState)(void 0);(0,v.useEffect)(()=>{if(u||f)return;qv();let e=Yv();e&&ie(e)},[u,f]);let ae=(0,v.useRef)(!1),oe=e=>{e?.preventDefault();let t=b.trim();!t||o||ae.current||F||(ae.current=!0,Promise.resolve(r(t,S,{newAgent:w})).finally(()=>{ae.current=!1}))},se=(e,t,n=!1)=>{C(`prompt`),T(n),a?.(e,t)},ce=(e,t,n)=>{let r=A.current?.loadTemplate(e)??!1;se(t,r,n)},le=e=>{x(e);let t=!e.trim()&&S!==`build`?`build`:S;t!==S&&C(t),t===`build`&&w&&T(!1),i?.(e,t)},{main:ue}=ez(z),de=(0,K.jsx)(WR,{ref:A,compact:u,onChange:le,onSubmit:oe,onPreset:se,onMentionProject:t,onMentionFile:t,...n?{onMentionRemoved:n}:{},projects:R,files:e,presets:ee,customPresets:U,projectPresets:W,...u?{}:{onNewPreset:()=>D(!0)},disabled:o,...l?{placeholder:l}:{},...re?{initialText:re}:{}}),fe=d&&(0,K.jsx)($R,{drivers:cz,driver:H,model:V,onChange:(e,t)=>fn({driver:e,model:t}),busy:o}),pe=!u&&(0,K.jsx)(XR,{presets:ee,customPresets:U,projectPresets:W,busy:o,onLoad:ce,onNew:()=>D(!0),onDelete:e=>fn({customPresets:U.filter(t=>t.id!==e)}),onDeleteProject:e=>un(W.filter(t=>t.id!==e))}),me=f&&!p?null:(0,K.jsx)(gy,{options:f?iz(z):ue,busy:o,...f?{label:`Resume options`}:{},...f?{}:{agentTarget:{value:te,onChange:e=>fn({target:e})}},...f?{}:{connection:{profiles:j,currentUrl:I,isLocal:L,selectedDeviceId:N,onSelect:e=>Ey(e.id),onSelectDriver:()=>Ey(null),onConnectLocal:Av,onAddDevice:()=>k(!0),onRemove:e=>{N===e.id&&Ey(null),Tv(e.id)},status:M}}}),he=!!b.trim(),ge=(0,K.jsxs)(Z,{children:[(0,K.jsx)(Q,{render:(0,K.jsx)(q,{type:`submit`,size:`icon-sm`,onClick:oe,disabled:o||!he||F,"aria-hidden":!he,tabIndex:he?void 0:-1,"aria-label":s,className:G(`h-8 w-8 shrink-0 transition-[margin,opacity,transform] duration-150 ease-out`,he?`ml-0 translate-x-0 opacity-100 disabled:opacity-100`:`pointer-events-none -ml-[2.375rem] translate-x-2 opacity-0 disabled:opacity-0`)}),children:o?(0,K.jsx)(Ki,{className:`h-4 w-4 animate-spin`}):(0,K.jsx)(pi,{className:`h-4 w-4`})}),(0,K.jsx)(f_,{children:o?c:`${s} (Enter · Shift+Enter for a new line)`})]}),_e=!he&&_?_:ge,ve=F&&(0,K.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:`${P?.label??`The selected device`} is offline. Pick another target in "Run on" to start.`}),ye=O&&(0,K.jsx)(az,{onClose:()=>k(!1),onAdded:()=>A.current?.focus()});return u?(0,K.jsxs)(`div`,{className:`flex items-start gap-1.5`,children:[(0,K.jsx)(`div`,{className:`min-w-0 flex-1`,children:de}),fe,me,_e,ye]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`rounded-lg border border-border bg-transparent focus-within:border-muted-foreground/40`,children:[de,(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 px-2 pb-2`,children:[pe,h,(0,K.jsxs)(`div`,{className:`ml-auto flex items-center gap-1.5`,children:[fe,me,_e]})]})]}),ve,!f&&(0,K.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-3`,children:[g,(0,K.jsx)(oz,{options:ue,sources:B})]}),E&&(0,K.jsx)(JR,{currentPrompt:b,busy:o,canSaveToProject:ne!==null,onCancel:()=>{D(!1),A.current?.focus()},onSave:(e,t)=>{t===`project`?un([...W,e]):fn({customPresets:[...U,e]}),D(!1),A.current?.focus()}}),ye]})});function uz({files:e,onRemove:t,busy:n}){return e.length===0?null:(0,K.jsx)(`div`,{className:`flex flex-col gap-1`,children:e.map(e=>(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsxs)(Z,{children:[(0,K.jsx)(Q,{render:(0,K.jsx)(`button`,{type:`button`,disabled:n,onClick:()=>t(e),"aria-label":`Remove ${e} from context`,className:`flex h-3.5 w-3.5 items-center justify-center rounded text-muted-foreground hover:text-danger disabled:opacity-50`}),children:(0,K.jsx)(ua,{className:`h-3.5 w-3.5`})}),(0,K.jsxs)(f_,{children:[`Remove `,e]})]}),(0,K.jsx)(`span`,{className:`truncate`,title:e,children:e})]},e))})}function dz({otherProjects:e,context:t,contextFiles:n,summary:r,busy:i,onToggle:a}){return(0,K.jsxs)(kg,{children:[(0,K.jsxs)(Z,{children:[(0,K.jsxs)(Q,{render:(0,K.jsx)(Ng,{type:`button`,disabled:i,className:G(Er({variant:`ghost`,size:`sm`}),`h-8 items-center gap-1.5 px-2 text-[11px] font-normal text-muted-foreground hover:text-foreground`)}),children:[(0,K.jsx)(Hi,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":!0}),`Context`,r&&(0,K.jsxs)(`span`,{className:`text-primary`,children:[` · `,r]})]}),(0,K.jsx)(f_,{children:`Narrow the run to specific repos and files`})]}),(0,K.jsxs)(Pg,{align:`start`,className:`min-w-[18rem] max-w-[24rem]`,children:[(0,K.jsxs)(Ag,{children:[(0,K.jsxs)(Z,{children:[(0,K.jsx)(Q,{render:(0,K.jsx)(Bg,{}),children:`Projects`}),(0,K.jsx)(f_,{className:`max-w-[22rem]`,children:`The agent can still reach every repo; ticking some just narrows its focus.`})]}),e.length>0?e.map(e=>(0,K.jsxs)(Z,{children:[(0,K.jsx)(Q,{render:(0,K.jsx)(Ig,{checked:t.has(e.path),onCheckedChange:()=>a(e.path),disabled:i}),children:(0,K.jsx)(`span`,{className:`truncate`,children:e.name})}),(0,K.jsx)(f_,{children:e.path})]},e.id)):(0,K.jsx)(`p`,{className:`px-2 py-1 text-xs text-muted-foreground/60`,children:`No other repos to add.`})]}),(0,K.jsx)(zg,{}),(0,K.jsxs)(Ag,{children:[(0,K.jsx)(Bg,{children:`Files`}),n.length>0?(0,K.jsx)(`div`,{className:`px-2 py-1`,children:(0,K.jsx)(uz,{files:n,onRemove:a,busy:i})}):(0,K.jsx)(`p`,{className:`px-2 py-1 text-xs text-muted-foreground/60`,children:`None yet — add with # or the Files tab.`})]})]})]})}var fz=v.createContext(void 0);function pz(e){let t=v.useContext(fz);if(t===void 0&&!e)throw Error(uo(47));return t}function mz(){return{...lm(),disabled:!1,modal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0}}var hz={...um,disabled:X(e=>e.disabled),instantType:X(e=>e.instantType),openMethod:X(e=>e.openMethod),openChangeReason:X(e=>e.openChangeReason),modal:X(e=>e.modal),stickIfOpen:X(e=>e.stickIfOpen),titleElementId:X(e=>e.titleElementId),descriptionElementId:X(e=>e.descriptionElementId),openOnHover:X(e=>e.openOnHover),closeDelay:X(e=>e.closeDelay)},gz=class e extends em{constructor(e){let t={...mz(),...e};t.open&&e?.mounted===void 0&&(t.mounted=!0),super(t,{popupRef:v.createRef(),backdropRef:v.createRef(),internalBackdropRef:v.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:v.createRef(),beforeContentFocusGuardRef:v.createRef(),stickIfOpenTimeout:new ol,triggerElements:new sm},hz)}setOpen=(e,t)=>{let n=t.reason===Bs,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null);if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;let a={open:e,nativeEvent:t.event,reason:t.reason,nested:this.state.nested,triggerElement:t.trigger};this.state.floatingRootContext.context.events?.emit(`openchange`,a);let o=()=>{let n={open:e,openChangeReason:t.reason},r=t.trigger?.id??null;(r||e)&&(n.activeTriggerId=r,n.activeTriggerElement=t.trigger??null),this.update(n)};n?(this.set(`stickIfOpen`,!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set(`stickIfOpen`,!1)}),As.flushSync(o)):o(),r||i?this.set(`instantType`,r?`click`:`dismiss`):t.reason===`focus-out`?this.set(`instantType`,`focus`):this.set(`instantType`,void 0)};static useStore(t,n){let r=qa(()=>t??new e(n)).current;return uc(r.disposeEffect),r}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()};function _z({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=gz.useStore(s?.store,{open:n??r,modal:o,activeTriggerId:c===void 0?l:c});u.useControlledProp(`open`,n,r),u.useControlledProp(`activeTriggerId`,c,l);let d=u.useState(`open`),f=u.useState(`positionerElement`),p=u.useState(`payload`),m=u.useState(`openChangeReason`);u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a);let{openMethod:h,triggerProps:g,reset:_}=Nh(d);am(u);let{forceUnmount:y}=om(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null}),_()});kh(d&&o===!0&&m!==`trigger-hover`&&h!==`touch`,f),v.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]);let b=v.useCallback(e=>{let t=nc(e);return t.preventUnmountOnClose=()=>{u.set(`preventUnmountingOnClose`,!0)},t},[u]),x=v.useCallback(()=>{u.setOpen(!1,b(tc))},[u,b]);v.useImperativeHandle(e.actionsRef,()=>({unmount:y,close:x}),[y,x]);let S=pm({popupStore:u,onOpenChange:u.setOpen}),{getReferenceProps:C,getFloatingProps:w,getTriggerProps:T}=Em([Cp(S,{outsidePressEvent:{mouse:o===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),Lm(S)]),E=v.useMemo(()=>C(g),[C,g]),D=v.useMemo(()=>T(g),[T,g]),O=v.useMemo(()=>w(),[w]);u.useSyncedValues({modal:o,openMethod:h,activeTriggerProps:E,inactiveTriggerProps:D,popupProps:O,floatingRootContext:S,nested:yd()!=null});let k=v.useMemo(()=>({store:u}),[u]);return(0,K.jsx)(fz.Provider,{value:k,children:typeof t==`function`?t({payload:p}):t})}function vz(e){return pz(!0)?(0,K.jsx)(_z,{props:e}):(0,K.jsx)(Cd,{children:(0,K.jsx)(_z,{props:e})})}var yz=v.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,handle:o,payload:s,openOnHover:c=!1,delay:l=300,closeDelay:u=0,id:d,...f}=e,p=pz(!0),m=o?.store??p?.store;if(!m)throw Error(uo(74));let h=Go(d),g=m.useState(`isTriggerActive`,h),_=m.useState(`floatingRootContext`),y=m.useState(`isOpenedByTrigger`,h),b=v.useRef(null),{registerTrigger:x,isMountedByThisTrigger:S}=im(h,b,m,{payload:s,disabled:i,openOnHover:c,closeDelay:u}),C=m.useState(`openChangeReason`),w=m.useState(`stickIfOpen`),T=m.useState(`openMethod`),E=Tm(_,{enabled:_!=null&&c&&(T!==`touch`||C!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:Vm(),restMs:l,delay:{close:u},triggerElementRef:b,isActiveTrigger:g}),D=Em([lf(_,{enabled:_!=null,stickIfOpen:w})]),O=m.useState(`triggerProps`,S),k=v.useMemo(()=>({disabled:i,open:y}),[i,y]),{getButtonProps:A,buttonRef:j}=xs({disabled:i,native:a}),M=v.useMemo(()=>({open(e){return e&&C===`trigger-press`?Rc.open(e):Lc.open(e)}}),[C]),N=Io(`button`,e,{state:k,ref:[j,t,x,b],props:[D.getReferenceProps(),E,O,{[Mo]:``,id:h},f,A],stateAttributesMapping:M}),P=v.useRef(null),F=J(e=>{As.flushSync(()=>{m.setOpen(!1,nc(qs,e.nativeEvent,e.currentTarget))}),dd(P.current)?.focus()}),I=J(e=>{let t=m.select(`positionerElement`);if(t&&fd(e,t))m.context.beforeContentFocusGuardRef.current?.focus();else{As.flushSync(()=>{m.setOpen(!1,nc(qs,e.nativeEvent,e.currentTarget))});let n=ud(b.current);for(;n!==null&&Ol(t,n)||n?.hasAttribute(`aria-hidden`);){let e=n;if(n=sd(n),n===e)break}n?.focus()}});return g?(0,K.jsxs)(v.Fragment,{children:[(0,K.jsx)(Fd,{ref:P,onFocus:F}),(0,K.jsx)(v.Fragment,{children:N},h),(0,K.jsx)(Fd,{ref:m.context.triggerFocusTargetRef,onFocus:I})]}):(0,K.jsx)(v.Fragment,{children:N},h)}),bz=v.createContext(void 0);function xz(){let e=v.useContext(bz);if(e===void 0)throw Error(uo(45));return e}var Sz=v.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=pz();return i.useState(`mounted`)||n?(0,K.jsx)(bz.Provider,{value:n,children:(0,K.jsx)(Zd,{ref:t,...r,renderGuards:!1})}):null}),Cz=v.createContext(void 0);function wz(){let e=v.useContext(Cz);if(!e)throw Error(uo(46));return e}var Tz=v.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`bottom`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=Po,...g}=e,{store:_}=pz(),y=xz(),b=xd(),x=_.useState(`floatingRootContext`),S=_.useState(`mounted`),C=_.useState(`open`),w=_.useState(`openChangeReason`),T=_.useState(`activeTriggerElement`),E=_.useState(`modal`),D=_.useState(`positionerElement`),O=_.useState(`instantType`),k=_.useState(`transitionStatus`),A=v.useRef(null),j=gc(D,!1,!1),M=mh({anchor:i,floatingRootContext:x,positionMethod:a,mounted:S,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m,keepMounted:y,nodeId:b,collisionAvoidance:h,adaptiveOrigin:dh}),N=v.useMemo(()=>{let e={};return C||(e.pointerEvents=`none`),{role:`presentation`,hidden:!S,style:{...M.positionerStyles,...e}}},[C,S,M.positionerStyles]),P=v.useMemo(()=>({props:N,...M}),[N,M]),F=x?.select(`domReferenceElement`);Y(()=>{let e=F,t=A.current;if(e&&(A.current=e),t&&e&&e!==t){_.set(`instantType`,void 0);let e=new AbortController;return j(()=>{_.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[F,j,_]);let I=v.useMemo(()=>({open:C,side:P.side,align:P.align,anchorHidden:P.anchorHidden,instant:O}),[C,P.side,P.align,P.anchorHidden,O]),L=v.useCallback(e=>{_.set(`positionerElement`,e)},[_]),R=Io(`div`,e,{state:I,props:[P.props,Qm(k),g],ref:[t,L],stateAttributesMapping:zc});return(0,K.jsxs)(Cz.Provider,{value:P,children:[S&&E===!0&&w!==`trigger-hover`&&(0,K.jsx)(bh,{ref:_.context.internalBackdropRef,inert:ih(!C),cutout:T}),(0,K.jsx)(Sd,{id:b,children:R})]})}),Ez={...zc,...Sc},Dz=v.forwardRef(function(e,t){let{className:n,render:r,initialFocus:i,finalFocus:a,...o}=e,{store:s}=pz(),c=wz(),l=Um(!0)!=null,u=oh(),d=s.useState(`open`),f=s.useState(`openMethod`),p=s.useState(`instantType`),m=s.useState(`transitionStatus`),h=s.useState(`popupProps`),g=s.useState(`titleElementId`),_=s.useState(`descriptionElementId`),y=s.useState(`modal`),b=s.useState(`mounted`),x=s.useState(`openChangeReason`),S=s.useState(`popupElement`),C=s.useState(`payload`),w=s.useState(`positionerElement`),T=s.useState(`activeTriggerElement`),E=s.useState(`floatingRootContext`);_c({open:d,ref:s.context.popupRef,onComplete(){d&&s.context.onOpenChangeComplete?.(!0)}});let D=s.useState(`disabled`),O=s.useState(`openOnHover`),k=s.useState(`closeDelay`);xm(E,{enabled:O&&!D,closeDelay:k});function A(e){return e!==`touch`||s.context.popupRef.current}let j=i===void 0?A:i,M=v.useMemo(()=>({open:d,side:c.side,align:c.align,instant:p,transitionStatus:m}),[d,c.side,c.align,p,m]),N=v.useCallback(e=>{s.set(`popupElement`,e)},[s]);function P(){E.context.events.emit(`measure-layout`)}function F(e,t){E.context.events.emit(`measure-layout-complete`,{previousDimensions:e,nextDimensions:t})}s_({popupElement:S,positionerElement:w,mounted:b,content:C,enabled:v.useCallback(()=>s.context.triggerElements.size>1,[s]),onMeasureLayout:P,onMeasureLayoutComplete:F,side:c.side,direction:u});let I=Io(`div`,e,{state:M,ref:[t,s.context.popupRef,N],props:[h,{"aria-labelledby":g,"aria-describedby":_,onKeyDown(e){l&&Zm.has(e.key)&&e.stopPropagation()}},Qm(m),o],stateAttributesMapping:Ez});return(0,K.jsx)(cf,{context:E,openInteractionType:f,modal:y===`trap-focus`,disabled:!b||x===`trigger-hover`,initialFocus:j,returnFocus:a,restoreFocus:`popup`,previousFocusableElement:Qo(T)?T:void 0,nextFocusableElement:s.context.triggerFocusTargetRef,beforeContentFocusGuardRef:s.context.beforeContentFocusGuardRef,children:I})}),Oz=`data-[popup-open]:bg-[var(--color-accent)] data-[popup-open]:text-[var(--color-accent-foreground)]`,kz=vz;function Az({className:e,...t}){return(0,K.jsx)(yz,{className:typeof e==`function`?e:G(Oz,e),...t})}function jz({className:e,sideOffset:t=6,align:n=`start`,children:r,...i}){return(0,K.jsx)(Sz,{children:(0,K.jsx)(Tz,{sideOffset:t,align:n,className:`z-50 outline-none`,children:(0,K.jsx)(Dz,{className:G(`rounded-md border border-[var(--color-border)] bg-[var(--color-card)] text-[var(--color-card-foreground)] shadow-md outline-none`,e),...i,children:(0,K.jsx)(wg,{viewportClassName:`max-h-[var(--available-height)]`,children:(0,K.jsx)(`div`,{className:`p-3`,children:r})})})})})}function Mz({prompt:e,disabled:t,onDisabledChange:n,transparent:r,onTransparentChange:i,browser:a,context:o,user:s,busy:c}){let l=Le({vanilla:t,...r?{transparent:!0}:{},...a?{browser:!0}:{},tf:{prompt:e},...o.length?{context:o}:{},...s?{user:s}:{}}),u=!t&&!r,d=!r,f=u&&d;return(0,K.jsxs)(kz,{children:[(0,K.jsxs)(Az,{className:G(`flex items-center gap-1.5 rounded-md px-2 py-1 text-xs text-muted-foreground outline-none hover:text-foreground`),children:[(0,K.jsx)(`span`,{className:G(`h-1.5 w-1.5 shrink-0 rounded-full`,f?`bg-success`:`bg-muted-foreground`),"aria-hidden":!0}),`Enhanced System Prompt`,(0,K.jsx)(`span`,{className:`sr-only`,children:f?` (fully enabled)`:` (not fully enabled)`}),(0,K.jsx)(yi,{className:`h-3.5 w-3.5 opacity-70`,"aria-hidden":!0})]}),(0,K.jsx)(jz,{align:`start`,className:`w-[min(42rem,calc(100vw-2rem))] text-xs text-muted-foreground`,children:(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsx)(`p`,{children:`The Framework wraps your prompt with a so-called "system prompt" (it's just a prompt wrapping your prompt) in order to enable long-running autonomous agents.`}),(0,K.jsxs)(`label`,{className:`flex w-fit cursor-pointer items-center gap-2`,children:[(0,K.jsx)(wc,{checked:u,onCheckedChange:e=>n(!e),disabled:c||r,...r?{title:`Off while the framework integration is off`}:{}}),`Anti-laziness and improved large-scope planning`]}),(0,K.jsxs)(`label`,{className:`flex w-fit cursor-pointer items-center gap-2`,children:[(0,K.jsx)(wc,{checked:d,onCheckedChange:e=>i?.(!e),disabled:c||!i}),`Integration with The Framework`,(0,K.jsx)(`span`,{className:`text-muted-foreground/80`,children:`(some functionality stops working)`})]}),l?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`pre`,{className:`max-h-96 overflow-auto whitespace-pre-wrap break-words rounded bg-muted p-2 font-mono text-foreground`,children:l}),(0,K.jsxs)(`p`,{children:[l.length.toLocaleString(),` characters. This is the whole system prompt: nothing else is appended when the session starts.`]})]}):(0,K.jsx)(`p`,{className:`text-foreground`,children:`No extra system prompt: only the built-in system prompt of your AI model provider.`})]})})]})}function Nz({projectId:e,onAgentStarted:t,files:n,context:r,addContext:i,removeContext:a,toggleContext:o}){let[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)(null),{busy:d,error:f,reset:p,start:m}=Wy(),h=(0,v.useRef)(null),g=hn(),_=g.vanilla??!1,y=g.transparent??!1,b=Bv(Ot,[],[]),x=Bv(()=>Qr(e),null,[e]),S=new Set(b.map(e=>e.path)),C=[...r].filter(e=>!S.has(e)),w=b.filter(t=>t.id!==e),T=w.filter(e=>r.has(e.path)).length,E=[T>0?`${T} project${T>1?`s`:``}`:null,C.length>0?`${C.length} file${C.length>1?`s`:``}`:null].filter(Boolean).join(` · `),D=Lv(),O=ky(),k=O?D.find(e=>e.id===O):void 0,A={...ft(g,[...r]),...k?{remote:{url:k.url,token:k.token,label:k.label}}:{}},j=A.target!==`actions`&&!k,M=A.driver??`claude`,N=j&&ct(A.handoff??`pr`,`pr`),P=Bv(()=>j?Mt(M,N):Promise.resolve(null),null,[M,j,N]),F=A.handoff===`merge`&&!k,I=Bv(()=>F?jt(e):Promise.resolve(null),null,[e,F]),L=F&&I!==null&&I.known&&!I.allowed,R=async(n,r)=>{if(d)return;u(`Starting…`);let i=await m(e,n,r,r===`prompt`?{...A,unattended:!0}:A);u(null),i&&(t?.(n,i.agentId,k?.label),h.current?.clear(),c(``))},z=(0,K.jsx)(Mz,{prompt:s,disabled:_,onDisabledChange:e=>fn({vanilla:e}),transparent:y,onTransparentChange:e=>fn({transparent:e}),browser:A.browser??!1,context:[...r],user:x,busy:d});return(0,K.jsxs)(`form`,{onSubmit:e=>e.preventDefault(),className:`p-3`,children:[(0,K.jsx)(`div`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Start an agent`}),(0,K.jsx)(lz,{ref:h,files:n,addContext:i,removeContext:a,onSubmit:R,onPromptChange:e=>{c(e),!e.trim()&&l&&u(null),f&&p()},onPreset:(e,t)=>{p(),u(t?`${e} preset loaded over your draft — undo (⌘Z) brings the draft back`:`${e} preset loaded — review or edit, then Start`)},busy:d,submitLabel:`Start agent`,submitBusyLabel:`Starting…`,contextControl:(0,K.jsx)(dz,{otherProjects:w,context:r,contextFiles:C,summary:E,busy:d,onToggle:o}),resolvedRowStart:z}),f&&(0,K.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:f}),l&&!f&&(0,K.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-muted-foreground`,children:l}),P?.problems.map(e=>(0,K.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:e},e)),P?.warnings.map(e=>(0,K.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-warning`,children:e},e)),A.model===`haiku`&&(0,K.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-warning`,children:`Haiku consistently skips the session-finish protocol, so a publishing run ends as an unmerged draft PR and needs hand-holding. Pick Fable for real work — Haiku is best kept for throwaway experiments.`}),L&&(0,K.jsxs)(`p`,{role:`status`,className:`mt-2 text-xs text-muted-foreground`,children:[`This repo has GitHub auto-merge disabled, so the daemon merges the PR once its checks pass (merge on green) — handled locally, only while the dashboard is running. For the server-side version, enable `,(0,K.jsx)(`span`,{className:`font-medium`,children:`Allow auto-merge`}),` in the repo settings and mark a check (e.g. `,(0,K.jsx)(`code`,{className:`font-mono`,children:`build`}),`) as required.`]})]})}function Pz(){return Bv(()=>Tt(),[],[])}function Fz({projectId:e,agentId:t}){let n=Bv(()=>Yr(e),null,[e],!0),{busy:r,error:i,reset:a,run:o}=Ba(),s=hn().editor,c=Pz(),l=s&&!c.some(e=>e.bin===s)?[...c,{bin:s,label:s}]:c;(0,v.useEffect)(()=>a(),[e,t,a]);let u=n=>o(()=>zy(e,n,t??void 0),`Failed to open.`);return(0,K.jsxs)(K.Fragment,{children:[n&&(0,K.jsxs)(Z,{children:[(0,K.jsx)(Q,{render:(0,K.jsx)(`a`,{href:n,target:`_blank`,rel:`noreferrer`,className:Er({variant:`outline`,size:`icon-sm`})}),children:(0,K.jsx)(Ri,{className:`h-3.5 w-3.5`})}),(0,K.jsx)(f_,{children:`Open on GitHub`})]}),(0,K.jsxs)(Z,{children:[(0,K.jsx)(Q,{render:(0,K.jsx)(q,{variant:`outline`,size:`icon-sm`,disabled:r,onClick:()=>void u(`files`)}),children:(0,K.jsx)(Mi,{className:`h-3.5 w-3.5`})}),(0,K.jsxs)(f_,{children:[t?`Open this agent's folder`:`Open folder`,` (Finder / Explorer)`]})]}),(0,K.jsxs)(kg,{children:[(0,K.jsxs)(Z,{children:[(0,K.jsx)(Q,{render:(0,K.jsx)(Ng,{type:`button`,disabled:r,"aria-label":`Open in editor`,className:Er({variant:`outline`,size:`icon-sm`})}),children:(0,K.jsx)(Ti,{className:`h-3.5 w-3.5`})}),(0,K.jsx)(f_,{children:`Open in editor`})]}),(0,K.jsxs)(Pg,{align:`end`,className:`min-w-[15rem]`,children:[(0,K.jsxs)(Fg,{disabled:r,onClick:()=>void u(`editor`),children:[(0,K.jsx)(Ti,{className:`h-3.5 w-3.5 shrink-0`}),t?`Open this agent's checkout`:`Open in your editor`]}),(0,K.jsx)(zg,{}),(0,K.jsxs)(Ag,{children:[(0,K.jsx)(Bg,{children:`Preferred editor`}),(0,K.jsxs)(Fg,{disabled:r,closeOnClick:!1,onClick:()=>fn({editor:``}),className:`items-start`,children:[(0,K.jsx)(vi,{className:G(`mt-0.5 h-3.5 w-3.5 shrink-0`,s?`opacity-0`:`opacity-100`)}),(0,K.jsx)(cy,{label:`Default`,description:`$FRAMEWORK_EDITOR, or code`})]}),l.map(e=>(0,K.jsxs)(Fg,{disabled:r,closeOnClick:!1,onClick:()=>fn({editor:e.bin}),className:`items-start`,children:[(0,K.jsx)(vi,{className:G(`mt-0.5 h-3.5 w-3.5 shrink-0`,s===e.bin?`opacity-100`:`opacity-0`)}),(0,K.jsx)(cy,{label:e.label,description:e.bin})]},e.bin))]})]})]}),i&&(0,K.jsx)(`span`,{className:`text-xs text-danger`,children:i})]})}function Iz({projectId:e,agentId:t,inline:n=!1,label:r,projectName:i,summary:a,agentState:o,expanded:s=!1,onToggle:c}){let[l,u]=(0,v.useState)(1e4),{value:d}=Vv(()=>t?jr(e,t):Xr(e),null,l,[e,t,l],!0);if((0,v.useEffect)(()=>u(d?.prPending?1e3:1e4),[d?.prPending]),!d)return null;let f=`path`in d?d:void 0,p=d.branch,m=N(f?.sizeBytes,``),h=f?.own?`Uncommitted changes in this agent`:`Uncommitted changes`,g=f?`${p??`no branch`}\n${f.path}`:`branch ${p}`,_=r&&p?p.replace(/^the-framework\//,``):p??`no branch`,y=(0,K.jsxs)(K.Fragment,{children:[c&&(0,K.jsx)(bi,{className:G(`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform`,s&&`rotate-90`)}),r&&(0,K.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 overflow-hidden`,children:[i&&(0,K.jsxs)(`span`,{className:`flex min-w-0 shrink-[999] items-center gap-1.5 overflow-hidden text-muted-foreground`,children:[(0,K.jsx)(`span`,{className:`truncate`,title:i,children:i}),(0,K.jsx)(`span`,{className:`shrink-0 text-muted-foreground/60`,"aria-hidden":!0,children:`/`})]}),(0,K.jsx)(`span`,{className:`min-w-0 truncate font-medium text-foreground`,title:r,children:r})]}),(0,K.jsxs)(`span`,{className:G(`flex items-center gap-1.5 overflow-hidden`,r?`hidden min-w-0 shrink-[999] text-muted-foreground @2xl:flex`:`min-w-0 shrink-0 text-muted-foreground`),children:[(0,K.jsx)(Fi,{className:`h-3.5 w-3.5 shrink-0`}),(0,K.jsxs)(Z,{children:[(0,K.jsx)(Q,{render:(0,K.jsx)(`span`,{className:G(`truncate`,r?`max-w-[14rem]`:`max-w-[16rem] font-medium text-foreground`)}),children:_}),(0,K.jsx)(f_,{className:`whitespace-pre-line`,children:g})]})]}),(0,K.jsxs)(Z,{children:[(0,K.jsxs)(Q,{render:(0,K.jsx)(`span`,{className:`flex shrink-0 items-center gap-1.5`}),children:[(0,K.jsx)(`span`,{className:G(`h-2 w-2 rounded-full`,d.dirty?`bg-warning`:`bg-muted-foreground`)}),(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:d.dirty?`dirty`:`clean`})]}),(0,K.jsx)(f_,{children:d.dirty?h:`Clean`})]}),o,m&&(0,K.jsxs)(Z,{children:[(0,K.jsx)(Q,{render:(0,K.jsx)(`span`,{className:`hidden shrink-0 text-muted-foreground @4xl:inline`}),children:m}),(0,K.jsx)(f_,{children:`This agent's worktree on disk`})]}),(0,K.jsx)(`span`,{className:`hidden shrink-0 @5xl:inline`,children:a})]}),b=(0,K.jsxs)(K.Fragment,{children:[c?(0,K.jsx)(`button`,{type:`button`,onClick:c,"aria-expanded":s,className:`flex min-w-0 items-center gap-2 overflow-hidden rounded text-left hover:text-foreground`,children:y}):y,d.pr&&(0,K.jsxs)(Z,{children:[(0,K.jsxs)(Q,{render:(0,K.jsx)(`a`,{href:d.pr.url,target:`_blank`,rel:`noreferrer`,className:G(`flex shrink-0 items-center gap-1.5 text-primary hover:underline`,!n&&`ml-auto`)}),children:[(0,K.jsxs)(`span`,{children:[`PR #`,d.pr.number]}),(0,K.jsx)(`span`,{className:`rounded-full border border-border px-1.5 text-[10px] uppercase text-muted-foreground`,children:d.pr.state.toLowerCase()})]}),(0,K.jsx)(f_,{children:d.pr.title})]})]});return n?(0,K.jsx)(`span`,{className:`flex min-w-0 items-center gap-2 overflow-hidden text-xs`,children:b}):(0,K.jsx)(`div`,{className:`flex items-center gap-2 border-b border-border px-4 py-2 text-xs`,children:b})}function Lz({projectId:e}){return(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-border px-4 py-2`,children:[(0,K.jsx)(Iz,{projectId:e,inline:!0}),(0,K.jsx)(`div`,{className:`min-w-0 flex-1`}),(0,K.jsx)(Fz,{projectId:e})]})}function Rz({events:e,headline:t=!1}){let n=I(e);if(n.length===0)return null;let r=n[n.length-1];return(0,K.jsxs)(Z,{children:[(0,K.jsx)(Q,{render:(0,K.jsxs)(`span`,{role:`alert`,className:`flex shrink-0 items-center gap-1.5 text-danger`,children:[(0,K.jsx)(la,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":!0}),(0,K.jsxs)(`span`,{className:`font-medium`,children:[n.length,` `,n.length===1?`error`:`errors`]}),t&&(0,K.jsxs)(`span`,{className:`min-w-0 truncate text-muted-foreground`,children:[`· `,r.headline]})]})}),(0,K.jsx)(f_,{className:`whitespace-pre-line`,children:n.map(e=>e.headline).join(`
`)})]})}function zz(e){let t=F(e),n=ga(e),r=n!==void 0&&!n.ok&&!n.stopped,i=n?.stopped===!0;return!t.sessionName&&!t.readyForMerge&&!r&&!i?null:r?{dot:`bg-danger`,label:n?.detail?`failed — ${n.detail}`:`failed`,tone:`text-danger`}:i?{dot:`bg-warning`,label:`stopped`,tone:`text-warning`}:_a(e)?{dot:`animate-pulse bg-success`,label:`publishing…`,tone:`text-muted-foreground`}:t.readyForMerge?{dot:`bg-success`,label:`ready for merge`,tone:`text-muted-foreground`}:ma(e)?{dot:`animate-pulse bg-warning`,label:`building…`,tone:`text-muted-foreground`}:{dot:`bg-muted-foreground`,label:`finished`,tone:`text-muted-foreground`}}function Bz(e){let t=e?.sessionLink,n=e?.sessionId;return!t||!n||!t.includes(n)?null:{href:t,label:`Open session (${n}) ↗`}}function Vz({events:e}){let t=R(e),n=F(e),r=zz(e),i=I(e),a=Bz(t);return!a&&!r&&i.length===0?null:(0,K.jsxs)(`div`,{className:`grid gap-3 border-b border-border p-4 md:grid-cols-2`,children:[r&&(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-sm md:col-span-2`,children:[(0,K.jsx)(`span`,{className:G(`h-2.5 w-2.5 shrink-0 rounded-full`,r.dot),"aria-hidden":!0}),n.sessionName&&(0,K.jsx)(`span`,{className:`font-medium`,children:n.sessionName}),(0,K.jsx)(`span`,{className:G(`text-xs`,r.tone),children:r.label})]}),i.length>0&&(0,K.jsx)(`div`,{className:`text-sm md:col-span-2`,children:(0,K.jsx)(Rz,{events:e,headline:!0})}),a&&(0,K.jsx)(`a`,{href:a.href,target:`_blank`,rel:`noreferrer`,className:`text-xs text-primary underline underline-offset-2 md:col-span-2`,children:a.label})]})}function Hz({choice:e,pick:t,meta:n,footer:r}){let[i,a]=(0,v.useState)(!1),o=new Set(C(t));return(0,K.jsxs)(`div`,{className:`overflow-hidden rounded-md border border-border`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>a(e=>!e),className:`flex w-full items-baseline gap-2 px-4 py-2 text-left text-xs text-muted-foreground hover:bg-accent/40`,"aria-expanded":i,children:[(0,K.jsx)(`span`,{className:`shrink-0 text-success`,children:`✓`}),(0,K.jsx)(`span`,{className:`truncate font-medium text-foreground`,children:e.title}),n,(0,K.jsx)(`span`,{className:`ml-auto shrink-0`,children:i?`Collapse`:`Expand`})]}),i&&(0,K.jsxs)(`div`,{className:`border-t border-border p-4`,children:[(0,K.jsxs)(`ul`,{className:`space-y-1 text-sm`,children:[e.options.map(e=>(0,K.jsxs)(`li`,{className:G(`flex items-baseline gap-2`,o.has(e.id)?``:`text-muted-foreground`),children:[(0,K.jsx)(`span`,{className:G(`w-4 shrink-0`,o.has(e.id)?`text-success`:``),children:o.has(e.id)?`✓`:``}),(0,K.jsx)(`span`,{children:e.label})]},e.id)),o.size===0&&(0,K.jsx)(`li`,{className:`text-muted-foreground`,children:`Accepted none`})]}),r]})]})}function Uz({projectId:e,agentId:t,choice:n,active:r=!1,countdown:i=!0,inline:a=!1,onAnswered:o}){let{busy:s,error:c,run:l}=Ba(),[u,d]=(0,v.useState)(!1),[f,p]=(0,v.useState)(()=>new Set(n.multi?n.options.filter(e=>e.default).map(e=>e.id):[])),m=(0,v.useRef)(f);m.current=f;let[h,g]=(0,v.useState)(null),[_,y]=(0,v.useState)(!1),b=s||u,x=(r,i=`user`)=>{l(()=>My(e,n.id,r,i,t??void 0),`Could not send your choice — try again.`).then(e=>{e!==void 0&&(d(!0),o?.(r))})},S=e=>p(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),C=n.recommended??n.options[0]?.id,w=()=>n.multi?[...m.current]:C??``,T=(e=`user`)=>x(w(),e);return(0,v.useEffect)(()=>{let e=()=>y(!0);return window.addEventListener(`mousemove`,e,{once:!0}),()=>window.removeEventListener(`mousemove`,e)},[]),(0,v.useEffect)(()=>{if(!r)return;let e=e=>{(e.ctrlKey||e.metaKey)&&e.key===`Enter`&&!b&&(e.preventDefault(),T())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r,b]),(0,K.jsxs)(`section`,{role:`region`,"aria-label":n.title,className:a?`rounded-md border border-border bg-accent/40 p-3`:`border-b border-border bg-accent/40 p-4`,children:[(0,K.jsx)(`div`,{className:`mb-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Your call`}),(0,K.jsx)(`h2`,{className:`mb-3 text-sm font-medium`,children:n.title}),n.multi?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`ul`,{className:`mb-3 space-y-1`,children:n.options.map(e=>(0,K.jsx)(`li`,{children:(0,K.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm`,children:[(0,K.jsx)(wc,{className:`mt-0.5`,checked:f.has(e.id),onCheckedChange:()=>S(e.id),disabled:b}),(0,K.jsxs)(`span`,{children:[e.label,e.detail&&(0,K.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:e.detail})]})]})},e.id))}),(0,K.jsx)(q,{disabled:b,onClick:()=>x([...f]),children:f.size===0?`Accept none`:`Accept ${f.size} selected`})]}):(0,K.jsx)(`div`,{className:`flex flex-col gap-2`,children:n.options.map(e=>(0,K.jsxs)(q,{variant:e.id===n.recommended?`default`:`outline`,className:G(`h-auto flex-col items-start gap-0.5 py-2 text-left`),disabled:b,onClick:()=>x(e.id),children:[(0,K.jsxs)(`span`,{className:`font-medium`,children:[e.label,e.id===n.recommended&&(0,K.jsx)(`span`,{className:`ml-2 text-xs font-normal opacity-80`,children:`Recommended`})]}),e.detail&&(0,K.jsx)(`span`,{className:`text-xs font-normal opacity-80`,children:e.detail})]},e.id))}),c&&(0,K.jsx)(`p`,{className:`mt-2 text-xs text-danger`,children:c}),(0,K.jsx)(`div`,{className:`mt-3 flex items-center gap-3 text-xs text-muted-foreground`,children:b?(0,K.jsx)(`span`,{role:`status`,children:s?`Sending your choice…`:`Choice sent — waiting for the agent to pick it up…`}):(0,K.jsx)(K.Fragment,{children:r&&(0,K.jsx)(`span`,{className:`ml-auto`,children:`Ctrl+Enter to accept`})})})]})}var Wz=[],Gz=e=>`${e.projectId} ${e.agentId} ${e.choice.id}`;function Kz({onOpenAgent:e}){let{value:t,loaded:n}=Vv(Vr,Wz,5e3,[]),[r,i]=(0,v.useState)(()=>new Map),a=(0,v.useRef)(new Map),o=t.map(e=>{let t=Gz(e);return{key:t,question:e,...r.has(t)?{answered:r.get(t)}:{}}}),s=new Set(o.map(e=>e.key));for(let[e,t]of r)s.has(e)||o.push({key:e,question:t.question,answered:t});if(!n||o.length===0)return null;let c=o.filter(e=>!e.answered).length,l=e=>a.current.get(e)?.scrollIntoView({behavior:`smooth`,block:`start`});return(0,K.jsxs)(`section`,{"aria-label":`Open questions`,className:`border-t border-border p-3`,children:[(0,K.jsxs)(`h2`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:[`Waiting on you · `,c]}),(0,K.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,K.jsx)(wg,{className:`min-w-0 flex-1`,viewportClassName:`max-h-[70vh]`,children:(0,K.jsx)(`div`,{className:`space-y-3`,children:o.map(({key:t,question:n,answered:r})=>(0,K.jsx)(`div`,{ref:e=>{e?a.current.set(t,e):a.current.delete(t)},children:r?(0,K.jsx)(Hz,{choice:n.choice,pick:r.pick,meta:(0,K.jsx)(`span`,{className:`truncate`,children:qz(n)}),footer:(0,K.jsx)(`button`,{type:`button`,onClick:()=>e(n.projectId,n.agentId),className:`mt-3 text-xs text-muted-foreground hover:text-foreground`,children:`Open session →`})}):(0,K.jsxs)(`div`,{className:`overflow-hidden rounded-md border border-border`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>e(n.projectId,n.agentId),className:`flex w-full items-baseline gap-2 px-4 py-2 text-left text-xs text-muted-foreground hover:bg-accent/40`,title:`Open this session`,children:[(0,K.jsx)(`span`,{className:`truncate font-medium text-foreground`,children:qz(n)}),(0,K.jsx)(`span`,{className:`truncate`,children:n.projectName}),(0,K.jsx)(`span`,{className:`ml-auto shrink-0`,children:`Open session →`})]}),(0,K.jsx)(Uz,{projectId:n.projectId,agentId:n.agentId,choice:n.choice,countdown:!1,onAnswered:e=>i(r=>new Map(r).set(t,{question:n,pick:e}))})]})},t))})}),o.length>1&&(0,K.jsx)(`nav`,{"aria-label":`Jump to a question`,className:`sticky top-2 w-44 shrink-0 space-y-1 self-start`,children:o.map(({key:e,question:t,answered:n})=>(0,K.jsxs)(`button`,{type:`button`,onClick:()=>l(e),className:G(`flex w-full items-baseline gap-1.5 rounded px-2 py-1 text-left text-xs hover:bg-accent/40`,n?`text-muted-foreground/60`:`text-muted-foreground`),children:[n&&(0,K.jsx)(`span`,{className:`shrink-0 text-success`,children:`✓`}),(0,K.jsx)(`span`,{className:`truncate`,children:qz(t)})]},e))})]})]})}function qz(e){return e.sessionName??e.intent?.split(`
`)[0]?.slice(0,80)??e.agentId}function Jz({text:e,compact:t=!1}){return(0,K.jsx)(`div`,{className:t?`space-y-1.5 text-xs leading-relaxed`:`space-y-2 text-sm leading-relaxed`,children:Qz(e,t)})}function Yz(e,t){return(0,K.jsx)(`pre`,{className:`overflow-x-auto rounded bg-muted p-2 text-xs`,children:(0,K.jsx)(`code`,{children:e.join(`
`)})},t)}function Xz(e){let t=e.trim().split(`|`);return t[0]?.trim()===``&&t.shift(),t[t.length-1]?.trim()===``&&t.pop(),t.map(e=>e.trim())}function Zz(e){return Xz(e).length>0&&Xz(e).every(e=>/^:?-{3,}:?$/.test(e))}function Qz(e,t=!1){let n=e.replace(/\r\n/g,`
`).split(`
`),r=[],i=[],a=null,o=[],s=0,c=()=>{i.length&&(r.push((0,K.jsx)(`ul`,{className:`ml-4 list-disc space-y-1 marker:text-muted-foreground`,children:i},s++)),i=[])},l=()=>{if(o.length===0)return;let e=o;if(o=[],e.length>=2&&Zz(e[1])){let t=Xz(e[0]),n=e.slice(2).map(Xz);r.push((0,K.jsx)(`div`,{className:`overflow-x-auto`,children:(0,K.jsxs)(`table`,{className:`w-full border-collapse text-xs`,children:[(0,K.jsx)(`thead`,{children:(0,K.jsx)(`tr`,{children:t.map((e,t)=>(0,K.jsx)(`th`,{className:`border-b border-border px-2 py-1 text-left font-semibold`,children:tB(e)},t))})}),(0,K.jsx)(`tbody`,{children:n.map((e,n)=>(0,K.jsx)(`tr`,{children:t.map((t,n)=>(0,K.jsx)(`td`,{className:`border-b border-border/50 px-2 py-1 align-top`,children:tB(e[n]??``)},n))},n))})]})},s++))}else for(let t of e)r.push((0,K.jsx)(`p`,{children:tB(t)},s++))};for(let e of n){if(e.trim().startsWith("```")){a===null?(c(),a=[]):(r.push(Yz(a,s++)),a=null);continue}if(a!==null){a.push(e);continue}if(/^\s*\|.*\|\s*$/.test(e)){c(),o.push(e);continue}l();let n=/^(#{1,6})\s+(.*)$/.exec(e);if(n){c();let e=n[1].length,i=t?[`text-sm`,`text-sm`,`text-xs`,`text-xs`,`text-xs`,`text-xs`]:[`text-lg`,`text-base`,`text-sm`,`text-sm`,`text-sm`,`text-sm`];r.push((0,K.jsx)(`p`,{className:`font-semibold ${i[e-1]}`,children:tB(n[2])},s++));continue}let u=/^\s*[-*]\s+\[([ xX])\]\s+(.*)$/.exec(e);if(u){i.push((0,K.jsxs)(`li`,{className:`list-none -ml-4 flex items-start gap-2`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:u[1].toLowerCase()===`x`,readOnly:!0,className:`mt-1`}),(0,K.jsx)(`span`,{children:tB(u[2])})]},s++));continue}let d=/^\s*[-*]\s+(.*)$/.exec(e);if(d){i.push((0,K.jsx)(`li`,{children:tB(d[1])},s++));continue}c(),e.trim()&&r.push((0,K.jsx)(`p`,{children:tB(e)},s++))}return c(),l(),a!==null&&r.push(Yz(a,s++)),r}var $z=`text-primary underline underline-offset-2 break-all`;function eB(e,t,n){return(0,K.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,className:$z,children:t},n)}function tB(e){let t=[],n=/(`[^`]+`|\[[^\]]+\]\(https?:\/\/[^\s)]+\)|\*\*[^*]+\*\*|\*[^*]+\*|https?:\/\/[^\s<>)\]]+)/g,r=0,i,a=0;for(;i=n.exec(e);){i.index>r&&t.push((0,K.jsx)(v.Fragment,{children:e.slice(r,i.index)},a++));let n=i[0];if(n.startsWith("`"))t.push((0,K.jsx)(`code`,{className:`rounded bg-muted px-1 text-xs`,children:n.slice(1,-1)},a++));else if(n.startsWith(`[`)){let e=/^\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)$/.exec(n);e?t.push(eB(e[2],e[1],a++)):t.push((0,K.jsx)(v.Fragment,{children:n},a++))}else n.startsWith(`**`)?t.push((0,K.jsx)(`strong`,{children:n.slice(2,-2)},a++)):n.startsWith(`*`)?t.push((0,K.jsx)(`em`,{children:n.slice(1,-1)},a++)):t.push(eB(n,n,a++));r=i.index+n.length}return r<e.length&&t.push((0,K.jsx)(v.Fragment,{children:e.slice(r)},a++)),t}function nB({docs:e,loaded:t}){let[n,r]=(0,v.useState)(0);if(!t)return(0,K.jsx)(`p`,{className:`p-4 text-sm text-muted-foreground`,children:`Loading…`});if(e.length===0)return(0,K.jsx)(`p`,{className:`p-4 text-sm text-muted-foreground`,children:`No PLAN/TODO docs yet.`});let i=e[Math.min(n,e.length-1)];return(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-auto flex-col`,children:[(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1 border-b border-border p-2`,children:e.map((e,t)=>(0,K.jsx)(q,{variant:`ghost`,size:`sm`,className:G(`h-7 text-xs`,t===n&&`bg-accent text-accent-foreground`),onClick:()=>r(t),children:e.name},e.name))}),(0,K.jsx)(wg,{className:`min-h-0 flex-auto`,children:(0,K.jsx)(`div`,{className:`p-4`,children:(0,K.jsx)(Jz,{text:i.content})})})]})}var rB=[];function iB({projectId:e}){let{value:t,loaded:n}=Vv(()=>Nr(e),rB,4e3,[e]);return!n||t.length===0?null:(0,K.jsxs)(`section`,{"aria-label":`Docs`,className:`border-t border-border p-3`,children:[(0,K.jsx)(`h2`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Docs`}),(0,K.jsx)(`div`,{className:`flex max-h-[28rem] flex-col overflow-hidden rounded-md border border-border`,children:(0,K.jsx)(nB,{docs:t,loaded:!0})})]})}function aB({projectId:e,events:t,onAgentStarted:n,files:r,context:i,addContext:a,removeContext:o,toggleContext:s,onOpenAgent:c,errors:l}){return(0,K.jsxs)(wg,{className:`min-h-0 flex-1`,children:[(0,K.jsx)(Lz,{projectId:e}),(0,K.jsx)(m_,{errors:l}),(0,K.jsx)(Nz,{projectId:e,onAgentStarted:n,files:r,context:i,addContext:a,removeContext:o,toggleContext:s}),t.length>0&&(0,K.jsx)(Vz,{events:t}),(0,K.jsx)(Kz,{onOpenAgent:c}),(0,K.jsx)(iB,{projectId:e})]})}var oB=yt(`onQuota`),sB=yt(`onAutoPm`),cB=yt(`sendAutoPmSweep`),lB=3e4;function uB(){return Vv(oB,void 0,lB,[]).value}function dB(){return Vv(sB,void 0,lB,[]).value}function fB(e){return new Intl.DateTimeFormat(`en-US`,{weekday:`short`}).format(e).slice(0,2).toUpperCase()}function pB(e,t,n=fB){let r=t-e;if(!(r>0))return[];let i=[e],a=new Date(e);for(a.setHours(24,0,0,0);a.getTime()<t;)i.push(a.getTime()),a.setHours(24,0,0,0);i.push(t);let o=[];for(let t=0;t<i.length-1;t++){let a=i[t],s=i[t+1];o.push({startPercent:(a-e)/r*100,endPercent:(s-e)/r*100,label:n(a)})}let s=o[0],c=o.at(-1);return o.length>1&&s.label===c.label&&(s.endPercent-s.startPercent>=c.endPercent-c.startPercent?c.label=void 0:s.label=void 0),o}var mB=5;function hB(e,t,n=mB){return e>=100?`full`:e>t+n?`over`:e>=t-n?`near`:`under`}var gB=100/7;function _B(e,t){return Math.min(Math.max(e+t,0),100)}function vB(e,t,n){return(e-t)/100*n}function yB(e,t){return Math.min(Math.max(e,0),100)/100*t}function bB(e,t){if(!(t<=0))return e/t*100}function xB(e,t){let n=Math.min(Math.max(e,0),100);return{start:n,end:Math.max(n,Math.min(Math.max(t,0),100))}}function SB({className:e,...t}){return(0,K.jsx)(`div`,{className:G(`rounded-lg border border-border bg-card text-card-foreground`,e),...t})}function CB({className:e,...t}){return(0,K.jsx)(`div`,{className:G(`flex flex-col gap-1 px-4 pt-4`,e),...t})}function wB({className:e,...t}){return(0,K.jsx)(`h3`,{className:G(`text-sm font-semibold`,e),...t})}function TB({className:e,...t}){return(0,K.jsx)(`div`,{className:G(`p-4`,e),...t})}var EB={under:`bg-success`,near:`bg-info`,over:`bg-warning`,full:`bg-danger`},DB={under:`text-success`,near:`text-info`,over:`text-warning`,full:`text-danger`},OB=` — `;function kB(e){return e.find(e=>e.kind===`week`)}function AB(e,t){let n=t.map(e=>`“${e.label}”`).join(`, `);return e?e.resetsAtText?`Couldn't parse quota: the week resets “${e.resetsAtText}”, which isn't a phrasing this version recognizes.`:`No quota week to place: “${e.label}” reports ${e.percentUsed}% used but no reset time, and the week is drawn between its start and its reset — there is no span to place it in.`:`Couldn't parse quota: no “Current week (all models)” line in the readout — it reported ${n}.`}function jB({swatch:e,children:t}){return(0,K.jsxs)(`span`,{className:`flex items-center gap-1`,children:[e,t]})}function MB({status:e,percentUsed:t,offset:n,onChangeOffset:r,others:i}){let{boundary:a}=e,o=pB(a.startsAt,a.resetsAt),s=hB(t,a.percent),c=_B(a.percent,n),l=xB(t,c),u=l.end>l.start,d=vB(c,a.percent,a.resetsAt-a.startsAt),f=c>a.percent+gB,p=`${Math.round(t)}% of the week used, against a boundary of ${Math.round(a.percent)}% on day ${a.day} of 7`,m=a.resetsAt-a.startsAt,h=vB(t,a.percent,m),g=h>=0,_=g?`Over-consuming`:`Under-consuming`,v=yB(t,m),y=bB(t,a.percent);return(0,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,K.jsx)(`div`,{className:`relative h-4 text-[10px] font-medium tracking-wide text-muted-foreground`,children:o.map((e,t)=>e.label&&(0,K.jsx)(`span`,{className:`absolute top-0 -translate-x-1/2`,style:{left:`${(e.startPercent+e.endPercent)/2}%`},children:e.label},t))}),(0,K.jsxs)(`div`,{className:`relative h-4`,children:[(0,K.jsxs)(`div`,{role:`img`,"aria-label":p,className:`absolute inset-x-0 top-[3px] h-2.5 overflow-hidden rounded-full bg-muted`,children:[(0,K.jsx)(`div`,{className:G(`absolute inset-y-0 left-0`,EB[s]),style:{width:`${l.start}%`}}),u&&(0,K.jsx)(`div`,{className:G(`absolute inset-y-0 opacity-35`,EB[s]),style:{left:`${l.start}%`,width:`${l.end-l.start}%`}}),o.slice(1).map((e,t)=>(0,K.jsx)(`div`,{className:`absolute inset-y-0 w-1 bg-background/60`,style:{left:`${e.startPercent}%`},"aria-hidden":!0},t)),(0,K.jsx)(`div`,{className:`absolute inset-y-0 w-0.5 -translate-x-1/2 bg-foreground`,style:{left:`${Math.min(Math.max(a.percent,0),100)}%`},"aria-hidden":!0})]}),(0,K.jsx)(`input`,{type:`range`,"aria-label":`Unattended work stops at`,className:G(`absolute inset-0 h-full w-full cursor-grab appearance-none bg-transparent active:cursor-grabbing`,`[&::-webkit-slider-runnable-track]:bg-transparent`,`[&::-moz-range-track]:border-none [&::-moz-range-track]:bg-transparent`,`[&::-webkit-slider-thumb]:h-3.5 [&::-webkit-slider-thumb]:w-3.5 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full`,`[&::-webkit-slider-thumb]:border [&::-webkit-slider-thumb]:border-background [&::-webkit-slider-thumb]:bg-foreground [&::-webkit-slider-thumb]:shadow-sm`,`[&::-moz-range-thumb]:h-3.5 [&::-moz-range-thumb]:w-3.5 [&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:border-none`,`[&::-moz-range-thumb]:border [&::-moz-range-thumb]:border-background [&::-moz-range-thumb]:bg-foreground [&::-moz-range-thumb]:shadow-sm`),min:0,max:100,step:`any`,value:c,onChange:e=>{let t=Math.round(Number(e.target.value)-a.percent);r(Math.min(Math.max(t,-50),50))}})]}),(0,K.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[(0,K.jsxs)(Z,{children:[(0,K.jsxs)(Q,{render:(0,K.jsx)(`span`,{className:`cursor-default`}),children:[_,`: `,(0,K.jsx)(`span`,{className:G(`font-medium`,DB[s]),children:Oa(Math.abs(h))})]}),(0,K.jsxs)(f_,{className:`max-w-64`,children:[`You are `,Aa(Math.abs(h)),` `,g?`above`:`below`,` the quota boundary.`,(0,K.jsx)(`br`,{}),(0,K.jsx)(`br`,{}),`You're`,` `,g?`over-consuming`:`under-consuming`,`: you spend `,g?`faster`:`slower`,` than the week's pace allows.`]})]}),OB,(0,K.jsxs)(Z,{children:[(0,K.jsxs)(Q,{render:(0,K.jsx)(`span`,{className:`cursor-default`}),children:[(0,K.jsx)(`span`,{className:`font-medium`,children:Oa(v)}),` spent`]}),(0,K.jsxs)(f_,{className:`max-w-64`,children:[Aa(v),` of the week's allowance has been consumed — `,Math.round(t),`% of it, said in the same unit as the pace figure beside it.`]})]}),y!==void 0&&(0,K.jsxs)(K.Fragment,{children:[OB,(0,K.jsxs)(Z,{children:[(0,K.jsxs)(Q,{render:(0,K.jsx)(`span`,{className:`cursor-default`}),children:[(0,K.jsxs)(`span`,{className:G(`font-medium`,DB[s]),children:[Math.round(y),`%`]}),` of pace`]}),(0,K.jsxs)(f_,{className:`max-w-64`,children:[`Against the `,Math.round(a.percent),`% of the week allowed by day `,a.day,` of 7 — 100% is exactly on pace. This is the line that parks unattended work, not the week's total.`]})]})]}),OB,(0,K.jsxs)(Z,{children:[(0,K.jsxs)(Q,{render:(0,K.jsx)(`span`,{className:`cursor-default`}),children:[`resets `,Ma(a.resetsAt)]}),(0,K.jsx)(f_,{children:Na(a.resetsAt)})]}),i.length>1?(0,K.jsxs)(K.Fragment,{children:[OB,(0,K.jsxs)(Z,{children:[(0,K.jsx)(Q,{render:(0,K.jsx)(`span`,{className:`cursor-default`}),children:`show all limits`}),(0,K.jsx)(f_,{children:(0,K.jsx)(`table`,{className:`border-collapse text-left`,children:(0,K.jsx)(`tbody`,{children:i.map(e=>(0,K.jsx)(PB,{window:e},e.label))})})})]})]}):null]}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-3 gap-y-1 text-[11px] text-muted-foreground`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,K.jsx)(jB,{swatch:(0,K.jsx)(`span`,{className:G(`h-2 w-2 rounded-sm`,EB[s]),"aria-hidden":!0}),children:`Used`}),(0,K.jsx)(jB,{swatch:(0,K.jsx)(`span`,{className:G(`h-2 w-2 rounded-sm opacity-35`,EB[s]),"aria-hidden":!0}),children:`Budget for Autonomous AI`}),(0,K.jsx)(jB,{swatch:(0,K.jsx)(`span`,{className:`h-2 w-0.5 bg-foreground`,"aria-hidden":!0}),children:(0,K.jsxs)(Z,{children:[(0,K.jsxs)(Q,{render:(0,K.jsx)(`span`,{className:`inline-flex cursor-default items-center gap-0.5`}),children:[`Quota boundary`,(0,K.jsx)(xi,{className:`h-3 w-3`,"aria-hidden":!0})]}),(0,K.jsxs)(f_,{className:`max-w-64 space-y-2`,children:[(0,K.jsx)(`p`,{children:`Not a hard limit — just an indication of whether you're over- or under-consuming. It's calculated as a pro-rated share of the weekly limit.`}),(0,K.jsx)(`p`,{children:`If your usage matches the quota boundary, then you're spending exactly what the week's pace allows.`}),(0,K.jsx)(`p`,{children:`Fun fact: the quota boundary is shown exactly at the current time in the week usage bar above.`})]})]})})]}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[f&&(0,K.jsxs)(Z,{children:[(0,K.jsxs)(Q,{render:(0,K.jsx)(`span`,{className:`inline-flex cursor-default items-center gap-0.5 text-warning`}),children:[`⚠️ Eager consumption`,(0,K.jsx)(xi,{className:`h-3 w-3`,"aria-hidden":!0})]}),(0,K.jsxs)(f_,{children:[`Autonomous AI will spend tokens `,Aa(d),` faster than the week's pace allows`]})]}),(0,K.jsxs)(Z,{children:[(0,K.jsx)(Q,{render:(0,K.jsx)(`span`,{className:`cursor-default`}),children:u?(0,K.jsxs)(K.Fragment,{children:[`✅ Autonomous AI `,(0,K.jsx)(`em`,{children:`enabled`}),` `,(0,K.jsx)(`small`,{className:`text-muted-foreground/70`,children:`move slider to the left to disable`})]}):(0,K.jsxs)(K.Fragment,{children:[`❌ Autonomous AI `,(0,K.jsx)(`em`,{children:`disabled`}),` `,(0,K.jsx)(`small`,{className:`text-muted-foreground/70`,children:`move slider to the right to enable`})]})}),(0,K.jsx)(f_,{className:`max-w-64`,children:u?`Autonomous AI enabled means that agents will automatically work on tasks in the AI queue, and tasks will be automatically added to the AI queue.`:`Autonomous AI disabled means that agents won't automatically start to work — every new agentic work is triggered by you manually.`})]})]})]})]})}function NB({window:e}){return(0,K.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 text-xs`,children:[(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:e.label}),(0,K.jsxs)(`span`,{className:`text-muted-foreground`,children:[Math.round(e.percentUsed),`% used`,e.resetsAtText?`${OB}resets ${e.resetsAtText}`:``]})]})}function PB({window:e}){return(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(`td`,{className:`pr-3 align-baseline text-muted-foreground`,children:e.label}),(0,K.jsxs)(`td`,{className:`whitespace-nowrap align-baseline text-muted-foreground`,children:[Math.round(e.percentUsed),`% used`,e.resetsAtText?`${OB}resets ${e.resetsAtText}`:``]})]})}function FB(e){switch(e.unavailable){case void 0:return;case`no-subscription`:return`This account has no subscription usage to report, so there is no boundary to measure against.`;case`agent-not-found`:return`Claude Code was not found, so usage cannot be read.`;case`unrecognized`:return e.windows.length?`Claude Code's latest usage readout wasn't one this version recognizes, so these numbers are from the reading before it.`:`Claude Code reported its usage in a way this version does not recognize. Trying again shortly.`;default:return e.windows.length?`Couldn't refresh just now, so these numbers may be a little behind.`:`Reading your usage now.`}}function IB(e){let[t,n]=(0,v.useState)(e??7.142857142857143),r=(0,v.useRef)(null);return(0,v.useEffect)(()=>{e!==void 0&&(r.current!==null&&r.current!==e||(r.current=null,n(e)))},[e]),[t,e=>{n(e),r.current=e,fn({autoSpendOffset:e})}]}function LB(){let e=uB(),[t,n]=IB(e?.boundary?.limit.offset),r=e?FB(e):void 0,i=e?.unavailable!==void 0&&e.windows.length>0?e.readAt:void 0,a=e?kB(e.windows):void 0,o=e?.windows??[];return(0,K.jsxs)(SB,{children:[(0,K.jsx)(CB,{children:(0,K.jsx)(wB,{className:`text-base`,children:`Usage`})}),(0,K.jsxs)(TB,{className:`space-y-4`,children:[!e&&(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Reading your usage…`}),e?.boundary&&a?(0,K.jsx)(MB,{status:e.boundary,percentUsed:a.percentUsed,offset:t,onChangeOffset:n,others:o}):e&&e.windows.length?(0,K.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:AB(a,o)}):null,!(e?.boundary&&a)&&o.length?(0,K.jsx)(`div`,{className:`space-y-1 border-t border-border pt-3`,children:o.map(e=>(0,K.jsx)(NB,{window:e},e.label))}):null,r?(0,K.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[r,i===void 0?``:` Last read ${Da(new Date(i).toISOString())}.`]}):null]})]})}var RB=`Delivers notifications to Discord, so an agent waiting on you reaches you with no dashboard open.`;function zB(e){let t=xn(hn());return(0,K.jsx)(BB,{...e,credential:`webhook`,title:`Discord notifications`,description:RB,label:`Webhook URL`,placeholder:`https://discord.com/api/webhooks/…`,steps:[`In Discord, open the channel the notifications should land in.`,`Edit Channel → Integrations → Webhooks → New Webhook, then Copy Webhook URL.`,`Paste it below.`],toggle:{on:t,onLabel:`Discord delivery on`,offLabel:`Discord delivery off`,description:`Whether notifications are posted to Discord.`,set:e=>fn({notifyDiscord:e})}})}function BB({open:e,onOpenChange:t,channels:n,onSaved:r,credential:i,title:a,description:o,label:s,placeholder:c,steps:l,toggle:u}){let d=n?.sources[i],f=d!==void 0,p=d===`env`,m=n?.editable??!1,[h,g]=(0,v.useState)(``),[_,y]=(0,v.useState)(!1),[b,x]=(0,v.useState)(null),[S,C]=(0,v.useState)(!1);(0,v.useEffect)(()=>{e||(g(``),x(null),C(!1))},[e]);let w=m&&!p&&(!f||S),T=h.trim()?ht(i,h):void 0,E=async e=>{y(!0),x(null);let t=await Dt({webhook:e}).catch(()=>({ok:!1,error:`Could not reach the daemon.`}));if(y(!1),!t.ok){x(t.error);return}g(``),C(!1),r()};return(0,K.jsx)(GR,{open:e,onOpenChange:t,title:a,children:(0,K.jsxs)(`div`,{className:`flex flex-col gap-3 text-sm`,children:[(0,K.jsx)(`p`,{className:`text-muted-foreground`,children:o}),p?(0,K.jsxs)(`p`,{className:`text-muted-foreground`,children:[`Set by `,(0,K.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 text-xs`,children:mt(i)}),` in the daemon's environment, so it is not editable here. Unset it and restart the daemon to manage it from the dashboard instead.`]}):m?f&&!S?(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-border p-3`,children:[(0,K.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,K.jsxs)(`span`,{children:[s,` saved`]}),(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Held on the daemon, and never shown again.`})]}),(0,K.jsxs)(`span`,{className:`flex shrink-0 gap-2`,children:[(0,K.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>C(!0),children:`Replace`}),(0,K.jsx)(q,{variant:`ghost`,size:`sm`,disabled:_,onClick:()=>void E(null),children:`Remove`})]})]}):(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,K.jsx)(`p`,{className:`font-medium`,children:`Not configured yet`}),(0,K.jsx)(`ol`,{className:`list-decimal space-y-1 pl-5 text-muted-foreground`,children:l.map(e=>(0,K.jsx)(`li`,{children:e},e))})]}):(0,K.jsx)(`p`,{className:`text-muted-foreground`,children:`This server does not store credentials, so Discord cannot be set up from here.`}),w&&(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,K.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:s}),(0,K.jsx)(`input`,{type:`password`,value:h,placeholder:c,autoFocus:!0,autoComplete:`off`,spellCheck:!1,onChange:e=>g(e.target.value),className:`w-full rounded-md border border-border bg-background px-2 py-1 font-mono text-xs text-foreground`})]}),T&&(0,K.jsx)(`p`,{className:`text-xs text-warning`,children:T}),(0,K.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[S&&(0,K.jsx)(q,{variant:`ghost`,size:`sm`,onClick:()=>{C(!1),g(``)},children:`Cancel`}),(0,K.jsx)(q,{size:`sm`,disabled:!h.trim()||!!T||_,onClick:()=>void E(h),children:_?`Saving…`:`Save`})]})]}),b&&(0,K.jsx)(`p`,{className:`text-xs text-destructive`,children:b}),(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-border p-3`,children:[(0,K.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,K.jsx)(`span`,{children:u.on?u.onLabel:u.offLabel}),(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:f?u.description:`Can be turned on now; it starts working once the credential is set.`})]}),(0,K.jsx)(q,{variant:u.on?`outline`:`default`,size:`sm`,onClick:()=>u.set(!u.on),children:u.on?`Disable`:`Enable`})]})]})})}function VB({dismissible:e=!1,onAgentStarted:t}){let{value:n,reload:r}=Vv(Ur,null,1e4,[]),{value:i,reload:a}=Vv(At,null,3e4,[]),o=sy(),s=hn(),c=$v(),{start:l,busy:u,error:d}=Wy(),[f,p]=(0,v.useState)(!1),[m,h]=(0,v.useState)(!1),[g,_]=(0,v.useState)(null),[y,b]=(0,v.useState)(!1),x=i?.cwdProjectId??n?.projects[0]?.projectId??null,S=n?.totals.projects??0,C=n?.projects.some(e=>e.hasTickets)??!1,w=c===`granted`&&bn(s),T=[{key:`project`,label:`Add a project`,description:`A project is a git repo The Framework may work in.`,done:S>0,action:(0,K.jsxs)(`div`,{className:`flex flex-col items-end gap-1`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[i?.cwd&&!i.cwdProjectId&&(0,K.jsx)(q,{size:`sm`,onClick:async()=>{if(!i?.cwd)return;h(!0),_(null);let e=await kt(i.cwd,!1).catch(()=>({ok:!1,error:`Could not reach the daemon.`}));if(h(!1),!e.ok){_(e.error);return}r(),a()},disabled:m,children:m?`Adding…`:`Add ${i.cwd} as project`}),(0,K.jsx)(q,{size:`sm`,variant:`outline`,onClick:()=>p(!0),children:`Select & add project directory`})]}),g&&(0,K.jsx)(`span`,{className:`text-xs text-destructive`,children:g})]})},{key:`todos`,label:`Populate the queue of AI tasks`,description:`TODO_AGENTS.md is the queue: each unchecked item is work the agent picks up on its own, so a filled queue is what lets it keep going without you.`,done:(n?.totals.openTodos??0)>0},{key:`tickets`,label:`Populate tickets/`,description:`tickets/ holds the bigger things to work on, in the repo. The agent researches and plans them, and they are the input the queue is filled from.`,done:C,optional:!0,action:(0,K.jsxs)(`div`,{className:`flex flex-col items-end gap-1`,children:[(0,K.jsx)(q,{size:`sm`,onClick:async()=>{if(!x)return;let e=qe.updateTickets.render(),n=await l(x,e,`prompt`,{unattended:!0});n&&t(x,e,n.agentId)},disabled:!x||u,children:u?`Starting…`:`Update from GitHub`}),!x&&(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Add a project first`}),d&&(0,K.jsx)(`span`,{className:`text-xs text-destructive`,children:d})]})},{key:`browser-notification`,label:`Add browser notifications`,description:`Desktop pings while the dashboard is open, so a session waiting on you does not sit unnoticed.`,done:w,optional:!0,action:c===`denied`?(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Blocked in your browser settings`}):c===`unsupported`?(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Not supported by this browser`}):(0,K.jsx)(q,{size:`sm`,variant:`outline`,onClick:()=>{fn({notifyBrowser:!0}),c==="default"&&Notification.requestPermission()},children:`Enable`})},{key:`discord-notification`,label:`Add Discord notifications`,description:RB,done:o?.discordWebhook??!1,optional:!0,action:(0,K.jsx)(q,{size:`sm`,variant:`outline`,onClick:()=>b(!0),children:`Add the webhook`})}],E=T.filter(e=>e.done).length;return(0,K.jsxs)(SB,{children:[(0,K.jsxs)(CB,{className:`flex flex-row items-start justify-between gap-3`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(wB,{className:`text-base`,children:`Onboarding`}),(0,K.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[E,` of `,T.length,` set up.`]})]}),e&&(0,K.jsxs)(Z,{children:[(0,K.jsx)(Q,{render:(0,K.jsx)(q,{variant:`ghost`,size:`sm`,onClick:()=>fn({onboardingDismissed:!0}),"aria-label":`Remove, you can resume the onboarding on the settings page`}),children:(0,K.jsx)(ua,{className:`h-4 w-4`,"aria-hidden":!0})}),(0,K.jsx)(f_,{children:`Remove, you can resume the onboarding on the settings page`})]})]}),(0,K.jsx)(TB,{children:(0,K.jsx)(`ul`,{className:`divide-y divide-border`,children:T.map(e=>(0,K.jsxs)(`li`,{className:`flex items-start justify-between gap-4 py-3 first:pt-0 last:pb-0`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[e.done?(0,K.jsx)(ra,{className:`mt-0.5 h-4 w-4 shrink-0 text-[var(--color-primary)]`,"aria-label":`Done`}):(0,K.jsx)(aa,{className:`mt-0.5 h-4 w-4 shrink-0 text-muted-foreground`,"aria-label":`Not done`}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`p`,{className:e.done?`text-sm text-muted-foreground line-through`:`text-sm`,children:[e.label,e.optional&&(0,K.jsx)(`span`,{className:`ml-2 rounded-full border border-border px-1.5 py-0.5 align-middle text-[10px] font-normal uppercase tracking-wide text-muted-foreground`,children:`Optional`})]}),(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.description})]})]}),!e.done&&e.action&&(0,K.jsx)(`div`,{className:`shrink-0`,children:e.action})]},e.key))})}),f&&(0,K.jsx)(Tc,{onAdded:()=>{r(),a()},onClose:()=>p(!1)}),(0,K.jsx)(zB,{open:y,onOpenChange:b,channels:o,onSaved:oy})]})}var HB=[];function UB(e){return`Work on tickets/${e}. Do not start any other ticket.`}function WB(e,t){Jv(UB(e.ticket.file)),t(e.projectId)}var GB=[{key:`in-progress`,label:`In progress`,dot:`bg-primary`},{key:`ai-queue`,label:`AI Queue`,dot:`bg-warning`}],KB=[{key:`high-priority`,label:`High priority`,dot:`bg-info`}];function qB({onSelectProject:e,onSelectAgent:t}){let{value:n}=Vv(zr,HB,1e4,[]),r=r=>(0,K.jsx)(JB,{lane:r,tickets:n.filter(e=>e.bucket===r.key),onSelectProject:e,onSelectAgent:t},r.key);return(0,K.jsxs)(SB,{children:[(0,K.jsx)(CB,{children:(0,K.jsxs)(wB,{className:`flex items-center gap-2 text-base`,children:[(0,K.jsx)(Ai,{className:`h-4 w-4 text-muted-foreground`}),`Hot tickets`]})}),(0,K.jsx)(TB,{children:n.length===0?(0,K.jsx)(`p`,{className:`py-2 text-sm text-muted-foreground`,children:`Nothing in progress, queued, or high priority.`}):(0,K.jsxs)(`div`,{className:`grid items-start gap-x-8 gap-y-5 sm:grid-cols-2`,children:[(0,K.jsx)(`div`,{className:`flex flex-col gap-5`,children:GB.map(r)}),(0,K.jsx)(`div`,{className:`flex flex-col gap-5`,children:KB.map(r)})]})})]})}function JB({lane:e,tickets:t,onSelectProject:n,onSelectAgent:r}){let i=t.length===0;return(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold uppercase tracking-wide`,children:[(0,K.jsx)(`span`,{"aria-hidden":!0,className:G(`h-2 w-2 shrink-0 rounded-full`,e.dot,i&&`opacity-40`)}),(0,K.jsx)(`span`,{className:i?`text-muted-foreground`:`text-foreground/80`,children:e.label}),(0,K.jsx)(`span`,{className:`tabular-nums text-muted-foreground/70`,children:t.length})]}),!i&&(0,K.jsx)(`ul`,{className:`mt-1.5`,children:t.map(e=>(0,K.jsx)(`li`,{children:(0,K.jsxs)(Z,{children:[(0,K.jsxs)(Q,{render:(0,K.jsx)(`button`,{type:`button`,onClick:()=>e.agentId?r(e.projectId,e.agentId):WB(e,n),className:`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left hover:bg-accent focus-visible:bg-accent focus-visible:outline-none`}),children:[(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-medium`,children:e.ticket.title}),(0,K.jsx)(YB,{ticket:e}),(0,K.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:e.projectName})]}),(0,K.jsx)(f_,{className:`max-w-[24rem]`,children:e.ticket.summary||e.ticket.title})]})},`${e.projectId}:${e.ticket.file}`))})]})}function YB({ticket:e}){if(e.agentId)return(0,K.jsx)(`span`,{className:`shrink-0 rounded border border-primary/40 px-1 text-[10px] uppercase tracking-wide text-primary`,children:`implementing`});let t=e.bucket===`in-progress`?e.ticket.planned?`planned`:null:e.bucket===`high-priority`?e.ticket.priority??null:null;return t?(0,K.jsx)(`span`,{className:`shrink-0 rounded border border-border px-1 text-[10px] uppercase tracking-wide text-muted-foreground`,children:t}):null}var XB=[];function ZB(e){return e?e.length?e.length===1?e[0].message:e.map(e=>`${e.path.split(`/`).pop()||e.path}: ${e.message}`).join(` · `):`The sweep ran and considered no projects.`:`The sweep ran.`}function QB({onAgentStarted:e,onSelectProject:t}){let n=Bv(Ot,XB,[]),r=hn(),i=dB(),{busy:a,error:o,start:s}=Wy(),[c,l]=(0,v.useState)(null),[u,d]=(0,v.useState)(null),[f,p]=(0,v.useState)(!1),[m,h]=(0,v.useState)(null),g=(c!==null&&n.some(e=>e.id===c)?c:n[0]?.id)??null,_=r.autoPm??!1,y=r.autoPmOptOut??[],b=(e,t)=>fn({autoPmOptOut:t?y.filter(t=>t!==e.name):[...y,e.name]}),x=r.autoPmConcurrency??2,S=_&&i?.nextSweepAt!==void 0?`Auto-runs ${Ea(i.nextSweepAt)}`:`Auto-run`,C=async()=>{if(f)return;p(!0),h(null);let e=await cB().catch(()=>({ok:!1}));p(!1),e.ok?h(ZB(`outcomes`in e?e.outcomes:void 0)):h(`This dashboard is not running the sweep, so there is nothing to trigger here.`)},w=e=>{g&&(Jv(e.prompt),t(g))},T=dy(r),E=n.find(e=>e.id===g)?.name,D=async t=>{if(!g||a)return;if(t.drains){d(t.name),h(null);let e=await cB({drainOnly:!0}).catch(()=>({ok:!1}));d(null),e.ok?h(ZB(`outcomes`in e?e.outcomes:void 0)):h(`This dashboard is not running the sweep, so there is nothing to trigger here.`);return}d(t.name);let n=await s(g,t.prompt,`prompt`,{...ft(r),unattended:!0});d(null),n&&e(g,t.prompt,n.agentId)};return(0,K.jsxs)(SB,{children:[(0,K.jsx)(CB,{children:(0,K.jsxs)(wB,{className:`flex items-center gap-2 text-base`,children:[(0,K.jsx)(_i,{className:`h-4 w-4 text-muted-foreground`}),`Routine work`]})}),(0,K.jsx)(TB,{className:`space-y-3`,children:n.length===0?(0,K.jsx)(`p`,{className:`py-2 text-sm text-muted-foreground`,children:`Add a project to run a routine.`}):(0,K.jsxs)(K.Fragment,{children:[n.length>1&&(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,K.jsx)(`label`,{htmlFor:`routine-project`,className:`text-muted-foreground`,children:`Run in`}),(0,K.jsx)(`select`,{id:`routine-project`,className:`min-w-0 flex-1 rounded-md border border-border bg-transparent px-2 py-1 text-sm`,value:g??``,onChange:e=>l(e.target.value),children:n.map(e=>(0,K.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),(0,K.jsx)(`ul`,{className:`divide-y divide-border`,children:rt.map(e=>(0,K.jsxs)(`li`,{className:`flex items-center gap-3 py-2 first:pt-0`,children:[(0,K.jsxs)(`label`,{className:`flex min-w-0 flex-1 cursor-pointer items-center gap-3`,children:[(0,K.jsx)(wc,{checked:!y.includes(e.name),onCheckedChange:t=>b(e,t)}),(0,K.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`span`,{className:`block truncate text-sm font-medium`,children:e.label??e.name}),e.describe&&(0,K.jsx)(`span`,{className:`block truncate text-xs text-muted-foreground`,children:e.describe})]})]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center`,children:[(0,K.jsxs)(Z,{children:[(0,K.jsxs)(Q,{render:(0,K.jsx)(q,{type:`button`,variant:`outline`,size:`xs`,disabled:a||!g,onClick:()=>void D(e),className:`rounded-r-none border-r-0`}),children:[(0,K.jsx)(Qi,{className:`h-3 w-3`,"aria-hidden":!0}),u===e.name?`Starting…`:`Run now`]}),(0,K.jsxs)(f_,{className:`max-w-[22rem] space-y-1`,children:[e.tooltip&&(0,K.jsx)(`span`,{className:`block`,children:e.tooltip}),(0,K.jsx)(`span`,{className:`block text-muted-foreground`,children:e.drains?`Each project's own settings decide the model and where it runs.`:T}),(0,K.jsx)(`span`,{className:`block text-muted-foreground`,children:e.drains?`Sweeps every project the daemon watches, up to ${x} ${x===1?`agent`:`agents`} each, unattended.`:`Starts one agent${E?` in ${E}`:``}, unattended — nothing is asked mid-run.`})]})]}),(0,K.jsxs)(kg,{children:[(0,K.jsx)(Ng,{type:`button`,disabled:!g,"aria-label":`Other ways to run ${e.label??e.name}`,className:G(Er({variant:`outline`,size:`xs`}),`rounded-l-none px-1.5`),children:(0,K.jsx)(yi,{className:`h-3 w-3`,"aria-hidden":!0})}),(0,K.jsx)(Pg,{align:`end`,className:`max-w-[20rem]`,children:(0,K.jsx)(Fg,{disabled:!g,onClick:()=>w(e),className:`items-start`,children:(0,K.jsx)(cy,{label:`Configure first, then run`,description:e.drains?`Opens the launcher with this prompt — one agent, not the fan-out.`:`Opens the launcher with this prompt, so you can set the model and where it runs.`})})})]})]})]},e.name))}),o&&(0,K.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:o}),(0,K.jsxs)(`div`,{className:`border-t border-border pt-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,K.jsxs)(Z,{children:[(0,K.jsxs)(Q,{render:(0,K.jsx)(`label`,{className:`flex cursor-pointer items-center gap-1.5 text-sm`}),children:[(0,K.jsx)(wc,{checked:_,onCheckedChange:e=>fn({autoPm:e})}),(0,K.jsx)(`span`,{className:`font-medium text-foreground`,children:S})]}),(0,K.jsx)(f_,{children:`Automatically run the ticked routines on a regular schedule.`})]}),(0,K.jsxs)(Z,{children:[(0,K.jsx)(Q,{render:(0,K.jsx)(`button`,{type:`button`,onClick:C,disabled:f,className:`shrink-0 rounded border border-border px-2 py-1 text-xs text-foreground hover:bg-accent disabled:opacity-50`}),children:f?`Triggering…`:`Trigger routine now`}),(0,K.jsx)(f_,{children:_?`Run the scheduled sweep now instead of waiting for the countdown.`:`Run the sweep once now. Auto-run stays off, so nothing further is scheduled.`})]})]}),(0,K.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-2`,children:[(0,K.jsxs)(Z,{children:[(0,K.jsx)(Q,{render:(0,K.jsx)(`label`,{htmlFor:`auto-pm-concurrency`,className:`cursor-pointer text-sm text-foreground`}),children:`Concurrent agents`}),(0,K.jsx)(f_,{children:`How many agents the routine keeps going at once while there is queued work.`})]}),(0,K.jsx)(`input`,{id:`auto-pm-concurrency`,type:`number`,min:1,max:10,step:1,value:x,onChange:e=>{let t=e.target.value.trim();if(!t)return;let n=Math.round(Number(t));Number.isFinite(n)&&fn({autoPmConcurrency:Math.min(Math.max(n,1),10)})},className:`w-16 rounded border border-border bg-background px-2 py-1 text-sm text-foreground`})]}),(0,K.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:x===1?`Only while nothing else is running and the week's allowance is not already spent.`:`Keeps up to ${x} agents going at once on queued work, and only while the week's allowance is not already spent.`}),_&&rt.every(e=>y.includes(e.name))&&(0,K.jsx)(`p`,{className:`mt-1 text-xs text-warning`,children:`Every routine is unticked, so the schedule has nothing to run.`}),m&&(0,K.jsx)(`p`,{role:`status`,className:`mt-1 text-xs text-muted-foreground`,children:m})]})]})})]})}function $B({working:e,loading:t,onSelectAgent:n}){return(0,K.jsxs)(SB,{children:[(0,K.jsx)(CB,{children:(0,K.jsxs)(wB,{className:`flex items-center gap-2 text-base`,children:[(0,K.jsx)(gi,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),`Agents`,(0,K.jsx)(`span`,{className:`truncate text-xs font-normal text-muted-foreground`,children:`Agents currently working`})]})}),(0,K.jsx)(TB,{children:t?(0,K.jsx)(`p`,{className:`py-2 text-sm text-muted-foreground`,children:`Loading…`}):e.length===0?(0,K.jsx)(`p`,{className:`py-2 text-sm text-muted-foreground`,children:`No agents working right now.`}):(0,K.jsx)(`ul`,{className:`space-y-0.5`,children:e.map(e=>(0,K.jsx)(eV,{label:tV(e),at:e.updatedAt,projectName:e.projectName,onOpen:()=>n(e.projectId,e.agentId)},`${e.projectId}:${e.agentId}`))})})]})}function eV({label:e,at:t,projectName:n,onOpen:r}){return(0,K.jsx)(`li`,{children:(0,K.jsxs)(`button`,{type:`button`,onClick:r,className:`flex w-full items-baseline gap-2 rounded-md px-2 py-1.5 text-left hover:bg-accent focus-visible:bg-accent focus-visible:outline-none`,children:[(0,K.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-muted-foreground/50`,children:`•`}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,children:e}),(0,K.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:n}),t&&(0,K.jsxs)(Z,{children:[(0,K.jsx)(Q,{render:(0,K.jsx)(`span`,{className:`shrink-0 whitespace-nowrap text-xs tabular-nums text-muted-foreground/80`}),children:Ta(t)}),(0,K.jsx)(f_,{children:Ca(t)})]})]})})}function tV(e){return e.intent?.trim()||e.sessionName?.trim()||e.scope?.trim()||e.projectName}var nV=/^\s*\[([^\]]+)\]\(([^)\s]+)\)\s*/,rV=`tickets/`;function iV(e){let t=nV.exec(e);if(!t)return{text:e.trim()};let n=t[1].trim(),r=t[2];return r.startsWith(rV)?{text:n,ticket:r.slice(8)}:/^https?:\/\//.test(r)?{text:n,url:r}:{text:n}}function aV(e){return`Open TODO_AGENTS.md and work on this one open entry only, then check it off. Do not start any other entry. The entry:\n\n${e}`}function oV({queue:e,loading:t,onOpenTicket:n,onAgentStarted:r}){let i=hn(),{busy:a,error:o,start:s}=Wy(),[c,l]=(0,v.useState)(null),u=async(e,t)=>{if(a)return;let n=`${e}\n${t}`,o=aV(t);l(n);let c=await s(e,o,`prompt`,{...ft(i),unattended:!0});l(null),c&&r(e,o,c.agentId)},d=e.filter(e=>e.open>0);return(0,K.jsxs)(SB,{children:[(0,K.jsxs)(CB,{children:[(0,K.jsxs)(wB,{className:`flex items-center gap-2 text-base`,children:[(0,K.jsx)(Gi,{className:`h-4 w-4 text-muted-foreground`}),`AI Queue`]}),(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Tasks AI will work on next`})]}),(0,K.jsxs)(TB,{children:[t?(0,K.jsx)(`p`,{className:`py-2 text-sm text-muted-foreground`,children:`Loading…`}):d.length===0?(0,K.jsx)(`p`,{className:`py-2 text-sm text-muted-foreground`,children:`Nothing queued.`}):(0,K.jsx)(`ul`,{className:`space-y-4`,children:d.map(e=>(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(`div`,{className:`flex w-full items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`truncate text-sm font-medium`,children:e.projectName}),(0,K.jsx)(`span`,{className:`ml-auto shrink-0 rounded-full bg-muted px-2 py-0.5 text-xs tabular-nums text-muted-foreground`,children:e.open})]}),(0,K.jsx)(`ul`,{className:`mt-1.5 space-y-1 pl-0.5`,children:e.items.filter(e=>!e.done).map((t,r)=>{let i=iV(t.text),o=`${e.projectId}\n${t.text}`;return(0,K.jsxs)(`li`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,K.jsx)(`span`,{"aria-hidden":!0,className:`text-muted-foreground/50`,children:`•`}),i.ticket===void 0?i.url===void 0?(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:t.text,children:i.text}):(0,K.jsx)(`a`,{href:i.url,target:`_blank`,rel:`noreferrer`,className:`min-w-0 flex-1 truncate hover:text-foreground hover:underline`,title:t.text,children:i.text}):(0,K.jsx)(`button`,{type:`button`,onClick:()=>n(e.projectId,i.ticket),className:`min-w-0 flex-1 truncate text-left hover:text-foreground hover:underline`,title:t.text,children:i.text}),(0,K.jsxs)(Z,{children:[(0,K.jsx)(Q,{render:(0,K.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Spin up an agent working on this entry`,disabled:a,onClick:()=>void u(e.projectId,t.text),className:`shrink-0 text-muted-foreground hover:text-foreground`}),children:c===o?(0,K.jsx)(Ki,{className:`h-3.5 w-3.5 animate-spin`,"aria-hidden":!0}):(0,K.jsx)(Qi,{className:`h-3.5 w-3.5`,"aria-hidden":!0})}),(0,K.jsx)(f_,{children:`Spin up an agent working on this entry`})]})]},r)})})]},e.projectId))}),o&&(0,K.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:o})]})]})}function sV({onSelectProject:e,onSelectAgent:t,onOpenTicket:n,onAgentStarted:r,interventions:i}){let{value:a}=Vv(Ur,null,5e3,[]),o=hn().onboardingDismissed??!1,s=a===null;return(0,K.jsx)(wg,{className:`min-h-0 flex-1`,children:(0,K.jsxs)(`div`,{className:`mx-auto max-w-6xl space-y-6 p-6`,children:[!o&&(0,K.jsx)(VB,{dismissible:!0,onAgentStarted:r}),(0,K.jsx)(LB,{}),(0,K.jsxs)(`div`,{className:`grid items-start gap-4 lg:grid-cols-2`,children:[(0,K.jsx)(cV,{items:i,onSelectProject:e,onSelectAgent:t}),(0,K.jsxs)(`div`,{className:`space-y-4`,children:[(0,K.jsx)($B,{working:a?.active??[],loading:s,onSelectAgent:t}),(0,K.jsx)(oV,{queue:a?.queue??[],loading:s,onOpenTicket:n,onAgentStarted:r})]})]}),(0,K.jsx)(QB,{onAgentStarted:r,onSelectProject:e}),(0,K.jsx)(qB,{onSelectProject:e,onSelectAgent:t})]})})}function cV({items:e,onSelectProject:t,onSelectAgent:n}){let r=e=>e.agentId?n(e.projectId,e.agentId):t(e.projectId);return(0,K.jsxs)(SB,{children:[(0,K.jsxs)(CB,{children:[(0,K.jsxs)(wB,{className:`flex items-center gap-2 text-base`,children:[(0,K.jsx)(Bi,{className:`h-4 w-4 text-muted-foreground`}),`Human Queue`,e.length>0&&(0,K.jsx)(`span`,{className:`rounded-full bg-primary px-1.5 text-xs font-semibold text-primary-foreground tabular-nums`,children:e.length})]}),(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Agents awaiting your approval, review, or input`})]}),(0,K.jsx)(TB,{children:e.length===0?(0,K.jsx)(`p`,{className:`py-2 text-sm text-muted-foreground`,children:`AI doesn't need you.`}):(0,K.jsx)(`ul`,{className:`divide-y divide-border`,children:e.map(e=>(0,K.jsx)(`li`,{children:e.kind===`awaiting`?(0,K.jsxs)(Z,{children:[(0,K.jsxs)(Q,{render:(0,K.jsx)(`button`,{type:`button`,onClick:()=>r(e),className:`flex w-full items-center gap-2.5 py-2 text-left hover:opacity-80`}),children:[(0,K.jsx)(Ji,{className:`h-4 w-4 shrink-0 text-warning`}),(0,K.jsx)(`span`,{className:`shrink-0 text-xs font-medium text-warning`,children:`Awaiting`}),(0,K.jsx)(`span`,{className:`truncate text-sm font-medium`,children:e.title}),(0,K.jsx)(`span`,{className:`ml-auto shrink-0 text-xs text-muted-foreground`,children:e.projectName})]}),(0,K.jsx)(f_,{children:`Open the agent to answer`})]}):e.kind===`unpushed`?(0,K.jsxs)(Z,{children:[(0,K.jsxs)(Q,{render:(0,K.jsx)(`button`,{type:`button`,onClick:()=>r(e),className:`flex w-full items-center gap-2.5 py-2 text-left hover:opacity-80`}),children:[(0,K.jsx)(Fi,{className:`h-4 w-4 shrink-0 text-info`}),(0,K.jsx)(`span`,{className:`shrink-0 text-xs font-medium text-info`,children:`Unpushed`}),(0,K.jsx)(`span`,{className:`truncate text-sm font-medium`,children:e.title}),e.commits!==void 0&&e.commits>0&&(0,K.jsx)(`span`,{className:`shrink-0 text-xs tabular-nums text-muted-foreground`,children:e.commits===1?`1 commit`:`${e.commits} commits`}),(0,K.jsx)(`span`,{className:`ml-auto shrink-0 text-xs text-muted-foreground`,children:e.projectName})]}),(0,K.jsx)(f_,{children:`Open the session: work on ${e.branch??``} was never pushed`})]}):(0,K.jsxs)(Z,{children:[(0,K.jsxs)(Q,{render:(0,K.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`flex items-center gap-2.5 py-2 hover:opacity-80`}),children:[(0,K.jsx)(Li,{className:`h-4 w-4 shrink-0 text-success`}),(0,K.jsxs)(`span`,{className:`shrink-0 text-xs font-medium tabular-nums text-muted-foreground`,children:[`#`,e.number]}),(0,K.jsx)(`span`,{className:`truncate text-sm font-medium`,children:e.title}),(0,K.jsx)(`span`,{className:`ml-auto shrink-0 text-xs text-muted-foreground`,children:e.projectName})]}),(0,K.jsx)(f_,{children:`Open PR #${e.number} on GitHub`})]})},it(e)))})})]})}function lV({text:e,label:t,className:n}){let[r,i]=(0,v.useState)(!1),a=(0,v.useRef)(void 0);(0,v.useEffect)(()=>()=>clearTimeout(a.current),[]);let o=()=>{navigator.clipboard?.writeText(e).then(()=>{i(!0),clearTimeout(a.current),a.current=setTimeout(()=>i(!1),1500)})},s=r?vi:Ei;return(0,K.jsxs)(Z,{children:[(0,K.jsx)(Q,{render:(0,K.jsx)(`button`,{type:`button`,onClick:o,"aria-label":t,className:G(`inline-flex shrink-0 items-center rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground`,r&&`text-success`,n)}),children:(0,K.jsx)(s,{className:`h-3 w-3`,"aria-hidden":!0})}),(0,K.jsx)(f_,{children:r?`Copied`:t})]})}function uV({enabled:e,onChange:t}){let[n,r]=(0,v.useState)(null),[i,a]=(0,v.useState)(!1),[o,s]=(0,v.useState)(null),[c,l]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{if(!e){s(null),l(!1);return}let t=!0,n=()=>void ei().then(e=>{t&&(s(e.version?.blocked?{got:e.version.got,expected:e.version.expected}:null),l(e.lastContact?.status===401))}).catch(()=>{});n();let r=setInterval(n,5e3);return()=>{t=!1,clearInterval(r)}},[e]),(0,v.useEffect)(()=>{if(!e){r(null),a(!1);return}let t=!0;return ti().then(e=>{t&&r(e)}).catch(()=>{}),()=>{t=!1}},[e]),e?(0,K.jsxs)(`div`,{className:`mt-2 space-y-2 rounded-md border border-border bg-muted/30 p-3 text-xs`,children:[(0,K.jsx)(`p`,{className:`text-muted-foreground`,children:`Install the browser extension, open its options, and paste this token. It reports the question a Claude web session is parked on, so it shows up here instead of only on claude.ai.`}),o&&(0,K.jsxs)(`p`,{className:`text-danger`,children:[`The extension is blocked: it is v`,o.got,` and this dashboard expects v`,o.expected,`. Update it — pull the repo, then reload the extension at chrome://extensions.`]}),!o&&c&&(0,K.jsx)(`p`,{className:`text-danger`,children:`Something is calling the bridge with a token this dashboard rejects, so the calls get nowhere. Open the extension's options and save the token shown below again.`}),n===null?(0,K.jsx)(`p`,{className:`text-muted-foreground`,children:`Restart the dashboard to generate the token.`}):(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(`code`,{className:`min-w-0 flex-1 truncate rounded bg-muted px-2 py-1 font-mono`,children:i?n:`•`.repeat(24)}),(0,K.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>a(e=>!e),children:i?`Hide`:`Reveal`}),(0,K.jsx)(lV,{text:n,label:`Copy the bridge token`})]})]}):null}function dV(){let e=Lv(),t=Wv(e),n=ky(),[r,i]=(0,v.useState)(!1),a=e=>{n===e.id&&Ey(null),Tv(e.id)};return(0,K.jsxs)(SB,{children:[(0,K.jsxs)(CB,{className:`flex flex-row items-start justify-between gap-3`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(wB,{children:`Devices`}),(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Other machines running The Framework that you can run a session on. Saved in this browser, not on the server, because each one is reached with its own token.`})]}),(0,K.jsx)(q,{size:`sm`,variant:`outline`,className:`shrink-0 whitespace-nowrap`,onClick:()=>i(!0),children:`Add device`})]}),(0,K.jsx)(TB,{children:e.length===0?(0,K.jsx)(`p`,{className:`py-2 text-sm text-muted-foreground`,children:`No devices saved. Add one with the URL another machine prints when it starts.`}):(0,K.jsx)(`ul`,{className:`divide-y divide-border`,children:e.map(e=>(0,K.jsxs)(`li`,{className:`flex items-center justify-between gap-4 py-3 first:pt-0 last:pb-0`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`p`,{className:`truncate text-sm`,children:e.label}),(0,K.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:e.url})]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3`,children:[(0,K.jsx)(fV,{state:t[e.id]}),(0,K.jsxs)(Z,{children:[(0,K.jsx)(Q,{render:(0,K.jsx)(q,{size:`sm`,variant:`ghost`,onClick:()=>a(e),"aria-label":`Remove ${e.label}`}),children:(0,K.jsx)(ca,{className:`h-4 w-4`,"aria-hidden":!0})}),(0,K.jsxs)(f_,{children:[`Remove `,e.label]})]})]})]},e.id))})}),r&&(0,K.jsx)(az,{onClose:()=>i(!1),onAdded:()=>i(!1)})]})}function fV({state:e}){let t=e===`online`?`Online`:e===`offline`?`Offline`:`Checking…`;return(0,K.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,K.jsx)(`span`,{"aria-hidden":!0,className:G(`h-1.5 w-1.5 rounded-full`,e===`online`?`bg-[var(--color-primary)]`:`bg-muted-foreground/40`)}),t]})}function pV({onAgentStarted:e}){let t=hn(),n=Pz(),r=vn(t),{main:i}=ez(t),a=$v(),o=sy(),s=o===null||o.discordWebhook,c=a===`denied`,[l,u]=(0,v.useState)(!1);return(0,K.jsxs)(wg,{className:`min-h-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`mx-auto max-w-4xl space-y-6 p-6`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h1`,{className:`text-xl font-semibold`,children:`Settings`}),(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Your defaults, everywhere. A repo can override them in its own the-framework.yml.`})]}),(0,K.jsx)(VB,{onAgentStarted:e}),(0,K.jsxs)(mV,{title:`Appearance`,children:[(0,K.jsx)(vV,{label:`Theme`,description:`Follow the system, or pin light or dark.`,value:r,options:[{value:`system`,label:`System`},{value:`light`,label:`Light`},{value:`dark`,label:`Dark`}],onChange:e=>fn({theme:e})}),(0,K.jsx)(vV,{label:`Editor`,description:`Which editor “Open in editor” launches.`,value:t.editor??``,options:[{value:``,label:`Auto-detect`},...n.map(e=>({value:e.bin,label:e.label}))],onChange:e=>fn({editor:e})})]}),(0,K.jsxs)(mV,{title:`Agent`,children:[(0,K.jsx)(vV,{label:`Agent`,description:`Which coding agent runs the work.`,value:t.driver??y[0],options:y.map(e=>({value:e,label:x[e]})),onChange:e=>fn({driver:e})}),(0,K.jsx)(yV,{label:`Model`,description:`Passed through to the agent. Empty uses the agent's own default.`,value:t.model??``,placeholder:`the agent's default`,onChange:e=>fn({model:e})}),(0,K.jsx)(vV,{label:`Run on`,description:`Where an agent executes: this machine, a fresh GitHub Actions runner, or a Claude Code cloud session.`,value:t.target??`local`,options:[{value:`local`,label:uy.local},{value:`actions`,label:uy.actions},{value:`web`,label:uy.web}],onChange:e=>fn({target:e})})]}),(0,K.jsx)(dV,{}),(0,K.jsx)(mV,{title:`Run options`,description:`What a new agent starts with. The launcher's gear shows the same options, and an agent's own action bar can still change its ending.`,children:i.map(e=>(0,K.jsx)(gV,{row:e},e.key))}),(0,K.jsxs)(mV,{title:`Notifications`,children:[(0,K.jsx)(_V,{label:`Browser`,description:c?`Blocked in your browser settings`:`Desktop notifications while the dashboard is open.`,checked:(t.notifyBrowser??!0)&&!c,disabled:c,onChange:e=>fn({notifyBrowser:e})}),(0,K.jsx)(_V,{label:`Discord`,description:s?`Deliver to Discord, so notifications reach you with no dashboard open.`:`Not configured — no webhook is set on the daemon`,checked:t.notifyDiscord??!1,onChange:e=>fn({notifyDiscord:e}),action:(0,K.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>u(!0),children:o?.discordWebhook?`Webhook`:`Set up`})}),(0,K.jsx)(_V,{label:`Human Queue`,description:`An agent awaiting your answer, or a PR ready to review.`,checked:t.notifyHumanIntervention??!0,onChange:e=>fn({notifyHumanIntervention:e})}),(0,K.jsx)(_V,{label:`New activity`,description:`Also ping when an agent starts or finishes.`,checked:t.notifyNewActivity??!1,onChange:e=>fn({notifyNewActivity:e})})]}),(0,K.jsxs)(mV,{title:`Automation`,children:[(0,K.jsx)(_V,{label:`Auto PM`,description:`Start queued work on its own while there is quota left in the week.`,checked:t.autoPm??!1,onChange:e=>fn({autoPm:e})}),(0,K.jsx)(bV,{label:`Spend offset`,description:`How far unattended work sits from the quota boundary, in percentage points (max 50). Negative holds it back; positive lets it borrow from the days ahead.`,value:Math.round((t.autoSpendOffset??7.142857142857143)*10)/10,min:-50,max:50,onChange:e=>fn({autoSpendOffset:e})})]}),(0,K.jsxs)(mV,{title:`Claude web`,description:`A Claude web agent hands off and ends, so the questions its session asks never reach this dashboard. The browser bridge carries them back.`,children:[(0,K.jsx)(_V,{label:`Browser bridge`,description:`Opens one route on this daemon that a browser extension can reach, guarded by the token below.`,checked:t.bridge??!1,onChange:e=>fn({bridge:e})}),(0,K.jsx)(uV,{enabled:t.bridge??!1,onChange:e=>fn({bridge:e})})]})]}),(0,K.jsx)(zB,{open:l,onOpenChange:u,channels:o,onSaved:oy})]})}function mV({title:e,description:t,children:n}){return(0,K.jsxs)(SB,{children:[(0,K.jsxs)(CB,{children:[(0,K.jsx)(wB,{children:e}),t&&(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t})]}),(0,K.jsx)(TB,{children:(0,K.jsx)(`div`,{className:`divide-y divide-border`,children:n})})]})}function hV({label:e,description:t,control:n,dimmed:r=!1}){return(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-3 first:pt-0 last:pb-0`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`p`,{className:G(`text-sm`,r&&`text-muted-foreground`),children:e}),(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t})]}),(0,K.jsx)(`div`,{className:`shrink-0`,children:n})]})}function gV({row:e}){let t=e.disabled??!1;return(0,K.jsx)(hV,{label:e.label,description:(t?e.disabledReason:e.description)??e.description??``,dimmed:t,control:(0,K.jsx)(wc,{checked:e.checked,disabled:t,onCheckedChange:t=>fn(e.patch(t===!0)),"aria-label":e.label})})}function _V({label:e,description:t,checked:n,onChange:r,disabled:i=!1,action:a}){return(0,K.jsx)(hV,{label:e,description:t,dimmed:i,control:(0,K.jsxs)(`span`,{className:`flex items-center gap-2`,children:[a,(0,K.jsx)(wc,{checked:n,disabled:i,onCheckedChange:e=>r(e===!0),"aria-label":e})]})})}function vV({label:e,description:t,value:n,options:r,onChange:i}){return r.length===0?null:(0,K.jsx)(hV,{label:e,description:t,control:(0,K.jsx)(`select`,{value:n,onChange:e=>i(e.target.value),"aria-label":e,className:`rounded-md border border-border bg-background px-2 py-1 text-sm`,children:r.map(e=>(0,K.jsx)(`option`,{value:e.value,children:e.label},e.value))})})}function yV({label:e,description:t,value:n,placeholder:r,onChange:i}){return(0,K.jsx)(hV,{label:e,description:t,control:(0,K.jsx)(`input`,{type:`text`,value:n,placeholder:r,onChange:e=>i(e.target.value),"aria-label":e,className:`w-48 rounded-md border border-border bg-background px-2 py-1 text-sm`})})}function bV({label:e,description:t,value:n,min:r,max:i,onChange:a}){return(0,K.jsx)(hV,{label:e,description:t,control:(0,K.jsx)(`input`,{type:`number`,value:n,min:r,max:i,onChange:e=>a(Math.min(Math.max(Math.round(Number(e.target.value)||0),r),i)),"aria-label":e,className:`w-24 rounded-md border border-border bg-background px-2 py-1 text-sm`})})}function xV(e){if(e===void 0)return;let t=Number.parseInt(e,10);return Number.isNaN(t)?void 0:t}function SV(e){let t=xV(e);return t===void 0?`text-muted-foreground`:t>=8?`text-danger`:t>=5?`text-warning`:`text-muted-foreground`}function CV(e){return e.flatMap(e=>e.tickets.map(t=>({projectId:e.projectId,projectName:e.projectName,ticket:t})))}var wV=[{id:`critical`,label:`Critical`,min:8,max:10},{id:`medium`,label:`Medium`,min:5,max:7},{id:`low`,label:`Low`,min:0,max:4}],TV=[{id:`trivial`,label:`Trivial`,min:0,max:2},{id:`moderate`,label:`Moderate`,min:3,max:5},{id:`large`,label:`Large`,min:6,max:10}],EV=[{id:`low`,label:`Low`,min:0,max:2},{id:`medium`,label:`Medium`,min:3,max:5},{id:`high`,label:`High`,min:6,max:10}],DV=[{id:`unplanned`,label:`Unplanned`},{id:`planned`,label:`Planned`},{id:`claimed`,label:`Claimed`}],OV={buckets:[],range:null,none:!1};function kV(){return{filters:{q:``,priority:{...OV},effort:{...OV},uncertainty:{...OV},topics:[],topicsNone:!1,stage:[],projects:[],unlinked:!1},sort:{key:`date`,dir:`desc`},group:`project`}}function AV(e){return e.q.trim()!==``||jV(e.priority)||jV(e.effort)||jV(e.uncertainty)||e.topics.length>0||e.topicsNone||e.stage.length>0||e.projects.length>0||e.unlinked}function jV(e){return e.buckets.length>0||e.range!==null||e.none}function MV(e){return(e.topics??[]).map(e=>e.toLowerCase())}function NV(e,t,n){return jV(t)?e===void 0?t.none:t.buckets.some(t=>PV(e,t,n))?!0:t.range!==null&&e>=t.range[0]&&e<=t.range[1]:!0}function PV(e,t,n){let r=n.find(e=>e.id===t);return r!==void 0&&e>=r.min&&e<=r.max}function FV(e,t){return t===`unplanned`?!e.planned:t===`planned`?e.planned:e.locked===!0}function IV(e,t){let n=t.trim().toLowerCase().split(/\s+/).filter(Boolean);if(n.length===0)return!0;let r=[e.ticket.title,e.ticket.summary,e.ticket.file,...MV(e.ticket)].join(` `).toLowerCase();return n.every(e=>r.includes(e))}function LV(e,t){let n=e.ticket;if(!IV(e,t.q)||!NV(xV(n.priority),t.priority,wV)||!NV(n.effort,t.effort,TV)||!NV(n.uncertainty,t.uncertainty,EV))return!1;if(t.topics.length>0||t.topicsNone){let e=MV(n);if(!(t.topics.some(t=>e.includes(t))||t.topicsNone&&e.length===0))return!1}return!(t.stage.length>0&&!t.stage.some(e=>FV(n,e))||t.projects.length>0&&!t.projects.includes(e.projectId)||t.unlinked&&n.github!==void 0)}function RV(e,t){return e.filter(e=>LV(e,t))}function zV(e,t){return t===`date`?e.ticket.date:t===`priority`?xV(e.ticket.priority):t===`title`?e.ticket.title.toLowerCase():e.ticket.effort}function BV(e,t){let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=zV(e,t.key),a=zV(r,t.key);if(i!==a){if(i===void 0)return 1;if(a===void 0)return-1;let e=typeof i==`string`?i.localeCompare(a):i-a;if(e!==0)return e*n}return r.ticket.date.localeCompare(e.ticket.date)})}var VV={date:`desc`,priority:`desc`,title:`asc`,effort:`asc`};function HV(e){return{key:e,dir:VV[e]}}function UV(e,t){let n=t.filter(t=>e.buckets.includes(t.id)).sort((e,t)=>e.min-t.min);if(n.length===0)return null;for(let e=1;e<n.length;e++)if(n[e].min>n[e-1].max+1)return null;return[n[0].min,n[n.length-1].max]}function WV(e,t){return{buckets:e.buckets.includes(t)?e.buckets.filter(e=>e!==t):[...e.buckets,t],range:null,none:e.none}}function GV(e,t){return{buckets:[],range:t,none:e.none}}function KV(e,t){return{...e,none:t}}function qV(e,t){return e.includes(t)?e.filter(e=>e!==t):[...e,t]}function JV(e,t,n){return RV(e,{...t,...n})}function YV(e,t,n,r){let i=JV(e,t,{[n]:{...OV}}),a=e=>n===`priority`?xV(e.priority):n===`effort`?e.effort:e.uncertainty,o={};for(let e of r)o[e.id]=i.filter(t=>{let n=a(t.ticket);return n!==void 0&&n>=e.min&&n<=e.max}).length;return{buckets:o,none:i.filter(e=>a(e.ticket)===void 0).length}}function XV(e,t){let n=JV(e,t,{topics:[],topicsNone:!1}),r=new Map;for(let e of n)for(let t of new Set(MV(e.ticket)))r.set(t,(r.get(t)??0)+1);for(let e of t.topics)r.has(e)||r.set(e,0);return{topics:[...r.entries()].sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])),none:n.filter(e=>MV(e.ticket).length===0).length}}function ZV(e,t){let n=JV(e,t,{stage:[]});return{unplanned:n.filter(e=>FV(e.ticket,`unplanned`)).length,planned:n.filter(e=>FV(e.ticket,`planned`)).length,claimed:n.filter(e=>FV(e.ticket,`claimed`)).length}}function QV(e,t){let n=JV(e,t,{projects:[]}),r={};for(let e of n)r[e.projectId]=(r[e.projectId]??0)+1;return r}function $V(e,t){return JV(e,t,{unlinked:!1}).filter(e=>e.ticket.github===void 0).length}var eH=/^(\d{1,2})-(\d{1,2})$/;function tH(e,t){let n={...OV};if(!e)return n;for(let r of e.split(`,`))if(r===`none`)n.none=!0;else if(t.some(e=>e.id===r))n.buckets=[...n.buckets,r];else{let e=eH.exec(r);if(e){let[t,r]=[Number(e[1]),Number(e[2])];t<=r&&r<=10&&(n.range=[t,r])}}return n}function nH(e){let t=[...e.buckets];return e.range&&t.push(`${e.range[0]}-${e.range[1]}`),e.none&&t.push(`none`),t.join(`,`)}var rH=[`date`,`priority`,`title`,`effort`];function iH(e){let t=new URLSearchParams(e),n=kV();n.filters.q=t.get(`q`)??``,n.filters.priority=tH(t.get(`priority`),wV),n.filters.effort=tH(t.get(`effort`),TV),n.filters.uncertainty=tH(t.get(`uncertainty`),EV);let r=(t.get(`topics`)??``).split(`,`).filter(Boolean);n.filters.topicsNone=r.includes(`none`),n.filters.topics=r.filter(e=>e!==`none`).map(e=>e.toLowerCase()),n.filters.stage=(t.get(`stage`)??``).split(`,`).filter(e=>DV.some(t=>t.id===e)),n.filters.projects=(t.get(`project`)??``).split(`,`).filter(Boolean),n.filters.unlinked=t.get(`github`)===`unlinked`;let i=t.get(`sort`);i&&rH.includes(i)&&(n.sort.key=i);let a=t.get(`dir`);return n.sort.dir=a===`asc`||a===`desc`?a:VV[n.sort.key],t.get(`group`)===`none`&&(n.group=`none`),n}function aH(e){let t=new URLSearchParams,n=e.filters;n.q.trim()&&t.set(`q`,n.q.trim());for(let[e,r]of[[`priority`,n.priority],[`effort`,n.effort],[`uncertainty`,n.uncertainty]]){let n=nH(r);n&&t.set(e,n)}let r=[...n.topics,...n.topicsNone?[`none`]:[]];return r.length&&t.set(`topics`,r.join(`,`)),n.stage.length&&t.set(`stage`,n.stage.join(`,`)),n.projects.length&&t.set(`project`,n.projects.join(`,`)),n.unlinked&&t.set(`github`,`unlinked`),e.sort.key!==`date`&&t.set(`sort`,e.sort.key),e.sort.dir!==VV[e.sort.key]&&t.set(`dir`,e.sort.dir),e.group===`none`&&t.set(`group`,`none`),t.toString()}function oH(e,t,n=(e,t)=>e===t){return e.length===t.length&&e.every((e,r)=>n(e,t[r]))}function sH(e,t){return e-t}function cH(e,t,n){let r=e.slice();return r[t]=n,r.sort(sH)}function lH(e,t,n,r,i,a){let o=e;return o=fg(o,n,r),i&&(o=cH(a,t,fg(o,a[t-1]||-1/0,a[t+1]||1/0))),o}function uH(e,t,n){if(!Array.isArray(e))return!0;let r=e.reduce((e,t,n,r)=>(n===r.length-1||e.push(Math.abs(t-r[n+1])),e),[]);return Math.min(...r)>=t*n}var dH={activeThumbIndex:()=>null,max:()=>null,min:()=>null,minStepsBetweenValues:()=>null,step:()=>null,values:()=>null},fH=v.createContext(void 0);function pH(){let e=v.useContext(fH);if(e===void 0)throw Error(uo(62));return e}function mH(e){return`key`in e?Xs:Ks}function hH(e,t){return typeof e==`number`&&typeof t==`number`?e===t:Array.isArray(e)&&Array.isArray(t)?oH(e,t):!1}var gH=v.forwardRef(function(e,t){let{"aria-labelledby":n,className:r,defaultValue:i,disabled:a=!1,id:o,format:s,largeStep:c=10,locale:l,render:u,max:d=100,min:f=0,minStepsBetweenValues:p=0,name:m,onValueChange:h,onValueCommitted:g,orientation:_=`horizontal`,step:y=1,thumbCollisionBehavior:b=`push`,thumbAlignment:x=`center`,value:S,...C}=e,w=Go(o),T=J(h),E=J(g),{clearErrors:D}=ks(),{state:O,disabled:k,name:A,setTouched:j,setDirty:M,validityData:N,shouldValidateOnChange:P,validation:F}=ws(),{labelId:I}=Ns(),L=n??I,R=k||a,z=A??m,[B,ee]=Ga({controlled:S,default:i??f,name:`Slider`}),V=v.useRef(null),H=v.useRef(null),te=v.useRef([]),U=v.useRef(null),W=v.useRef(null),ne=v.useRef(-1),re=v.useRef(null),ie=v.useRef(null),ae=v.useRef(`none`),oe=sc(s),[se,ce]=v.useState(-1),[le,ue]=v.useState(-1),[de,fe]=v.useState(!1),[pe,me]=v.useState(()=>new Map),[he,ge]=v.useState([void 0,void 0]),_e=J(e=>{ce(e),e!==-1&&ue(e)});js({id:w,commit:F.commit,value:B,controlRef:H,name:z,getValue:()=>B}),ic(B,()=>{D(z),P()?F.commit(B):F.commit(B,!0);let e=N.initialValue,t;t=Array.isArray(B)&&Array.isArray(e)?!oH(B,e):B!==e,M(t)});let ve=J(e=>{e&&(H.current=e)}),ye=Array.isArray(B),be=v.useMemo(()=>ye?B.slice().sort(sH):[fg(B,f,d)],[d,f,ye,B]),xe=J((e,t)=>{if(Number.isNaN(e)||hH(e,B))return;let n=t??nc(`none`,void 0,void 0,{activeThumbIndex:-1});ae.current=n.reason;let r=new event.constructor(event.type,event);Object.defineProperty(r,"target",{writable:!0,value:{value:e,name:z}}),n.event=r,ie.current=e,T(e,n),!n.isCanceled&&ee(e)}),Se=J((e,t,n)=>{let r=lH(e,t,f,d,ye,be);if(uH(r,y,p)){let e=mH(n);xe(r,nc(e,n.nativeEvent,void 0,{activeThumbIndex:t})),j(!0);let i=ie.current??r;E(i,rc(e,n.nativeEvent))}});Y(()=>{let e=Dl(Pd(V.current));R&&e&&V.current?.contains(e)&&e.blur()},[R]),R&&se!==-1&&_e(-1);let Ce=v.useMemo(()=>({...O,activeThumbIndex:se,disabled:R,dragging:de,orientation:_,max:d,min:f,minStepsBetweenValues:p,step:y,values:be}),[O,se,R,de,d,f,p,_,y,be]),we=v.useMemo(()=>({active:se,controlRef:H,disabled:R,dragging:de,validation:F,formatOptionsRef:oe,handleInputChange:Se,indicatorPosition:he,inset:x!==`center`,labelId:L,largeStep:c,lastUsedThumbIndex:le,lastChangedValueRef:ie,lastChangeReasonRef:ae,locale:l,max:d,min:f,minStepsBetweenValues:p,name:z,onValueCommitted:E,orientation:_,pressedInputRef:U,pressedThumbCenterOffsetRef:W,pressedThumbIndexRef:ne,pressedValuesRef:re,registerFieldControlRef:ve,renderBeforeHydration:x===`edge`,setActive:_e,setDragging:fe,setIndicatorPosition:ge,setValue:xe,state:Ce,step:y,thumbCollisionBehavior:b,thumbMap:pe,thumbRefs:te,values:be}),[se,H,L,R,de,F,oe,Se,he,c,le,ie,ae,l,d,f,p,z,E,_,U,W,ne,re,ve,_e,fe,ge,xe,Ce,y,b,x,pe,te,be]),Te=Io(`div`,e,{state:Ce,ref:[t,V],props:[{"aria-labelledby":L,id:w,role:`group`},F.getValidationProps,C],stateAttributesMapping:dH});return(0,K.jsx)(fH.Provider,{value:we,children:(0,K.jsx)(gh,{elementsRef:te,onMapChange:me,children:Te})})}),_H=new Map;function vH(e,t){let n=JSON.stringify({locale:e,options:t}),r=_H.get(n);if(r)return r;let i=new Intl.NumberFormat(e,t);return _H.set(n,i),i}function yH(e,t,n){return e==null?``:vH(t,n).format(e)}function bH(e){let t=e.getBoundingClientRect();return{x:(t.left+t.right)/2,y:(t.top+t.bottom)/2}}function xH(e){if(Math.abs(e)<1){let t=e.toExponential().split(`e-`),n=t[0].split(`.`)[1];return(n?n.length:0)+parseInt(t[1],10)}let t=e.toString().split(`.`)[1];return t?t.length:0}function SH(e,t,n){let r=Math.round((e-n)/t)*t+n;return Number(r.toFixed(xH(t)))}function CH({values:e,index:t,nextValue:n,min:r,max:i,step:a,minStepsBetweenValues:o,initialValues:s}){if(e.length===0)return[];let c=e.slice(),l=a*o,u=c.length-1,d=s??e;c[t]=fg(n,r+t*l,i-(u-t)*l);for(let e=t+1;e<=u;e+=1){let t=c[e-1]+l,n=i-(u-e)*l,r=d[e]??c[e],a=Math.max(c[e],t);r<a&&(a=Math.max(r,t)),c[e]=fg(a,t,n)}for(let e=t-1;e>=0;--e){let t=c[e+1]-l,n=r+e*l,i=d[e]??c[e],a=Math.min(c[e],t);i>a&&(a=Math.min(i,t)),c[e]=fg(a,n,t)}for(let e=0;e<=u;e+=1)c[e]=Number(c[e].toFixed(12));return c}function wH({behavior:e,values:t,currentValues:n,initialValues:r,pressedIndex:i,nextValue:a,min:o,max:s,step:c,minStepsBetweenValues:l}){let u=n??t,d=r??t;if(!(u.length>1))return{value:a,thumbIndex:0,didSwap:!1};let f=c*l;switch(e){case`swap`:{let e=u[i],t=1e-7,n=u.slice(),r=n[i-1],p=n[i+1],m=fg(a,r==null?o:r+f,p==null?s:p-f),h=Number(m.toFixed(12));n[i]=h;let g=a>e,_=a<e,v=g&&p!=null&&a>=p-t,y=_&&r!=null&&a<=r+t;if(!v&&!y)return{value:n,thumbIndex:i,didSwap:!1};let b=v?i+1:i-1,x=n.map((e,t)=>t===i?h:d[t]??u[t]),S=a;S=v?Math.max(a,n[b]):Math.min(a,n[b]);let C=CH({values:n,index:b,nextValue:S,min:o,max:s,step:c,minStepsBetweenValues:l,initialValues:x}),w=v?b-1:b+1;if(w>=0&&w<C.length){let e=C[w-1],t=C[w+1],n=e==null?o:e+f;n=Math.max(n,o+w*f);let r=t==null?s:t-f;r=Math.min(r,s-(C.length-1-w)*f);let i=fg(h,n,r);C[w]=Number(i.toFixed(12))}return{value:C,thumbIndex:b,didSwap:!0}}case`push`:return{value:CH({values:u,index:i,nextValue:a,min:o,max:s,step:c,minStepsBetweenValues:l}),thumbIndex:i,didSwap:!1};default:{let e=u.slice(),t=e[i-1],n=e[i+1],r=fg(a,t==null?o:t+f,n==null?s:n-f);return e[i]=Number(r.toFixed(12)),{value:e,thumbIndex:i,didSwap:!1}}}}var TH=2;function EH(e,t){if(!e)return{start:0,end:0};function n(e){let t=e==null?0:parseFloat(e);return Number.isNaN(t)?0:t}let r=t?`Top`:`InlineStart`,i=t?`Bottom`:`InlineEnd`;return{start:n(e[`border${r}Width`])+n(e[`padding${r}`]),end:n(e[`border${i}Width`])+n(e[`padding${i}`])}}function DH(e,t){if(t.current!=null&&e.changedTouches){let n=e;for(let e=0;e<n.changedTouches.length;e+=1){let r=n.changedTouches[e];if(r.identifier===t.current)return{x:r.clientX,y:r.clientY}}return null}return{x:e.clientX,y:e.clientY}}var OH=v.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{disabled:a,dragging:o,validation:s,inset:c,lastChangedValueRef:l,lastChangeReasonRef:u,max:d,min:f,minStepsBetweenValues:p,onValueCommitted:m,orientation:h,pressedInputRef:g,pressedThumbCenterOffsetRef:_,pressedThumbIndexRef:y,pressedValuesRef:b,registerFieldControlRef:x,renderBeforeHydration:S,setActive:C,setDragging:w,setValue:T,state:E,step:D,thumbCollisionBehavior:O,thumbRefs:k,values:A}=pH(),j=oh(),M=A.length>1,N=h===`vertical`,P=v.useRef(null),F=v.useRef(null),I=J(e=>{e&&F.current==null&&(F.current??=getComputedStyle(e))}),L=v.useRef(null),R=v.useRef(0),z=v.useRef(0),B=sc(A),ee=J(e=>{y.current!==e&&(y.current=e);let t=k.current[e];if(!t){_.current=null,g.current=null;return}g.current=t.querySelector(`input[type="range"]`)}),V=J(e=>{let t=P.current;if(!t)return null;let{width:n,height:r,bottom:i,left:a,right:o}=t.getBoundingClientRect(),s=EH(F.current,N),c=z.current,l=(N?r:n)-s.start-s.end-c*2,u=_.current??0,m=e.x-u,h=e.y-u,g=fg(((N?i-h-s.end:(j===`rtl`?o-m:m-a)-s.start)-c)/l,0,1),v=(d-f)*g+f;if(v=SH(v,D,f),v=fg(v,f,d),!M)return{value:v,thumbIndex:0,didSwap:!1};let x=y.current;if(x<0)return null;let S=wH({behavior:O,values:A,currentValues:B.current??A,initialValues:b.current,pressedIndex:x,nextValue:v,min:f,max:d,step:D,minStepsBetweenValues:p});return O===`swap`&&S.didSwap?ee(S.thumbIndex):y.current=S.thumbIndex,S}),H=J(e=>{b.current=M?A.slice():null,B.current=A;let t=y.current,n=t;if(t>-1&&t<A.length){if(A[t]===d){let e=t;for(;e>0&&A[e-1]===d;)--e;n=e}}else{let t=N?`y`:`x`,r;n=-1;for(let i=0;i<k.current.length;i+=1){let a=k.current[i];if(Zo(a)){let o=bH(a),s=Math.abs(e[t]-o[t]);(r===void 0||s<=r)&&(n=i,r=s)}}}if(n>-1&&n!==t&&ee(n),c){let e=k.current[n];if(Zo(e)){let t=e.getBoundingClientRect();z.current=t[N?`height`:`width`]/2}}}),te=J(e=>{k.current?.[e]?.querySelector(`input[type="range"]`)?.focus({preventScroll:!0})}),U=J(e=>{let t=DH(e,L);if(t==null)return;if(R.current+=1,e.type===`pointermove`&&e.buttons===0){W(e);return}let n=V(t);n!=null&&uH(n.value,D,p)&&(!o&&R.current>TH&&w(!0),T(n.value,nc(Zs,e,void 0,{activeThumbIndex:n.thumbIndex})),B.current=Array.isArray(n.value)?n.value:[n.value],n.didSwap&&te(n.thumbIndex))});function W(e){C(-1),w(!1),g.current=null,_.current=null,y.current=-1;let t=DH(e,L),n=t==null?null:V(t);if(n!=null){let t=u.current;s.commit(l.current??n.value),m(l.current??n.value,rc(t,e))}`pointerType`in e&&P.current?.hasPointerCapture(e.pointerId)&&P.current?.releasePointerCapture(e.pointerId),L.current=null,b.current=null,re()}let ne=J(e=>{if(a)return;let t=e.changedTouches[0];t!=null&&(L.current=t.identifier);let n=DH(e,L);if(n!=null){H(n);let t=V(n);if(t==null)return;te(t.thumbIndex),T(t.value,nc(Gs,e,void 0,{activeThumbIndex:t.thumbIndex})),B.current=Array.isArray(t.value)?t.value:[t.value],t.didSwap&&te(t.thumbIndex)}R.current=0;let r=Pd(P.current);r.addEventListener(`touchmove`,U,{passive:!0}),r.addEventListener(`touchend`,W,{passive:!0})}),re=J(()=>{let e=Pd(P.current);e.removeEventListener(`pointermove`,U),e.removeEventListener(`pointerup`,W),e.removeEventListener(`touchmove`,U),e.removeEventListener(`touchend`,W),b.current=null}),ie=mc();return v.useEffect(()=>{let e=P.current;return e?(e.addEventListener(`touchstart`,ne,{passive:!0}),()=>{e.removeEventListener(`touchstart`,ne),ie.cancel(),re()}):()=>re()},[re,ne,P,ie]),v.useEffect(()=>{a&&re()},[a,re]),Io(`div`,e,{state:E,ref:[t,x,P,I],props:[{"data-base-ui-slider-control":S?``:void 0,onPointerDown(e){let t=P.current;if(!t||a||e.defaultPrevented||!Zo(e.target)||e.button!==0)return;let n=DH(e,L);if(n!=null){H(n);let r=V(n);if(r==null)return;Ol(k.current[r.thumbIndex],Dl(Pd(t)))?e.preventDefault():ie.request(()=>{te(r.thumbIndex)}),w(!0),_.current??(T(r.value,nc(Gs,e.nativeEvent,void 0,{activeThumbIndex:r.thumbIndex})),B.current=Array.isArray(r.value)?r.value:[r.value],r.didSwap&&te(r.thumbIndex))}e.nativeEvent.pointerId&&t.setPointerCapture(e.nativeEvent.pointerId),R.current=0;let r=Pd(P.current);r.addEventListener(`pointermove`,U,{passive:!0}),r.addEventListener(`pointerup`,W,{once:!0})},tabIndex:-1},i],stateAttributesMapping:dH})}),kH=v.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{state:a}=pH();return Io(`div`,e,{state:a,ref:t,props:[{style:{position:`relative`}},i],stateAttributesMapping:dH})});function AH(e,t,n){return(e-t)*100/(n-t)}function jH(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,setControlId:a}=Ns(),o=Go(t);return Y(()=>{if(!(!n&&!t||a===Ha)){if(n){let e=r?.current;Zo(e)&&e.closest(`label`)!=null?a(t??null):a(i??o)}else t&&a(t);return()=>{t&&a(void 0)}}},[t,r,i,a,n,o]),i??o}var MH=function(e){return e.index=`data-index`,e.dragging=`data-dragging`,e.orientation=`data-orientation`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.focused=`data-focused`,e}({}),NH=`PageUp`,PH=`PageDown`,FH=new Set([Wm,Gm,Km,qm,Jm,`End`,NH,PH]);function IH(e,t,n,r){if(!(t<0))return e.length===2?t===0?`${yH(e[t],r,n)} start range`:`${yH(e[t],r,n)} end range`:n?yH(e[t],r,n):void 0}function LH(e,t,n,r,i){return n===1?Math.min(e+t,i):Math.max(e-t,r)}var RH=v.forwardRef(function(e,t){let{render:n,children:r,className:i,"aria-describedby":a,"aria-label":o,"aria-labelledby":s,disabled:c=!1,getAriaLabel:l,getAriaValueText:u,id:d,index:f,inputRef:p,onBlur:m,onFocus:h,onKeyDown:g,tabIndex:_,...y}=e,b=Go(d),{active:x,lastUsedThumbIndex:S,controlRef:C,disabled:w,validation:T,formatOptionsRef:E,handleInputChange:D,inset:O,labelId:k,largeStep:A,locale:j,max:M,min:N,minStepsBetweenValues:P,name:F,orientation:I,pressedInputRef:L,pressedThumbCenterOffsetRef:R,pressedThumbIndexRef:z,renderBeforeHydration:B,setActive:ee,setIndicatorPosition:V,state:H,step:te,values:U}=pH(),W=oh(),ne=c||w,re=U.length>1,ie=I===`vertical`,ae=W===`rtl`,{setTouched:oe,setFocused:se,validationMode:ce}=ws(),le=v.useRef(null),ue=v.useRef(null),de=Go(),fe=jH(),pe=re?de:fe,{ref:me,index:he}=Yc({metadata:v.useMemo(()=>({inputId:pe}),[pe])}),ge=re?f??he:0,_e=ge===U.length-1,ve=U[ge],ye=AH(ve,N,M),[be,xe]=v.useState(!1),[Se,Ce]=v.useState();uc(()=>xe(!0));let we=S>=0&&S<U.length?S:-1,Te=J(()=>{let e=C.current,t=le.current;if(!e||!t)return;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),i=ie?`height`:`width`,a=r[i]-n[i],o=(n[i]/2+a*ye/100)/r[i]*100;Ce(o),ge===0?V(e=>[o,e[1]]):_e&&V(e=>[e[0],o])});Y(()=>{O&&queueMicrotask(Te)},[Te,O]),Y(()=>{O&&Te()},[Te,O,ye]);let Ee=v.useCallback(()=>{let e=ie?`bottom`:`insetInlineStart`,t=ie?`left`:`top`,n;return re?x===ge?n=2:we===ge&&(n=1):x===ge&&(n=1),O?{"--position":`${Se}%`,visibility:B&&!be||Se===void 0?`hidden`:void 0,position:`absolute`,[e]:`var(--position)`,[t]:`50%`,translate:`${(ie||!ae?-1:1)*50}% ${(ie?1:-1)*50}%`,zIndex:n}:Number.isFinite(ye)?{position:`absolute`,[e]:`${ye}%`,[t]:`50%`,translate:`${(ie||!ae?-1:1)*50}% ${(ie?1:-1)*50}%`,zIndex:n}:io},[x,ge,O,be,Se,re,B,ae,we,ye,ie]),De;I===`vertical`&&(De=ae?`vertical-rl`:`vertical-lr`);let Oe=bo({"aria-label":typeof l==`function`?l(ge):o,"aria-labelledby":s??k,"aria-describedby":a,"aria-orientation":I,"aria-valuenow":ve,"aria-valuetext":typeof u==`function`?u(yH(ve,j,E.current??void 0),ve,ge):IH(U,ge,E.current??void 0,j),disabled:ne,id:pe,max:M,min:N,name:F,onChange(e){D(e.target.valueAsNumber,ge,e)},onFocus(){ee(ge),se(!0)},onBlur(){le.current&&(ee(-1),oe(!0),se(!1),ce===`onBlur`&&T.commit(lH(ve,ge,N,M,re,U)))},onKeyDown(e){if(!FH.has(e.key))return;Zm.has(e.key)&&e.stopPropagation();let t=null,n=SH(ve,te,N);switch(e.key){case Wm:t=LH(n,e.shiftKey?A:te,1,N,M);break;case qm:t=LH(n,e.shiftKey?A:te,ae?-1:1,N,M);break;case Gm:t=LH(n,e.shiftKey?A:te,-1,N,M);break;case Km:t=LH(n,e.shiftKey?A:te,ae?1:-1,N,M);break;case NH:t=LH(n,A,1,N,M);break;case PH:t=LH(n,A,-1,N,M);break;case`End`:t=M,re&&(t=Number.isFinite(U[ge+1])?U[ge+1]-te*P:M);break;case Jm:t=N,re&&(t=Number.isFinite(U[ge-1])?U[ge-1]+te*P:N);break;default:break}t!==null&&(D(t,ge,e),e.preventDefault())},step:te,style:{...io,width:`100%`,height:`100%`,writingMode:De},tabIndex:_??void 0,type:`range`,value:ve??``},T.getInputValidationProps),ke=Qa(ue,T.inputRef,p);return Io(`div`,e,{state:H,ref:[t,me,le],props:[{[MH.index]:ge,children:(0,K.jsxs)(v.Fragment,{children:[r,(0,K.jsx)(`input`,{ref:ke,...Oe}),O&&!be&&B&&_e&&(0,K.jsx)(`script`,{dangerouslySetInnerHTML:{__html:'!function(){const t=document.currentScript?.parentElement;if(!t)return;const e=t.closest("[data-base-ui-slider-control]");if(!e)return;const r=e.querySelector("[data-base-ui-slider-indicator]"),i=e.getBoundingClientRect(),n="vertical"===e.getAttribute("data-orientation")?"height":"width",o=e.querySelectorAll(\'input[type="range"]\'),l=o.length>1,s=o.length-1;let a=null,u=null;for(let t=0;t<o.length;t+=1){const e=o[t],y=parseFloat(e.getAttribute("value")??"");if(Number.isNaN(y))return;const c=e.parentElement;if(!c)return;const p=parseFloat(e.getAttribute("max")??"100"),g=parseFloat(e.getAttribute("min")??"0"),b=c?.getBoundingClientRect(),d=i[n]-b[n],m=100*(y-g)/(p-g),v=(b[n]/2+d*m/100)/i[n]*100;c.style.setProperty("--position",`${v}%`),Number.isFinite(v)&&(c.style.removeProperty("visibility"),r&&(0===t?(a=v,r.style.setProperty("--start-position",`${v}%`),l||r.style.removeProperty("visibility")):t===s&&(u=v-(a??0),r.style.setProperty("--end-position",`${v}%`),r.style.setProperty("--relative-size",`${u}%`),r.style.removeProperty("visibility"))))}}();'},suppressHydrationWarning:!0})]}),id:b,onBlur:m,onFocus:h,onPointerDown(e){if(z.current=ge,le.current!=null){let t=I===`horizontal`?`x`:`y`,n=bH(le.current),r=(I===`horizontal`?e.clientX:e.clientY)-n[t];R.current=r}ue.current!=null&&L.current!==ue.current&&(L.current=ue.current)},style:Ee(),suppressHydrationWarning:B||void 0,tabIndex:-1},y],stateAttributesMapping:dH})});function zH(e,t,n,r,i,a){let o=n===void 0||t&&r===void 0?`hidden`:void 0,s=e?`bottom`:`insetInlineStart`,c=e?`height`:`width`,l={visibility:i&&!a?`hidden`:o,position:e?`absolute`:`relative`,[e?`width`:`height`]:`inherit`};return l[`--start-position`]=`${n??0}%`,t?(l[`--relative-size`]=`${(r??0)-(n??0)}%`,l[s]=`var(--start-position)`,l[c]=`var(--relative-size)`,l):(l[s]=0,l[c]=`var(--start-position)`,l)}function BH(e,t,n,r){let i=e?`bottom`:`insetInlineStart`,a=e?`height`:`width`,o={position:e?`absolute`:`relative`,[e?`width`:`height`]:`inherit`};if(!t)return o[i]=0,o[a]=`${n}%`,o;let s=r-n;return o[i]=`${n}%`,o[a]=`${s}%`,o}var VH=v.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{indicatorPosition:a,inset:o,max:s,min:c,orientation:l,renderBeforeHydration:u,state:d,values:f}=pH(),[p,m]=v.useState(!1);uc(()=>m(!0));let h=l===`vertical`,g=f.length>1,_=o?zH(h,g,a[0],a[1],u,p):BH(h,g,AH(f[0],c,s),AH(f[f.length-1],c,s));return Io(`div`,e,{state:d,ref:t,props:[{"data-base-ui-slider-indicator":u?``:void 0,style:_,suppressHydrationWarning:u||void 0},i],stateAttributesMapping:dH})}),HH=`h-3.5 w-3.5 rounded-full border border-primary bg-card shadow-sm outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-primary)] focus-visible:ring-offset-1`;function UH({value:e,onValueChange:t,min:n=0,max:r=10,className:i,"aria-label":a}){return(0,K.jsx)(gH,{value:e,onValueChange:e=>{Array.isArray(e)&&e.length===2&&t([e[0],e[1]])},min:n,max:r,step:1,className:G(`w-full`,i),children:(0,K.jsx)(OH,{className:`flex w-full touch-none select-none items-center py-1.5`,children:(0,K.jsxs)(kH,{className:`relative h-1 w-full rounded-full bg-[var(--color-muted)]`,children:[(0,K.jsx)(VH,{className:`rounded-full bg-primary`}),(0,K.jsx)(RH,{"aria-label":a?`${a} minimum`:`Minimum`,className:HH}),(0,K.jsx)(RH,{"aria-label":a?`${a} maximum`:`Maximum`,className:HH})]})})})}function WH({label:e,count:t,checked:n,onChange:r,tone:i}){return(0,K.jsxs)(`label`,{className:`flex cursor-pointer select-none items-center gap-2 rounded-sm px-1 py-1 text-sm hover:bg-accent/60`,children:[(0,K.jsx)(wc,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":e}),(0,K.jsx)(`span`,{className:G(`min-w-0 flex-1 truncate`,i),children:e}),(0,K.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:t})]})}function GH({label:e,active:t,...n}){return(0,K.jsxs)(q,{variant:`outline`,size:`xs`,...n,className:G(`gap-1`,t>0&&`border-[var(--color-primary)]/50`),children:[e,t>0&&(0,K.jsx)(`span`,{className:`rounded bg-primary/15 px-1 text-[10px] text-primary`,children:t}),(0,K.jsx)(yi,{className:`h-3 w-3 opacity-60`,"aria-hidden":!0})]})}function KH(e){return e.buckets.length+ +!!e.range+ +!!e.none}function qH({label:e,noneLabel:t,buckets:n,filter:r,counts:i,onChange:a}){return(0,K.jsxs)(kz,{children:[(0,K.jsx)(Az,{render:(0,K.jsx)(GH,{label:e,active:KH(r)})}),(0,K.jsxs)(jz,{className:`w-56`,children:[(0,K.jsx)(`div`,{className:`space-y-0.5`,children:n.map(e=>(0,K.jsx)(WH,{label:`${e.label} (${e.min}–${e.max})`,count:i.buckets[e.id]??0,checked:r.buckets.includes(e.id),onChange:()=>a(WV(r,e.id))},e.id))}),(0,K.jsx)(__,{className:`my-2`}),(()=>{let t=UV(r,n),i=r.buckets.length>0&&t===null,o=r.range??t;return(0,K.jsxs)(`div`,{className:G(`px-1`,i&&`opacity-40`),"data-dimmed":i||void 0,title:i?`The selected buckets skip a middle span — dragging the range replaces them`:void 0,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[(0,K.jsxs)(`span`,{children:[`Range: `,o?`${o[0]}–${o[1]}`:i?`not one span`:`any`]}),r.range&&(0,K.jsx)(`button`,{type:`button`,"aria-label":`Clear the ${e.toLowerCase()} range`,onClick:()=>a(GV(r,null)),className:`text-muted-foreground hover:text-foreground`,children:(0,K.jsx)(ua,{className:`h-3 w-3`,"aria-hidden":!0})})]}),(0,K.jsx)(UH,{"aria-label":`${e} range`,value:o??[0,10],onValueChange:e=>a(GV(r,e))})]})})(),(i.none>0||r.none)&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(__,{className:`my-2`}),(0,K.jsx)(WH,{label:t,count:i.none,checked:r.none,onChange:e=>a(KV(r,e))})]})]})]})}function JH({label:e,active:t,children:n}){return(0,K.jsxs)(kz,{children:[(0,K.jsx)(Az,{render:(0,K.jsx)(GH,{label:e,active:t})}),(0,K.jsx)(jz,{className:`w-56`,children:(0,K.jsx)(`div`,{className:`space-y-0.5`,children:n})})]})}var YH={date:`Date`,priority:`Priority`,title:`Title`,effort:`Effort`},XH={date:{desc:`Newest first`,asc:`Oldest first`},priority:{desc:`Highest first`,asc:`Lowest first`},title:{asc:`A to Z`,desc:`Z to A`},effort:{asc:`Easiest first`,desc:`Hardest first`}};function ZH({view:e,rows:t,projects:n,onChange:r}){let i=e.filters,a=t=>r({...e,filters:{...i,...t}}),o=(0,v.useRef)(null),[s,c]=(0,v.useState)(!1);(0,v.useEffect)(()=>{let e=e=>{if(e.key!==`/`||e.metaKey||e.ctrlKey||e.altKey)return;let t=e.target;t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable)||(e.preventDefault(),o.current?.focus())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let l=XV(t,i),u=ZV(t,i),d=$V(t,i),f=t.some(e=>e.ticket.effort!==void 0),p=t.some(e=>e.ticket.uncertainty!==void 0),m=n.length>1?QV(t,i):{},h=AV(i);return(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsxs)(`div`,{className:`relative`,children:[(0,K.jsx)(ta,{className:`pointer-events-none absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground`,"aria-hidden":!0}),(0,K.jsx)(g_,{ref:o,value:i.q,onChange:e=>a({q:e.target.value}),onFocus:()=>c(!0),onBlur:()=>c(!1),placeholder:`Search tickets…`,"aria-label":`Search tickets`,className:`h-7 w-56 pl-7 pr-6 text-xs`}),!s&&i.q===``&&(0,K.jsx)(`kbd`,{className:`pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 rounded border border-border bg-muted/60 px-1 font-mono text-[10px] text-muted-foreground`,children:`/`})]}),(0,K.jsx)(qH,{label:`Priority`,noneLabel:`No priority`,buckets:wV,filter:i.priority,counts:YV(t,i,`priority`,wV),onChange:e=>a({priority:e})}),(l.topics.length>0||l.none>0)&&(0,K.jsxs)(JH,{label:`Topics`,active:i.topics.length+ +!!i.topicsNone,children:[l.topics.map(([e,t])=>(0,K.jsx)(WH,{label:e,count:t,checked:i.topics.includes(e),onChange:()=>a({topics:qV(i.topics,e)})},e)),(l.none>0||i.topicsNone)&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(__,{className:`my-2`}),(0,K.jsx)(WH,{label:`No topics`,count:l.none,checked:i.topicsNone,onChange:e=>a({topicsNone:e})})]})]}),(0,K.jsx)(JH,{label:`Stage`,active:i.stage.length,children:DV.map(e=>(0,K.jsx)(WH,{label:e.label,count:u[e.id],checked:i.stage.includes(e.id),onChange:()=>a({stage:qV(i.stage,e.id)})},e.id))}),(f||KH(i.effort)>0)&&(0,K.jsx)(qH,{label:`Effort`,noneLabel:`No effort`,buckets:TV,filter:i.effort,counts:YV(t,i,`effort`,TV),onChange:e=>a({effort:e})}),(p||KH(i.uncertainty)>0)&&(0,K.jsx)(qH,{label:`Uncertainty`,noneLabel:`No uncertainty`,buckets:EV,filter:i.uncertainty,counts:YV(t,i,`uncertainty`,EV),onChange:e=>a({uncertainty:e})}),n.length>1&&(0,K.jsx)(JH,{label:`Project`,active:i.projects.length,children:n.map(e=>(0,K.jsx)(WH,{label:e.name,count:m[e.id]??0,checked:i.projects.includes(e.id),onChange:()=>a({projects:qV(i.projects,e.id)})},e.id))}),(d>0||i.unlinked)&&(0,K.jsxs)(q,{variant:`outline`,size:`xs`,onClick:()=>a({unlinked:!i.unlinked}),className:G(i.unlinked&&`border-[var(--color-primary)]/50 bg-primary/10`),"aria-pressed":i.unlinked,children:[`Not linked `,(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:d})]}),h&&(0,K.jsxs)(q,{variant:`ghost`,size:`xs`,onClick:()=>r({...e,filters:kV().filters}),children:[(0,K.jsx)(ua,{className:`h-3 w-3`,"aria-hidden":!0}),` Clear`]}),(0,K.jsx)(`div`,{className:`ml-auto flex items-center gap-2`,children:(0,K.jsxs)(kg,{children:[(0,K.jsx)(Ng,{render:(0,K.jsxs)(q,{variant:`outline`,size:`xs`,className:`gap-1`,children:[`Sort: `,YH[e.sort.key],e.sort.dir===`desc`?(0,K.jsx)(ui,{className:`h-3 w-3`,"aria-hidden":!0}):(0,K.jsx)(pi,{className:`h-3 w-3`,"aria-hidden":!0}),(0,K.jsx)(yi,{className:`h-3 w-3 opacity-60`,"aria-hidden":!0})]})}),(0,K.jsxs)(Pg,{children:[Object.keys(YH).map(t=>(0,K.jsxs)(Fg,{closeOnClick:!1,onClick:()=>{e.sort.key!==t&&r({...e,sort:HV(t)})},children:[(0,K.jsx)(`span`,{className:`flex h-3.5 w-3.5 items-center justify-center`,children:e.sort.key===t&&(0,K.jsx)(vi,{className:`h-3.5 w-3.5`,"aria-hidden":!0})}),YH[t]]},t)),(0,K.jsx)(zg,{}),(0,K.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-1.5`,children:[[`asc`,`desc`].map(t=>(0,K.jsx)(`button`,{type:`button`,"aria-label":XH[e.sort.key][t],"aria-pressed":e.sort.dir===t,onClick:()=>r({...e,sort:{...e.sort,dir:t}}),className:G(`flex h-6 w-7 items-center justify-center rounded-sm hover:bg-[var(--color-accent)] hover:text-[var(--color-accent-foreground)]`,e.sort.dir===t&&`bg-[var(--color-accent)] text-[var(--color-accent-foreground)]`),children:t===`asc`?(0,K.jsx)(fi,{className:`h-3.5 w-3.5`,"aria-hidden":!0}):(0,K.jsx)(li,{className:`h-3.5 w-3.5`,"aria-hidden":!0})},t)),(0,K.jsx)(`span`,{className:`ml-1 text-xs text-muted-foreground`,children:XH[e.sort.key][e.sort.dir]})]}),(0,K.jsx)(zg,{}),(0,K.jsx)(Ig,{checked:e.group===`project`,onCheckedChange:()=>r({...e,group:e.group===`project`?`none`:`project`}),children:`Group by project`})]})]})})]})}var QH=qe.updateTickets.render(),$H={};function eU(e){return`Create tickets/${e.replace(/\.md$/,``)}.plan.md`}function tU(e){return`Work on tickets/${e}. Do not start any other ticket.`}function nU({ticket:e,projectName:t,busy:n,onOpen:r,onStartWork:i,onOpenPlan:a,onStartPlan:o,onTopicClick:s,onClaimedClick:c}){return(0,K.jsxs)(`li`,{className:`flex items-stretch transition-colors hover:bg-accent/60`,children:[(0,K.jsx)(`div`,{className:`flex w-10 shrink-0 items-center justify-center`,children:(0,K.jsxs)(Z,{children:[(0,K.jsx)(Q,{render:(0,K.jsx)(`button`,{type:`button`,onClick:i,disabled:n,"aria-label":`Start work on ${e.title}`,className:`text-muted-foreground/50 hover:text-foreground disabled:opacity-50`}),children:(0,K.jsx)(Qi,{className:`h-4 w-4`,"aria-hidden":!0})}),(0,K.jsx)(f_,{children:`Spin up an agent working on this ticket`})]})}),(0,K.jsx)(`button`,{type:`button`,onClick:r,className:`flex min-w-0 flex-1 items-center gap-2 py-2 pl-0 pr-3 text-left text-sm`,children:(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium`,children:e.title})}),t&&(0,K.jsx)(`span`,{className:`flex shrink-0 items-center pr-2 text-xs text-muted-foreground`,children:t}),(0,K.jsxs)(`span`,{className:`hidden shrink-0 items-center gap-1.5 sm:flex`,children:[e.topics?.map(e=>s?(0,K.jsx)(`button`,{type:`button`,onClick:()=>s(e),title:`Filter by ${e}`,className:`shrink-0 rounded-full border border-border px-1.5 text-[10px] text-muted-foreground hover:border-foreground/40 hover:text-foreground`,children:e},e):(0,K.jsx)(da,{className:`shrink-0 border-border px-1.5 text-[10px] text-muted-foreground`,children:e},e)),e.locked&&(0,K.jsxs)(Z,{children:[(0,K.jsxs)(Q,{render:c?(0,K.jsx)(`button`,{type:`button`,onClick:c,className:`flex shrink-0 items-center gap-1 text-[10px] text-warning hover:opacity-80`}):(0,K.jsx)(`span`,{className:`flex shrink-0 items-center gap-1 text-[10px] text-warning`}),children:[(0,K.jsx)(zi,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),e.lockedBy&&(0,K.jsx)(`span`,{className:`inline-block max-w-[8rem] truncate`,children:e.lockedBy})]}),(0,K.jsxs)(f_,{children:[`Claimed${e.lockedBy?` by ${e.lockedBy}`:``} — an agent is working on this ticket (planning it or implementing it).`,c?` Click to see all claimed tickets.`:``]})]}),e.effort!==void 0&&(0,K.jsxs)(da,{className:`shrink-0 border-transparent px-1 text-[10px] text-muted-foreground`,children:[`Effort: `,e.effort]}),e.uncertainty!==void 0&&(0,K.jsxs)(da,{className:`shrink-0 border-transparent px-1 text-[10px] text-muted-foreground`,children:[`Uncertainty: `,e.uncertainty]})]}),(0,K.jsx)(`span`,{className:G(`flex w-16 shrink-0 items-center justify-end text-[10px]`,SV(e.priority)),children:e.priority?`Priority: ${e.priority}`:``}),(0,K.jsx)(`span`,{className:`flex w-14 shrink-0 items-center justify-end text-[10px] text-muted-foreground/70`,title:Ca(e.date),children:Ta(e.date)}),(0,K.jsx)(`div`,{className:`flex w-10 shrink-0 items-center justify-center`,children:e.planned?(0,K.jsxs)(Z,{children:[(0,K.jsx)(Q,{render:(0,K.jsx)(`button`,{type:`button`,onClick:()=>a?.(),disabled:!a,"aria-label":`View the plan for ${e.title}`,className:`text-info hover:text-info/80 disabled:pointer-events-none disabled:opacity-50`}),children:(0,K.jsx)(Si,{className:`h-4 w-4`,strokeWidth:2.5,"aria-hidden":!0})}),(0,K.jsx)(f_,{children:`View the plan`})]}):(0,K.jsxs)(Z,{children:[(0,K.jsx)(Q,{render:(0,K.jsx)(`button`,{type:`button`,onClick:o,disabled:n,"aria-label":`Create a plan for ${e.title}`,className:`text-muted-foreground/50 hover:text-foreground disabled:opacity-50`}),children:(0,K.jsx)(Ci,{className:`h-4 w-4`,"aria-hidden":!0})}),(0,K.jsx)(f_,{children:`Plan this ticket — starts an agent to write its plan`})]})}),e.github?(0,K.jsxs)(`a`,{href:e.github.url,target:`_blank`,rel:`noreferrer`,className:`flex w-20 shrink-0 items-center justify-end gap-1 px-3 text-xs text-muted-foreground hover:text-foreground hover:underline`,children:[(0,K.jsx)(Ri,{className:`h-4 w-4`,"aria-hidden":!0}),e.github.label]}):(0,K.jsx)(`span`,{className:`w-20 shrink-0`,"aria-hidden":!0})]})}function rU({projectId:e,tickets:t,loaded:n,hiddenByFilter:r=0,onOpen:i,onOpenPlan:a,onAgentStarted:o,onTopicClick:s,onClaimedClick:c,onClearFilters:l}){let{busy:u,error:d,run:f}=Ba(),p=Bv(e?()=>Fr(e):null,$H,[e]);if(!e)return null;if(!n)return(0,K.jsx)(`p`,{className:`p-4 text-sm text-muted-foreground`,children:`Loading…`});let m=async(t,n,r={})=>{let i=await f(()=>Ry(e,t,`prompt`,r),n);i?.ok&&o?.(t,i.agentId)},h=()=>m(QH,`The update could not be started.`,{unattended:!0}),g=e=>m(eU(e),`The planning agent could not be started.`),_=e=>m(tU(e),`The work agent could not be started.`,{unattended:!0,ticket:`tickets/${e}`});return t.length===0&&r>0?(0,K.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border border-border p-4 text-sm`,children:[(0,K.jsxs)(`p`,{className:`text-muted-foreground`,children:[r,` ticket`,r===1?``:`s`,` hidden by the current filters.`]}),l&&(0,K.jsx)(q,{variant:`outline`,size:`xs`,onClick:l,children:`Clear filters`})]}):t.length===0?(0,K.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-border p-4 text-sm`,children:[(0,K.jsxs)(`p`,{className:`text-muted-foreground`,children:[`No tickets yet. Tickets live in `,(0,K.jsx)(`code`,{className:`rounded bg-muted px-1`,children:`tickets/`}),` and are what the agent plans from.`]}),d&&(0,K.jsx)(`p`,{className:`text-xs text-danger`,children:d}),(0,K.jsx)(q,{size:`sm`,variant:`outline`,disabled:u,onClick:()=>void h(),children:u?`Starting…`:`Update from GitHub`})]}):(0,K.jsxs)(`div`,{className:`overflow-hidden rounded-lg border border-border`,children:[d&&(0,K.jsx)(`p`,{className:`border-b border-border p-2 text-xs text-danger`,children:d}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border bg-muted/40 px-2 py-1.5`,children:[(0,K.jsx)(`span`,{className:`min-w-0 truncate text-xs text-muted-foreground`,children:p.lastImportedAt?`Updated from GitHub ${Da(p.lastImportedAt)}`:`No record of an import yet`}),(0,K.jsxs)(Z,{children:[(0,K.jsxs)(Q,{render:(0,K.jsx)(q,{variant:`outline`,size:`sm`,className:`h-6 shrink-0 gap-1 px-2 text-xs`,disabled:u,onClick:()=>void h()}),children:[(0,K.jsx)(ea,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),u?`Starting…`:`Update from GitHub`]}),(0,K.jsx)(f_,{children:p.lastImportedAt?`Bring tickets/ up to date with the issues and comments changed since the last import.`:`Bring tickets/ up to date with GitHub. With no import on record, everything open comes across.`})]})]}),(0,K.jsx)(`ul`,{className:`divide-y divide-border`,children:t.map(e=>(0,K.jsx)(nU,{ticket:e,busy:u,onOpen:()=>i(e.file),onStartWork:()=>void _(e.file),onOpenPlan:a?()=>a(e.file):void 0,onStartPlan:()=>void g(e.file),onTopicClick:s,onClaimedClick:c},e.file))})]})}var iU=[];function aU(){return typeof window>`u`?kV():iH(window.location.search)}function oU({onOpenTicket:e,onOpenTicketPlan:t,onAgentStarted:n}){let{value:r,loaded:i}=Vv(Ir,iU,1e4,[]),[a,o]=(0,v.useState)(aU),s=e=>{if(o(e),typeof window<`u`){let t=aH(e);window.history.replaceState(null,``,window.location.pathname+(t?`?${t}`:``))}},c=()=>s({...a,filters:kV().filters}),l=e=>{a.filters.topics.includes(e)||s({...a,filters:{...a.filters,topics:[...a.filters.topics,e]}})},u=()=>{a.filters.stage.includes(`claimed`)||s({...a,filters:{...a.filters,stage:[...a.filters.stage,`claimed`]}})},d=(0,v.useMemo)(()=>CV(r),[r]),f=RV(d,a.filters),p=AV(a.filters),{busy:m,error:h,run:g}=Ba(),_=async(e,t)=>{let r=eU(t),i=await g(()=>Ry(e,r,`prompt`),`The planning agent could not be started.`);i?.ok&&n?.(e,r,i.agentId)},y=async(e,t)=>{let r=tU(t),i=await g(()=>Ry(e,r,`prompt`,{unattended:!0,ticket:`tickets/${t}`}),`The work agent could not be started.`);i?.ok&&n?.(e,r,i.agentId)},b=a.filters.projects.length>0?r.filter(e=>a.filters.projects.includes(e.projectId)):r,x=BV(f,a.sort);return(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,K.jsxs)(`div`,{className:`space-y-2 border-b border-border px-6 py-3`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`h1`,{className:`text-base font-semibold`,children:[`Tickets`,i&&d.length>0&&(0,K.jsxs)(`span`,{className:`ml-2 text-xs font-normal text-muted-foreground`,children:[f.length,`/`,d.length]})]}),(0,K.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Every project's `,(0,K.jsx)(`code`,{className:`rounded bg-muted px-1`,children:`tickets/`}),` backlog — what the agent plans from.`]})]}),(0,K.jsx)(ZH,{view:a,rows:d,projects:r.map(e=>({id:e.projectId,name:e.projectName})),onChange:s})]}),(0,K.jsx)(wg,{className:`min-h-0 flex-1`,children:(0,K.jsx)(`div`,{className:`w-full p-6`,children:i?r.length===0?(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No projects registered yet.`}):a.group===`none`?(0,K.jsxs)(`div`,{className:`space-y-2`,children:[h&&(0,K.jsx)(`p`,{className:`text-xs text-danger`,children:h}),p&&d.length-f.length>0&&(0,K.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-muted-foreground`,children:[(0,K.jsxs)(`span`,{children:[d.length-f.length,` ticket`,d.length-f.length===1?``:`s`,` hidden by the current filters.`]}),(0,K.jsx)(q,{variant:`outline`,size:`xs`,onClick:c,children:`Clear filters`})]}),x.length===0?(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:d.length===0?`No tickets in any project yet — group by project to import from GitHub.`:`No tickets match.`}):(0,K.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-border`,children:(0,K.jsx)(`ul`,{className:`divide-y divide-border`,children:x.map(n=>(0,K.jsx)(nU,{ticket:n.ticket,projectName:n.projectName,busy:m,onOpen:()=>e(n.projectId,n.ticket.file),onStartWork:()=>void y(n.projectId,n.ticket.file),onOpenPlan:t?()=>t(n.projectId,n.ticket.file):void 0,onStartPlan:()=>void _(n.projectId,n.ticket.file),onTopicClick:l,onClaimedClick:u},`${n.projectId}/${n.ticket.file}`))})})]}):(0,K.jsx)(`div`,{className:`space-y-8`,children:b.map(r=>{let i=f.filter(e=>e.projectId===r.projectId),o=BV(i,a.sort);return(0,K.jsxs)(`section`,{className:`min-w-0 space-y-2`,children:[(0,K.jsx)(`h2`,{className:`truncate text-sm font-semibold`,children:r.projectName}),(0,K.jsx)(rU,{projectId:r.projectId,tickets:o.map(e=>e.ticket),loaded:!0,hiddenByFilter:r.tickets.length-i.length,onOpen:t=>e(r.projectId,t),onOpenPlan:t?e=>t(r.projectId,e):void 0,onAgentStarted:(e,t)=>n?.(r.projectId,e,t),onTopicClick:l,onClaimedClick:u,onClearFilters:p?c:void 0})]},r.projectId)})}):(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading…`})})})]})}function sU({projectId:e,slug:t,onBack:n}){let{value:r,loaded:i}=Vv(()=>Pr(e,t),null,1e4,[e,t]),[a,o]=(0,v.useState)(!1),{busy:s,error:c,run:l}=Ba(),u=async()=>{r&&(await l(()=>Uy(e,r.title,{file:r.file,...r.priority?{priority:r.priority}:{}}),`The ticket could not be queued.`))?.ok&&o(!0)},[d,f]=(0,v.useState)(!1),p=!!r?.locked&&!d,m=async()=>{r&&(await l(()=>Hy(e,r.file),`The lock could not be released.`))?.ok&&f(!0)};return(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,K.jsx)(`div`,{className:`border-b border-border px-4 py-2`,children:(0,K.jsxs)(q,{variant:`ghost`,size:`sm`,className:`gap-1.5`,onClick:n,children:[(0,K.jsx)(di,{className:`h-4 w-4`}),` Tickets`]})}),(0,K.jsx)(wg,{className:`min-h-0 flex-1`,children:(0,K.jsx)(`div`,{className:`mx-auto max-w-3xl p-6`,children:i?r?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,K.jsx)(`h1`,{className:`text-lg font-semibold`,children:r.title}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[p&&(0,K.jsxs)(q,{size:`sm`,variant:`outline`,disabled:s,onClick:()=>void m(),title:r.lockedBy?`Claimed by ${r.lockedBy}`:void 0,className:`gap-1.5`,children:[(0,K.jsx)(qi,{className:`h-3.5 w-3.5`}),` Release lock`]}),(0,K.jsx)(q,{size:`sm`,variant:`outline`,disabled:s||a,onClick:()=>void u(),className:`gap-1.5`,children:a?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(vi,{className:`h-3.5 w-3.5`}),` Queued`]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Wi,{className:`h-3.5 w-3.5`}),` Queue`]})})]})]}),r.summary&&(0,K.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:r.summary}),(0,K.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5`,children:[(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground/70`,title:Ca(r.date),children:Ta(r.date)}),r.priority&&(0,K.jsxs)(da,{className:G(`border-transparent px-0 text-[10px]`,SV(r.priority)),children:[`Priority: `,r.priority]}),r.github&&(0,K.jsxs)(`a`,{href:r.github.url,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground hover:underline`,children:[(0,K.jsx)(Ri,{className:`h-4 w-4`,"aria-hidden":!0}),r.github.label]}),r.topics?.map(e=>(0,K.jsx)(da,{className:`border-border px-1.5 text-[10px] text-muted-foreground`,children:e},e)),r.planned&&(0,K.jsx)(da,{className:`border-transparent px-0 text-[10px] uppercase`,children:`planned`}),p&&(0,K.jsxs)(da,{className:`border-transparent px-0 text-[10px] text-warning`,children:[(0,K.jsx)(`span`,{className:`uppercase`,children:`claimed`}),r.lockedBy&&(0,K.jsxs)(K.Fragment,{children:[`\xA0· `,r.lockedBy]})]}),r.effort!==void 0&&(0,K.jsxs)(da,{className:`border-transparent px-0 text-[10px] text-muted-foreground`,children:[`Effort: `,r.effort]}),r.uncertainty!==void 0&&(0,K.jsxs)(da,{className:`border-transparent px-0 text-[10px] text-muted-foreground`,children:[`Uncertainty: `,r.uncertainty]}),(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground/70`,children:r.file})]}),c&&(0,K.jsx)(`p`,{className:`mt-2 text-xs text-danger`,children:c}),(0,K.jsx)(`div`,{className:`mt-4`,children:(0,K.jsx)(Jz,{text:r.content})})]}):(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This ticket does not exist.`}):(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading…`})})})]})}var cU=`tickets`;function lU(e){return`${cU}/${e.replace(/\.md$/,``)}.plan.md`}function uU({projectId:e,slug:t,onBack:n}){let r=lU(t),{value:i,loaded:a}=Vv(()=>Jr(e,r),null,1e4,[e,r]);return(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-4 py-2`,children:[(0,K.jsxs)(q,{variant:`ghost`,size:`sm`,className:`gap-1.5`,onClick:n,children:[(0,K.jsx)(di,{className:`h-4 w-4`}),` Tickets`]}),(0,K.jsx)(`span`,{className:`min-w-0 truncate text-xs text-muted-foreground`,children:r})]}),(0,K.jsx)(wg,{className:`min-h-0 flex-1`,children:(0,K.jsx)(`div`,{className:`mx-auto max-w-3xl p-6`,children:a?!i||i.binary?(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This ticket has no plan yet.`}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Jz,{text:i.text}),i.truncated&&(0,K.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`Plan truncated — open the file to read the rest.`})]}):(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading…`})})})]})}function dU(e,t,n=!0){let[r,i]=(0,v.useState)(15e3),{value:a,reload:o,loaded:s}=Vv(n&&t?()=>Zr(e,t):null,null,r,[e,t,n,r],!0);(0,v.useEffect)(()=>i(a?.prPending?1e3:15e3),[a?.prPending]);let{busy:c,error:l,run:u}=Ba(),[d,f]=(0,v.useState)(null);return{handoff:a,loaded:s,busy:c,error:l,pending:d,act:(e,t,n)=>{f(e),u(t,n).then(e=>{f(null),e!==void 0&&o()})}}}function fU(e){let t=e?.sessionId;if(!t)return null;let n=e.workspace;return n?`mkdir -p ${n} && cd ${n} && claude --resume ${t}`:t}function pU(e){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,actionsRef:o,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=y_(),d=!!u,f=qa(()=>s?.store??new N_({open:n??r,activeTriggerId:c===void 0?l:c,modal:!0,disablePointerDismissal:!0,nested:d,role:`alertdialog`})).current;f.useControlledProp(`open`,n,r),f.useControlledProp(`activeTriggerId`,c,l),f.useSyncedValue(`nested`,d),f.useContextCallback(`onOpenChange`,i),f.useContextCallback(`onOpenChangeComplete`,a);let p=f.useState(`payload`);j_({store:f,actionsRef:o,parentContext:u?.store.context,onOpenChange:i,triggerIdProp:c});let m=v.useMemo(()=>({store:f}),[f]);return(0,K.jsx)(v_.Provider,{value:m,children:typeof t==`function`?t({payload:p}):t})}function mU({trigger:e,open:t,onOpenChange:n,title:r,body:i,confirmLabel:a,confirmBusyLabel:o=`Working…`,onConfirm:s,onSuccess:c,fallbackError:l=`Something went wrong.`,destructive:u=!0}){let[d,f]=(0,v.useState)(!1),p=t??d,m=n??f,{busy:h,error:g,run:_,reset:y}=Ba();return(0,K.jsxs)(pU,{open:p,onOpenChange:e=>{h||(m(e),e&&y())},children:[e&&(0,K.jsx)(L_,{render:e}),(0,K.jsxs)(A_,{children:[(0,K.jsx)(x_,{className:`fixed inset-0 z-50 bg-black/40 backdrop-blur-[1px]`}),(0,K.jsxs)(k_,{className:`fixed left-1/2 top-1/2 z-50 w-[min(26rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 rounded-lg border border-border bg-card p-5 text-card-foreground shadow-lg`,children:[(0,K.jsx)(I_,{className:`text-sm font-semibold`,children:r}),(0,K.jsx)(C_,{className:`mt-2 text-xs leading-relaxed text-muted-foreground`,children:i}),g&&(0,K.jsx)(`p`,{className:`mt-2 text-xs text-danger`,children:g}),(0,K.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,K.jsx)(S_,{render:(0,K.jsx)(q,{variant:`outline`,size:`sm`,disabled:h,children:`Cancel`})}),(0,K.jsx)(q,{variant:u?`destructive`:`default`,size:`sm`,disabled:h,onClick:()=>{_(s,l).then(e=>{e!==void 0&&(m(!1),queueMicrotask(()=>c?.()))})},className:G(h&&`cursor-progress`),children:h?o:a})]})]})]})]})}function hU({projectId:e,agentId:t,events:n,label:r,retainedWorktree:i=!1,onWorktreeRemoved:a,onDeleted:o}){let s=ma(n),c=R(n),l=Bz(c),u=s||i,d=fU(c),[f,p]=(0,v.useState)(!1),m=(0,v.useRef)(void 0);(0,v.useEffect)(()=>()=>clearTimeout(m.current),[]);let h=()=>{d&&navigator.clipboard?.writeText(d).then(()=>{p(!0),clearTimeout(m.current),m.current=setTimeout(()=>p(!1),1500)})},g=Bv(()=>Yr(e),null,[e],!0),_=hn().editor,y=Pz(),b=_&&!y.some(e=>e.bin===_)?[...y,{bin:_,label:_}]:y,{busy:x,error:S,reset:C,run:w}=Ba(),[T,E]=(0,v.useState)(!1);(0,v.useEffect)(()=>E(!1),[t]);let D=x||T&&s,[O,k]=(0,v.useState)(!1);(0,v.useEffect)(()=>k(!1),[t]);let[A,j]=(0,v.useState)(!1),M=n=>w(()=>zy(e,n,t??void 0),`Failed to open.`),N=()=>void w(()=>Ay(e,t??void 0).then(()=>!0),`Could not stop the session.`).then(e=>{e&&E(!0)}),P=()=>{t&&w(()=>Vy(e,t),`Could not arm the merge.`).then(e=>{e?.ok&&k(!0)})},F=()=>{t&&w(()=>Iy(e,t),`Could not remove the worktree.`).then(e=>{e!==void 0&&a?.()})},I=r?.trim()||t;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(kg,{children:[(0,K.jsxs)(Z,{children:[(0,K.jsx)(Q,{render:(0,K.jsx)(Ng,{type:`button`,"aria-label":`Session actions`,className:Er({variant:`outline`,size:`icon-sm`})}),children:(0,K.jsx)(Di,{className:`h-3.5 w-3.5`})}),(0,K.jsx)(f_,{children:`Session actions`})]}),(0,K.jsxs)(Pg,{align:`end`,className:`min-w-[14rem]`,children:[g&&(0,K.jsxs)(Fg,{render:(0,K.jsx)(`a`,{href:g,target:`_blank`,rel:`noreferrer`}),children:[(0,K.jsx)(Ri,{className:`h-3.5 w-3.5 shrink-0`}),` Open on GitHub`]}),(0,K.jsxs)(Fg,{disabled:x,onClick:()=>void M(`files`),title:t&&!u?`This session no longer has its own checkout`:void 0,children:[(0,K.jsx)(Mi,{className:`h-3.5 w-3.5 shrink-0`}),` `,t?u?`Open session's folder`:`Open project folder`:`Open folder`]}),(0,K.jsxs)(jg,{children:[(0,K.jsxs)(Lg,{disabled:x,children:[(0,K.jsx)(Ti,{className:`h-3.5 w-3.5 shrink-0`}),` Open in editor`]}),(0,K.jsxs)(Rg,{className:`min-w-[15rem]`,children:[(0,K.jsxs)(Fg,{disabled:x,onClick:()=>void M(`editor`),children:[(0,K.jsx)(Ti,{className:`h-3.5 w-3.5 shrink-0`}),` `,t?`Open this session's checkout`:`Open in your editor`]}),(0,K.jsx)(zg,{}),(0,K.jsxs)(Ag,{children:[(0,K.jsx)(Bg,{children:`Preferred editor`}),(0,K.jsxs)(Fg,{disabled:x,closeOnClick:!1,onClick:()=>fn({editor:``}),className:`items-start`,children:[(0,K.jsx)(vi,{className:G(`mt-0.5 h-3.5 w-3.5 shrink-0`,_?`opacity-0`:`opacity-100`)}),(0,K.jsx)(cy,{label:`Default`,description:`$FRAMEWORK_EDITOR, or code`})]}),b.map(e=>(0,K.jsxs)(Fg,{disabled:x,closeOnClick:!1,onClick:()=>fn({editor:e.bin}),className:`items-start`,children:[(0,K.jsx)(vi,{className:G(`mt-0.5 h-3.5 w-3.5 shrink-0`,_===e.bin?`opacity-100`:`opacity-0`)}),(0,K.jsx)(cy,{label:e.label,description:e.bin})]},e.bin))]})]})]}),l&&(0,K.jsxs)(Fg,{render:(0,K.jsx)(`a`,{href:l.href,target:`_blank`,rel:`noreferrer`}),children:[(0,K.jsx)(Oi,{className:`h-3.5 w-3.5 shrink-0`}),` `,l.label.replace(` ↗`,``)]}),d&&c?.sessionId&&(0,K.jsxs)(Fg,{closeOnClick:!1,onClick:h,title:d,children:[f?(0,K.jsx)(vi,{className:`h-3.5 w-3.5 shrink-0 text-success`}):(0,K.jsx)(Ei,{className:`h-3.5 w-3.5 shrink-0`}),(0,K.jsx)(`span`,{className:`flex-1`,children:f?`Copied`:c.workspace?`Copy resume command`:`Copy session id`}),(0,K.jsx)(`span`,{className:`ml-auto pl-3 font-mono text-[10px] text-muted-foreground`,children:c.sessionId.slice(0,8)})]}),(0,K.jsx)(zg,{}),s&&(0,K.jsxs)(Fg,{disabled:D,onClick:()=>void N(),children:[(0,K.jsx)(aa,{className:`h-3 w-3 shrink-0 fill-current`}),` `,D?`Stopping…`:`Stop agent`]}),s&&t&&(0,K.jsxs)(Fg,{disabled:O||x,onClick:()=>P(),children:[(0,K.jsx)(Ii,{className:`h-3.5 w-3.5 shrink-0`}),` `,O?`Merge armed`:`Merge when finished`]}),(i&&!s||o&&!s)&&t&&(0,K.jsx)(zg,{}),i&&!s&&t&&(0,K.jsxs)(Fg,{disabled:x,onClick:()=>F(),children:[(0,K.jsx)(Ni,{className:`h-3.5 w-3.5 shrink-0`}),` Remove worktree`]}),o&&!s&&t&&(0,K.jsxs)(Fg,{onClick:()=>j(!0),className:`text-danger`,children:[(0,K.jsx)(ca,{className:`h-3.5 w-3.5 shrink-0`}),` Delete session`]}),S&&(0,K.jsx)(`p`,{className:`px-2 py-1.5 text-xs text-danger`,children:S})]})]}),o&&t&&(0,K.jsx)(mU,{open:A,onOpenChange:j,title:`Delete this agent?`,body:(0,K.jsxs)(K.Fragment,{children:[`Deleting `,(0,K.jsx)(`span`,{className:`font-medium text-foreground`,children:I}),` removes it from the dashboard for good — its history can’t be recovered. Its branch and any pull request stay in git.`]}),confirmLabel:`Delete`,confirmBusyLabel:`Deleting…`,fallbackError:`Could not delete the agent.`,onConfirm:()=>Ly(e,t).then(e=>e.ok?e:Promise.reject(Error(e.error))),onSuccess:o})]})}function gU({projectId:e,agentId:t,events:n,retainedWorktree:r=!1,onWorktreeRemoved:i,onDeleted:a,label:o,projectName:s,summary:c,expanded:l=!1,onToggle:u,actions:d}){let f=zz(n);return(0,K.jsxs)(`div`,{className:`@container flex items-center gap-2 overflow-hidden px-4 py-2`,children:[(0,K.jsx)(Iz,{projectId:e,agentId:t,inline:!0,label:o,projectName:s,summary:c,expanded:l,onToggle:u,agentState:f&&(0,K.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5`,title:f.label,children:[(0,K.jsx)(`span`,{className:G(`h-2 w-2 shrink-0 rounded-full`,f.dot),"aria-hidden":!0}),(0,K.jsx)(`span`,{className:G(`max-w-40 truncate`,f.tone),children:f.label})]})}),(0,K.jsx)(`div`,{className:`grow shrink-0`}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,K.jsx)(Rz,{events:n}),d,(0,K.jsx)(hU,{projectId:e,agentId:t,events:n,label:o,retainedWorktree:r,onWorktreeRemoved:i,onDeleted:a})]})]})}var _U=`This session was stopped before it finished, not because the work was done. Look at what you had already done, then carry on from there. The session lifecycle still applies: once the work is genuinely finished with nothing left to do, call setReadyForMerge() — without it the finished work is never merged.`;function vU({projectId:e,agentId:t,live:n,sessionId:r,driver:i,files:a,addContext:o,removeContext:s,sessionName:c,onAgentStarted:l,outcome:u}){let d=(0,v.useRef)(null),{busy:f,error:p,run:m}=Ba(),{busy:h,error:g,start:_}=Wy(),{busy:y,error:b,run:x}=Ba(),[C,w]=(0,v.useState)(!1);(0,v.useEffect)(()=>w(!1),[t]),(0,v.useEffect)(()=>{n||w(!1)},[n]);let[T,E]=(0,v.useState)(!1);(0,v.useEffect)(()=>E(!1),[t]),(0,v.useEffect)(()=>{n&&E(!1)},[n]);let D=y||C&&n,[O,k]=(0,v.useState)(null),A=!n&&r!==void 0,j=async(a,o,s)=>{if(f||h)return;if(s.newAgent||!n&&!A){let t=await _(e,a,`prompt`,{});t&&(d.current?.clear(),l?.(a,t.agentId)),d.current?.focus();return}if(n){await m(()=>Fy(e,a,t??void 0).then(()=>!0),`Could not send — the agent may have just ended. Your text is kept, try again.`)&&(k(a),d.current?.clear()),d.current?.focus();return}let c=S(i),u=await _(e,a,`prompt`,{resumeSession:r,...t?{continueAgentId:t}:{},...c&&c!==`claude`?{driver:c}:{}},`Failed to continue the agent.`);u&&(d.current?.clear(),l?.(a,u.agentId))},M=()=>void x(()=>Ay(e,t??void 0).then(()=>!0),`Could not stop the agent.`).then(e=>{e&&w(!0)}),N=async()=>{if(h||!r)return;let n=S(i),a=await _(e,_U,`prompt`,{resumeSession:r,...t?{continueAgentId:t}:{},...n&&n!==`claude`?{driver:n}:{}},`Failed to resume the agent.`);a&&(E(!0),l?.(_U,a.agentId))},P=n?(0,K.jsxs)(Z,{children:[(0,K.jsx)(Q,{render:(0,K.jsx)(q,{type:`button`,size:`icon-sm`,onClick:M,disabled:D,"aria-label":`Stop agent`,className:`h-8 w-8 shrink-0 disabled:opacity-100`}),children:D?(0,K.jsx)(Ki,{className:`h-4 w-4 animate-spin`}):(0,K.jsx)(aa,{className:`h-3 w-3 fill-current`})}),(0,K.jsx)(f_,{children:D?`Stopping…`:`Stop agent`})]}):A&&(u?.stopped||T)?(0,K.jsxs)(Z,{children:[(0,K.jsx)(Q,{render:(0,K.jsx)(q,{type:`button`,size:`icon-sm`,onClick:()=>void N(),disabled:h||T,"aria-label":`Resume`,className:`h-8 w-8 shrink-0 disabled:opacity-100`}),children:h||T?(0,K.jsx)(Ki,{className:`h-4 w-4 animate-spin`}):(0,K.jsx)(Qi,{className:`h-3.5 w-3.5 fill-current`})}),(0,K.jsx)(f_,{children:h||T?`Resuming…`:`Resume the agent`})]}):void 0,F=p??g??b;return(0,K.jsxs)(`div`,{className:`p-2`,children:[(0,K.jsx)(bU,{live:n,resumable:A,outcome:u,queued:O,muted:!!F}),F&&(0,K.jsx)(`p`,{role:`alert`,className:`mb-1 px-2 text-xs text-danger`,children:F}),(0,K.jsx)(lz,{ref:d,files:a,addContext:o,removeContext:s,onSubmit:j,busy:f||h,submitLabel:`Send`,submitBusyLabel:n?`Sending…`:A?`Resuming…`:`Starting…`,showDriverModel:!1,inAgent:!0,agentEnded:!n,sessionName:c,idleControl:P,placeholder:n?`Message the agent… ( / commands · < tags · @ projects · # files )`:A?`Message the agent to continue it… ( / commands · < tags · @ projects · # files )`:yU})]})}var yU=`This agent can’t be continued — it ended before reporting a session id. Your next message starts a new one.`;function bU({live:e,resumable:t,outcome:n,queued:r,muted:i}){return e?!r||i?null:(0,K.jsxs)(`p`,{role:`status`,className:`mb-1 truncate px-2 text-xs text-muted-foreground`,children:[`Queued — the session reads it between turns: “`,r,`”`]}):t?(0,K.jsx)(`p`,{className:`mb-2 px-2 text-xs text-muted-foreground`,children:n&&!n.ok&&!n.stopped?`Session failed — your next message resumes it where it stopped.`:n?.stopped?`Session stopped — your next message resumes it.`:`Agent ended — your next message continues it.`}):null}var xU={driver:`agent`,settled:`waiting`,usage:`cost`,"session-update":`resume`};function SU(e){return xU[e]??e.replace(/-/g,` `)}var CU=new WeakMap;function wU(e){CU.set(e,Date.now())}function TU(e){return CU.get(e)}function EU({projectId:e,agentId:t,inline:n,onFrame:r}){let i=(0,v.useRef)(null),[a,o]=(0,v.useState)(0),[s,c]=(0,v.useState)(void 0),l=`/browser/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,[u,d]=(0,v.useState)(l);u!==l&&(d(l),o(0),c(void 0));let f=`${l}#${a}`,p=s===f;(0,v.useEffect)(()=>{if(!r)return;let e=setInterval(()=>{let e=i.current;if(!(!e||!e.naturalWidth))try{let t=document.createElement(`canvas`);t.width=e.naturalWidth,t.height=e.naturalHeight;let n=t.getContext(`2d`);if(!n)return;n.drawImage(e,0,0),r(t.toDataURL(`image/jpeg`,.7))}catch{}},2e3);return()=>clearInterval(e)},[r]);let m=e=>{let t=e.currentTarget,n=t.getBoundingClientRect();return{x:Math.round((e.clientX-n.left)/n.width*(t.naturalWidth||n.width)),y:Math.round((e.clientY-n.top)/n.height*(t.naturalHeight||n.height))}},h=e=>{fetch(`${l}/input`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(e)}).catch(()=>{})};return p?(0,K.jsxs)(`div`,{className:`p-3 text-xs text-muted-foreground`,children:[(0,K.jsx)(`p`,{className:`mb-2`,children:`The preview is not reachable. It ends with the session, and a session only has one when it was started with Browser on. If it just started, the stream may not be up yet.`}),(0,K.jsx)(q,{variant:`outline`,size:`xs`,onClick:()=>o(e=>e+1),children:`Retry`})]}):(0,K.jsxs)(`div`,{className:n?`flex h-full min-h-0 w-full flex-col`:`flex min-h-0 flex-auto flex-col`,children:[(0,K.jsx)(`div`,{className:n?`flex min-h-0 flex-1 items-center justify-center overflow-hidden`:`min-h-0 flex-auto overflow-auto p-2`,children:(0,K.jsx)(`img`,{ref:i,src:`${l}/stream?r=${a}`,alt:`The agent's browser`,tabIndex:0,className:`cursor-crosshair focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-primary)] ${n?`max-h-full max-w-full`:`w-full rounded border border-border bg-muted`}`,onError:()=>c(f),onClick:e=>h({type:`click`,...m(e)}),onWheel:e=>h({type:`scroll`,...m(e),deltaY:e.deltaY}),onKeyDown:e=>{e.key.length!==1||e.metaKey||e.ctrlKey||(e.preventDefault(),h({type:`key`,text:e.key}))}})}),!n&&(0,K.jsx)(`p`,{className:`border-t border-border p-2 text-xs text-muted-foreground`,children:`Click the frame, then type. Chrome only sends a frame when the page changes, so this stays blank until the agent opens something.`})]})}function DU({projectId:e,agentId:t,url:n,live:r}){let[i,a]=(0,v.useState)(void 0);return!r&&i===void 0?(0,K.jsxs)(`span`,{className:`font-mono text-foreground`,children:[`browser · `,n]}):(0,K.jsx)(`div`,{className:`relative aspect-[16/10] max-h-96 w-full overflow-hidden rounded-md border border-border bg-muted`,children:r?(0,K.jsx)(EU,{inline:!0,projectId:e,agentId:t,onFrame:a}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`img`,{src:i,alt:`The browser's last frame`,className:`h-full w-full object-contain`}),(0,K.jsx)(`p`,{className:`absolute inset-x-0 bottom-0 bg-background/80 px-2 py-1 text-[11px] text-muted-foreground`,children:`preview ended — session finished`})]})})}function OU({defaultTagName:e,props:t,render:n,state:r={},stateAttributesMapping:i}){let a=kU(AU(r,i),t);if(!n)return v.createElement(e,a);if(typeof n==`function`)return n(a,r);if(!v.isValidElement(n))return null;let o=n.props,s={...kU(a,o),ref:NU(a.ref,o.ref)};return v.cloneElement(n,s)}function kU(...e){let t={};for(let n of e){if(!n)continue;let e=n;for(let n of Object.keys(e)){let r=e[n];if(r===void 0)continue;let i=t[n];n===`className`?t[n]=[i,r].filter(Boolean).join(` `):n===`style`?t[n]={...i,...r}:n===`ref`?t[n]=NU(i,r):MU(n)&&typeof i==`function`&&typeof r==`function`?t[n]=jU(r,i):t[n]=r}}return t}function AU(e,t){let n={};for(let r of Object.keys(e)){let i=e[r],a=t?.[r]?.(i);if(a){Object.assign(n,a);continue}if(r===`slot`){n[`data-slot`]=i;continue}let o=`data-${String(r).replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}`;typeof i==`boolean`?n[o]=i?``:void 0:i!=null&&(n[o]=String(i))}return n}function jU(e,t){return function(n){e(n),n.defaultPrevented||t(n)}}function MU(e){return/^on[A-Z]/.test(e)}function NU(...e){let t=e.filter(Boolean);if(t.length!==0)return e=>{for(let n of t)typeof n==`function`?n(e):n&&(n.current=e)}}var PU=8,FU=64,IU=0,LU=.5,RU=180,zU=new Set([`ArrowDown`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`,` `]),BU={start:!1,end:!1},VU={currentAnchorId:null,visibleMessageIds:[]};function HU({content:e,scrollEdgeThreshold:t,spacer:n,viewport:r}){if(!r||!e)return BU;let i=eW({content:e,spacer:n,viewport:r});return{start:r.scrollTop>t,end:i-r.scrollTop-r.clientHeight>t}}function UU({content:e,scrollMargin:t,scrollPreviousItemPeek:n,spacer:r,viewport:i,visibleMessageIds:a}){if(!e||!i)return VU;let o=i.getBoundingClientRect(),s=o.top+t+n,c=typeof IntersectionObserver>`u`,l=[],u=null;for(let t of WU(e,r)){let e=t.dataset.messageId;if(!e)continue;let n=t.dataset.scrollAnchor===`true`,r=n||c?t.getBoundingClientRect():null;(c&&r?r.bottom>s&&r.top<o.bottom:a.has(e))&&l.push(e),n&&r&&r.top<=s+LU&&(u=e)}return l.length===0&&u===null?VU:{currentAnchorId:u,visibleMessageIds:l}}function WU(e,t){return Array.from(e.children).filter(e=>e instanceof HTMLElement&&e!==t)}function GU(e,t){for(let n=t;n<e.length;n++){let t=e[n];if(t?.dataset.scrollAnchor===`true`)return t}return null}function KU(e,t){for(let n of e)if(n.dataset.scrollAnchor===`true`&&!t.has(n))return n;return null}function qU(e,t){let n=0;for(let r=t;r<e.length;r++)if(e[r]?.dataset.scrollAnchor===`true`&&(n+=1,n>1))return!0;return!1}function JU(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n?.dataset.scrollAnchor===`true`)return n}return null}function YU({content:e,spacer:t,viewport:n}){let r=n.getBoundingClientRect();for(let n of WU(e,t)){if(!n.dataset.messageId)continue;let e=n.getBoundingClientRect();if(e.bottom>r.top&&e.top<r.bottom)return n}return null}function XU({align:e,element:t,scrollMargin:n,spacer:r,viewport:i}){let a=ZU(t,i),o=t.getBoundingClientRect().height,s=rW(r);if(e===`center`){let e=Math.max(0,i.clientHeight-s.start-s.end);return a-s.start-(e-o)/2-n}if(e===`end`)return a-i.clientHeight+o+s.end+n;if(e===`nearest`){let e=a+o,t=i.scrollTop+s.start,r=i.scrollTop+i.clientHeight-s.end;return a>=t&&e<=r?i.scrollTop:a<t?a-s.start-n:e-i.clientHeight+s.end+n}return a-s.start-n}function ZU(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return n.top-r.top+t.scrollTop}function QU(e,t){return e.getBoundingClientRect().top-t.getBoundingClientRect().top}function $U({content:e,scrollTop:t,spacer:n,viewport:r}){let i=eW({content:e,spacer:n,viewport:r});return t+r.clientHeight-i}function eW({content:e,spacer:t,viewport:n}){let r=WU(e,t),i=nW(e),a=n.getBoundingClientRect(),o=n.scrollTop,s=i.start+i.end;for(let e of r){let t=e.getBoundingClientRect();s=Math.max(s,t.bottom-a.top+o+i.end)}return s}function tW(e){return Math.max(0,e.scrollHeight-e.clientHeight)}function nW(e){let t=window.getComputedStyle(e);return{end:aW(t.paddingBlockEnd||t.paddingBottom),start:aW(t.paddingBlockStart||t.paddingTop)}}function rW(e){let t=e?.parentElement;return t?nW(t):{end:0,start:0}}function iW(e){if(!e)return 0;let t=window.getComputedStyle(e);return aW(t.rowGap===`normal`?t.gap:t.rowGap)}function aW(e){if(!e)return 0;let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function oW({refs:e,commitScrollState:t,scheduleStateCommit:n,scheduleVisibilitySync:r}){let{streamingTurnRef:i,autoScrollRef:a,autoscrollingRef:o,autoscrollingTimeoutRef:s,contentRef:c,defaultScrollPositionAppliedRef:l,itemCountRef:u,messageElementsRef:d,modeRef:f,pendingScrollToMessageRef:p,prependRestoreRef:m,scrollMarginRef:h,scrollPreviousItemPeekRef:g,spacerGapRef:_,spacerHeightRef:y,spacerRef:b,viewportRef:x}=e,S=v.useCallback(e=>{s.current!==null&&(window.clearTimeout(s.current),s.current=null),o.current!==e&&(o.current=e,t()),e&&(s.current=window.setTimeout(()=>{s.current=null,o.current=!1,t()},RU))},[t]),C=v.useCallback(e=>{let t=b.current;if(!t)return;let n=Math.max(0,Math.ceil(e));y.current!==n&&(y.current=n,t.hidden=n===0,t.style.height=`${n}px`,t.style.marginTop=n>0?`${-_.current}px`:``)},[]),w=v.useCallback((e,{behavior:r=`auto`,autoscrolling:i=!1}={})=>{let a=x.current;if(!a)return;let o=Math.max(0,e);if(Math.abs(a.scrollTop-o)<=LU){a.scrollTop=o,t();return}i&&S(!0),a.scrollTo({top:o,behavior:r}),n()},[t,n,S]),T=v.useCallback(({behavior:e=`auto`}={})=>x.current?(C(0),i.current=null,f.current=`free-scrolling`,w(0,{behavior:e}),r(),!0):!1,[r,w,C]),E=v.useCallback(({behavior:e=`auto`}={})=>{let t=x.current;return t?(C(0),i.current=null,f.current=a.current?`following-bottom`:`free-scrolling`,w(tW(t),{autoscrolling:!0,behavior:e}),r(),!0):!1},[r,w,C]),D=v.useCallback((e,{align:t=`start`,behavior:n=`auto`,scrollMargin:a=h.current}={},{keepPreviousPeek:o=!1}={})=>{let s=c.current,l=x.current;if(!s||!l||!s.contains(e))return!1;let u=XU({align:t,element:e,scrollMargin:o?a+g.current:a,spacer:b.current,viewport:l}),d=$U({content:s,scrollTop:u,spacer:b.current,viewport:l});return C(d),m.current={element:e,viewportTop:QU(e,l)},f.current=o?`anchored-to-message`:`settling-jump`,i.current=o?e:null,w(u,{behavior:n}),r(),!0},[r,w,C]),O=v.useCallback(()=>{let e=i.current;return!e||!e.isConnected||f.current!==`anchored-to-message`?!1:D(e,{align:`start`},{keepPreviousPeek:!0})},[D]),k=v.useCallback((e,t)=>{let n=d.current.get(e);return n?(l.current=!0,D(n,t)?(p.current=null,!0):(p.current={messageId:e,options:t},!0)):u.current===0?(p.current={messageId:e,options:t},l.current=!0,!0):!1},[D]);return{flushPendingScrollToMessage:v.useCallback(()=>{let e=p.current;if(!e)return!1;let t=d.current.get(e.messageId);return!t||!D(t,e.options)?!1:(p.current=null,l.current=!0,!0)},[D]),reanchorToAnchoredMessage:O,scrollToElement:D,scrollToEnd:E,scrollToMessage:k,scrollToStart:T}}function sW(e,t){let n=e,r=new Set;return{getSnapshot:()=>n,hasListeners:()=>r.size>0,setSnapshot:e=>{t(n,e)||(n=e,r.forEach(e=>e()))},subscribe:(e,t,n)=>{let i=r.size===0;return r.add(e),i&&t?.(),()=>{r.delete(e),r.size===0&&n?.()}}}}function cW(e,t){return sW(e,t)}function lW(){return sW(VU,dW)}function uW(e,t){return e.start===t.start&&e.end===t.end}function dW(e,t){return e.currentAnchorId!==t.currentAnchorId||e.visibleMessageIds.length!==t.visibleMessageIds.length?!1:e.visibleMessageIds.every((e,n)=>e===t.visibleMessageIds[n])}function fW({autoScroll:e,scrollEdgeThreshold:t,scrollMargin:n,scrollPreviousItemPeek:r}){let i=v.useRef(e),a=v.useRef(!1),o=v.useRef(null),s=v.useRef(!1),c=v.useRef(t),l=v.useRef(0),u=v.useRef(null),d=v.useRef(0),f=v.useRef(e?`following-bottom`:`free-scrolling`),p=v.useRef(new Map),m=v.useRef(null),h=v.useRef(null),g=v.useRef(null),_=v.useRef(r),y=v.useRef(!0),b=v.useRef(null),x=v.useRef(n),S=v.useRef(null),C=v.useRef(0),w=v.useRef(0),T=v.useRef(null),E=v.useRef(null),D=v.useRef(null),O=v.useRef(null),k=v.useRef(null),A=v.useRef(null),j=v.useRef(null),M=v.useRef(null),N=v.useRef(new Set),P=v.useRef(new WeakSet);return D.current===null&&(D.current=cW(BU,uW)),M.current===null&&(M.current=lW()),i.current=e,c.current=t,x.current=n,_.current=r,{autoScrollRef:i,autoscrollingRef:a,autoscrollingTimeoutRef:O,streamingTurnRef:g,contentRef:o,defaultScrollPositionAppliedRef:s,firstItemRef:u,itemCountRef:l,lastScrollTopRef:d,messageElementsRef:p,modeRef:f,pendingScrollFrameRef:S,pendingScrollToMessageRef:m,prependRestoreRef:h,preserveScrollOnPrependRef:y,rootRef:b,scrollEdgeThresholdRef:c,scrollMarginRef:x,scrollPreviousItemPeekRef:_,spacerGapRef:C,spacerHeightRef:w,spacerRef:T,stateFrameRef:E,stateStore:D.current,viewportRef:k,visibilityFrameRef:A,visibilityObserverRef:j,visibilityStore:M.current,visibleMessageIdsRef:N,handledScrollAnchorsRef:P}}function pW(e,t){return v.useCallback(n=>{e.current=n,n&&t()},[e,t])}function mW({autoScroll:e=!1,defaultScrollPosition:t=`end`,scrollEdgeThreshold:n=PU,scrollPreviousItemPeek:r=FU,scrollMargin:i=IU}){let a=fW({autoScroll:e,scrollEdgeThreshold:n,scrollMargin:i,scrollPreviousItemPeek:r}),{streamingTurnRef:o,autoScrollRef:s,autoscrollingRef:c,autoscrollingTimeoutRef:l,contentRef:u,defaultScrollPositionAppliedRef:d,firstItemRef:f,itemCountRef:p,lastScrollTopRef:m,messageElementsRef:h,modeRef:g,pendingScrollFrameRef:_,pendingScrollToMessageRef:y,prependRestoreRef:b,preserveScrollOnPrependRef:x,rootRef:S,scrollEdgeThresholdRef:C,scrollMarginRef:w,scrollPreviousItemPeekRef:T,spacerGapRef:E,spacerHeightRef:D,spacerRef:O,stateFrameRef:k,stateStore:A,viewportRef:j,visibilityFrameRef:M,visibilityObserverRef:N,visibilityStore:P,visibleMessageIdsRef:F,handledScrollAnchorsRef:I}=a,L=v.useRef(t);L.current!==t&&(L.current=t,d.current=!1);let R=v.useCallback(e=>{let t=S.current,n=j.current,r=[e.start&&`start`,e.end&&`end`].filter(Boolean).join(` `),i=c.current;for(let e of[t,n])e&&(r?e.setAttribute(`data-scrollable`,r):e.removeAttribute(`data-scrollable`),e.toggleAttribute(`data-autoscrolling`,i))},[]),z=v.useCallback(e=>{let t=j.current?.scrollTop??0,n=t<m.current-LU;m.current=t,s.current&&!e.end&&g.current!==`settling-jump`&&g.current!==`anchored-to-message`?g.current=`following-bottom`:g.current===`following-bottom`&&e.end&&n&&!c.current&&(g.current=`free-scrolling`)},[]),B=v.useCallback(()=>{let e=HU({content:u.current,scrollEdgeThreshold:C.current,spacer:O.current,viewport:j.current});z(e);let t=g.current===`following-bottom`?{...e,end:!1}:e;R(t),A.setSnapshot(t)},[z,A,R]),ee=v.useCallback(()=>{k.current===null&&(k.current=window.requestAnimationFrame(()=>{k.current=null,B()}))},[B]),V=v.useCallback(()=>{P.hasListeners()&&M.current===null&&(M.current=window.requestAnimationFrame(()=>{M.current=null,P.hasListeners()&&P.setSnapshot(UU({content:u.current,scrollMargin:w.current,scrollPreviousItemPeek:T.current,spacer:O.current,viewport:j.current,visibleMessageIds:F.current}))}))},[P]),{flushPendingScrollToMessage:H,reanchorToAnchoredMessage:te,scrollToElement:U,scrollToEnd:W,scrollToMessage:ne,scrollToStart:re}=oW({refs:a,commitScrollState:B,scheduleStateCommit:ee,scheduleVisibilitySync:V}),ie=v.useCallback(()=>{let e=b.current,t=j.current;if(!e||!t||!e.element.isConnected)return!1;let n=QU(e.element,t)-e.viewportTop;return Math.abs(n)<=LU?!1:(t.scrollTop+=n,e.viewportTop=QU(e.element,t),ee(),V(),!0)},[ee,V]),ae=v.useCallback(()=>{let e=u.current,t=j.current;if(!e||!t){b.current=null;return}let n=YU({content:e,spacer:O.current,viewport:t});b.current=n?{element:n,viewportTop:QU(n,t)}:null},[]),oe=v.useCallback(()=>{_.current===null&&(_.current=window.requestAnimationFrame(()=>{_.current=null,H()&&ae()}))},[ae,H]),se=v.useCallback(()=>{if(!t||d.current||p.current===0)return!1;let e=!1;if(t===`last-anchor`){let t=u.current,n=j.current,r=t&&n?JU(WU(t,O.current)):null;if(!t||!n||!r)e=W({behavior:`auto`});else{let i=ZU(r,n);e=eW({content:t,spacer:O.current,viewport:n})-i<=n.clientHeight?W({behavior:`auto`}):U(r,{align:`start`},{keepPreviousPeek:!0})}}else e=t===`end`?W({behavior:`auto`}):re({behavior:`auto`});return e?(d.current=!0,!0):!1},[t,U,W,re]),ce=v.useCallback(()=>{let e=u.current;if(!e)return;let t=WU(e,O.current),n=p.current,r=f.current;p.current=t.length,f.current=t[0]??null,(()=>{if(H())return;if(n===0){if(se()||t.length>0&&s.current&&W({behavior:`auto`}))return;B(),V();return}let e=r?t.indexOf(r):-1;if(x.current&&e>0){ie();return}if(t.length>n){let e=GU(t,n);if(e){if(s.current&&g.current===`following-bottom`&&qU(t,n)){W({behavior:`auto`});return}U(e,{align:`start`},{keepPreviousPeek:!0}),I.current.add(e);return}}if(t.length===n){let e=KU(t,I.current);if(e){U(e,{align:`start`},{keepPreviousPeek:!0}),I.current.add(e);return}}g.current===`following-bottom`&&s.current?W({behavior:`auto`}):(B(),V())})(),ae()},[se,ae,B,H,ie,V,U,W]),le=v.useCallback(()=>{if(g.current===`following-bottom`&&s.current){W({behavior:`auto`});return}let e=D.current;if(te()){s.current&&e>0&&D.current===0&&W({behavior:`auto`});return}ee(),V()},[te,ee,V,W]),ue=v.useCallback(()=>{let e=j.current;if(!(!e||!P.hasListeners())){if(typeof IntersectionObserver>`u`){V();return}N.current||=new IntersectionObserver(e=>{for(let t of e){let e=t.target.dataset.messageId;e&&(t.isIntersecting?F.current.add(e):F.current.delete(e))}V()},{root:e,rootMargin:`${-(w.current+T.current)}px 0px 0px 0px`,threshold:[0,.01,.5,1]}),h.current.forEach(e=>{N.current?.observe(e)}),V()}},[V,P]),de=v.useCallback(()=>{M.current!==null&&(window.cancelAnimationFrame(M.current),M.current=null),N.current?.disconnect(),N.current=null,F.current.clear(),P.setSnapshot(VU)},[P]),fe=v.useCallback((e,t,n)=>{if(t){h.current.set(e,t),N.current?.observe(t),V(),y.current?.messageId===e&&oe();return}n&&h.current.get(e)===n&&(h.current.delete(e),F.current.delete(e),N.current?.unobserve(n),V())},[oe,V]),pe=v.useCallback(()=>{(g.current===`following-bottom`||g.current===`anchored-to-message`||g.current===`settling-jump`)&&(o.current=null,g.current=`free-scrolling`)},[]),me=v.useCallback(()=>R(A.getSnapshot()),[A,R]),he=pW(S,me),ge=pW(j,me),_e=v.useCallback(e=>{u.current=e},[]),ve=v.useCallback(e=>{O.current=e,E.current=iW(e?.parentElement??null)},[]),ye=v.useCallback(()=>{B(),V(),ae()},[ae,B,V]),be=v.useMemo(()=>({handleContentChange:ce,handleResize:le,observeVisibility:ue,preserveScrollOnPrependRef:x,scrollToEnd:W,scrollToMessage:ne,scrollToStart:re,setContentElement:_e,setRootElement:he,setSpacerElement:ve,setViewportElement:ge,stateStore:A,syncAfterScroll:ye,unobserveVisibility:de,userScrollIntent:pe,viewportRef:j,visibilityStore:P}),[ce,le,ue,W,ne,re,_e,he,ve,ge,A,ye,de,pe,P]);return v.useLayoutEffect(()=>{se()},[se]),v.useEffect(()=>()=>{k.current!==null&&(window.cancelAnimationFrame(k.current),k.current=null),M.current!==null&&(window.cancelAnimationFrame(M.current),M.current=null),l.current!==null&&(window.clearTimeout(l.current),l.current=null),_.current!==null&&(window.cancelAnimationFrame(_.current),_.current=null),N.current?.disconnect(),N.current=null},[]),v.useLayoutEffect(()=>{if(e&&g.current===`following-bottom`&&p.current>0){W({behavior:`auto`});return}B()},[e,B,W]),{context:be,registerMessage:fe}}function hW(e){let t=v.useRef(e);return t.current=e,t}var gW=v.createContext(null),_W=v.createContext(null);function vW(){let e=v.useContext(gW);if(!e)throw Error(`useMessageScroller must be used within a MessageScroller.`);return e}function yW(){let e=v.useContext(_W);if(!e)throw Error(`MessageScrollerItem must be used within a MessageScroller.`);return e}function bW({autoScroll:e=!1,children:t,defaultScrollPosition:n=`end`,scrollEdgeThreshold:r,scrollPreviousItemPeek:i,scrollMargin:a}){let{context:o,registerMessage:s}=mW({autoScroll:e,defaultScrollPosition:n,scrollEdgeThreshold:r,scrollPreviousItemPeek:i,scrollMargin:a});return(0,K.jsx)(gW.Provider,{value:o,children:(0,K.jsx)(_W.Provider,{value:s,children:t})})}function xW({children:e,...t}){let{setRootElement:n}=vW();return(0,K.jsx)(`div`,{ref:n,...t,children:e})}function SW({"aria-label":e,children:t,onKeyDown:n,onScroll:r,onTouchMove:i,onWheel:a,preserveScrollOnPrepend:o=!0,ref:s,role:c,tabIndex:l,...u}){let{handleResize:d,preserveScrollOnPrependRef:f,setViewportElement:p,syncAfterScroll:m,userScrollIntent:h,viewportRef:g}=vW();f.current=o;let _=v.useCallback(e=>{p(e),NU(s)?.(e)},[s,p]);function y(e){m(),r?.(e)}function b(e){h(),a?.(e)}function x(e){h(),i?.(e)}function S(e){zU.has(e.key)&&h(),n?.(e)}return v.useEffect(()=>{let e=g.current;if(!e||typeof ResizeObserver>`u`)return;let t=0,n=new ResizeObserver(()=>{window.cancelAnimationFrame(t),t=window.requestAnimationFrame(d)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.disconnect()}},[d,g]),(0,K.jsx)(`div`,{ref:_,role:c??`region`,"aria-label":e??`Messages`,tabIndex:l??0,onKeyDown:S,onScroll:y,onTouchMove:x,onWheel:b,...u,children:t})}function CW({"aria-relevant":e,children:t,ref:n,role:r,spacerClassName:i,...a}){let{handleContentChange:o,handleResize:s,setContentElement:c,setSpacerElement:l}=vW(),u=v.useRef(null),d=v.useCallback(e=>{u.current=e,c(e),NU(n)?.(e)},[n,c]);return v.useLayoutEffect(()=>{let e=u.current;if(!e||(o(),typeof MutationObserver>`u`))return;let t=new MutationObserver(()=>{o()});return t.observe(e,{childList:!0}),()=>t.disconnect()},[o]),v.useEffect(()=>{let e=u.current;if(!e||typeof ResizeObserver>`u`)return;let t=0,n=new ResizeObserver(()=>{window.cancelAnimationFrame(t),t=window.requestAnimationFrame(s)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.disconnect()}},[s]),(0,K.jsxs)(`div`,{ref:d,role:r??`log`,"aria-relevant":e??`additions`,...a,children:[t,(0,K.jsx)(`div`,{ref:l,"aria-hidden":`true`,"data-message-scroller-spacer":``,hidden:!0,className:i})]})}function wW({messageId:e,ref:t,scrollAnchor:n=!1,...r}){let i=yW(),a=v.useRef(null);return(0,K.jsx)(`div`,{ref:v.useCallback(n=>{let r=a.current;a.current=n,e&&i(e,n,r),NU(t)?.(n)},[e,t,i]),"data-message-id":e,"data-scroll-anchor":n?`true`:`false`,...r})}function TW({behavior:e=`smooth`,children:t,direction:n=`end`,onClick:r,render:i,tabIndex:a,type:o=`button`,...s}){let{scrollToEnd:c,scrollToStart:l,stateStore:u}=vW(),d=hW(r),f=v.useCallback(e=>u.subscribe(e),[u]),p=v.useCallback(()=>{let e=u.getSnapshot();return n===`start`?e.start:e.end},[n,u]),m=v.useSyncExternalStore(f,p,p),h=v.useCallback(t=>{m&&(d.current?.(t),t.defaultPrevented||(t.currentTarget.blur(),n===`start`?l({behavior:e}):c({behavior:e})))},[e,n,m,d,c,l]);return OU({defaultTagName:`button`,props:kU({type:o,inert:!m,tabIndex:m?a:-1,children:t??(0,K.jsxs)(`span`,{children:[`Scroll to `,n]}),onClick:h},s),render:i,state:{active:m,direction:n},stateAttributesMapping:{active:e=>({"data-active":e?`true`:`false`})}})}var EW={Provider:bW,Root:xW,Viewport:SW,Content:CW,Item:wW,Button:TW},DW=EW.Provider;function OW({className:e,...t}){return(0,K.jsx)(EW.Root,{"data-slot":`message-scroller`,className:G(`group/message-scroller relative flex size-full min-h-0 flex-col overflow-hidden`,e),...t})}function kW({className:e,...t}){return(0,K.jsx)(EW.Viewport,{"data-slot":`message-scroller-viewport`,className:G(`size-full min-h-0 min-w-0 overflow-y-auto overscroll-contain`,`scroll-fade-b scrollbar-thin scrollbar-gutter-stable data-autoscrolling:scrollbar-quiet`,e),...t})}function AW({className:e,...t}){return(0,K.jsx)(EW.Content,{"data-slot":`message-scroller-content`,className:G(`flex h-max min-h-full flex-col`,e),...t})}function jW({className:e,scrollAnchor:t=!1,...n}){return(0,K.jsx)(EW.Item,{"data-slot":`message-scroller-item`,scrollAnchor:t,className:G(`min-w-0 shrink-0`,e),...n})}function MW({direction:e=`end`,className:t,children:n,...r}){return(0,K.jsx)(EW.Button,{"data-slot":`message-scroller-button`,"data-direction":e,direction:e,className:G(`absolute left-1/2 z-10 flex -translate-x-1/2 items-center gap-1 rounded-full border border-border bg-background/90 px-3 py-1 text-xs text-foreground shadow-sm backdrop-blur transition-[translate,scale,opacity] duration-200 hover:bg-accent`,`data-[active=false]:pointer-events-none data-[active=false]:scale-95 data-[active=false]:opacity-0`,`data-[active=true]:translate-y-0 data-[active=true]:scale-100 data-[active=true]:opacity-100`,`data-[direction=end]:bottom-3 data-[direction=end]:data-[active=false]:translate-y-full`,`data-[direction=start]:top-3 data-[direction=start]:data-[active=false]:-translate-y-full`,t),...r,children:n??(0,K.jsxs)(K.Fragment,{children:[`Jump to latest`,(0,K.jsx)(ui,{className:`size-3.5`,"aria-hidden":!0})]})})}function NW(e){return e.kind===`system-prompt`?{text:e.text,label:`system prompt sent`}:null}function PW(e){return e.kind===`driver`?e.event.type===`start`?e.event.prompt:e.event.type===`text`?e.event.text:null:null}function FW(e){return e.replace(/\s+/g,` `).trim().length>100}function IW(e){return e.kind===`driver`?e.event.type===`start`?`you`:`agent`:e.kind}function LW(e){return e.kind===`driver`&&e.event.type===`start`?`you`:SU(e.kind)}function RW(e){return e.kind===`driver`&&e.event.type===`start`}function zW(e){return e.kind===`driver`?e.event.type===`error`:e.kind===`error`||e.kind===`end`&&!e.ok&&!e.stopped}function BW(e){return zW(e)?`text-danger`:e.kind===`driver`&&e.event.type===`start`?`text-info`:``}function VW(e){return BW(e)||(e.kind===`choice`||e.kind===`choice-resolved`?`text-warning`:e.kind===`end`&&e.ok||e.kind===`ready-for-merge`?`text-success`:e.kind===`view`||e.kind===`browser-stream`||e.kind===`browser`||e.kind===`preview`?`text-primary`:``)}function HW(e){return zW(e)?`bg-danger/10`:e.kind===`driver`&&e.event.type===`start`?`bg-info/10`:e.kind===`end`&&e.ok||e.kind===`ready-for-merge`?`bg-success/10`:``}function UW(e){let t=e.findIndex(RW);return t<=0?e:[e[t],...e.slice(0,t),...e.slice(t+1)]}function WW(e){return new Date(e).toLocaleTimeString()}function GW(e){let t=new Map,n=new Set,r=new Map,i=new Map;e.forEach((e,t)=>{e.kind===`choice`?r.set(e.id,{e,at:t}):e.kind===`choice-resolved`&&i.set(e.id,{e,at:t})});let a=new Set(fa(e).map(e=>e.id)),o;for(let[e,t]of r)a.has(e)&&(o=t.e);for(let[e,s]of r){let{kind:r,...c}=s.e,l=i.get(e);a.has(e)?t.set(s.e,{render:`open`,choice:c,active:s.e===o}):l&&l.at>s.at&&(t.set(s.e,{render:`answered`,choice:c,pick:l.e.picked}),n.add(l.e))}return{rows:t,hidden:n}}function KW(e){let t=new Map,n=new Set,r,i=!1;for(let a of e)if(a.kind===`browser`){let e=t.get(a.url);e&&n.add(e),t.set(a.url,a),r=a,i=!0}else a.kind===`end`&&(i=!1);return{pane:r,live:i,hidden:n}}function qW({text:e}){let[t,n]=(0,v.useState)(!1);return FW(e)?(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-1.5`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>n(e=>!e),"aria-expanded":t,"aria-label":t?`Collapse message`:`Expand message`,className:`shrink-0 select-none text-muted-foreground transition-transform ${t?`rotate-90`:``}`,children:`›`}),(0,K.jsx)(`div`,{className:t?`min-w-0 flex-1`:`max-h-[1.35rem] min-w-0 flex-1 cursor-pointer overflow-hidden`,onClick:t?void 0:()=>n(!0),children:(0,K.jsx)(Jz,{text:e,compact:!0})})]}):(0,K.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,K.jsx)(Jz,{text:e,compact:!0})})}function JW({events:e,stick:t=!0,openAt:n,tail:r,projectId:i,agentId:a}){let o=(0,v.useMemo)(()=>i?GW(e):void 0,[i,e]),s=(0,v.useMemo)(()=>i&&a?KW(e):void 0,[i,a,e]),c=UW(e).filter(e=>!o?.hidden.has(e)&&!s?.hidden.has(e));return(0,K.jsx)(DW,{autoScroll:t,defaultScrollPosition:n??(t?`end`:`start`),children:(0,K.jsxs)(OW,{className:`flex-1`,children:[(0,K.jsx)(kW,{"aria-label":`Agent output`,children:(0,K.jsxs)(AW,{className:`gap-1 p-4 font-mono text-xs`,children:[c.map((e,t,n)=>{let r=NW(e),c=PW(e),l=o?.rows.get(e),u=t>0?n[t-1]:void 0,d=!u||IW(u)!==IW(e),f=TU(e);return(0,K.jsxs)(jW,{messageId:String(t),scrollAnchor:RW(e),className:`-mx-1.5 flex items-start gap-2 rounded-sm px-1.5 ${HW(e)}`,children:[(0,K.jsx)(`span`,{className:`w-28 shrink-0`,children:d&&(0,K.jsx)(da,{className:`mt-0.5 text-[10px] uppercase ${VW(e)||`text-muted-foreground`}`,children:LW(e)})}),r?(0,K.jsxs)(`details`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`summary`,{className:`cursor-pointer text-foreground marker:text-muted-foreground`,children:[r.label,` (`,r.text.length.toLocaleString(),` chars)`]}),(0,K.jsx)(`pre`,{className:`mt-1 max-h-96 overflow-auto whitespace-pre-wrap break-words rounded bg-muted p-2 text-foreground`,children:r.text})]}):c===null?l&&i?(0,K.jsx)(`div`,{className:`min-w-0 flex-1 font-sans`,children:l.render===`open`?(0,K.jsx)(Uz,{inline:!0,projectId:i,agentId:a,choice:l.choice,active:l.active},l.choice.id):(0,K.jsx)(Hz,{choice:l.choice,pick:l.pick})}):e.kind===`browser`&&e===s?.pane&&i&&a?(0,K.jsx)(`div`,{className:`min-w-0 flex-1 font-sans`,children:(0,K.jsx)(DU,{projectId:i,agentId:a,url:e.url,live:s.live})}):(0,K.jsx)(`span`,{className:`min-w-0 flex-1 whitespace-pre-wrap break-words ${BW(e)||`text-foreground`}`,children:(w(e)??``).trim()}):(0,K.jsx)(qW,{text:c}),d&&f!==void 0&&(0,K.jsxs)(Z,{children:[(0,K.jsx)(Q,{render:(0,K.jsx)(`span`,{className:`ml-auto shrink-0 pt-0.5 text-[10px] tabular-nums text-muted-foreground`}),children:WW(f)}),(0,K.jsx)(f_,{children:new Date(f).toLocaleString()})]})]},t)}),r]})}),(0,K.jsx)(MW,{})]})})}function YW({events:e,lost:t=!1,stick:n=!0,openAt:r,emptyLabel:i=`Waiting for the session to start…`,tail:a,projectId:o,agentId:s}){let c=t&&(0,K.jsxs)(`div`,{role:`status`,className:`flex items-center gap-2 border-b border-border bg-warning/10 px-4 py-2 text-xs text-warning`,children:[(0,K.jsx)(la,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":!0}),`Live stream lost — reconnecting. The session keeps running; this view may be behind.`]});return e.length===0?(0,K.jsxs)(K.Fragment,{children:[c,(0,K.jsx)(`div`,{className:`grid flex-1 place-items-center text-sm text-muted-foreground`,children:i})]}):(0,K.jsxs)(K.Fragment,{children:[c,(0,K.jsx)(JW,{events:e,stick:n,...r?{openAt:r}:{},...a?{tail:a}:{},projectId:o,agentId:s})]})}function XW({target:e,events:t,live:n}){if(e!==`actions`)return null;let r=ya(t);return(0,K.jsxs)(`div`,{role:`status`,className:`flex items-center gap-2 border-b border-border bg-muted/40 px-4 py-2 text-xs text-muted-foreground`,children:[(0,K.jsx)(Ri,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":!0}),(0,K.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[`Running on GitHub Actions`,n?` — updates arrive when the run finishes.`:`.`]}),r&&(0,K.jsxs)(`a`,{href:r,target:`_blank`,rel:`noreferrer`,className:`inline-flex shrink-0 items-center gap-1 text-primary hover:underline`,children:[`View the Actions run`,(0,K.jsx)(Oi,{className:`h-3.5 w-3.5`,"aria-hidden":!0})]})]})}var ZW=4e3;function QW({target:e,events:t}){let n=e===`web`?ba(t):void 0,r=oG(n?.id),i=aG(n?.id);return e===`web`?(0,K.jsxs)(`div`,{className:`border-b border-border bg-muted/40`,children:[(0,K.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center gap-2 px-4 py-2 text-xs text-muted-foreground`,children:[(0,K.jsx)(wi,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":!0}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1`,children:n?`Running as a Claude Code cloud session. It asks its questions and opens its own pull request over there, not here.`:`Starting a Claude Code cloud session…`}),n&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1`,children:[(0,K.jsxs)(`code`,{className:`rounded bg-muted px-1 py-0.5`,children:[`claude --teleport `,n.id]}),(0,K.jsx)(lV,{text:`claude --teleport ${n.id}`,label:`Copy the command that continues this session here`})]}),(0,K.jsxs)(`a`,{href:n.url,target:`_blank`,rel:`noreferrer`,className:`inline-flex shrink-0 items-center gap-1 text-primary hover:underline`,children:[`Open the session`,(0,K.jsx)(Oi,{className:`h-3.5 w-3.5`,"aria-hidden":!0})]})]})]}),r&&n&&(!i||i.state===`failed`)&&(0,K.jsx)($W,{question:r,url:n.url,sessionId:n.id,failure:i?.state===`failed`?i:void 0}),i&&n&&i.state!==`failed`&&(0,K.jsx)(eG,{answer:i,url:n.url,sessionId:n.id})]}):null}function $W({question:e,url:t,sessionId:n,failure:r}){let[i,a]=(0,v.useState)(void 0),[o,s]=(0,v.useState)(void 0);return(0,K.jsxs)(`div`,{className:`flex gap-2 border-t border-border px-4 py-2.5 text-xs`,children:[(0,K.jsx)(Ji,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-primary`,"aria-hidden":!0}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`p`,{className:`font-medium text-foreground`,children:e.title}),(0,K.jsx)(`div`,{className:`mt-1.5 flex flex-col items-start gap-1`,children:e.options.map(t=>(0,K.jsxs)(`button`,{type:`button`,onClick:()=>a(t.label),"aria-pressed":i===t.label,className:`rounded border px-2 py-1 text-left transition-colors ${i===t.label?`border-primary bg-primary/10 text-foreground`:`border-border text-muted-foreground hover:border-primary/50 hover:text-foreground`}`,children:[t.label,t.label===e.recommended&&(0,K.jsx)(`span`,{className:`ml-1.5 text-[10px] uppercase tracking-wide text-primary`,children:`recommended`}),t.detail&&(0,K.jsx)(`span`,{className:`ml-1.5 opacity-70`,children:t.detail})]},t.label))}),r&&(0,K.jsxs)(`p`,{className:`mt-1.5 flex items-center gap-1 text-destructive`,children:[(0,K.jsx)(la,{className:`h-3 w-3 shrink-0`,"aria-hidden":!0}),`Sending “`,r.label,`” failed`,r.note?`: ${r.note}`:``,`. Pick again, or answer in the session.`]}),o&&(0,K.jsx)(`p`,{className:`mt-1.5 text-destructive`,children:o}),(0,K.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-3`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>{i&&Ny(n,i).then(e=>{e.ok||s(e.error??`could not queue the answer`)}).catch(()=>s(`could not reach the daemon`))},disabled:!i,className:`rounded bg-primary px-2.5 py-1 font-medium text-primary-foreground disabled:cursor-not-allowed disabled:opacity-50`,children:i?`Send “${i}”`:`Pick an answer`}),(0,K.jsxs)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 text-primary hover:underline`,children:[`Answer it in the session`,(0,K.jsx)(Oi,{className:`h-3 w-3`,"aria-hidden":!0})]})]})]})]})}function eG({answer:e,url:t,sessionId:n}){return(0,K.jsx)(`div`,{className:`flex items-center gap-2 border-t border-border px-4 py-2.5 text-xs text-muted-foreground`,children:e.state===`queued`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Ki,{className:`h-3.5 w-3.5 shrink-0 animate-spin text-primary`,"aria-hidden":!0}),(0,K.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[`Sending “`,e.label,`” through your Claude web tab… It goes out the next time the extension checks in.`]}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>void Py(n).catch(()=>{}),className:`shrink-0 rounded border border-border px-2 py-1 hover:border-primary/50 hover:text-foreground`,children:`Cancel`})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(vi,{className:`h-3.5 w-3.5 shrink-0 text-primary`,"aria-hidden":!0}),(0,K.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[`Answered “`,e.label,`”. The session continues over there and its transcript above follows along.`]}),(0,K.jsxs)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`inline-flex shrink-0 items-center gap-1 text-primary hover:underline`,children:[`Open the session`,(0,K.jsx)(Oi,{className:`h-3 w-3`,"aria-hidden":!0})]})]})})}var tG=[/^Arrow keys move the tile/i,/^Show message actions$/i,/^(Claude\s+)?(Fable|Opus|Sonnet|Haiku)(\s+\d[\d.]*)?$/i];function nG(e){return e.split(`
`).filter(e=>!tG.some(t=>t.test(e.trim()))).join(`
`).replace(/\n{3,}/g,`
`).trim()}function rG({target:e,events:t}){let n=e===`web`?ba(t):void 0,r=iG(n?.id);if(e!==`web`||!n)return null;let i=r.map(e=>nG(e.text)).filter(Boolean);return(0,K.jsxs)(`div`,{role:`status`,"aria-label":`Cloud session mirror`,className:`mt-2 rounded-md border border-border bg-muted/40 font-sans`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-border px-3 py-1.5 text-[10px] text-muted-foreground`,children:[(0,K.jsx)(wi,{className:`h-3 w-3 shrink-0 text-primary`,"aria-hidden":!0}),(0,K.jsx)(`span`,{className:`font-medium uppercase tracking-wide`,children:`Cloud session mirror`}),(0,K.jsx)(`span`,{className:`opacity-70`,children:`a best-effort view of the Claude tab, not the run's own log`})]}),i.length>0?(0,K.jsx)(`div`,{className:`max-h-80 space-y-2 overflow-y-auto px-3 py-2 text-xs`,children:i.map((e,t)=>(0,K.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-muted-foreground`,children:e},t))}):(0,K.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-xs text-muted-foreground`,children:[(0,K.jsx)(Ki,{className:`h-3.5 w-3.5 shrink-0 animate-spin text-primary`,"aria-hidden":!0}),`Connecting to the cloud session…`]})]})}function iG(e){let[t,n]=(0,v.useState)([]);return(0,v.useEffect)(()=>{if(!e){n([]);return}let t=!0,r=()=>{ri(e).then(e=>{t&&n(e)}).catch(()=>{})};r();let i=setInterval(r,ZW);return()=>{t=!1,clearInterval(i)}},[e]),t}function aG(e){let[t,n]=(0,v.useState)(void 0);return(0,v.useEffect)(()=>{if(!e){n(void 0);return}let t=!0,r=()=>{ni(e).then(e=>{t&&n(e??void 0)}).catch(()=>{})};r();let i=setInterval(r,ZW);return()=>{t=!1,clearInterval(i)}},[e]),t}function oG(e){let[t,n]=(0,v.useState)(void 0);return(0,v.useEffect)(()=>{if(!e){n(void 0);return}let t=!0,r=()=>{$r(e).then(e=>{t&&n(e??void 0)}).catch(()=>{})};r();let i=setInterval(r,ZW);return()=>{t=!1,clearInterval(i)}},[e]),t}function sG({device:e}){return e?(0,K.jsxs)(`div`,{role:`status`,className:`flex items-center gap-2 border-b border-border bg-muted/40 px-4 py-2 text-xs text-muted-foreground`,children:[(0,K.jsx)(Yi,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":!0}),(0,K.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[`Running on `,e,`. Its worktree, diff, and pull request live on the device; the browser preview is not available for remote runs yet.`]})]}):null}var cG=v.createContext(void 0);function lG(){let e=v.useContext(cG);if(e===void 0)throw Error(uo(50));return e}function uG(e,t={}){let n=e.useState(`domReferenceElement`),r=e.context.dataRef,{delay:i}=t,a=sl(),o=v.useRef(!1);v.useEffect(()=>{let t=Jo(n);function r(){let t=e.select(`domReferenceElement`);!e.select(`open`)&&Qo(t)&&t===Dl(Ml(t))&&(o.current=!0)}return t.addEventListener(`blur`,r),()=>{t.removeEventListener(`blur`,r)}},[e,n]);let s=v.useMemo(()=>({onFocus(t){let{nativeEvent:n}=t,r=typeof i==`function`?i():i;a.start(r??0,()=>{e.setOpen(!0,nc(Vs,n))})},onBlur(t){o.current=!1;let{relatedTarget:n,nativeEvent:i}=t;a.start(0,()=>{let t=e.select(`domReferenceElement`),a=Dl(t?t.ownerDocument:document);!n&&a===t||Ol(r.current.floatingContext?.refs.floating.current,a)||Ol(t,a)||e.setOpen(!1,nc(Vs,i))})}}),[i,e,r,a]);return v.useMemo(()=>({reference:s}),[s])}function dG(e){let{open:t,defaultOpen:n,onOpenChange:r,onOpenChangeComplete:i,actionsRef:a}=e,o=v.useRef(600),s=v.useRef(300),c=J(e=>{o.current=e.delay??600,s.current=e.closeDelay??300}),[l,u]=v.useState(null),[d,f]=v.useState(null),[p,m]=v.useState(),h=v.useRef(null),[g,_]=Ga({controlled:t,default:n,name:`PreviewCard`,state:`open`}),y=J(r),{mounted:b,setMounted:x,transitionStatus:S}=vc(g),C=J(()=>{x(!1),i?.(!1)});_c({enabled:!a,open:g,ref:h,onComplete(){g||C()}}),v.useImperativeHandle(a,()=>({unmount:C}),[C]);let w=J((e,t)=>{let n=t.reason===Bs,r=e&&t.reason===`trigger-focus`,i=!e&&(t.reason===`trigger-press`||t.reason===`escape-key`);if(y(e,t),t.isCanceled)return;function a(){_(e)}n?As.flushSync(a):a(),r||i?m(r?`focus`:`dismiss`):t.reason===`trigger-hover`&&m(void 0)}),T=dm({elements:{reference:l,floating:d},open:g,onOpenChange:w}),E=p,D=()=>o.current,O=()=>s.current,{getReferenceProps:k,getFloatingProps:A}=Em([Ad(T,{mouseOnly:!0,move:!1,handleClose:Vm(),restMs:D,delay:()=>({close:O()})}),uG(T,{delay:D}),Cp(T)]),j=v.useMemo(()=>({open:g,setOpen:w,mounted:b,setMounted:x,setTriggerElement:u,positionerElement:d,setPositionerElement:f,popupRef:h,triggerProps:k(),popupProps:A(),floatingRootContext:T,instantType:E,transitionStatus:S,onOpenChangeComplete:i,writeDelayRefs:c}),[g,w,b,x,d,k,A,T,E,S,i,c]);return(0,K.jsx)(cG.Provider,{value:j,children:e.children})}var fG=v.createContext(void 0);function pG(){let e=v.useContext(fG);if(e===void 0)throw Error(uo(48));return e}var mG=v.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{mounted:i}=lG();return i||n?(0,K.jsx)(fG.Provider,{value:n,children:(0,K.jsx)($g,{ref:t,...r})}):null}),hG=v.forwardRef(function(e,t){let{render:n,className:r,delay:i,closeDelay:a,...o}=e,{open:s,triggerProps:c,setTriggerElement:l,writeDelayRefs:u}=lG();Y(()=>{u({delay:i,closeDelay:a})});let d=v.useMemo(()=>({open:s}),[s]);return Io(`a`,e,{ref:[l,t],state:d,props:[c,o],stateAttributesMapping:Lc})}),gG=v.createContext(void 0);function _G(){let e=v.useContext(gG);if(e===void 0)throw Error(uo(49));return e}var vG=v.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`bottom`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=Po,...g}=e,{open:_,mounted:y,floatingRootContext:b,setPositionerElement:x}=lG(),S=mh({anchor:i,floatingRootContext:b,positionMethod:a,mounted:y,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m,keepMounted:pG(),collisionAvoidance:h}),C=v.useMemo(()=>{let e={};return _||(e.pointerEvents=`none`),{role:`presentation`,hidden:!y,style:{...S.positionerStyles,...e}}},[_,y,S.positionerStyles]),w=v.useMemo(()=>({open:_,side:S.side,align:S.align,anchorHidden:S.anchorHidden}),[_,S.side,S.align,S.anchorHidden]),T=v.useMemo(()=>({side:S.side,align:S.align,arrowRef:S.arrowRef,arrowUncentered:S.arrowUncentered,arrowStyles:S.arrowStyles}),[S.side,S.align,S.arrowRef,S.arrowUncentered,S.arrowStyles]),E=Io(`div`,e,{state:w,ref:[x,t],props:[C,g],stateAttributesMapping:zc});return(0,K.jsx)(gG.Provider,{value:T,children:E})}),yG={...zc,...Sc},bG=v.forwardRef(function(e,t){let{className:n,render:r,...i}=e,{open:a,transitionStatus:o,popupRef:s,onOpenChangeComplete:c,popupProps:l}=lG(),{side:u,align:d}=_G();_c({open:a,ref:s,onComplete(){a&&c?.(!0)}});let f=v.useMemo(()=>({open:a,side:u,align:d,transitionStatus:o}),[a,u,d,o]);return Io(`div`,e,{ref:[s,t],state:f,props:[l,Qm(o),i],stateAttributesMapping:yG})});function xG(){return(0,K.jsx)(`p`,{className:`px-2 py-1 text-[10px] italic text-muted-foreground`,children:`Cut here. The rest is in the worktree.`})}function SG(){return(0,K.jsx)(`p`,{className:`p-2 text-xs text-muted-foreground`,children:`Binary file, nothing to show.`})}function CG({added:e,removed:t,className:n}){return(0,K.jsxs)(`span`,{className:G(`shrink-0 font-mono text-[10px] tabular-nums`,n),children:[e>0&&(0,K.jsxs)(`span`,{className:`text-success`,children:[`+`,e]}),e>0&&t>0&&` `,t>0&&(0,K.jsxs)(`span`,{className:`text-danger`,children:[`−`,t]})]})}function wG(e){return e.startsWith(`+++`)||e.startsWith(`---`)?`text-muted-foreground`:e.startsWith(`@@`)?`text-primary`:e.startsWith(`+`)?`bg-success/10 text-success`:e.startsWith(`-`)?`bg-danger/10 text-danger`:`text-muted-foreground`}function TG({diff:e,className:t}){return e.binary?(0,K.jsx)(SG,{}):(0,K.jsxs)(`div`,{className:G(`overflow-auto font-mono text-[11px] leading-[1.45]`,t),children:[e.patch.split(`
`).map((e,t)=>(0,K.jsx)(`div`,{className:G(`whitespace-pre px-2`,wG(e)),children:e||` `},t)),e.truncated&&(0,K.jsx)(xG,{})]})}function EG({content:e,className:t}){if(e.binary)return(0,K.jsx)(SG,{});if(!e.text)return(0,K.jsx)(`p`,{className:`p-2 text-xs text-muted-foreground`,children:`Empty file.`});let n=e.text.split(`
`),r=`${String(n.length).length+1}ch`;return(0,K.jsxs)(`div`,{className:G(`overflow-auto font-mono text-[11px] leading-[1.45]`,t),children:[n.map((e,t)=>(0,K.jsxs)(`div`,{className:`flex whitespace-pre px-2 text-foreground`,children:[(0,K.jsx)(`span`,{className:`shrink-0 select-none pr-3 text-right tabular-nums text-muted-foreground/60`,style:{width:r},children:t+1}),(0,K.jsx)(`span`,{children:e||` `})]},t)),e.truncated&&(0,K.jsx)(xG,{})]})}function DG(e){return`patch`in e}function OG({projectId:e,agentId:t,path:n,changed:r=!0}){let{value:i,loaded:a}=Vv(()=>r?Kr(e,n,t??void 0):Jr(e,n,t??void 0),null,5e3,[e,t,n,r]);return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`header`,{className:`flex items-center gap-2 border-b border-border px-2 py-1.5`,children:[(0,K.jsx)(`span`,{className:`truncate font-mono text-[11px] text-muted-foreground`,children:n}),i&&DG(i)&&(0,K.jsx)(CG,{added:i.added,removed:i.removed,className:`ml-auto`})]}),a?i?DG(i)?(0,K.jsx)(TG,{diff:i,className:`py-1`}):(0,K.jsx)(EG,{content:i,className:`py-1`}):(0,K.jsx)(`p`,{className:`p-2 text-xs text-muted-foreground`,children:r?`No change to show.`:`Nothing to show.`}):(0,K.jsx)(`p`,{className:`p-2 text-xs text-muted-foreground`,children:r?`Reading the diff…`:`Reading the file…`})]})}function kG({projectId:e,agentId:t,path:n,changed:r=!0,children:i}){return(0,K.jsxs)(dG,{children:[(0,K.jsx)(hG,{delay:350,closeDelay:150,render:(0,K.jsx)(`div`,{className:`pointer-events-auto`}),children:i}),(0,K.jsx)(mG,{children:(0,K.jsx)(vG,{side:`left`,align:`start`,sideOffset:8,children:(0,K.jsx)(bG,{className:`z-50 flex max-h-[70vh] w-[42rem] max-w-[80vw] flex-col overflow-hidden rounded-md border border-border bg-card text-card-foreground shadow-lg`,children:(0,K.jsx)(OG,{projectId:e,agentId:t,path:n,changed:r})})})})]})}var AG=[],jG={untracked:`new`,modified:`modified`,deleted:`deleted`},MG={untracked:`text-success`,modified:`text-warning`,deleted:`text-danger`};function NG({projectId:e,agentId:t,change:n}){let[r,i]=(0,v.useState)(!1),a=n.path.slice(0,n.path.lastIndexOf(`/`)+1),o=n.path.slice(n.path.lastIndexOf(`/`)+1);return(0,K.jsxs)(`li`,{className:`border-t border-border first:border-t-0`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>i(e=>!e),"aria-expanded":r,className:`flex w-full items-center gap-2 px-2 py-1.5 text-left hover:bg-accent`,children:[(0,K.jsx)(bi,{className:G(`size-3.5 shrink-0 text-muted-foreground transition-transform`,r&&`rotate-90`)}),(0,K.jsxs)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs`,children:[(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:a}),(0,K.jsx)(`span`,{className:G(n.status===`deleted`&&`line-through`),children:o})]}),(0,K.jsx)(`span`,{className:G(`shrink-0 text-[10px] uppercase tracking-wide`,MG[n.status]),children:jG[n.status]}),!n.binary&&(0,K.jsx)(CG,{added:n.added,removed:n.removed})]}),r&&(0,K.jsx)(`div`,{className:`border-t border-border bg-muted/30`,children:(0,K.jsx)(OG,{projectId:e,agentId:t,path:n.path})})]})}function PG({count:e,added:t,removed:n}){return e===0?null:(0,K.jsxs)(`span`,{className:`flex items-center gap-x-2 text-muted-foreground`,children:[(0,K.jsxs)(`span`,{children:[e,` `,e===1?`file`:`files`]}),(0,K.jsx)(CG,{added:t,removed:n,className:`text-xs`})]})}function FG({projectId:e,agentId:t,open:n=!0,onSummary:r}){let{value:i}=Vv(()=>qr(e,t),AG,8e3,[e,t]),a=i.reduce((e,t)=>e+t.added,0),o=i.reduce((e,t)=>e+t.removed,0),s=(0,v.useRef)(r);return s.current=r,(0,v.useEffect)(()=>s.current?.(i.length,a,o),[i.length,a,o]),i.length===0||!n?null:(0,K.jsx)(`section`,{className:`border-b border-border`,"aria-label":`Changed files`,children:(0,K.jsx)(`ul`,{className:`max-h-80 overflow-auto`,children:i.map(n=>(0,K.jsx)(NG,{projectId:e,agentId:t,change:n},n.path))})})}var IG=6,LG=10;function RG(e){return!!(e&&e.exists&&(!e.empty||e.pendingFiles?.length))}function zG({handoff:e}){if(!e)return null;if(!e.exists)return(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`branch gone`});if(e.empty)return(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`no changes`});let t=`${e.commits.length} commit${e.commits.length===1?``:`s`}`,n=`${e.files.length} file${e.files.length===1?``:`s`}`;return(0,K.jsxs)(`span`,{className:`flex items-center gap-x-2 whitespace-nowrap text-muted-foreground`,children:[(0,K.jsx)(`span`,{children:t}),(0,K.jsx)(`span`,{children:`·`}),(0,K.jsx)(`span`,{children:n}),(0,K.jsx)(CG,{added:e.insertions,removed:e.deletions,className:`text-xs`}),e.pushed&&!e.pr&&(0,K.jsx)(`span`,{children:`· pushed`}),e.merged&&(0,K.jsx)(`span`,{children:`· merged`})]})}function BG({projectId:e,agentId:t,state:n}){let[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(null),s=lt(n),c=a??s;(0,v.useEffect)(()=>{a&&a===s&&o(null)},[a,s]);let l=n=>{o(n),i(!0),jy(e,t,n).catch(()=>o(null)).finally(()=>i(!1))},u=c===`push`,d=c===`merge`;return(0,K.jsx)(`div`,{className:`flex items-center gap-x-3 whitespace-nowrap text-xs text-muted-foreground`,children:(0,K.jsx)(VG,{label:u?`Push branch`:d?`Open PR & merge`:`Open PR`,title:u?`Push this agent's branch to origin when it finishes. Set to push only, so no pull request is opened.`:d?`Open a pull request when this agent finishes and merge it once it is open, pushing the branch on the way.`:`Open a draft pull request when this agent finishes, pushing the branch on the way.`,checked:c!==`local`,disabled:r,onChange:e=>l(e?`pr`:`local`)})})}function VG({label:e,title:t,checked:n,disabled:r,onChange:i}){return(0,K.jsxs)(Z,{children:[(0,K.jsxs)(Q,{render:(0,K.jsx)(`label`,{className:`flex cursor-pointer items-center gap-x-1.5 select-none`}),children:[(0,K.jsx)(wc,{checked:n,disabled:r,onCheckedChange:e=>i(e===!0)}),e]}),(0,K.jsx)(f_,{className:`max-w-[22rem]`,children:t})]})}function HG({projectId:e,agentId:t,state:n}){let{handoff:r,busy:i,pending:a,act:o}=n;if(!r||r.prPending)return null;if(r.pr)return r.pr.state!==`OPEN`||r.merged?null:(0,K.jsxs)(q,{size:`xs`,disabled:i,onClick:()=>o(`merge`,()=>Vy(e,t),`Could not merge the pull request.`),children:[(0,K.jsx)(Ii,{className:`h-3.5 w-3.5`}),a===`merge`?`Merging…`:`Merge PR`]});if(!r.exists)return(0,K.jsx)(WG,{children:`Branch gone — nothing to open a PR from.`});if(r.empty){let e=r.pendingFiles??[];return e.length===0?(0,K.jsx)(WG,{children:`Nothing committed — no PR to open.`}):(0,K.jsxs)(WG,{title:e.join(`
`),children:[`Nothing committed — `,UG(e),` left uncommitted.`]})}return r.hasRemote?(0,K.jsxs)(q,{size:`xs`,disabled:i,onClick:()=>o(`pr`,()=>By(e,t),`Could not open the pull request.`),children:[(0,K.jsx)(Li,{className:`h-3.5 w-3.5`}),a===`pr`?`Opening PR…`:`Open PR`]}):(0,K.jsx)(WG,{children:`No remote to push to.`})}function UG(e){let t=e.slice(0,2).join(`, `),n=e.length-Math.min(e.length,2);return n>0?`${t} and ${n} more`:t}function WG({children:e,title:t}){return(0,K.jsx)(`span`,{className:`inline-block max-w-[24rem] truncate align-middle text-xs text-muted-foreground`,...t?{title:t}:{},children:e})}function GG({handoff:e}){if(!RG(e)||!e)return null;let t=e.pendingFiles??[],n=[e.commits.length>0,e.files.length>0,t.length>0].filter(Boolean).length;return(0,K.jsxs)(`section`,{className:G(`grid gap-3 border-b border-border px-4 py-3 text-xs`,n>1&&`sm:grid-cols-2`),"aria-label":`Agent handoff`,children:[e.commits.length>0&&(0,K.jsx)(KG,{handoff:e}),e.files.length>0&&(0,K.jsx)(JG,{handoff:e}),t.length>0&&(0,K.jsx)(qG,{paths:t})]})}function KG({handoff:e}){let t=e.commits.slice(0,IG),n=e.commits.length-t.length;return(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h3`,{className:`mb-1.5 text-muted-foreground`,children:`Commits`}),(0,K.jsx)(`ul`,{className:`space-y-1`,children:t.map(e=>(0,K.jsxs)(`li`,{className:`flex gap-2`,children:[(0,K.jsx)(`code`,{className:`shrink-0 text-muted-foreground`,children:e.short}),(0,K.jsx)(`span`,{className:`truncate`,title:e.subject,children:e.subject})]},e.sha))}),n>0&&(0,K.jsxs)(`p`,{className:`mt-1 text-muted-foreground`,children:[`and `,n,` more`]})]})}function qG({paths:e}){let t=e.slice(0,LG),n=e.length-t.length;return(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h3`,{className:`mb-1.5 text-muted-foreground`,children:`Uncommitted files`}),(0,K.jsx)(`ul`,{className:`space-y-1`,children:t.map(e=>(0,K.jsx)(`li`,{className:`truncate`,title:e,children:e},e))}),n>0&&(0,K.jsxs)(`p`,{className:`mt-1 text-muted-foreground`,children:[`and `,n,` more`]})]})}function JG({handoff:e}){let t=e.files.slice(0,LG),n=e.files.length-t.length;return(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h3`,{className:`mb-1.5 text-muted-foreground`,children:`Changed files`}),(0,K.jsx)(`ul`,{className:`space-y-1`,children:t.map(e=>(0,K.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`truncate`,title:e.path,children:e.path}),(0,K.jsx)(`span`,{className:`ml-auto shrink-0 text-muted-foreground`,children:e.binary?`binary`:(0,K.jsx)(CG,{added:e.insertions,removed:e.deletions,className:`text-xs`})})]},e.path))}),n>0&&(0,K.jsxs)(`p`,{className:`mt-1 text-muted-foreground`,children:[`and `,n,` more`]})]})}function YG(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n?.kind===`usage`)return n}}function XG(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function ZG({label:e,value:t}){return(0,K.jsxs)(`span`,{className:`flex items-baseline gap-1.5`,children:[(0,K.jsx)(`span`,{className:`text-muted-foreground/70`,children:e}),(0,K.jsx)(`span`,{className:`tabular-nums text-foreground`,children:t})]})}function QG({events:e}){let t=R(e),n=S(t?.driver),r=n?x[n]:t?.driver??`Agent`,i=YG(e);return(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 border-b border-border px-4 py-2 text-xs`,children:[(0,K.jsx)(ZG,{label:`Agent`,value:r}),t?.model&&(0,K.jsx)(ZG,{label:`Model`,value:t.model}),i?(0,K.jsxs)(K.Fragment,{children:[i.costUsd!==void 0&&(0,K.jsx)(ZG,{label:`Spent`,value:`$${i.costUsd.toFixed(2)}`}),(0,K.jsx)(ZG,{label:`Tokens`,value:`${XG(i.inputTokens)} in / ${XG(i.outputTokens)} out`}),(i.cacheReadTokens>0||i.cacheCreationTokens>0)&&(0,K.jsx)(ZG,{label:`Cache`,value:`${XG(i.cacheReadTokens)} read / ${XG(i.cacheCreationTokens)} write`}),(0,K.jsx)(ZG,{label:`Turns`,value:String(i.turns)})]}):(0,K.jsx)(`span`,{className:`text-muted-foreground/70`,children:`No spend reported yet`})]})}function $G({projectId:e,agentId:t,events:n,live:r,label:i,projectName:a,target:o,remoteLabel:s,files:c,addContext:l,removeContext:u,lost:d=!1,armedDefault:f,onAgentStarted:p,onDeleted:m}){let[h,g]=(0,v.useState)(0),_=Bv(!r&&t?()=>Mr(e,t):null,null,[e,t,r,h]),y=Bv(!r&&t?()=>Ar(e):null,[],[e,t,r]),[b,x]=(0,v.useState)(!1),S=(0,v.useCallback)(()=>x(!0),[]),C=!r&&!b&&t!=null&&y.includes(t),w=r&&!ha(n),T=dU(e,t??null,!w),[E,D]=(0,v.useState)({count:0,added:0,removed:0}),[O,k]=(0,v.useState)(!1),A=(0,v.useCallback)((e,t,n)=>{D(r=>r.count===e&&r.added===t&&r.removed===n?r:{count:e,added:t,removed:n})},[]),j=(0,v.useCallback)(()=>k(e=>!e),[]),M=(!_?.length||n.length===0||JSON.stringify(n[0])===JSON.stringify(_[0]))&&n.length>(_?.length??0),N=r?n:_?.length&&!M?_:n;(0,v.useEffect)(()=>{!r&&_!==null&&M&&g(n.length)},[r,_,M,n.length]);let P=r||M&&ma(n),I=R(N),z=F(N),B=r?void 0:ga(N),ee=L(N,f),V=!w&&T.loaded;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(gU,{projectId:e,agentId:t,events:N,label:i??z.sessionName,projectName:a,retainedWorktree:C,onWorktreeRemoved:S,onDeleted:m,summary:V?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(zG,{handoff:T.handoff}),ee.result?.outcome===`failed`&&(0,K.jsxs)(`span`,{className:`text-danger`,children:[`auto-handoff failed: `,ee.result.error]}),T.error&&(0,K.jsx)(`span`,{className:`text-danger`,children:T.error})]}):(0,K.jsx)(PG,{...E}),expanded:O,onToggle:j,actions:t?w?(0,K.jsx)(BG,{projectId:e,agentId:t,state:ee}):(0,K.jsx)(HG,{projectId:e,agentId:t,state:T}):void 0}),O&&(0,K.jsx)(QG,{events:N}),w&&t&&(0,K.jsx)(FG,{projectId:e,agentId:t,open:O,onSummary:A}),!w&&O&&(0,K.jsx)(GG,{handoff:T.handoff}),(0,K.jsx)(XW,{target:o,events:N,live:r}),(0,K.jsx)(QW,{target:o,events:N}),(0,K.jsx)(sG,{device:s}),!r&&_===null&&N.length===0?(0,K.jsx)(`div`,{className:`grid flex-1 place-items-center text-sm text-muted-foreground`,children:`Loading agent…`}):(0,K.jsx)(YW,{events:N,projectId:e,agentId:t,lost:d,...P?{}:{stick:!1,openAt:`end`,emptyLabel:`This agent has no events.`},tail:(0,K.jsx)(rG,{target:o,events:N})}),(0,K.jsx)(vU,{projectId:e,agentId:t,live:P,sessionId:I?.sessionId,driver:I?.driver,files:c,addContext:l,removeContext:u,sessionName:z.sessionName,onAgentStarted:p,outcome:B})]})}function eK({views:e}){let[t,n]=(0,v.useState)(0),r=(0,v.useRef)(new Set);(0,v.useEffect)(()=>{let t=e.findIndex(e=>!r.current.has(e.id));for(let t of e)r.current.add(t.id);t>=0&&n(t)},[e]);let i=e[Math.min(t,e.length-1)],a=(0,v.useRef)(null);return i?(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-auto flex-col`,children:[e.length>1&&(0,K.jsx)(`nav`,{className:`sticky top-0 z-10 flex flex-wrap gap-1 border-b border-border bg-background/95 p-2 backdrop-blur`,children:e.map((e,r)=>(0,K.jsx)(`button`,{type:`button`,onClick:()=>n(r),title:e.title,className:G(`max-w-[10rem] truncate rounded px-2 py-0.5 text-xs`,r===t?`bg-accent text-accent-foreground`:`bg-muted text-muted-foreground hover:text-foreground`),children:e.title},e.id))}),(0,K.jsx)(wg,{viewportRef:a,className:`min-h-0 flex-auto`,children:(0,K.jsxs)(`div`,{className:`p-4`,children:[(0,K.jsxs)(`h2`,{className:`mb-2 flex items-center gap-1.5 text-sm font-semibold`,children:[i.title,(0,K.jsx)(lV,{text:i.markdown,label:`Copy this view as markdown`})]}),(0,K.jsx)(Jz,{text:i.markdown})]})})]}):(0,K.jsx)(`p`,{className:`p-4 text-sm text-muted-foreground`,children:`No views yet.`})}var tK={untracked:`text-success`,modified:`text-warning`,deleted:`text-danger`},nK={untracked:`bg-success`,modified:`bg-warning`,deleted:`bg-danger`},rK={untracked:`U`,modified:`M`,deleted:`D`};function iK({icon:e,gitStatus:t,badge:n,className:r,children:i}){return(0,K.jsxs)(`span`,{className:G(`flex items-center justify-between gap-2 p-2`,t&&tK[t],r),children:[(0,K.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(e,{className:`size-4.5 shrink-0`}),(0,K.jsx)(`span`,{className:`text-sm`,children:i})]}),t&&(n===`letter`?(0,K.jsx)(`span`,{className:`text-sm font-medium`,children:rK[t]}):(0,K.jsx)(`span`,{className:G(`size-2 shrink-0 rounded-full`,nK[t])}))]})}var aK={};function oK(e){let t={name:``,path:``,dirs:new Map,files:[]};for(let n of e){let e=n.split(`/`),r=t;for(let t=0;t<e.length-1;t++){let n=e[t],i=r.path?`${r.path}/${n}`:n,a=r.dirs.get(n);a||(a={name:n,path:i,dirs:new Map,files:[]},r.dirs.set(n,a)),r=a}r.files.push(n)}return t}function sK(e){let t=new Map;for(let[n,r]of Object.entries(e)){let e=n.split(`/`),i=``;for(let n=0;n<e.length-1;n++){i=i?`${i}/${e[n]}`:e[n];let a=t.get(i);t.set(i,a&&a!==r?`modified`:r)}}return t}var cK=(e,t)=>e.name.localeCompare(t.name);function lK({projectId:e,agentId:t,files:n,selected:r,onToggle:i}){let[a,o]=(0,v.useState)(``),{value:s}=Vv(()=>Gr(e,t??void 0),aK,8e3,[e,t]),c=(0,v.useMemo)(()=>sK(s),[s]),l=(0,v.useMemo)(()=>{let e=a.trim().toLowerCase();return e?n.filter(t=>t.toLowerCase().includes(e)):n},[n,a]),u=(0,v.useMemo)(()=>oK(l),[l]),d=n=>(0,K.jsxs)(K.Fragment,{children:[[...n.dirs.values()].sort(cK).map(e=>{let t=c.get(e.path);return(0,K.jsxs)(`details`,{className:`group`,children:[(0,K.jsxs)(`summary`,{className:`cursor-pointer list-none rounded-lg hover:bg-accent`,children:[(0,K.jsx)(iK,{icon:Pi,gitStatus:t,badge:`dot`,className:`group-open:hidden`,children:e.name}),(0,K.jsx)(iK,{icon:Mi,gitStatus:t,badge:`dot`,className:`hidden group-open:flex`,children:e.name})]}),(0,K.jsx)(`div`,{className:`relative ml-6 before:absolute before:inset-y-0 before:-left-2 before:h-full before:w-px before:bg-border`,children:d(e)})]},e.path)}),[...n.files].sort((e,t)=>e.localeCompare(t)).map(n=>{let a=n.slice(n.lastIndexOf(`/`)+1),o=r.has(n),c=s[n],l=(0,K.jsx)(`button`,{type:`button`,onClick:()=>i(n),className:G(`w-full rounded-lg text-start hover:bg-accent`,o&&`text-primary`),children:(0,K.jsx)(iK,{icon:o?vi:ki,gitStatus:c,badge:`letter`,children:a})});return(0,K.jsx)(kG,{projectId:e,agentId:t,path:n,changed:!!c,children:l},n)})]});return n.length===0?null:(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-auto flex-col p-2`,children:[(0,K.jsx)(`input`,{type:`search`,value:a,onChange:e=>o(e.target.value),placeholder:`Filter files…`,"aria-label":`Filter files`,className:`mb-2 w-full rounded border border-border bg-background px-2 py-1 text-xs text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-[var(--color-primary)]`}),a.trim()&&l.length===0?(0,K.jsxs)(`p`,{className:`px-1 py-2 text-xs text-muted-foreground`,children:[`No files match “`,a.trim(),`”.`]}):(0,K.jsxs)(K.Fragment,{children:[a.trim()&&(0,K.jsxs)(`p`,{className:`px-1 pb-1 text-[10px] text-muted-foreground`,children:[l.length,` of `,n.length,` files`]}),(0,K.jsx)(`div`,{className:`min-h-0 w-full flex-auto overflow-y-auto text-sm`,children:d(u)})]})]})}var uK={files:{label:`Files`,help:`The project’s files — click one to add it to the next session’s context.`},views:{label:`Views`,help:`Documents the agent pushed up during the session — a plan, a summary, a writeup.`},browser:{label:`Browser`,help:`Live view of the browser this session is driving.`},docs:{label:`Docs`,help:`The PLAN/TODO markdown files at the root of the workspace.`}};function dK({projectId:e,agentId:t,views:n,files:r,context:i,toggleContext:a,hasBrowser:o=!1,target:s,docsInMain:c=!1}){let{value:l,loaded:u}=Vv(e&&!c?()=>Nr(e):null,[],4e3,[e,c]),d=!c&&(!u||l.length>0),[f,p]=(0,v.useState)(`docs`),m=(0,v.useRef)(!1),h=e=>{m.current=!0,p(e)},g=n.length>0,_=r.length>0,y=o&&s!==`actions`,b=(0,v.useRef)(!1);if((0,v.useEffect)(()=>{let e=g&&!b.current;b.current=b.current||g,e?p(`views`):!m.current&&!g&&p(_?`files`:`docs`)},[g,_]),!e)return null;let x=[..._?[`files`]:[],...g?[`views`]:[],...y&&t?[`browser`]:[],...d?[`docs`]:[]];if(x.length===0)return null;let S=x.includes(f)?f:x[0],C=r.filter(e=>i.has(e)).length,w=e=>e===`views`?n.length:e===`files`?C:0;return(0,K.jsxs)(`aside`,{className:G(`flex w-[22rem] shrink-0 flex-col border-l border-border`),children:[(0,K.jsx)(`div`,{role:`tablist`,"aria-label":`Rail panels`,className:`flex flex-wrap gap-1 p-2`,children:x.map(e=>(0,K.jsxs)(Z,{children:[(0,K.jsxs)(Q,{render:(0,K.jsx)(q,{role:`tab`,"aria-selected":S===e,variant:`ghost`,size:`sm`,className:G(`h-7 gap-1.5 text-xs`,S===e&&`bg-accent text-accent-foreground`),onClick:()=>h(e)}),children:[uK[e].label,w(e)>0&&(0,K.jsx)(da,{className:`border-primary/40 text-primary`,children:w(e)})]}),(0,K.jsx)(f_,{className:`max-w-64`,children:uK[e].help})]},e))}),(0,K.jsx)(`div`,{className:`flex min-h-0 flex-col overflow-hidden`,children:S===`files`&&_?(0,K.jsx)(lK,{projectId:e,agentId:t,files:r,selected:i,onToggle:a}):S===`views`&&g?(0,K.jsx)(eK,{views:n}):S===`browser`&&y&&t?(0,K.jsx)(EU,{projectId:e,agentId:t}):(0,K.jsx)(nB,{docs:l,loaded:u})})]})}function fK({title:e,detail:t,actionLabel:n,onAction:r}){return(0,K.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,K.jsx)(`p`,{className:`font-medium`,children:e}),(0,K.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:t}),(0,K.jsx)(q,{variant:`outline`,onClick:r,children:n})]})}var pK=[1e3,2e3,4e3,8e3];function mK(e){return pK[Math.min(e,pK.length-1)]}var hK=1500;function gK(e,t,n){let[r,i]=(0,v.useState)([]),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{i([])},[n]),(0,v.useEffect)(()=>{if(i([]),o(!1),c(!1),!e)return;let n,r=!1,a=0,s=!0,l,u,d=()=>{r||(o(!0),l=setTimeout(f,mK(a++)))},f=()=>{let l=!s;s=!1,bt(e,t??void 0).then(e=>{if(r){e.close();return}n=e,a=0,o(!1);let t=l?[]:void 0,s=()=>{if(r||t===void 0)return;let e=t;t=void 0,i(e)};l?u=setTimeout(s,hK):i([]),e.listen(e=>{if(e.kind===`stream-sync`){s();return}wU(e),t?t.push(e):i(t=>[...t,e])}),e.onClose(e=>{t=void 0,u&&clearTimeout(u),e?d():r||c(!0)})},d)};return f(),()=>{r=!0,l&&clearTimeout(l),u&&clearTimeout(u),n?.close()}},[e,t]),{events:(0,v.useMemo)(()=>t?r:xa(r),[r,t]),lost:a,done:s}}function _K(e){let{value:t,reload:n,loaded:r}=Vv(e?()=>kr(e):null,[],2e3,[e]);return{agents:t,reload:n,loaded:r}}var vK=new Set;function yK(){for(let e of vK)e()}function bK(e){return vK.size===0&&window.addEventListener(`popstate`,yK),vK.add(e),()=>{vK.delete(e),vK.size===0&&window.removeEventListener(`popstate`,yK)}}var xK=()=>window.location.pathname;function SK(){let e=(0,v.useSyncExternalStore)(bK,xK,()=>`/`);return{route:It(e),go:(t,n)=>{let r=Lt(t);r!==e&&(n?.replace?window.history.replaceState(null,``,r):window.history.pushState(null,``,r),yK())}}}function CK(){let[e,t]=(0,v.useState)(new Set);return{context:e,add:e=>t(t=>t.has(e)?t:new Set(t).add(e)),remove:e=>t(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n}),toggle:e=>t(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),reset:()=>t(new Set)}}function wK(e,t){if(typeof Notification>`u`||Notification.permission!==`granted`)return;let n=e[0];if(!n)return;let r=new Notification(t.title(n,e.length),{body:e.map(t.label).join(`
`)});r.onclick=()=>{let e=t.clickUrl(n);e?window.open(e,`_blank`,`noopener`):window.focus(),r.close()}}function TK(e,t,n){let r=(0,v.useRef)(void 0);r.current??=new ot(n.keyOf,e=>e.projectId);let i=(0,v.useRef)(void 0);(0,v.useEffect)(()=>{if(e===i.current)return;i.current=e;let a=r.current.observe(e.items,e.whole);t&&a.length>0&&wK(a,n)},[e,t])}var EK={keyOf:it,title:(e,t)=>t===1?`Human Queue · ${e.projectName}`:`${t} items in your Human Queue`,label:e=>e.kind===`awaiting`?e.title:e.kind===`unpushed`?e.commits===void 0||e.commits===0?`${e.title} — work not pushed`:`${e.title} — ${e.commits===1?`1 commit`:`${e.commits} commits`} not pushed`:`#${e.number} ${e.title}`,clickUrl:e=>e.kind===`awaiting`||e.kind===`unpushed`?void 0:e.url},DK={keyOf:at,title:(e,t)=>t===1?`${e.kind===`started`?`Agent started`:`Agent finished`} · ${e.projectName}`:`${t} agent updates`,label:e=>`${e.kind===`started`?`Started`:`Finished`}: ${e.title??`a session`}`,clickUrl:()=>void 0};function OK(e,t){TK(e,t,EK)}function kK(e,t){TK(e,t,DK)}function AK(e,t){return`${e>0?`(${e}) `:``}${t?`${t} — `:``}The Framework`}function jK(e,t){(0,v.useEffect)(()=>{typeof document>`u`||(document.title=AK(e,t))},[e,t])}var MK={active:[],queueOpen:0,recent:[]};function NK(){let{value:e}=Vv(Lr,MK,5e3,[]);return e.active.length>0}var PK=`/logo.svg`,FK=`/logo-animated.svg`;function IK(e){return e?FK:PK}function LK(e){(0,v.useEffect)(()=>{if(typeof document>`u`)return;let t=document.querySelector(`link[rel~="icon"]`);t||(t=document.createElement(`link`),t.rel=`icon`,document.head.appendChild(t));let n=IK(e);t.getAttribute(`href`)!==n&&t.setAttribute(`href`,n)},[e])}var RK=5e3;function zK(){let[e,t]=(0,v.useState)(!0);return(0,v.useEffect)(()=>{let e=!1,n,r=()=>{Ot().then(()=>{e||(t(!0),n=setTimeout(r,RK))},()=>{e||(t(!1),n=setTimeout(r,RK))})};return r(),()=>{e=!0,n&&clearTimeout(n)}},[]),e}var BK=[],VK=[],HK={items:[],whole:[]},UK={items:[],whole:[]},WK=[];function GK(){let{route:e,go:t}=SK(),{view:n,projectId:r,agentId:i,ticketSlug:a,plan:o}=e,[s,c]=(0,v.useState)({tick:0,intent:``,id:null}),[l,u]=(0,v.useState)(!1),{agents:d,reload:f,loaded:p}=_K(r),{context:m,add:h,remove:g,toggle:_,reset:y}=CK();(0,v.useEffect)(()=>{y()},[r]);let{value:b}=Vv(r?()=>Wr(r,i??void 0):null,BK,1e4,[r,i]),{value:x}=Vv(Br,HK,15e3,[]),S=x.items,[C,w]=(0,v.useState)(0),{value:T}=Vv(Ot,VK,3e4,[C]),E=r?T.find(e=>e.id===r):void 0,D=E?.name??null;jK(S.length,D);let O=r!==null&&T.length>0&&!T.some(e=>e.id===r),k=hn();OK(x,Cn(k)&&bn(k));let A=Sn(k)&&bn(k),{value:j}=Vv(A?Hr:null,UK,15e3,[A]);kK(j,A);let{value:M}=Vv(r===null?Rr:null,WK,1e4,[r]),N=(e,n,a,o)=>{let s=a!==void 0&&a===i&&e===r;c(e=>({tick:s?e.tick:e.tick+1,intent:n,id:a??null,...o?{runsOn:o}:{}})),u(a===void 0),y(),t({projectId:e,agentId:a??null}),f()},P=(e,t,n)=>N(r,e,t,n);(0,v.useEffect)(()=>{if(!l)return;let e=d.find(e=>e.status===`running`);e&&(u(!1),t({projectId:r,agentId:e.id},{replace:!0}))},[l,d,r]);let F=e=>{u(!1),t({projectId:r,agentId:e})},I=e=>{u(!1),t({projectId:e,agentId:null})},L=(e,n)=>{u(!1),t({projectId:e,agentId:n})},R=e=>{u(!1),y(),t({projectId:e,agentId:null})},z=()=>{u(!1),t({projectId:null,agentId:null})},B=()=>{u(!1),t({view:`settings`,projectId:null,agentId:null})},ee=()=>{u(!1),t({view:`tickets`,projectId:null,agentId:null})},V=(e,n)=>{u(!1),t({view:`tickets`,projectId:e,agentId:null,ticketSlug:n})},H=(e,n)=>{u(!1),t({view:`tickets`,projectId:e,agentId:null,ticketSlug:n,plan:!0})},{events:te,lost:U}=gK(r,i,s.tick),W=xa(te),ne=r?pa(W):[],re=NK();LK(re);let ie=zK(),ae=i?d.find(e=>e.id===i):void 0;return(0,K.jsxs)($_,{className:`h-screen flex-col overflow-hidden`,children:[!ie&&(0,K.jsxs)(`div`,{role:`alert`,className:`flex items-center gap-2 border-b border-border bg-warning/10 px-4 py-2 text-xs text-warning`,children:[(0,K.jsx)(la,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":!0}),`The daemon is not answering — retrying. Everything on this page is frozen until it returns.`]}),(0,K.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 overflow-hidden`,children:[(0,K.jsx)(vy,{projectId:r,agents:d,selectedAgentId:i,onSelect:F,recentAgents:M,onSelectRecent:L,projects:T,onNewAgentInProject:R,onProjectAdded:()=>{w(e=>e+1),f()},startTick:s.tick,startIntent:s.intent,followLive:l,working:re,onDashboard:z,onSelectProject:I,onSettings:B,onTickets:ee,ticketsActive:n===`tickets`,interventionCount:S.length}),(0,K.jsx)(`main`,{className:`flex min-w-0 flex-1 flex-col`,children:n===`settings`?(0,K.jsx)(pV,{onAgentStarted:N,onDone:z}):n===`tickets`&&r&&a&&o?(0,K.jsx)(uU,{projectId:r,slug:a,onBack:ee}):n===`tickets`&&r&&a?(0,K.jsx)(sU,{projectId:r,slug:a,onBack:ee}):n===`tickets`?(0,K.jsx)(oU,{onOpenTicket:V,onOpenTicketPlan:H,onAgentStarted:N}):r?O?(0,K.jsx)(fK,{title:`No such project`,detail:`No project is registered as "${r}". It may have been removed, or the link may be from another machine.`,actionLabel:`Go to the Overview`,onAction:z}):i===null?l?(0,K.jsx)($G,{projectId:r,agentId:null,events:te,live:!0,label:s.intent||void 0,projectName:D,remoteLabel:s.runsOn,files:b,addContext:h,removeContext:g,lost:U,onAgentStarted:P}):(0,K.jsx)(aB,{projectId:r,events:te,onAgentStarted:P,files:b,context:m,addContext:h,removeContext:g,toggleContext:_,onOpenAgent:L,errors:E?.errors}):ae?(0,K.jsx)($G,{projectId:r,agentId:i,events:te,live:ae.status===`running`,label:Fa(ae),projectName:D,files:b,addContext:h,removeContext:g,lost:U,target:ae.target,remoteLabel:ae.remoteLabel,armedDefault:ae.handoff,onAgentStarted:P,onDeleted:()=>{F(null),f()}}):i===s.id||!p?(0,K.jsx)($G,{projectId:r,agentId:i,events:te,live:!0,label:s.intent||void 0,projectName:D,remoteLabel:i===s.id?s.runsOn:void 0,files:b,addContext:h,removeContext:g,lost:U,onAgentStarted:P}):(0,K.jsx)(fK,{title:`This agent is gone`,detail:`It is not in this project's agents. An agent disappears when its worktree is removed.`,actionLabel:`Back to the project`,onAction:()=>F(null)}):(0,K.jsx)(sV,{onSelectProject:I,onSelectAgent:L,onOpenTicket:V,onAgentStarted:N,interventions:S})}),n!==`tickets`&&(0,K.jsx)(dK,{projectId:r,agentId:i,views:ne,files:b,context:m,toggleContext:_,hasBrowser:ae?.status===`running`&&ae.browserStreamPort!==void 0,target:ae?.target,docsInMain:n!==`settings`&&!!r&&!O&&i===null&&!l})]})]})}var KK=document.getElementById(`root`);if(!KK)throw Error(`no #root in index.html`);(0,_.createRoot)(KK).render((0,K.jsx)(Or,{children:(0,K.jsx)(GK,{})}));