vendor: 20,495 bytes, lines 1-3
1var 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,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},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(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 l=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 ee(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var k=/\/+/g;function te(e,t){return typeof e==`object`&&e&&e.key!=null?ee(``+e.key):t.toString(36)}function ne(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 re(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,re(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+te(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(k,`$&/`)+`/`),re(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(k,`$&/`)+`/`)+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+te(a,u),c+=re(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+te(a,u++),c+=re(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return re(ne(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 ie(e,t,n){if(e==null)return e;var r=[],i=0;return re(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function ae(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 A=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)},oe={map:ie,forEach:function(e,t,n){ie(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return ie(e,function(){t++}),t},toArray:function(e){return ie(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=oe,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:ae}},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,A)}catch(e){A(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.6`})),u=o(((e,t)=>{t.exports=l()})),d=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&&te(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&&te(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 ee=new MessageChannel,k=ee.port2;ee.port1.onmessage=D,O=function(){k.postMessage(null)}}else O=function(){_(D,0)};function te(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,te(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}}}})),f=o(((e,t)=>{t.exports=d()})),p=o((e=>{var t=u();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.6`})),m=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=p()})),h=o((e=>{var t=f(),n=u(),r=m();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 d(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 p(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=p(e),t!==null)return t;e=e.sibling}return null}var h=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`),ee=Symbol.for(`react.activity`),k=Symbol.for(`react.memo_cache_sentinel`),te=Symbol.iterator;function ne(e){return typeof e!=`object`||!e?null:(e=te&&e[te]||e[`@@iterator`],typeof e==`function`?e:null)}var re=Symbol.for(`react.client.reference`);function ie(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===re?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 ee: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?ie(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return ie(e(t))}catch{}}return null}var ae=Array.isArray,A=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,oe=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,se={pending:!1,data:null,method:null,action:null},ce=[],le=-1;function ue(e){return{current:e}}function de(e){0>le||(e.current=ce[le],ce[le]=null,le--)}function fe(e,t){le++,ce[le]=e.current,e.current=t}var pe=ue(null),me=ue(null),he=ue(null),ge=ue(null);function _e(e,t){switch(fe(he,t),fe(me,e),fe(pe,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?cf(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=cf(t),e=lf(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}de(pe),fe(pe,e)}function ve(){de(pe),de(me),de(he)}function ye(e){e.memoizedState!==null&&fe(ge,e);var t=pe.current,n=lf(t,e.type);t!==n&&(fe(me,e),fe(pe,n))}function be(e){me.current===e&&(de(pe),de(me)),ge.current===e&&(de(ge),vp._currentValue=se)}var xe,Se;function Ce(e){if(xe===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);xe=t&&t[1]||``,Se=-1<e.stack.indexOf(` 2 at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return` 3`+xe+e+Se}var we=!1;function Te(e,t){if(!e||we)return``;we=!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)}
vendor: 20,330 bytes, lines 3-8
3else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,`name`,{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(` 4`),l=s.split(` 5`);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=` 6`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{we=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?Ce(n):``}function Ee(e,t){switch(e.tag){case 26:case 27:case 5:return Ce(e.type);case 16:return Ce(`Lazy`);case 13:return e.child!==t&&t!==null?Ce(`Suspense Fallback`):Ce(`Suspense`);case 19:return Ce(`SuspenseList`);case 0:case 15:return Te(e.type,!1);case 11:return Te(e.type.render,!1);case 1:return Te(e.type,!0);case 31:return Ce(`Activity`);default:return``}}function De(e){try{var t=``,n=null;do t+=Ee(e,n),n=e,e=e.return;while(e);return t}catch(e){return` 7Error generating stack: `+e.message+` 8`+e.stack}}var Oe=Object.prototype.hasOwnProperty,ke=t.unstable_scheduleCallback,Ae=t.unstable_cancelCallback,je=t.unstable_shouldYield,Me=t.unstable_requestPaint,Ne=t.unstable_now,Pe=t.unstable_getCurrentPriorityLevel,Fe=t.unstable_ImmediatePriority,Ie=t.unstable_UserBlockingPriority,Le=t.unstable_NormalPriority,Re=t.unstable_LowPriority,ze=t.unstable_IdlePriority,Be=t.log,Ve=t.unstable_setDisableYieldValue,He=null,Ue=null;function We(e){if(typeof Be==`function`&&Ve(e),Ue&&typeof Ue.setStrictMode==`function`)try{Ue.setStrictMode(He,e)}catch{}}var Ge=Math.clz32?Math.clz32:Je,Ke=Math.log,qe=Math.LN2;function Je(e){return e>>>=0,e===0?32:31-(Ke(e)/qe|0)|0}var Ye=256,Xe=262144,Ze=4194304;function Qe(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 $e(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=Qe(n))):i=Qe(o):i=Qe(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Qe(n))):i=Qe(o)):i=Qe(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 et(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function tt(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 nt(){var e=Ze;return Ze<<=1,!(Ze&62914560)&&(Ze=4194304),e}function rt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function it(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function at(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-Ge(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&&ot(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function ot(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Ge(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function st(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Ge(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function ct(e,t){var n=t&-t;return n=n&42?1:lt(n),(n&(e.suspendedLanes|t))===0?n:0}function lt(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 ut(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function dt(){var e=oe.p;return e===0?(e=window.event,e===void 0?32:Pp(e.type)):e}function ft(e,t){var n=oe.p;try{return oe.p=e,t()}finally{oe.p=n}}var pt=Math.random().toString(36).slice(2),mt=`__reactFiber$`+pt,ht=`__reactProps$`+pt,gt=`__reactContainer$`+pt,_t=`__reactEvents$`+pt,vt=`__reactListeners$`+pt,yt=`__reactHandles$`+pt,bt=`__reactResources$`+pt,xt=`__reactMarker$`+pt;function St(e){delete e[mt],delete e[ht],delete e[_t],delete e[vt],delete e[yt]}function Ct(e){var t=e[mt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[gt]||n[mt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=jf(e);e!==null;){if(n=e[mt])return n;e=jf(e)}return t}e=n,n=e.parentNode}return null}function wt(e){if(e=e[mt]||e[gt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Tt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function Et(e){var t=e[bt];return t||=e[bt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function Dt(e){e[xt]=!0}var Ot=new Set,kt={};function At(e,t){jt(e,t),jt(e+`Capture`,t)}function jt(e,t){for(kt[e]=t,e=0;e<t.length;e++)Ot.add(t[e])}var Mt=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]*$`),Nt={},Pt={};function Ft(e){return Oe.call(Pt,e)?!0:Oe.call(Nt,e)?!1:Mt.test(e)?Pt[e]=!0:(Nt[e]=!0,!1)}function It(e,t,n){if(Ft(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 Lt(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 Rt(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 zt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Bt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Vt(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 Ht(e){if(!e._valueTracker){var t=Bt(e)?`checked`:`value`;e._valueTracker=Vt(e,t,``+e[t])}}function Ut(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Bt(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function Wt(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 Gt=/[\n"\\]/g;function Kt(e){return e.replace(Gt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function qt(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=``+zt(t)):e.value!==``+zt(t)&&(e.value=``+zt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Yt(e,o,zt(n)):Yt(e,o,zt(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=``+zt(s):e.removeAttribute(`name`)}function Jt(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)){Ht(e);return}n=n==null?``:``+zt(n),t=t==null?n:``+zt(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),Ht(e)}function Yt(e,t,n){t===`number`&&Wt(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Xt(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=``+zt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Zt(e,t,n){if(t!=null&&(t=``+zt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+zt(n)}function Qt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(ae(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=zt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Ht(e)}function $t(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var en=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 tn(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||en.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function nn(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&&tn(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&tn(e,o,t[o])}function rn(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 an=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`]]),on=/^[\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 sn(e){return on.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function cn(){}var ln=null;function un(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var dn=null,fn=null;function pn(e){var t=wt(e);if(t&&(e=t.stateNode)){var n=e[ht]||null;a:switch(e=t.stateNode,t.type){case`input`:if(qt(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="`+Kt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[ht]||null;if(!a)throw Error(i(90));qt(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&&Ut(r)}break a;case`textarea`:Zt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Xt(e,!!n.multiple,t,!1)}}}var mn=!1;function hn(e,t,n){if(mn)return e(t,n);mn=!0;try{return e(t)}finally{if(mn=!1,(dn!==null||fn!==null)&&(Lu(),dn&&(t=dn,e=fn,fn=dn=null,pn(t),e)))for(t=0;t<e.length;t++)pn(e[t])}}function gn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[ht]||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 _n=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),vn=!1;if(_n)try{var yn={};Object.defineProperty(yn,`passive`,{get:function(){vn=!0}}),window.addEventListener(`test`,yn,yn),window.removeEventListener(`test`,yn,yn)}catch{vn=!1}var bn=null,xn=null,Sn=null;function Cn(){if(Sn)return Sn;var e,t=xn,n=t.length,r,i=`value`in bn?bn.value:bn.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 Sn=i.slice(e,1<r?1-r:void 0)}function wn(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 Tn(){return!0}function En(){return!1}function Dn(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)?Tn:En,this.isPropagationStopped=En,this}return h(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=Tn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=Tn)},persist:function(){},isPersistent:Tn}),t}var On={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},kn=Dn(On),An=h({},On,{view:0,detail:0}),jn=Dn(An),j,Mn,Nn,Pn=h({},An,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Gn,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!==Nn&&(Nn&&e.type===`mousemove`?(j=e.screenX-Nn.screenX,Mn=e.screenY-Nn.screenY):Mn=j=0,Nn=e),j)},movementY:function(e){return`movementY`in e?e.movementY:Mn}}),Fn=Dn(Pn),In=Dn(h({},Pn,{dataTransfer:0})),Ln=Dn(h({},An,{relatedTarget:0})),Rn=Dn(h({},On,{animationName:0,elapsedTime:0,pseudoElement:0})),zn=Dn(h({},On,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Bn=Dn(h({},On,{data:0})),Vn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Hn={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:`F
85`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},Un={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Wn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Un[e])?!!t[e]:!1}function Gn(){return Wn}var Kn=Dn(h({},An,{key:function(e){if(e.key){var t=Vn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=wn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Hn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Gn,charCode:function(e){return e.type===`keypress`?wn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?wn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),qn=Dn(h({},Pn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Jn=Dn(h({},An,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Gn})),Yn=Dn(h({},On,{propertyName:0,elapsedTime:0,pseudoElement:0})),Xn=Dn(h({},Pn,{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})),Zn=Dn(h({},On,{newState:0,oldState:0})),Qn=[9,13,27,32],$n=_n&&`CompositionEvent`in window,er=null;_n&&`documentMode`in document&&(er=document.documentMode);var tr=_n&&`TextEvent`in window&&!er,nr=_n&&(!$n||er&&8<er&&11>=er),rr=` `,ir=!1;function ar(e,t){switch(e){case`keyup`:return Qn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function or(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var sr=!1;function cr(e,t){switch(e){case`compositionend`:return or(t);case`keypress`:return t.which===32?(ir=!0,rr):null;case`textInput`:return e=t.data,e===rr&&ir?null:e;default:return null}}function lr(e,t){if(sr)return e===`compositionend`||!$n&&ar(e,t)?(e=Cn(),Sn=xn=bn=null,sr=!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 nr&&t.locale!==`ko`?null:t.data;default:return null}}var ur={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 dr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!ur[e.type]:t===`textarea`}function fr(e,t,n,r){dn?fn?fn.push(r):fn=[r]:dn=r,t=Gd(t,`onChange`),0<t.length&&(n=new kn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var pr=null,mr=null;function hr(e){Ld(e,0)}function gr(e){if(Ut(Tt(e)))return e}function _r(e,t){if(e===`change`)return t}var vr=!1;if(_n){var yr;if(_n){var br=`oninput`in document;if(!br){var xr=document.createElement(`div`);xr.setAttribute(`oninput`,`return;`),br=typeof xr.oninput==`function`}yr=br}else yr=!1;vr=yr&&(!document.documentMode||9<document.documentMode)}function Sr(){pr&&(pr.detachEvent(`onpropertychange`,Cr),mr=pr=null)}function Cr(e){if(e.propertyName===`value`&&gr(mr)){var t=[];fr(t,mr,e,un(e)),hn(hr,t)}}function wr(e,t,n){e===`focusin`?(Sr(),pr=t,mr=n,pr.attachEvent(`onpropertychange`,Cr)):e===`focusout`&&Sr()}function Tr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return gr(mr)}function Er(e,t){if(e===`click`)return gr(t)}function Dr(e,t){if(e===`input`||e===`change`)return gr(t)}function Or(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var kr=typeof Object.is==`function`?Object.is:Or;function Ar(e,t){if(kr(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(!Oe.call(t,i)||!kr(e[i],t[i]))return!1}return!0}function jr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Mr(e,t){var n=jr(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=jr(n)}}function Nr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Nr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Pr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Wt(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=Wt(e.document)}return t}function Fr(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 Ir=_n&&`documentMode`in document&&11>=document.documentMode,Lr=null,Rr=null,zr=null,Br=!1;function Vr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Br||Lr==null||Lr!==Wt(r)||(r=Lr,`selectionStart`in r&&Fr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focu
vendor: 106,165 bytes, line 8
8sNode:r.focusNode,focusOffset:r.focusOffset}),zr&&Ar(zr,r)||(zr=r,r=Gd(Rr,`onSelect`),0<r.length&&(t=new kn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Lr)))}function Hr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Ur={animationend:Hr(`Animation`,`AnimationEnd`),animationiteration:Hr(`Animation`,`AnimationIteration`),animationstart:Hr(`Animation`,`AnimationStart`),transitionrun:Hr(`Transition`,`TransitionRun`),transitionstart:Hr(`Transition`,`TransitionStart`),transitioncancel:Hr(`Transition`,`TransitionCancel`),transitionend:Hr(`Transition`,`TransitionEnd`)},Wr={},Gr={};_n&&(Gr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Ur.animationend.animation,delete Ur.animationiteration.animation,delete Ur.animationstart.animation),`TransitionEvent`in window||delete Ur.transitionend.transition);function Kr(e){if(Wr[e])return Wr[e];if(!Ur[e])return e;var t=Ur[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Gr)return Wr[e]=t[n];return e}var qr=Kr(`animationend`),Jr=Kr(`animationiteration`),Yr=Kr(`animationstart`),Xr=Kr(`transitionrun`),Zr=Kr(`transitionstart`),Qr=Kr(`transitioncancel`),$r=Kr(`transitionend`),ei=new Map,ti=`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(` `);ti.push(`scrollEnd`);function ni(e,t){ei.set(e,t),At(t,[e])}var ri=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)},ii=[],ai=0,oi=0;function si(){for(var e=ai,t=oi=ai=0;t<e;){var n=ii[t];ii[t++]=null;var r=ii[t];ii[t++]=null;var i=ii[t];ii[t++]=null;var a=ii[t];if(ii[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&&di(n,i,a)}}function ci(e,t,n,r){ii[ai++]=e,ii[ai++]=t,ii[ai++]=n,ii[ai++]=r,oi|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function li(e,t,n,r){return ci(e,t,n,r),fi(e)}function ui(e,t){return ci(e,null,null,t),fi(e)}function di(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-Ge(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function fi(e){if(50<Ou)throw Ou=0,ku=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var pi={};function mi(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 hi(e,t,n,r){return new mi(e,t,n,r)}function gi(e){return e=e.prototype,!(!e||!e.isReactComponent)}function _i(e,t){var n=e.alternate;return n===null?(n=hi(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 vi(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 yi(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)gi(e)&&(s=1);else if(typeof e==`string`)s=lp(e,n,pe.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case ee:return e=hi(31,n,t,a),e.elementType=ee,e.lanes=o,e;case y:return bi(n.children,a,o,t);case b:s=8,a|=24;break;case x:return e=hi(12,n,t,a|2),e.elementType=x,e.lanes=o,e;case T:return e=hi(13,n,t,a),e.elementType=T,e.lanes=o,e;case E:return e=hi(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=hi(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function bi(e,t,n,r){return e=hi(7,e,r,t),e.lanes=n,e}function xi(e,t,n){return e=hi(6,e,null,t),e.lanes=n,e}function Si(e){var t=hi(18,null,null,0);return t.stateNode=e,t}function Ci(e,t,n){return t=hi(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var wi=new WeakMap;function Ti(e,t){if(typeof e==`object`&&e){var n=wi.get(e);return n===void 0?(t={value:e,source:t,stack:De(t)},wi.set(e,t),t):n}return{value:e,source:t,stack:De(t)}}var Ei=[],Di=0,Oi=null,ki=0,Ai=[],ji=0,Mi=null,Ni=1,Pi=``;function Fi(e,t){Ei[Di++]=ki,Ei[Di++]=Oi,Oi=e,ki=t}function Ii(e,t,n){Ai[ji++]=Ni,Ai[ji++]=Pi,Ai[ji++]=Mi,Mi=e;var r=Ni;e=Pi;var i=32-Ge(r)-1;r&=~(1<<i),n+=1;var a=32-Ge(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Ni=1<<32-Ge(t)+i|n<<i|r,Pi=a+e}else Ni=1<<a|n<<i|r,Pi=e}function Li(e){e.return!==null&&(Fi(e,1),Ii(e,1,0))}function Ri(e){for(;e===Oi;)Oi=Ei[--Di],Ei[Di]=null,ki=Ei[--Di],Ei[Di]=null;for(;e===Mi;)Mi=Ai[--ji],Ai[ji]=null,Pi=Ai[--ji],Ai[ji]=null,Ni=Ai[--ji],Ai[ji]=null}function zi(e,t){Ai[ji++]=Ni,Ai[ji++]=Pi,Ai[ji++]=Mi,Ni=t.id,Pi=t.overflow,Mi=e}var Bi=null,Vi=null,Hi=!1,Ui=null,Wi=!1,Gi=Error(i(519));function Ki(e){throw Qi(Ti(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Gi}function qi(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[mt]=e,t[ht]=r,n){case`dialog`:Rd(`cancel`,t),Rd(`close`,t);break;case`iframe`:case`object`:case`embed`:Rd(`load`,t);break;case`video`:case`audio`:for(n=0;n<Fd.length;n++)Rd(Fd[n],t);break;case`source`:Rd(`error`,t);break;case`img`:case`image`:case`link`:Rd(`error`,t),Rd(`load`,t);break;case`details`:Rd(`toggle`,t);break;case`input`:Rd(`invalid`,t),Jt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Rd(`invalid`,t);break;case`textarea`:Rd(`invalid`,t),Qt(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||Zd(t.textContent,n)?(r.popover!=null&&(Rd(`beforetoggle`,t),Rd(`toggle`,t)),r.onScroll!=null&&Rd(`scroll`,t),r.onScrollEnd!=null&&Rd(`scrollend`,t),r.onClick!=null&&(t.onclick=cn),t=!0):t=!1,t||Ki(e,!0)}function Ji(e){for(Bi=e.return;Bi;)switch(Bi.tag){case 5:case 31:case 13:Wi=!1;return;case 27:case 3:Wi=!0;return;default:Bi=Bi.return}}function Yi(e){if(e!==Bi)return!1;if(!Hi)return Ji(e),Hi=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!==`form`&&n!==`button`)||uf(e.type,e.memoizedProps)),n=!n),n&&Vi&&Ki(e),Ji(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Vi=Af(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Vi=Af(e)}else t===27?(t=Vi,vf(e.type)?(e=kf,kf=null,Vi=e):Vi=t):Vi=Bi?Of(e.stateNode.nextSibling):null;return!0}function Xi(){Vi=Bi=null,Hi=!1}function Zi(){var e=Ui;return e!==null&&(mu===null?mu=e:mu.push.apply(mu,e),Ui=null),e}function Qi(e){Ui===null?Ui=[e]:Ui.push(e)}var M=ue(null),$i=null,ea=null;function ta(e,t,n){fe(M,t._currentValue),t._currentValue=n}function na(e){e._currentValue=M.current,de(M)}function ra(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 ia(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),ra(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),ra(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 aa(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;kr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===ge.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[vp]:e.push(vp))}a=a.return}e!==null&&ia(t,e,n,r),t.flags|=262144}function oa(e){for(e=e.firstContext;e!==null;){if(!kr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function sa(e){$i=e,ea=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function ca(e){return ua($i,e)}function la(e,t){return $i===null&&sa(e),ua(e,t)}function ua(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},ea===null){if(e===null)throw Error(i(308));ea=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else ea=ea.next=t;return n}var da=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()})}},fa=t.unstable_scheduleCallback,pa=t.unstable_NormalPriority,ma={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ha(){return{controller:new da,data:new Map,refCount:0}}function ga(e){e.refCount--,e.refCount===0&&fa(pa,function(){e.controller.abort()})}var _a=null,va=0,ya=0,ba=null;function xa(e,t){if(_a===null){var n=_a=[];va=0,ya=kd(),ba={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return va++,t.then(Sa,Sa),t}function Sa(){if(--va===0&&_a!==null){ba!==null&&(ba.status=`fulfilled`);var e=_a;_a=null,ya=0,ba=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 wa=A.S;A.S=function(e,t){_u=Ne(),typeof t==`object`&&t&&typeof t.then==`function`&&xa(e,t),wa!==null&&wa(e,t)};var Ta=ue(null);function Ea(){var e=Ta.current;return e===null?Ql.pooledCache:e}function Da(e,t){t===null?fe(Ta,Ta.current):fe(Ta,t.pool)}function Oa(){var e=Ea();return e===null?null:{parent:ma._currentValue,pool:e}}var ka=Error(i(460)),Aa=Error(i(474)),N=Error(i(542)),ja={then:function(){}};function Ma(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Na(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(cn,cn),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,La(e),e;default:if(typeof t.status==`string`)t.then(cn,cn);else{if(e=Ql,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,La(e),e}throw Fa=t,ka}}function Pa(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Fa=e,ka):e}}var Fa=null;function Ia(){if(Fa===null)throw Error(i(459));var e=Fa;return Fa=null,e}function La(e){if(e===ka||e===N)throw Error(i(483))}var Ra=null,za=0;function P(e){var t=za;return za+=1,Ra===null&&(Ra=[]),Na(Ra,e,t)}function Ba(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Va(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 Ha(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=_i(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=xi(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&&Pa(i)===t.type)?(t=a(t,n.props),Ba(t,n),t.return=e,t):(t=yi(n.type,n.key,n.props,null,e.mode,r),Ba(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=Ci(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=bi(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=xi(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case _:return n=yi(t.type,t.key,t.props,null,e.mode,n),Ba(n,t),n.return=e,n;case v:return t=Ci(t,e.mode,n),t.return=e,t;case O:return t=Pa(t),f(e,t,n)}if(ae(t)||ne(t))return t=bi(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,P(t),n);if(t.$$typeof===C)return f(e,la(e,t),n);Va(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=Pa(n),p(e,t,n,r)}if(ae(n)||ne(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,P(n),r);if(n.$$typeof===C)return p(e,t,la(e,n),r);Va(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=Pa(r),m(e,t,n,r,i)}if(ae(r)||ne(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,P(r),i);if(r.$$typeof===C)return m(e,t,n,la(t,r),i);Va(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),Hi&&Fi(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 Hi&&Fi(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)}),Hi&&Fi(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),Hi&&Fi(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 Hi&&Fi(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)}),Hi&&Fi(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&&Pa(l)===r.type){n(e,r.sibling),c=a(r,o.props),Ba(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===y?(c=bi(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=yi(o.type,o.key,o.props,null,e.mode,c),Ba(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=Ci(o,e.mode,c),c.return=e,e=c}return s(e);case O:return o=Pa(o),b(e,r,o,c)}if(ae(o))return h(e,r,o,c);if(ne(o)){if(l=ne(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,P(o),c);if(o.$$typeof===C)return b(e,r,la(e,o),c);Va(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=xi(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{za=0;var i=b(e,t,n,r);return Ra=null,i}catch(t){if(t===ka||t===N)throw t;var a=hi(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Ua=Ha(!0),Wa=Ha(!1),Ga=!1;function Ka(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function qa(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 Ja(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ya(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Zl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=fi(e),di(e,null,n),t}return ci(e,r,t,n),fi(e)}function Xa(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,st(e,n)}}function Za(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 Qa=!1;function $a(){if(Qa){var e=ba;if(e!==null)throw e}}function eo(e,t,n,r){Qa=!1;var i=e.updateQueue;Ga=!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?(eu&f)===f:(r&f)===f){f!==0&&f===ya&&(Qa=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(m=g.payload,typeof m==`function`){d=m.call(_,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,f=typeof m==`function`?m.call(_,d,f):m,f==null)break a;d=h({},d,f);break a;case 2:Ga=!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),cu|=o,e.lanes=o,e.memoizedState=d}}function to(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function no(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)to(n[e],t)}var ro=ue(null),io=ue(0);function ao(e,t){e=ou,fe(io,e),fe(ro,t),ou=e|t.baseLanes}function oo(){fe(io,ou),fe(ro,ro.current)}function so(){ou=io.current,de(ro),de(io)}var co=ue(null),lo=null;function uo(e){var t=e.alternate;fe(go,go.current&1),fe(co,e),lo===null&&(t===null||ro.current!==null||t.memoizedState!==null)&&(lo=e)}function fo(e){fe(go,go.current),fe(co,e),lo===null&&(lo=e)}function po(e){e.tag===22?(fe(go,go.current),fe(co,e),lo===null&&(lo=e)):mo(e)}function mo(){fe(go,go.current),fe(co,co.current)}function ho(e){de(co),lo===e&&(lo=null),de(go)}var go=ue(0);function _o(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||Tf(n)||Ef(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 vo=0,yo=null,bo=null,xo=null,So=!1,Co=!1,wo=!1,To=0,Eo=0,Do=null,Oo=0;function ko(){throw Error(i(321))}function Ao(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!kr(e[n],t[n]))return!1;return!0}function jo(e,t,n,r,i,a){return vo=a,yo=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,A.H=e===null||e.memoizedState===null?Ys:Xs,wo=!1,a=n(r,i),wo=!1,Co&&(a=No(t,n,r,i)),Mo(e),a}function Mo(e){A.H=Js;var t=bo!==null&&bo.next!==null;if(vo=0,xo=bo=yo=null,So=!1,Eo=0,Do=null,t)throw Error(i(300));e===null||pc||(e=e.dependencies,e!==null&&oa(e)&&(pc=!0))}function No(e,t,n,r){yo=e;var a=0;do{if(Co&&(Do=null),Eo=0,Co=!1,25<=a)throw Error(i(301));if(a+=1,xo=bo=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}A.H=Zs,o=t(n,r)}while(Co);return o}function Po(){var e=A.H,t=e.useState()[0];return t=typeof t.then==`function`?Vo(t):t,e=e.useState()[0],(bo===null?null:bo.memoizedState)!==e&&(yo.flags|=1024),t}function Fo(){var e=To!==0;return To=0,e}function Io(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Lo(e){if(So){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}So=!1}vo=0,xo=bo=yo=null,Co=!1,Eo=To=0,Do=null}function Ro(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return xo===null?yo.memoizedState=xo=e:xo=xo.next=e,xo}function zo(){if(bo===null){var e=yo.alternate;e=e===null?null:e.memoizedState}else e=bo.next;var t=xo===null?yo.memoizedState:xo.next;if(t!==null)xo=t,bo=e;else{if(e===null)throw yo.alternate===null?Error(i(467)):Error(i(310));bo=e,e={memoizedState:bo.memoizedState,baseState:bo.baseState,baseQueue:bo.baseQueue,queue:bo.queue,next:null},xo===null?yo.memoizedState=xo=e:xo=xo.next=e}return xo}function Bo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Vo(e){var t=Eo;return Eo+=1,Do===null&&(Do=[]),e=Na(Do,e,t),t=yo,(xo===null?t.memoizedState:xo.next)===null&&(t=t.alternate,A.H=t===null||t.memoizedState===null?Ys:Xs),e}function Ho(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Vo(e);if(e.$$typeof===C)return ca(e)}throw Error(i(438,String(e)))}function Uo(e){var t=null,n=yo.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=yo.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=Bo(),yo.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]=k;return t.index++,n}function Wo(e,t){return typeof t==`function`?t(e):t}function Go(e){return Ko(zo(),bo,e)}function Ko(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?(vo&f)===f:(eu&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===ya&&(d=!0);else if((vo&p)===p){u=u.next,p===ya&&(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,yo.lanes|=p,cu|=p;f=u.action,wo&&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,yo.lanes|=f,cu|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!kr(o,e.memoizedState)&&(pc=!0,d&&(n=ba,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 qo(e){var t=zo(),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);kr(o,t.memoizedState)||(pc=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Jo(e,t,n){var r=yo,a=zo(),o=Hi;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!kr((bo||a).memoizedState,n);if(s&&(a.memoizedState=n,pc=!0),a=a.queue,bs(Zo.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||xo!==null&&xo.memoizedState.tag&1){if(r.flags|=2048,hs(9,{destroy:void 0},Xo.bind(null,r,a,n,t),null),Ql===null)throw Error(i(349));o||vo&127||Yo(r,t,n)}return n}function Yo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=yo.updateQueue,t===null?(t=Bo(),yo.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Xo(e,t,n,r){t.value=n,t.getSnapshot=r,Qo(t)&&$o(e)}function Zo(e,t,n){return n(function(){Qo(t)&&$o(e)})}function Qo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!kr(e,n)}catch{return!0}}function $o(e){var t=ui(e,2);t!==null&&Mu(t,e,2)}function es(e){var t=Ro();if(typeof e==`function`){var n=e;if(e=n(),wo){We(!0);try{n()}finally{We(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wo,lastRenderedState:e},t}function ts(e,t,n,r){return e.baseState=n,Ko(e,bo,typeof r==`function`?r:Wo)}function ns(e,t,n,r,a){if(Gs(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)}};A.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,rs(t,o)):(o.next=n.next,t.pending=n.next=o)}}function rs(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=A.T,o={};A.T=o;try{var s=n(i,r),c=A.S;c!==null&&c(o,s),is(e,t,s)}catch(n){ss(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),A.T=a}}else try{a=n(i,r),is(e,t,a)}catch(n){ss(e,t,n)}}function is(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){as(e,t,n)},function(n){return ss(e,t,n)}):as(e,t,n)}function as(e,t,n){t.status=`fulfilled`,t.value=n,cs(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,rs(e,n)))}function ss(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,cs(t),t=t.next;while(t!==r)}e.action=null}function cs(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function ls(e,t){return t}function us(e,t){if(Hi){var n=Ql.formState;if(n!==null){a:{var r=yo;if(Hi){if(Vi){b:{for(var i=Vi,a=Wi;i.nodeType!==8;){if(!a){i=null;break b}if(i=Of(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Vi=Of(i.nextSibling),r=i.data===`F!`;break a}}Ki(r)}r=!1}r&&(t=n[0])}}return n=Ro(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ls,lastRenderedState:t},n.queue=r,n=Hs.bind(null,yo,r),r.dispatch=n,r=es(!1),a=Ws.bind(null,yo,!1,r.queue),r=Ro(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=ns.bind(null,yo,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function ds(e){return fs(zo(),bo,e)}function fs(e,t,n){if(t=Ko(e,t,ls)[0],e=Go(Wo)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Vo(t)}catch(e){throw e===ka?N:e}else r=t;t=zo();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(yo.flags|=2048,hs(9,{destroy:void 0},ps.bind(null,i,n),null)),[r,a,e]}function ps(e,t){e.action=t}function ms(e){var t=zo(),n=bo;if(n!==null)return fs(t,n,e);zo(),t=t.memoizedState,n=zo();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function hs(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=yo.updateQueue,t===null&&(t=Bo(),yo.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 gs(){return zo().memoizedState}function _s(e,t,n,r){var i=Ro();yo.flags|=e,i.memoizedState=hs(1|t,{destroy:void 0},n,r===void 0?null:r)}function vs(e,t,n,r){var i=zo();r=r===void 0?null:r;var a=i.memoizedState.inst;bo!==null&&r!==null&&Ao(r,bo.memoizedState.deps)?i.memoizedState=hs(t,a,n,r):(yo.flags|=e,i.memoizedState=hs(1|t,a,n,r))}function ys(e,t){_s(8390656,8,e,t)}function bs(e,t){vs(2048,8,e,t)}function xs(e){yo.flags|=4;var t=yo.updateQueue;if(t===null)t=Bo(),yo.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Ss(e){var t=zo().memoizedState;return xs({ref:t,nextImpl:e}),function(){if(Zl&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function Cs(e,t){return vs(4,2,e,t)}function ws(e,t){return vs(4,4,e,t)}function Ts(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 Es(e,t,n){n=n==null?null:n.concat([e]),vs(4,4,Ts.bind(null,t,e),n)}function Ds(){}function Os(e,t){var n=zo();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&Ao(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function ks(e,t){var n=zo();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&Ao(t,r[1]))return r[0];if(r=e(),wo){We(!0);try{e()}finally{We(!1)}}return n.memoizedState=[r,t],r}function As(e,t,n){return n===void 0||vo&1073741824&&!(eu&261930)?e.memoizedState=t:(e.memoizedState=n,e=ju(),yo.lanes|=e,cu|=e,n)}function js(e,t,n,r){return kr(n,t)?n:ro.current===null?!(vo&42)||vo&1073741824&&!(eu&261930)?(pc=!0,e.memoizedState=n):(e=ju(),yo.lanes|=e,cu|=e,t):(e=As(e,n,r),kr(e,t)||(pc=!0),e)}function Ms(e,t,n,r,i){var a=oe.p;oe.p=a!==0&&8>a?a:8;var o=A.T,s={};A.T=s,Ws(e,!1,t,n);try{var c=i(),l=A.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Us(e,t,Ca(c,r),Au(e)):Us(e,t,r,Au(e))}catch(n){Us(e,t,{then:function(){},status:`rejected`,reason:n},Au())}finally{oe.p=a,o!==null&&s.types!==null&&(o.types=s.types),A.T=o}}function Ns(){}function Ps(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=Fs(e).queue;Ms(e,a,t,se,n===null?Ns:function(){return Is(e),n(r)})}function Fs(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:se,baseState:se,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wo,lastRenderedState:se},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Is(e){var t=Fs(e);t.next===null&&(t=e.alternate.memoizedState),Us(e,t.next.queue,{},Au())}function Ls(){return ca(vp)}function Rs(){return zo().memoizedState}function zs(){return zo().memoizedState}function Bs(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Au();e=Ja(n);var r=Ya(t,e,n);r!==null&&(Mu(r,t,n),Xa(r,t,n)),t={cache:ha()},e.payload=t;return}t=t.return}}function Vs(e,t,n){var r=Au();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Gs(e)?Ks(t,n):(n=li(e,t,n,r),n!==null&&(Mu(n,e,r),qs(n,t,r)))}function Hs(e,t,n){Us(e,t,n,Au())}function Us(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Gs(e))Ks(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,kr(s,o))return ci(e,t,i,0),Ql===null&&si(),!1}catch{}if(n=li(e,t,i,r),n!==null)return Mu(n,e,r),qs(n,t,r),!0}return!1}function Ws(e,t,n,r){if(r={lane:2,revertLane:kd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Gs(e)){if(t)throw Error(i(479))}else t=li(e,n,r,2),t!==null&&Mu(t,e,2)}function Gs(e){var t=e.alternate;return e===yo||t!==null&&t===yo}function Ks(e,t){Co=So=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function qs(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,st(e,n)}}var Js={readContext:ca,use:Ho,useCallback:ko,useContext:ko,useEffect:ko,useImperativeHandle:ko,useLayoutEffect:ko,useInsertionEffect:ko,useMemo:ko,useReducer:ko,useRef:ko,useState:ko,useDebugValue:ko,useDeferredValue:ko,useTransition:ko,useSyncExternalStore:ko,useId:ko,useHostTransitionStatus:ko,useFormState:ko,useActionState:ko,useOptimistic:ko,useMemoCache:ko,useCacheRefresh:ko};Js.useEffectEvent=ko;var Ys={readContext:ca,use:Ho,useCallback:function(e,t){return Ro().memoizedState=[e,t===void 0?null:t],e},useContext:ca,useEffect:ys,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),_s(4194308,4,Ts.bind(null,t,e),n)},useLayoutEffect:function(e,t){return _s(4194308,4,e,t)},useInsertionEffect:function(e,t){_s(4,2,e,t)},useMemo:function(e,t){var n=Ro();t=t===void 0?null:t;var r=e();if(wo){We(!0);try{e()}finally{We(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Ro();if(n!==void 0){var i=n(t);if(wo){We(!0);try{n(t)}finally{We(!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=Vs.bind(null,yo,e),[r.memoizedState,e]},useRef:function(e){var t=Ro();return e={current:e},t.memoizedState=e},useState:function(e){e=es(e);var t=e.queue,n=Hs.bind(null,yo,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Ds,useDeferredValue:function(e,t){return As(Ro(),e,t)},useTransition:function(){var e=es(!1);return e=Ms.bind(null,yo,e.queue,!0,!1),Ro().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=yo,a=Ro();if(Hi){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Ql===null)throw Error(i(349));eu&127||Yo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,ys(Zo.bind(null,r,o,e),[e]),r.flags|=2048,hs(9,{destroy:void 0},Xo.bind(null,r,o,n,t),null),n},useId:function(){var e=Ro(),t=Ql.identifierPrefix;if(Hi){var n=Pi,r=Ni;n=(r&~(1<<32-Ge(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=To++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=Oo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Ls,useFormState:us,useActionState:us,useOptimistic:function(e){var t=Ro();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Ws.bind(null,yo,!0,n),n.dispatch=t,[e,t]},useMemoCache:Uo,useCacheRefresh:function(){return Ro().memoizedState=Bs.bind(null,yo)},useEffectEvent:function(e){var t=Ro(),n={impl:e};return t.memoizedState=n,function(){if(Zl&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Xs={readContext:ca,use:Ho,useCallback:Os,useContext:ca,useEffect:bs,useImperativeHandle:Es,useInsertionEffect:Cs,useLayoutEffect:ws,useMemo:ks,useReducer:Go,useRef:gs,useState:function(){return Go(Wo)},useDebugValue:Ds,useDeferredValue:function(e,t){return js(zo(),bo.memoizedState,e,t)},useTransition:function(){var e=Go(Wo)[0],t=zo().memoizedState;return[typeof e==`boolean`?e:Vo(e),t]},useSyncExternalStore:Jo,useId:Rs,useHostTransitionStatus:Ls,useFormState:ds,useActionState:ds,useOptimistic:function(e,t){return ts(zo(),bo,e,t)},useMemoCache:Uo,useCacheRefresh:zs};Xs.useEffectEvent=Ss;var Zs={readContext:ca,use:Ho,useCallback:Os,useContext:ca,useEffect:bs,useImperativeHandle:Es,useInsertionEffect:Cs,useLayoutEffect:ws,useMemo:ks,useReducer:qo,useRef:gs,useState:function(){return qo(Wo)},useDebugValue:Ds,useDeferredValue:function(e,t){var n=zo();return bo===null?As(n,e,t):js(n,bo.memoizedState,e,t)},useTransition:function(){var e=qo(Wo)[0],t=zo().memoizedState;return[typeof e==`boolean`?e:Vo(e),t]},useSyncExternalStore:Jo,useId:Rs,useHostTransitionStatus:Ls,useFormState:ms,useActionState:ms,useOptimistic:function(e,t){var n=zo();return bo===null?(n.baseState=e,[e,n.queue.dispatch]):ts(n,bo,e,t)},useMemoCache:Uo,useCacheRefresh:zs};Zs.useEffectEvent=Ss;function Qs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:h({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var $s={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Au(),i=Ja(r);i.payload=t,n!=null&&(i.callback=n),t=Ya(e,i,r),t!==null&&(Mu(t,e,r),Xa(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Au(),i=Ja(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Ya(e,i,r),t!==null&&(Mu(t,e,r),Xa(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Au(),r=Ja(n);r.tag=2,t!=null&&(r.callback=t),t=Ya(e,r,n),t!==null&&(Mu(t,e,n),Xa(t,e,n))}};function ec(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?!Ar(n,r)||!Ar(i,a):!0}function tc(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&$s.enqueueReplaceState(t,t.state,null)}function nc(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=h({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function rc(e){ri(e)}function ic(e){console.error(e)}function ac(e){ri(e)}function oc(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function sc(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 cc(e,t,n){return n=Ja(n),n.tag=3,n.payload={element:null},n.callback=function(){oc(e,t)},n}function lc(e){return e=Ja(e),e.tag=3,e}function uc(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(){sc(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){sc(t,n,r),typeof i!=`function`&&(bu===null?bu=new Set([this]):bu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function dc(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&aa(t,n,a,!0),n=co.current,n!==null){switch(n.tag){case 31:case 13:return lo===null?Wu():n.alternate===null&&su===0&&(su=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===ja?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),ld(e,r,a)),!1;case 22:return n.flags|=65536,r===ja?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)),ld(e,r,a)),!1}throw Error(i(435,n.tag))}return ld(e,r,a),Wu(),!1}if(Hi)return t=co.current,t===null?(r!==Gi&&(t=Error(i(423),{cause:r}),Qi(Ti(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=Ti(r,n),a=cc(e.stateNode,r,a),Za(e,a),su!==4&&(su=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==Gi&&(e=Error(i(422),{cause:r}),Qi(Ti(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=Ti(o,n),pu===null?pu=[o]:pu.push(o),su!==4&&(su=2),t===null)return!0;r=Ti(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=cc(n.stateNode,r,e),Za(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`&&(bu===null||!bu.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=lc(a),uc(a,e,n,r),Za(n,a),!1}n=n.return}while(n!==null);return!1}var fc=Error(i(461)),pc=!1;function mc(e,t,n,r){t.child=e===null?Wa(t,null,n,r):Ua(t,e.child,n,r)}function hc(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 sa(t),r=jo(e,t,n,o,a,i),s=Fo(),e!==null&&!pc?(Io(e,t,i),zc(e,t,i)):(Hi&&s&&Li(t),t.flags|=1,mc(e,t,r,i),t.child)}function gc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!gi(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,_c(e,t,a,r,i)):(e=yi(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Bc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?Ar:n,n(o,r)&&e.ref===t.ref)return zc(e,t,i)}return t.flags|=1,e=_i(a,r),e.ref=t.ref,e.return=t,t.child=e}function _c(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Ar(a,r)&&e.ref===t.ref)if(pc=!1,t.pendingProps=r=a,Bc(e,i))e.flags&131072&&(pc=!0);else return t.lanes=e.lanes,zc(e,t,i)}return Tc(e,t,n,r,i)}function vc(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 bc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Da(t,a===null?null:a.cachePool),a===null?oo():ao(t,a),po(t);else return r=t.lanes=536870912,bc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&Da(t,null),oo(),mo(t)):(Da(t,a.cachePool),ao(t,a),mo(t),t.memoizedState=null);return mc(e,t,i,n),t.child}function yc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function bc(e,t,n,r,i){var a=Ea();return a=a===null?null:{parent:ma._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&Da(t,null),oo(),po(t),e!==null&&aa(e,t,r,!0),t.childLanes=i,null}function xc(e,t){return t=Pc({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 Ua(t,e.child,null,n),e=xc(t,t.pendingProps),e.flags|=2,ho(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(Hi){if(r.mode===`hidden`)return e=xc(t,r),t.lanes=536870912,yc(null,e);if(fo(t),(e=Vi)?(e=wf(e,Wi),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Mi===null?null:{id:Ni,overflow:Pi},retryLane:536870912,hydrationErrors:null},n=Si(e),n.return=t,t.child=n,Bi=t,Vi=null)):e=null,e===null)throw Ki(t);return t.lanes=536870912,null}return xc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(fo(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(pc||aa(e,t,n,!1),a=(n&e.childLanes)!==0,pc||a){if(r=Ql,r!==null&&(s=ct(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,ui(e,s),Mu(r,e,s),fc;Wu(),t=Sc(e,t,n)}else e=o.treeContext,Vi=Of(s.nextSibling),Bi=t,Hi=!0,Ui=null,Wi=!1,e!==null&&zi(t,e),t=xc(t,r),t.flags|=4096;return t}return e=_i(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function wc(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 Tc(e,t,n,r,i){return sa(t),n=jo(e,t,n,r,void 0,i),r=Fo(),e!==null&&!pc?(Io(e,t,i),zc(e,t,i)):(Hi&&r&&Li(t),t.flags|=1,mc(e,t,n,i),t.child)}function Ec(e,t,n,r,i,a){return sa(t),t.updateQueue=null,n=No(t,r,n,i),Mo(e),r=Fo(),e!==null&&!pc?(Io(e,t,a),zc(e,t,a)):(Hi&&r&&Li(t),t.flags|=1,mc(e,t,n,a),t.child)}function Dc(e,t,n,r,i){if(sa(t),t.stateNode===null){var a=pi,o=n.contextType;typeof o==`object`&&o&&(a=ca(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=$s,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Ka(t),o=n.contextType,a.context=typeof o==`object`&&o?ca(o):pi,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Qs(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&&$s.enqueueReplaceState(a,a.state,null),eo(t,r,a,i),$a(),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=nc(n,s);a.props=c;var l=a.context,u=n.contextType;o=pi,typeof u==`object`&&u&&(o=ca(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)&&tc(t,a,r,o),Ga=!1;var f=t.memoizedState;a.state=f,eo(t,r,a,i),$a(),l=t.memoizedState,s||f!==l||Ga?(typeof d==`function`&&(Qs(t,n,d,r),l=t.memoizedState),(c=Ga||ec(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,qa(e,t),o=t.memoizedProps,u=nc(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=pi,typeof l==`object`&&l&&(c=ca(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)&&tc(t,a,r,c),Ga=!1,f=t.memoizedState,a.state=f,eo(t,r,a,i),$a();var p=t.memoizedState;o!==d||f!==p||Ga||e!==null&&e.dependencies!==null&&oa(e.dependencies)?(typeof s==`function`&&(Qs(t,n,s,r),p=t.memoizedState),(u=Ga||ec(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&oa(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,wc(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=Ua(t,e.child,null,i),t.child=Ua(t,null,n,i)):mc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=zc(e,t,i),e}function Oc(e,t,n,r){return Xi(),t.flags|=256,mc(e,t,n,r),t.child}var kc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Ac(e){return{baseLanes:e,cachePool:Oa()}}function jc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=du),e}function Mc(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:(go.current&2)!=0),s&&(a=!0,t.flags&=-129),s=(t.flags&32)!=0,t.flags&=-33,e===null){if(Hi){if(a?uo(t):mo(t),(e=Vi)?(e=wf(e,Wi),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Mi===null?null:{id:Ni,overflow:Pi},retryLane:536870912,hydrationErrors:null},n=Si(e),n.return=t,t.child=n,Bi=t,Vi=null)):e=null,e===null)throw Ki(t);return Ef(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(mo(t),a=t.mode,c=Pc({mode:`hidden`,children:c},a),r=bi(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=Ac(n),r.childLanes=jc(e,s,n),t.memoizedState=kc,yc(null,r)):(uo(t),Nc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(uo(t),t.flags&=-257,t=Fc(e,t,n)):t.memoizedState===null?(mo(t),c=r.fallback,a=t.mode,r=Pc({mode:`visible`,children:r.children},a),c=bi(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Ua(t,e.child,null,n),r=t.child,r.memoizedState=Ac(n),r.childLanes=jc(e,s,n),t.memoizedState=kc,t=yc(null,r)):(mo(t),t.child=e.child,t.flags|=128,t=null);else if(uo(t),Ef(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,Qi({value:r,source:null,stack:null}),t=Fc(e,t,n)}else if(pc||aa(e,t,n,!1),s=(n&e.childLanes)!==0,pc||s){if(s=Ql,s!==null&&(r=ct(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,ui(e,r),Mu(s,e,r),fc;Tf(c)||Wu(),t=Fc(e,t,n)}else Tf(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Vi=Of(c.nextSibling),Bi=t,Hi=!0,Ui=null,Wi=!1,e!==null&&zi(t,e),t=Nc(t,r.children),t.flags|=4096);return t}return a?(mo(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=_i(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=bi(c,a,n,null),c.flags|=2):c=_i(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,yc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=Ac(n):(a=c.cachePool,a===null?a=Oa():(l=ma._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=jc(e,s,n),t.memoizedState=kc,yc(e.child,r)):(uo(t),n=e.child,e=n.sibling,n=_i(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 Nc(e,t){return t=Pc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function Pc(e,t){return e=hi(22,e,null,t),e.lanes=0,e}function Fc(e,t,n){return Ua(t,e.child,null,n),e=Nc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Ic(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),ra(e.return,t,n)}function Lc(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 Rc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=go.current,s=(o&2)!=0;if(s?(o=o&1|2,t.flags|=128):o&=1,fe(go,o),mc(e,t,r,n),r=Hi?ki:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Ic(e,n,t);else if(e.tag===19)Ic(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&&_o(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Lc(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&&_o(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Lc(t,!0,n,null,a,r);break;case`together`:Lc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function zc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),cu|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(aa(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=_i(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=_i(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Bc(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&oa(e))):!0}function Vc(e,t,n){switch(t.tag){case 3:_e(t,t.stateNode.containerInfo),ta(t,ma,e.memoizedState.cache),Xi();break;case 27:case 5:ye(t);break;case 4:_e(t,t.stateNode.containerInfo);break;case 10:ta(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,fo(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(uo(t),e=zc(e,t,n),e===null?null:e.sibling):Mc(e,t,n):(uo(t),t.flags|=128,null);uo(t);break;case 19:var i=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=(aa(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return Rc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),fe(go,go.current),r)break;return null;case 22:return t.lanes=0,vc(e,t,n,t.pendingProps);case 24:ta(t,ma,e.memoizedState.cache)}return zc(e,t,n)}function Hc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)pc=!0;else{if(!Bc(e,n)&&!(t.flags&128))return pc=!1,Vc(e,t,n);pc=!!(e.flags&131072)}else pc=!1,Hi&&t.flags&1048576&&Ii(t,ki,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=Pa(t.elementType),t.type=e,typeof e==`function`)gi(e)?(r=nc(e,r),t.tag=1,t=Dc(null,t,e,r,n)):(t.tag=0,t=Tc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===w){t.tag=11,t=hc(null,t,e,r,n);break a}else if(a===D){t.tag=14,t=gc(null,t,e,r,n);break a}}throw t=ie(e)||e,Error(i(306,t,``))}}return t;case 0:return Tc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=nc(r,t.pendingProps),Dc(e,t,r,a,n);case 3:a:{if(_e(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,qa(e,t),eo(t,r,null,n);var s=t.memoizedState;if(r=s.cache,ta(t,ma,r),r!==o.cache&&ia(t,[ma],n,!0),$a(),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=Oc(e,t,r,n);break a}else if(r!==a){a=Ti(Error(i(424)),t),Qi(a),t=Oc(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(Vi=Of(e.firstChild),Bi=t,Hi=!0,Ui=null,Wi=!0,n=Wa(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Xi(),r===a){t=zc(e,t,n);break a}mc(e,t,r,n)}t=t.child}return t;case 26:return wc(e,t),e===null?(n=Yf(t.type,null,t.pendingProps,null))?t.memoizedState=n:Hi||(n=t.type,e=t.pendingProps,r=sf(he.current).createElement(n),r[mt]=t,r[ht]=e,ef(r,n,e),Dt(r),t.stateNode=r):t.memoizedState=Yf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ye(t),e===null&&Hi&&(r=t.stateNode=Mf(t.type,t.pendingProps,he.current),Bi=t,Wi=!0,a=Vi,vf(t.type)?(kf=a,Vi=Of(r.firstChild)):Vi=a),mc(e,t,t.pendingProps.children,n),wc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Hi&&((a=r=Vi)&&(r=Sf(r,t.type,t.pendingProps,Wi),r===null?a=!1:(t.stateNode=r,Bi=t,Vi=Of(r.firstChild),Wi=!1,a=!0)),a||Ki(t)),ye(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,uf(a,o)?r=null:s!==null&&uf(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=jo(e,t,Po,null,null,n),vp._currentValue=a),wc(e,t),mc(e,t,r,n),t.child;case 6:return e===null&&Hi&&((e=n=Vi)&&(n=Cf(n,t.pendingProps,Wi),n===null?e=!1:(t.stateNode=n,Bi=t,Vi=null,e=!0)),e||Ki(t)),null;case 13:return Mc(e,t,n);case 4:return _e(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ua(t,null,r,n):mc(e,t,r,n),t.child;case 11:return hc(e,t,t.type,t.pendingProps,n);case 7:return mc(e,t,t.pendingProps,n),t.child;case 8:return mc(e,t,t.pendingProps.children,n),t.child;case 12:return mc(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,ta(t,t.type,r.value),mc(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,sa(t),a=ca(a),r=r(a),t.flags|=1,mc(e,t,r,n),t.child;case 14:return gc(e,t,t.type,t.pendingProps,n);case 15:return _c(e,t,t.type,t.pendingProps,n);case 19:return Rc(e,t,n);case 31:return Cc(e,t,n);case 22:return vc(e,t,n,t.pendingProps);case 24:return sa(t),r=ca(ma),e===null?(a=Ea(),a===null&&(a=Ql,o=ha(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},Ka(t),ta(t,ma,a)):((e.lanes&n)!==0&&(qa(e,t),eo(t,null,null,n),$a()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,ta(t,ma,r),r!==a.cache&&ia(t,[ma],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),ta(t,ma,r))),mc(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Uc(e){e.flags|=4}function Wc(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(Vu())e.flags|=8192;else throw Fa=ja,Aa}else e.flags&=-16777217}function Gc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!up(t))if(Vu())e.flags|=8192;else throw Fa=ja,Aa}function Kc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:nt(),e.lanes|=t,fu|=t)}function qc(e,t){if(!Hi)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 Jc(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 Yc(e,t,n){var r=t.pendingProps;switch(Ri(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Jc(t),null;case 1:return Jc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),na(ma),ve(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Yi(t)?Uc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Zi())),Jc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(Uc(t),o===null?(Jc(t),Wc(t,a,null,r,n)):(Jc(t),Gc(t,o))):o?o===e.memoizedState?(Jc(t),t.flags&=-16777217):(Uc(t),Jc(t),Gc(t,o)):(e=e.memoizedProps,e!==r&&Uc(t),Jc(t),Wc(t,a,e,r,n)),null;case 27:if(be(t),n=he.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Uc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Jc(t),null}e=pe.current,Yi(t)?qi(t,e):(e=Mf(a,r,n),t.stateNode=e,Uc(t))}return Jc(t),null;case 5:if(be(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Uc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Jc(t),null}if(o=pe.current,Yi(t))qi(t,o);else{var s=sf(he.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[mt]=t,o[ht]=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(ef(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&&Uc(t)}}return Jc(t),Wc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Uc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=he.current,Yi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Bi,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[mt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Zd(e.nodeValue,n)),e||Ki(t,!0)}else e=sf(e).createTextNode(r),e[mt]=t,t.stateNode=e}return Jc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Yi(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[mt]=t}else Xi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Jc(t),e=!1}else n=Zi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(ho(t),t):(ho(t),null);if(t.flags&128)throw Error(i(558))}return Jc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Yi(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[mt]=t}else Xi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Jc(t),a=!1}else a=Zi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(ho(t),t):(ho(t),null)}return ho(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),Kc(t,t.updateQueue),Jc(t),null);case 4:return ve(),e===null&&Vd(t.stateNode.containerInfo),Jc(t),null;case 10:return na(t.type),Jc(t),null;case 19:if(de(go),r=t.memoizedState,r===null)return Jc(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)qc(r,!1);else{if(su!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=_o(e),o!==null){for(t.flags|=128,qc(r,!1),e=o.updateQueue,t.updateQueue=e,Kc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)vi(n,e),n=n.sibling;return fe(go,go.current&1|2),Hi&&Fi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ne()>vu&&(t.flags|=128,a=!0,qc(r,!1),t.lanes=4194304)}else{if(!a)if(e=_o(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Kc(t,e),qc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!Hi)return Jc(t),null}else 2*Ne()-r.renderingStartTime>vu&&n!==536870912&&(t.flags|=128,a=!0,qc(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?(Jc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Ne(),e.sibling=null,n=go.current,fe(go,a?n&1|2:n&1),Hi&&Fi(t,r.treeForkCount),e);case 22:case 23:return ho(t),so(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Jc(t),t.subtreeFlags&6&&(t.flags|=8192)):Jc(t),n=t.updateQueue,n!==null&&Kc(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&&de(Ta),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),na(ma),Jc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Xc(e,t){switch(Ri(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return na(ma),ve(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return be(t),null;case 31:if(t.memoizedState!==null){if(ho(t),t.alternate===null)throw Error(i(340));Xi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(ho(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Xi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return de(go),null;case 4:return ve(),null;case 10:return na(t.type),null;case 22:case 23:return ho(t),so(),e!==null&&de(Ta),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return na(ma),null;case 25:return null;default:return null}}function Zc(e,t){switch(Ri(t),t.tag){case 3:na(ma),ve();break;case 26:case 27:case 5:be(t);break;case 4:ve();break;case 31:t.memoizedState!==null&&ho(t);break;case 13:ho(t);break;case 19:de(go);break;case 10:na(t.type);break;case 22:case 23:ho(t),so(),e!==null&&de(Ta);break;case 24:na(ma)}}function Qc(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){cd(t,t.return,e)}}function $c(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){cd(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){cd(t,t.return,e)}}function el(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{no(t,n)}catch(t){cd(e,e.return,t)}}}function tl(e,t,n){n.props=nc(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){cd(e,t,n)}}function nl(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){cd(e,t,n)}}function rl(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){cd(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){cd(e,t,n)}else n.current=null}function il(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){cd(e,e.return,t)}}function al(e,t,n){try{var r=e.stateNode;tf(r,e.type,n,t),r[ht]=t}catch(t){cd(e,e.return,t)}}function ol(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&vf(e.type)||e.tag===4}function sl(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||ol(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&&vf(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 cl(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=cn));else if(r!==4&&(r===27&&vf(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(cl(e,t,n),e=e.sibling;e!==null;)cl(e,t,n),e=e.sibling}function ll(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&&vf(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(ll(e,t,n),e=e.sibling;e!==null;)ll(e,t,n),e=e.sibling}function ul(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);ef(t,r,n),t[mt]=e,t[ht]=n}catch(t){cd(e,e.return,t)}}var dl=!1,fl=!1,pl=!1,ml=typeof WeakSet==`function`?WeakSet:Set,hl=null;function gl(e,t){if(e=e.containerInfo,af=Dp,e=Pr(e),Fr(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(of={focusedElem:e,selectionRange:n},Dp=!1,hl=t;hl!==null;)if(t=hl,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,hl=e;else for(;hl!==null;){switch(t=hl,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=nc(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){cd(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)xf(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:xf(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,hl=e;break}hl=t.return}}function _l(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Ml(e,n),r&4&&Qc(5,n);break;case 1:if(Ml(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){cd(n,n.return,e)}else{var i=nc(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){cd(n,n.return,e)}}r&64&&el(n),r&512&&nl(n,n.return);break;case 3:if(Ml(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{no(e,t)}catch(e){cd(n,n.return,e)}}break;case 27:t===null&&r&4&&ul(n);case 26:case 5:Ml(e,n),t===null&&r&4&&il(n),r&512&&nl(n,n.return);break;case 12:Ml(e,n);break;case 31:Ml(e,n),r&4&&Cl(e,n);break;case 13:Ml(e,n),r&4&&wl(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=fd.bind(null,n),Df(e,n))));break;case 22:if(r=n.memoizedState!==null||dl,!r){t=t!==null&&t.memoizedState!==null||fl,i=dl;var a=fl;dl=r,(fl=t)&&!a?Pl(e,n,(n.subtreeFlags&8772)!=0):Ml(e,n),dl=i,fl=a}break;case 30:break;default:Ml(e,n)}}function vl(e){var t=e.alternate;t!==null&&(e.alternate=null,vl(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&St(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 yl=null,bl=!1;function xl(e,t,n){for(n=n.child;n!==null;)Sl(e,t,n),n=n.sibling}function Sl(e,t,n){if(Ue&&typeof Ue.onCommitFiberUnmount==`function`)try{Ue.onCommitFiberUnmount(He,n)}catch{}switch(n.tag){case 26:fl||rl(n,t),xl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:fl||rl(n,t);var r=yl,i=bl;vf(n.type)&&(yl=n.stateNode,bl=!1),xl(e,t,n),Nf(n.stateNode),yl=r,bl=i;break;case 5:fl||rl(n,t);case 6:if(r=yl,i=bl,yl=null,xl(e,t,n),yl=r,bl=i,yl!==null)if(bl)try{(yl.nodeType===9?yl.body:yl.nodeName===`HTML`?yl.ownerDocument.body:yl).removeChild(n.stateNode)}catch(e){cd(n,t,e)}else try{yl.removeChild(n.stateNode)}catch(e){cd(n,t,e)}break;case 18:yl!==null&&(bl?(e=yl,yf(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),$p(e)):yf(yl,n.stateNode));break;case 4:r=yl,i=bl,yl=n.stateNode.containerInfo,bl=!0,xl(e,t,n),yl=r,bl=i;break;case 0:case 11:case 14:case 15:$c(2,n,t),fl||$c(4,n,t),xl(e,t,n);break;case 1:fl||(rl(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&tl(n,t,r)),xl(e,t,n);break;case 21:xl(e,t,n);break;case 22:fl=(r=fl)||n.memoizedState!==null,xl(e,t,n),fl=r;break;default:xl(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{$p(e)}catch(e){cd(t,t.return,e)}}}function wl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{$p(e)}catch(e){cd(t,t.return,e)}}function Tl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new ml),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new ml),t;default:throw Error(i(435,e.tag))}}function El(e,t){var n=Tl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=pd.bind(null,e,t);t.then(r,r)}})}function Dl(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(vf(c.type)){yl=c.stateNode,bl=!1;break a}break;case 5:yl=c.stateNode,bl=!1;break a;case 3:case 4:yl=c.stateNode.containerInfo,bl=!0;break a}c=c.return}if(yl===null)throw Error(i(160));Sl(o,s,a),yl=null,bl=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)kl(t,e),t=t.sibling}var Ol=null;function kl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Dl(t,e),Al(e),r&4&&($c(3,e,e.return),Qc(3,e),$c(5,e,e.return));break;case 1:Dl(t,e),Al(e),r&512&&(fl||n===null||rl(n,n.return)),r&64&&dl&&(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=Ol;if(Dl(t,e),Al(e),r&512&&(fl||n===null||rl(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[xt]||o[mt]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),ef(o,r,n),o[mt]=e,Dt(o),r=o;break a;case`link`:var s=sp(`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),ef(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=sp(`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),ef(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[mt]=e,Dt(o),r=o}e.stateNode=r}else cp(a,e.type,e.stateNode);else e.stateNode=np(a,r,e.memoizedProps);else o===r?r===null&&e.stateNode!==null&&al(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?cp(a,e.type,e.stateNode):np(a,r,e.memoizedProps))}break;case 27:Dl(t,e),Al(e),r&512&&(fl||n===null||rl(n,n.return)),n!==null&&r&4&&al(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Dl(t,e),Al(e),r&512&&(fl||n===null||rl(n,n.return)),e.flags&32){a=e.stateNode;try{$t(a,``)}catch(t){cd(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,al(e,a,n===null?a:n.memoizedProps)),r&1024&&(pl=!0);break;case 6:if(Dl(t,e),Al(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){cd(e,e.return,t)}}break;case 3:if(op=null,a=Ol,Ol=If(t.containerInfo),Dl(t,e),Ol=a,Al(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{$p(t.containerInfo)}catch(t){cd(e,e.return,t)}pl&&(pl=!1,jl(e));break;case 4:r=Ol,Ol=If(e.stateNode.containerInfo),Dl(t,e),Al(e),Ol=r;break;case 12:Dl(t,e),Al(e);break;case 31:Dl(t,e),Al(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,El(e,r)));break;case 13:Dl(t,e),Al(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(gu=Ne()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,El(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=dl,d=fl;if(dl=u||a,fl=d||l,Dl(t,e),fl=d,dl=u,Al(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||dl||fl||Nl(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){cd(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){cd(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?bf(m,!0):bf(l.stateNode,!1)}catch(e){cd(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,El(e,n))));break;case 19:Dl(t,e),Al(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,El(e,r)));break;case 30:break;case 21:break;default:Dl(t,e),Al(e)}}function Al(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(ol(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;ll(e,sl(e),a);break;case 5:var o=n.stateNode;n.flags&32&&($t(o,``),n.flags&=-33),ll(e,sl(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;cl(e,sl(e),s);break;default:throw Error(i(161))}}catch(t){cd(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function jl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;jl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Ml(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)_l(e,t.alternate,t),t=t.sibling}function Nl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:$c(4,t,t.return),Nl(t);break;case 1:rl(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&tl(t,t.return,n),Nl(t);break;case 27:Nf(t.stateNode);case 26:case 5:rl(t,t.return),Nl(t);break;case 22:t.memoizedState===null&&Nl(t);break;case 30:Nl(t);break;default:Nl(t)}e=e.sibling}}function Pl(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:Pl(i,a,n),Qc(4,a);break;case 1:if(Pl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){cd(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++)to(c[i],s)}catch(e){cd(r,r.return,e)}}n&&o&64&&el(a),nl(a,a.return);break;case 27:ul(a);case 26:case 5:Pl(i,a,n),n&&r===null&&o&4&&il(a),nl(a,a.return);break;case 12:Pl(i,a,n);break;case 31:Pl(i,a,n),n&&o&4&&Cl(i,a);break;case 13:Pl(i,a,n),n&&o&4&&wl(i,a);break;case 22:a.memoizedState===null&&Pl(i,a,n),nl(a,a.return);break;case 30:break;default:Pl(i,a,n)}t=t.sibling}}function Fl(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&&ga(n))}function Il(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ga(e))}function Ll(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Rl(e,t,n,r),t=t.sibling}function Rl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Ll(e,t,n,r),i&2048&&Qc(9,t);break;case 1:Ll(e,t,n,r);break;case 3:Ll(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&&ga(e)));break;case 12:if(i&2048){Ll(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){cd(t,t.return,e)}}else Ll(e,t,n,r);break;case 31:Ll(e,t,n,r);break;case 13:Ll(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?Ll(e,t,n,r):(a._visibility|=2,zl(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?Ll(e,t,n,r):Bl(e,t),i&2048&&Fl(o,t);break;case 24:Ll(e,t,n,r),i&2048&&Il(t.alternate,t);break;default:Ll(e,t,n,r)}}function zl(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:zl(a,o,s,c,i),Qc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,zl(a,o,s,c,i)):u._visibility&2?zl(a,o,s,c,i):Bl(a,o),i&&l&2048&&Fl(o.alternate,o);break;case 24:zl(a,o,s,c,i),i&&l&2048&&Il(o.alternate,o);break;default:zl(a,o,s,c,i)}t=t.sibling}}function Bl(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:Bl(n,r),i&2048&&Fl(r.alternate,r);break;case 24:Bl(n,r),i&2048&&Il(r.alternate,r);break;default:Bl(n,r)}t=t.sibling}}var Vl=8192;function Hl(e,t,n){if(e.subtreeFlags&Vl)for(e=e.child;e!==null;)Ul(e,t,n),e=e.sibling}function Ul(e,t,n){switch(e.tag){case 26:Hl(e,t,n),e.flags&Vl&&e.memoizedState!==null&&dp(n,Ol,e.memoizedState,e.memoizedProps);break;case 5:Hl(e,t,n);break;case 3:case 4:var r=Ol;Ol=If(e.stateNode.containerInfo),Hl(e,t,n),Ol=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Vl,Vl=16777216,Hl(e,t,n),Vl=r):Hl(e,t,n));break;default:Hl(e,t,n)}}function Wl(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 Gl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];hl=r,Jl(r,e)}Wl(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Kl(e),e=e.sibling}function Kl(e){switch(e.tag){case 0:case 11:case 15:Gl(e),e.flags&2048&&$c(9,e,e.return);break;case 3:Gl(e);break;case 12:Gl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,ql(e)):Gl(e);break;default:Gl(e)}}function ql(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];hl=r,Jl(r,e)}Wl(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:$c(8,t,t.return),ql(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,ql(t));break;default:ql(t)}e=e.sibling}}function Jl(e,t){for(;hl!==null;){var n=hl;switch(n.tag){case 0:case 11:case 15:$c(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:ga(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,hl=r;else a:for(n=e;hl!==null;){r=hl;var i=r.sibling,a=r.return;if(vl(r),r===n){hl=null;break a}if(i!==null){i.return=a,hl=i;break a}hl=a}}}var Yl={getCacheForType:function(e){var t=ca(ma),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return ca(ma).controller.signal}},Xl=typeof WeakMap==`function`?WeakMap:Map,Zl=0,Ql=null,$l=null,eu=0,tu=0,nu=null,ru=!1,iu=!1,au=!1,ou=0,su=0,cu=0,lu=0,uu=0,du=0,fu=0,pu=null,mu=null,hu=!1,gu=0,_u=0,vu=1/0,yu=null,bu=null,xu=0,Su=null,Cu=null,wu=0,Tu=0,Eu=null,Du=null,Ou=0,ku=null;function Au(){return Zl&2&&eu!==0?eu&-eu:A.T===null?dt():kd()}function ju(){if(du===0)if(!(eu&536870912)||Hi){var e=Xe;Xe<<=1,!(Xe&3932160)&&(Xe=262144),du=e}else du=536870912;return e=co.current,e!==null&&(e.flags|=32),du}function Mu(e,t,n){(e===Ql&&(tu===2||tu===9)||e.cancelPendingCommit!==null)&&(zu(e,0),Iu(e,eu,du,!1)),it(e,n),(!(Zl&2)||e!==Ql)&&(e===Ql&&(!(Zl&2)&&(lu|=n),su===4&&Iu(e,eu,du,!1)),xd(e))}function Nu(e,t,n){if(Zl&6)throw Error(i(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||et(e,t),a=r?qu(e,t):Gu(e,t,!0),o=r;do{if(a===0){iu&&!r&&Iu(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!Fu(n)){a=Gu(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=pu;var l=c.current.memoizedState.isDehydrated;if(l&&(zu(c,s).flags|=256),s=Gu(c,s,!1),s!==2){if(au&&!l){c.errorRecoveryDisabledLanes|=o,lu|=o,a=4;break a}o=mu,mu=a,o!==null&&(mu===null?mu=o:mu.push.apply(mu,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){zu(e,0),Iu(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:Iu(r,t,du,!ru);break a;case 2:mu=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=gu+300-Ne(),10<a)){if(Iu(r,t,du,!ru),$e(r,0,!0)!==0)break a;wu=t,r.timeoutHandle=pf(Pu.bind(null,r,n,mu,yu,hu,t,du,lu,fu,ru,o,`Throttled`,-0,0),a);break a}Pu(r,n,mu,yu,hu,t,du,lu,fu,ru,o,null,-0,0)}}break}while(1);xd(e)}function Pu(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:cn},Ul(t,a,d);var m=(a&62914560)===a?gu-Ne():(a&4194048)===a?_u-Ne():0;if(m=pp(d,m),m!==null){wu=a,e.cancelPendingCommit=m(ed.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),Iu(e,a,o,!l);return}}ed(e,t,a,n,r,i,o,s,c)}function Fu(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(!kr(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 Iu(e,t,n,r){t&=~uu,t&=~lu,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Ge(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&ot(e,n,t)}function Lu(){return Zl&6?!0:(Sd(0,!1),!1)}function Ru(){if($l!==null){if(tu===0)var e=$l.return;else e=$l,ea=$i=null,Lo(e),Ra=null,za=0,e=$l;for(;e!==null;)Zc(e.alternate,e),e=e.return;$l=null}}function zu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,mf(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),wu=0,Ru(),Ql=e,$l=n=_i(e.current,null),eu=t,tu=0,nu=null,ru=!1,iu=et(e,t),au=!1,fu=du=uu=lu=cu=su=0,mu=pu=null,hu=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Ge(r),a=1<<i;t|=e[i],r&=~a}return ou=t,si(),n}function Bu(e,t){yo=null,A.H=Js,t===ka||t===N?(t=Ia(),tu=3):t===Aa?(t=Ia(),tu=4):tu=t===fc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,nu=t,$l===null&&(su=1,oc(e,Ti(t,e.current)))}function Vu(){var e=co.current;return e===null?!0:(eu&4194048)===eu?lo===null:(eu&62914560)===eu||eu&536870912?e===lo:!1}function Hu(){var e=A.H;return A.H=Js,e===null?Js:e}function Uu(){var e=A.A;return A.A=Yl,e}function Wu(){su=4,ru||(eu&4194048)!==eu&&co.current!==null||(iu=!0),!(cu&134217727)&&!(lu&134217727)||Ql===null||Iu(Ql,eu,du,!1)}function Gu(e,t,n){var r=Zl;Zl|=2;var i=Hu(),a=Uu();(Ql!==e||eu!==t)&&(yu=null,zu(e,t)),t=!1;var o=su;a:do try{if(tu!==0&&$l!==null){var s=$l,c=nu;switch(tu){case 8:Ru(),o=6;break a;case 3:case 2:case 9:case 6:co.current===null&&(t=!0);var l=tu;if(tu=0,nu=null,Zu(e,s,c,l),n&&iu){o=0;break a}break;default:l=tu,tu=0,nu=null,Zu(e,s,c,l)}}Ku(),o=su;break}catch(t){Bu(e,t)}while(1);return t&&e.shellSuspendCounter++,ea=$i=null,Zl=r,A.H=i,A.A=a,$l===null&&(Ql=null,eu=0,si()),o}function Ku(){for(;$l!==null;)Yu($l)}function qu(e,t){var n=Zl;Zl|=2;var r=Hu(),a=Uu();Ql!==e||eu!==t?(yu=null,vu=Ne()+500,zu(e,t)):iu=et(e,t);a:do try{if(tu!==0&&$l!==null){t=$l;var o=nu;b:switch(tu){case 1:tu=0,nu=null,Zu(e,t,o,1);break;case 2:case 9:if(Ma(o)){tu=0,nu=null,Xu(t);break}t=function(){tu!==2&&tu!==9||Ql!==e||(tu=7),xd(e)},o.then(t,t);break a;case 3:tu=7;break a;case 4:tu=5;break a;case 7:Ma(o)?(tu=0,nu=null,Xu(t)):(tu=0,nu=null,Zu(e,t,o,7));break;case 5:var s=null;switch($l.tag){case 26:s=$l.memoizedState;case 5:case 27:var c=$l;if(s?up(s):c.stateNode.complete){tu=0,nu=null;var l=c.sibling;if(l!==null)$l=l;else{var u=c.return;u===null?$l=null:($l=u,Qu(u))}break b}}tu=0,nu=null,Zu(e,t,o,5);break;case 6:tu=0,nu=null,Zu(e,t,o,6);break;case 8:Ru(),su=6;break a;default:throw Error(i(462))}}Ju();break}catch(t){Bu(e,t)}while(1);return ea=$i=null,A.H=r,A.A=a,Zl=n,$l===null?(Ql=null,eu=0,si(),su):0}function Ju(){for(;$l!==null&&!je();)Yu($l)}function Yu(e){var t=Hc(e.alternate,e,ou);e.memoizedProps=e.pendingProps,t===null?Qu(e):$l=t}function Xu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Ec(n,t,t.pendingProps,t.type,void 0,eu);break;case 11:t=Ec(n,t,t.pendingProps,t.type.render,t.ref,eu);break;case 5:Lo(t);default:Zc(n,t),t=$l=vi(t,ou),t=Hc(n,t,ou)}e.memoizedProps=e.pendingProps,t===null?Qu(e):$l=t}function Zu(e,t,n,r){ea=$i=null,Lo(t),Ra=null,za=0;var i=t.return;try{if(dc(e,i,t,n,eu)){su=1,oc(e,Ti(n,e.current)),$l=null;return}}catch(t){if(i!==null)throw $l=i,t;su=1,oc(e,Ti(n,e.current)),$l=null;return}t.flags&32768?(Hi||r===1?e=!0:iu||eu&536870912?e=!1:(ru=e=!0,(r===2||r===9||r===3||r===6)&&(r=co.current,r!==null&&r.tag===13&&(r.flags|=16384))),$u(t,e)):Qu(t)}function Qu(e){var t=e;do{if(t.flags&32768){$u(t,ru);return}e=t.return;var n=Yc(t.alternate,t,ou);if(n!==null){$l=n;return}if(t=t.sibling,t!==null){$l=t;return}$l=t=e}while(t!==null);su===0&&(su=5)}function $u(e,t){do{var n=Xc(e.alternate,e);if(n!==null){n.flags&=32767,$l=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){$l=e;return}$l=e=n}while(e!==null);su=6,$l=null}function ed(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do ad();while(xu!==0);if(Zl&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=oi,at(e,n,o,s,c,l),e===Ql&&($l=Ql=null,eu=0),Cu=t,Su=e,wu=n,Tu=o,Eu=a,Du=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,md(Le,function(){return od(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!=0,t.subtreeFlags&13878||r){r=A.T,A.T=null,a=oe.p,oe.p=2,s=Zl,Zl|=4;try{gl(e,t,n)}finally{Zl=s,oe.p=a,A.T=r}}xu=1,td(),nd(),rd()}}function td(){if(xu===1){xu=0;var e=Su,t=Cu,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=A.T,A.T=null;var r=oe.p;oe.p=2;var i=Zl;Zl|=4;try{kl(t,e);var a=of,o=Pr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&Nr(s.ownerDocument.documentElement,s)){if(c!==null&&Fr(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 _=Mr(s,h),v=Mr(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}}Dp=!!af,of=af=null}finally{Zl=i,oe.p=r,A.T=n}}e.current=t,xu=2}}function nd(){if(xu===2){xu=0;var e=Su,t=Cu,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=A.T,A.T=null;var r=oe.p;oe.p=2;var i=Zl;Zl|=4;try{_l(e,t.alternate,t)}finally{Zl=i,oe.p=r,A.T=n}}xu=3}}function rd(){if(xu===4||xu===3){xu=0,Me();var e=Su,t=Cu,n=wu,r=Du;t.subtreeFlags&10256||t.flags&10256?xu=5:(xu=0,Cu=Su=null,id(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(bu=null),ut(n),t=t.stateNode,Ue&&typeof Ue.onCommitFiberRoot==`function`)try{Ue.onCommitFiberRoot(He,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=A.T,i=oe.p,oe.p=2,A.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{A.T=t,oe.p=i}}wu&3&&ad(),xd(e),i=e.pendingLanes,n&261930&&i&42?e===ku?Ou++:(Ou=0,ku=e):Ou=0,Sd(0,!1)}}function id(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ga(t)))}function ad(){return td(),nd(),rd(),od()}function od(){if(xu!==5)return!1;var e=Su,t=Tu;Tu=0;var n=ut(wu),r=A.T,a=oe.p;try{oe.p=32>n?32:n,A.T=null,n=Eu,Eu=null;var o=Su,s=wu;if(xu=0,Cu=Su=null,wu=0,Zl&6)throw Error(i(331));var c=Zl;if(Zl|=4,Kl(o.current),Rl(o,o.current,s,n),Zl=c,Sd(0,!1),Ue&&typeof Ue.onPostCommitFiberRoot==`function`)try{Ue.onPostCommitFiberRoot(He,o)}catch{}return!0}finally{oe.p=a,A.T=r,id(e,t)}}function sd(e,t,n){t=Ti(n,t),t=cc(e.stateNode,t,2),e=Ya(e,t,2),e!==null&&(it(e,2),xd(e))}function cd(e,t,n){if(e.tag===3)sd(e,e,n);else for(;t!==null;){if(t.tag===3){sd(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(bu===null||!bu.has(r))){e=Ti(n,e),n=lc(2),r=Ya(t,n,2),r!==null&&(uc(n,r,t,e),it(r,2),xd(r));break}}t=t.return}}function ld(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Xl;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)||(au=!0,i.add(n),e=ud.bind(null,e,t,n),t.then(e,e))}function ud(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Ql===e&&(eu&n)===n&&(su===4||su===3&&(eu&62914560)===eu&&300>Ne()-gu?!(Zl&2)&&zu(e,0):uu|=n,fu===eu&&(fu=0)),xd(e)}function dd(e,t){t===0&&(t=nt()),e=ui(e,t),e!==null&&(it(e,t),xd(e))}function fd(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),dd(e,n)}function pd(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),dd(e,n)}function md(e,t){return ke(e,t)}var hd=null,gd=null,_d=!1,vd=!1,yd=!1,bd=0;function xd(e){e!==gd&&e.next===null&&(gd===null?hd=gd=e:gd=gd.next=e),vd=!0,_d||(_d=!0,Od())}function Sd(e,t){if(!yd&&vd){yd=!0;do for(var n=!1,r=hd;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-Ge(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,Dd(r,a))}else a=eu,a=$e(r,r===Ql?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||et(r,a)||(n=!0,Dd(r,a));r=r.next}while(n);yd=!1}}function Cd(){wd()}function wd(){vd=_d=!1;var e=0;bd!==0&&ff()&&(e=bd);for(var t=Ne(),n=null,r=hd;r!==null;){var i=r.next,a=Td(r,t);a===0?(r.next=null,n===null?hd=i:n.next=i,i===null&&(gd=n)):(n=r,(e!==0||a&3)&&(vd=!0)),r=i}xu!==0&&xu!==5||Sd(e,!1),bd!==0&&(bd=0)}function Td(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Ge(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=tt(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Ql,n=eu,n=$e(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(tu===2||tu===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Ae(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||et(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Ae(r),ut(n)){case 2:case 8:n=Ie;break;case 32:n=Le;break;case 268435456:n=ze;break;default:n=Le}return r=Ed.bind(null,e),n=ke(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Ae(r),e.callbackPriority=2,e.callbackNode=null,2}function Ed(e,t){if(xu!==0&&xu!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(ad()&&e.callbackNode!==n)return null;var r=eu;return r=$e(e,e===Ql?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Nu(e,r,t),Td(e,Ne()),e.callbackNode!=null&&e.callbackNode===n?Ed.bind(null,e):null)}function Dd(e,t){if(ad())return null;Nu(e,t,!0)}function Od(){gf(function(){Zl&6?ke(Fe,Cd):wd()})}function kd(){if(bd===0){var e=ya;e===0&&(e=Ye,Ye<<=1,!(Ye&261888)&&(Ye=256)),bd=e}return bd}function Ad(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:sn(``+e)}function jd(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 Md(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=Ad((i[ht]||null).action),o=r.submitter;o&&(t=(t=o[ht]||null)?Ad(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new kn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(bd!==0){var e=o?jd(i,o):new FormData(i);Ps(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?jd(i,o):new FormData(i),Ps(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var Nd=0;Nd<ti.length;Nd++){var Pd=ti[Nd];ni(Pd.toLowerCase(),`on`+(Pd[0].toUpperCase()+Pd.slice(1)))}ni(qr,`onAnimationEnd`),ni(Jr,`onAnimationIteration`),ni(Yr,`onAnimationStart`),ni(`dblclick`,`onDoubleClick`),ni(`focusin`,`onFocus`),ni(`focusout`,`onBlur`),ni(Xr,`onTransitionRun`),ni(Zr,`onTransitionStart`),ni(Qr,`onTransitionCancel`),ni($r,`onTransitionEnd`),jt(`onMouseEnter`,[`mouseout`,`mouseover`]),jt(`onMouseLeave`,[`mouseout`,`mouseover`]),jt(`onPointerEnter`,[`pointerout`,`pointerover`]),jt(`onPointerLeave`,[`pointerout`,`pointerover`]),At(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),At(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),At(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),At(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),At(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),At(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Fd=`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(` `),Id=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(Fd));function Ld(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){ri(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){ri(e)}i.currentTarget=null,a=c}}}}function Rd(e,t){var n=t[_t];n===void 0&&(n=t[_t]=new Set);var r=e+`__bubble`;n.has(r)||(Hd(t,e,2,!1),n.add(r))}function zd(e,t,n){var r=0;t&&(r|=4),Hd(n,e,r,t)}var Bd=`_reactListening`+Math.random().toString(36).slice(2);function Vd(e){if(!e[Bd]){e[Bd]=!0,Ot.forEach(function(t){t!==`selectionchange`&&(Id.has(t)||zd(t,!1,e),zd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Bd]||(t[Bd]=!0,zd(`selectionchange`,!1,t))}}function Hd(e,t,n,r){switch(Pp(t)){case 2:var i=Op;break;case 8:i=kp;break;default:i=Ap}n=i.bind(null,t,n,e),i=void 0,!vn||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 Ud(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=Ct(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}hn(function(){var r=a,i=un(n),s=[];a:{var c=ei.get(e);if(c!==void 0){var l=kn,u=e;switch(e){case`keypress`:if(wn(n)===0)break a;case`keydown`:case`keyup`:l=Kn;break;case`focusin`:u=`focus`,l=Ln;break;case`focusout`:u=`blur`,l=Ln;break;case`beforeblur`:case`afterblur`:l=Ln;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=Fn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=In;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Jn;break;case qr:case Jr:case Yr:l=Rn;break;case $r:l=Yn;break;case`scroll`:case`scrollend`:l=jn;break;case`wheel`:l=Xn;break;case`copy`:case`cut`:case`paste`:l=zn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=qn;break;case`toggle`:case`beforetoggle`:l=Zn}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=gn(m,p),g!=null&&d.push(Wd(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!==ln&&(u=n.relatedTarget||n.fromElement)&&(Ct(u)||u[gt]))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?Ct(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=Fn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=qn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:Tt(l),h=u==null?c:Tt(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,Ct(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=Kd,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&&qd(s,c,l,d,!1),u!==null&&f!==null&&qd(s,f,u,d,!0)}}a:{if(c=r?Tt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=_r;else if(dr(c))if(vr)v=Dr;else{v=Tr;var y=wr}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&rn(r.elementType)&&(v=_r):v=Er;
vendor: 4,858 bytes, lines 8-9
8if(v&&=v(e,r)){fr(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&Yt(c,`number`,c.value)}switch(y=r?Tt(r):window,e){case`focusin`:(dr(y)||y.contentEditable===`true`)&&(Lr=y,Rr=r,zr=null);break;case`focusout`:zr=Rr=Lr=null;break;case`mousedown`:Br=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Br=!1,Vr(s,n,i);break;case`selectionchange`:if(Ir)break;case`keydown`:case`keyup`:Vr(s,n,i)}var b;if($n)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 sr?ar(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(nr&&n.locale!==`ko`&&(sr||x!==`onCompositionStart`?x===`onCompositionEnd`&&sr&&(b=Cn()):(bn=i,xn=`value`in bn?bn.value:bn.textContent,sr=!0)),y=Gd(r,x),0<y.length&&(x=new Bn(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=or(n),b!==null&&(x.data=b)))),(b=tr?cr(e,n):lr(e,n))&&(x=Gd(r,`onBeforeInput`),0<x.length&&(y=new Bn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),Md(s,e,r,n,i)}Ld(s,t)})}function Wd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Gd(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=gn(e,n),i!=null&&r.unshift(Wd(e,i,a)),i=gn(e,t),i!=null&&r.push(Wd(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Kd(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function qd(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=gn(n,a),l!=null&&o.unshift(Wd(n,l,c))):i||(l=gn(n,a),l!=null&&o.push(Wd(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Jd=/\r\n?/g,Yd=/\u0000|\uFFFD/g;function Xd(e){return(typeof e==`string`?e:``+e).replace(Jd,` 9`).replace(Yd,``)}function Zd(e,t){return t=Xd(t),Xd(e)===t}function Qd(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||$t(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&$t(e,``+r);break;case`className`:Lt(e,`class`,r);break;case`tabIndex`:Lt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Lt(e,n,r);break;case`style`:nn(e,r,o);break;case`data`:if(t!==`object`){Lt(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=sn(``+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`&&Qd(e,t,`name`,a.name,a,null),Qd(e,t,`formEncType`,a.formEncType,a,null),Qd(e,t,`formMethod`,a.formMethod,a,null),Qd(e,t,`formTarget`,a.formTarget,a,null)):(Qd(e,t,`encType`,a.encType,a,null),Qd(e,t,`method`,a.method,a,null),Qd(e,t,`target`,a.target,a,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=sn(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=cn);break;case`onScroll`:r!=null&&Rd(`scroll`,e);break;case`onScrollEnd`:r!=null&&Rd(`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=sn(``+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`playsInl
9ine`: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`:Rd(`beforetoggle`,e),Rd(`toggle`,e),It(e,`popover`,r);break;case`xlinkActuate`:Rt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Rt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Rt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Rt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Rt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Rt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Rt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Rt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Rt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:It(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=an.get(n)||n,It(e,n,r))}}function $d(e,t,n,r,a,o){switch(n){case`style`:nn(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`?$t(e,r):(typeof r==`number`||typeof r==`bigint`)&&$t(e,``+r);break;case`onScroll`:r!=null&&Rd(`scroll`,e);break;case`onScrollEnd`:r!=null&&Rd(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=cn);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!kt.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[ht]||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,``):It(e,n,r)}}}function ef(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Rd(`error`,e),Rd(`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:Qd(e,t,o,s,n,null)}}a&&Qd(e,t,`srcSet`,n.srcSet,n,null),r&&Qd(e,t,`src`,n.src,n,null);return;case`input`:Rd(`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:Qd(e,t,r,d,n,null)}}Jt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in Rd(`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:Qd(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Xt(e,!!r,n,!0):Xt(e,!!r,t,!1);return;case`textarea`:for(s in Rd(`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:Qd(e,t,s,c,n,null)}Qt(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:Qd(e,t,l,r,n,null)}return;case`dialog`:Rd(`beforetoggle`,e),Rd(`toggle`,e),Rd(`cancel`,e),Rd(`close`,e);break;case`iframe`:case`object`:Rd(`load`,e);break;case`video`:case`audio`:for(r=0;r<Fd.length;r++)Rd(Fd[r],e);break;case`image`:Rd(`error`,e),Rd(`load`,e);break;case`details`:Rd(`toggle`,e);break;case`embed`:case`source`:case`link`:Rd(`error`,e),Rd(`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:Qd(e,t,u,r,n,null)}return;default:if(rn(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&$d(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Qd(e,t,c,r,n,null))}function tf(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)||Qd(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&&Qd(e,t,p,m,r,f)}}qt(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)||Qd(e,t,o,null,r,l)}
vendor: 24,672 bytes, line 9
9for(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&&Qd(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Xt(e,!!n,n?[]:``,!1):Xt(e,!!n,t,!0)):Xt(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:Qd(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&&Qd(e,t,s,a,r,o)}Zt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Qd(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:Qd(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)&&Qd(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:Qd(e,t,u,p,r,m)}return;default:if(rn(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&$d(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||$d(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Qd(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||Qd(e,t,f,p,r,m)}function nf(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function rf(){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&&nf(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&&nf(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 af=null,of=null;function sf(e){return e.nodeType===9?e:e.ownerDocument}function cf(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 lf(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 uf(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 df=null;function ff(){var e=window.event;return e&&e.type===`popstate`?e===df?!1:(df=e,!0):(df=null,!1)}var pf=typeof setTimeout==`function`?setTimeout:void 0,mf=typeof clearTimeout==`function`?clearTimeout:void 0,hf=typeof Promise==`function`?Promise:void 0,gf=typeof queueMicrotask==`function`?queueMicrotask:hf===void 0?pf:function(e){return hf.resolve(null).then(e).catch(_f)};function _f(e){setTimeout(function(){throw e})}function vf(e){return e===`head`}function yf(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),$p(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)Nf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,Nf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[xt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&Nf(e.ownerDocument.body);n=i}while(n);$p(t)}function bf(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 xf(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`:xf(n),St(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[xt])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=Of(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=Of(e.nextSibling),e===null))return null;return e}function wf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=Of(e.nextSibling),e===null))return null;return e}function Tf(e){return e.data===`$?`||e.data===`$~`}function Ef(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function Df(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 Of(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 kf=null;function Af(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return Of(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function jf(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 Mf(e,t,n){switch(t=sf(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 Nf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);St(e)}var Pf=new Map,Ff=new Set;function If(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Lf=oe.d;oe.d={f:Rf,r:zf,D:Hf,C:Uf,L:Wf,m:Gf,X:qf,S:Kf,M:Jf};function Rf(){var e=Lf.f(),t=Lu();return e||t}function zf(e){var t=wt(e);t!==null&&t.tag===5&&t.type===`form`?Is(t):Lf.r(e)}var Bf=typeof document>`u`?null:document;function Vf(e,t,n){var r=Bf;if(r&&typeof t==`string`&&t){var i=Kt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),Ff.has(i)||(Ff.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),ef(t,`link`,e),Dt(t),r.head.appendChild(t)))}}function Hf(e){Lf.D(e),Vf(`dns-prefetch`,e,null)}function Uf(e,t){Lf.C(e,t),Vf(`preconnect`,e,t)}function Wf(e,t,n){Lf.L(e,t,n);var r=Bf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Kt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Kt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Kt(n.imageSizes)+`"]`)):i+=`[href="`+Kt(e)+`"]`;var a=i;switch(t){case`style`:a=Xf(e);break;case`script`:a=ep(e)}Pf.has(a)||(e=h({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),Pf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Zf(a))||t===`script`&&r.querySelector(tp(a))||(t=r.createElement(`link`),ef(t,`link`,e),Dt(t),r.head.appendChild(t)))}}function Gf(e,t){Lf.m(e,t);var n=Bf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Kt(r)+`"][href="`+Kt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=ep(e)}if(!Pf.has(a)&&(e=h({rel:`modulepreload`,href:e},t),Pf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(tp(a)))return}r=n.createElement(`link`),ef(r,`link`,e),Dt(r),n.head.appendChild(r)}}}function Kf(e,t,n){Lf.S(e,t,n);var r=Bf;if(r&&e){var i=Et(r).hoistableStyles,a=Xf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Zf(a)))s.loading=5;else{e=h({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=Pf.get(a))&&ip(e,n);var c=o=r.createElement(`link`);Dt(c),ef(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,rp(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function qf(e,t){Lf.X(e,t);var n=Bf;if(n&&e){var r=Et(n).hoistableScripts,i=ep(e),a=r.get(i);a||(a=n.querySelector(tp(i)),a||(e=h({src:e,async:!0},t),(t=Pf.get(i))&&ap(e,t),a=n.createElement(`script`),Dt(a),ef(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Jf(e,t){Lf.M(e,t);var n=Bf;if(n&&e){var r=Et(n).hoistableScripts,i=ep(e),a=r.get(i);a||(a=n.querySelector(tp(i)),a||(e=h({src:e,async:!0,type:`module`},t),(t=Pf.get(i))&&ap(e,t),a=n.createElement(`script`),Dt(a),ef(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Yf(e,t,n,r){var a=(a=he.current)?If(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=Xf(n.href),n=Et(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=Xf(n.href);var o=Et(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(Zf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),Pf.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},Pf.set(e,n),o||$f(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=ep(n),n=Et(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 Xf(e){return`href="`+Kt(e)+`"`}function Zf(e){return`link[rel="stylesheet"][`+e+`]`}function Qf(e){return h({},e,{"data-precedence":e.precedence,precedence:null})}function $f(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}),ef(t,`link`,n),Dt(t),e.head.appendChild(t))}function ep(e){return`[src="`+Kt(e)+`"]`}function tp(e){return`script[async]`+e}function np(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Kt(n.href)+`"]`);if(r)return t.instance=r,Dt(r),r;var a=h({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Dt(r),ef(r,`style`,a),rp(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Xf(n.href);var o=e.querySelector(Zf(a));if(o)return t.state.loading|=4,t.instance=o,Dt(o),o;r=Qf(n),(a=Pf.get(a))&&ip(r,a),o=(e.ownerDocument||e).createElement(`link`),Dt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),ef(o,`link`,r),t.state.loading|=4,rp(o,n.precedence,e),t.instance=o;case`script`:return o=ep(n.src),(a=e.querySelector(tp(o)))?(t.instance=a,Dt(a),a):(r=n,(a=Pf.get(o))&&(r=h({},n),ap(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),Dt(a),ef(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,rp(r,n.precedence,e));return t.instance}function rp(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 ip(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function ap(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var op=null;function sp(e,t,n){if(op===null){var r=new Map,i=op=new Map;i.set(n,r)}else i=op,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[xt]||a[mt]||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 cp(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function lp(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 up(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function dp(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=Xf(r.href),a=t.querySelector(Zf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=mp.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Dt(a);return}a=t.ownerDocument||t,r=Qf(r),(i=Pf.get(i))&&ip(r,i),a=a.createElement(`link`),Dt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),ef(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=mp.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var fp=0;function pp(e,t){return e.stylesheets&&e.count===0&&gp(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&gp(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&fp===0&&(fp=62500*rf());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&gp(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>fp?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function mp(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)gp(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var hp=null;function gp(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,hp=new Map,t.forEach(_p,e),hp=null,mp.call(e))}function _p(e,t){if(!(t.state.loading&4)){var n=hp.get(e);if(n)var r=n.get(null);else{n=new Map,hp.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=mp.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 vp={$$typeof:C,Provider:null,Consumer:null,_currentValue:se,_currentValue2:se,_threadCount:0};function yp(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=rt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=rt(0),this.hiddenUpdates=rt(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 bp(e,t,n,r,i,a,o,s,c,l,u,d){return e=new yp(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=hi(3,null,null,t),e.current=a,a.stateNode=e,t=ha(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Ka(a),e}function xp(e){return e?(e=pi,e):pi}function Sp(e,t,n,r,i,a){i=xp(i),r.context===null?r.context=i:r.pendingContext=i,r=Ja(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Ya(e,r,t),n!==null&&(Mu(n,e,t),Xa(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 wp(e,t){Cp(e,t),(e=e.alternate)&&Cp(e,t)}function Tp(e){if(e.tag===13||e.tag===31){var t=ui(e,67108864);t!==null&&Mu(t,e,67108864),wp(e,67108864)}}function Ep(e){if(e.tag===13||e.tag===31){var t=Au();t=lt(t);var n=ui(e,t);n!==null&&Mu(n,e,t),wp(e,t)}}var Dp=!0;function Op(e,t,n,r){var i=A.T;A.T=null;var a=oe.p;try{oe.p=2,Ap(e,t,n,r)}finally{oe.p=a,A.T=i}}function kp(e,t,n,r){var i=A.T;A.T=null;var a=oe.p;try{oe.p=8,Ap(e,t,n,r)}finally{oe.p=a,A.T=i}}function Ap(e,t,n,r){if(Dp){var i=jp(r);if(i===null)Ud(e,t,r,Mp,n),Up(e,r);else if(Gp(i,e,t,n,r))r.stopPropagation();else if(Up(e,r),t&4&&-1<Hp.indexOf(e)){for(;i!==null;){var a=wt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Qe(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Ge(o);s.entanglements[1]|=c,o&=~c}xd(a),!(Zl&6)&&(vu=Ne()+500,Sd(0,!1))}}break;case 31:case 13:s=ui(a,2),s!==null&&Mu(s,a,2),Lu(),wp(a,2)}if(a=jp(r),a===null&&Ud(e,t,r,Mp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Ud(e,t,r,null,n)}}function jp(e){return e=un(e),Np(e)}var Mp=null;function Np(e){if(Mp=null,e=Ct(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 Mp=e,null}function Pp(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(Pe()){case Fe:return 2;case Ie:return 8;case Le:case Re:return 32;case ze:return 268435456;default:return 32}default:return 32}}var Fp=!1,Ip=null,Lp=null,Rp=null,zp=new Map,Bp=new Map,Vp=[],Hp=`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 Up(e,t){switch(e){case`focusin`:case`focusout`:Ip=null;break;case`dragenter`:case`dragleave`:Lp=null;break;case`mouseover`:case`mouseout`:Rp=null;break;case`pointerover`:case`pointerout`:zp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Bp.delete(t.pointerId)}}function Wp(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=wt(t),t!==null&&Tp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Gp(e,t,n,r,i){switch(t){case`focusin`:return Ip=Wp(Ip,e,t,n,r,i),!0;case`dragenter`:return Lp=Wp(Lp,e,t,n,r,i),!0;case`mouseover`:return Rp=Wp(Rp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return zp.set(a,Wp(zp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Bp.set(a,Wp(Bp.get(a)||null,e,t,n,r,i)),!0}return!1}function Kp(e){var t=Ct(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,ft(e.priority,function(){Ep(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,ft(e.priority,function(){Ep(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 qp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=jp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);ln=r,n.target.dispatchEvent(r),ln=null}else return t=wt(n),t!==null&&Tp(t),e.blockedOn=n,!1;t.shift()}return!0}function Jp(e,t,n){qp(e)&&n.delete(t)}function Yp(){Fp=!1,Ip!==null&&qp(Ip)&&(Ip=null),Lp!==null&&qp(Lp)&&(Lp=null),Rp!==null&&qp(Rp)&&(Rp=null),zp.forEach(Jp),Bp.forEach(Jp)}function Xp(e,n){e.blockedOn===n&&(e.blockedOn=null,Fp||(Fp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Yp)))}var Zp=null;function Qp(e){Zp!==e&&(Zp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Zp===e&&(Zp=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(Np(r||n)===null)continue;break}var a=wt(n);a!==null&&(e.splice(t,3),t-=3,Ps(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function $p(e){function t(t){return Xp(t,e)}Ip!==null&&Xp(Ip,e),Lp!==null&&Xp(Lp,e),Rp!==null&&Xp(Rp,e),zp.forEach(t),Bp.forEac
9h(t);for(var n=0;n<Vp.length;n++){var r=Vp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Vp.length&&(n=Vp[0],n.blockedOn===null);)Kp(n),n.blockedOn===null&&Vp.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[ht]||null;if(typeof a==`function`)o||Qp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[ht]||null)s=o.formAction;else if(Np(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Qp(n)}}}function em(){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 tm(e){this._internalRoot=e}nm.prototype.render=tm.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;Sp(n,Au(),e,t,null,null)},nm.prototype.unmount=tm.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),Lu(),t[gt]=null}};function nm(e){this._internalRoot=e}nm.prototype.unstable_scheduleHydration=function(e){if(e){var t=dt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Vp.length&&t!==0&&t<Vp[n].priority;n++);Vp.splice(n,0,e),n===0&&Kp(e)}};var rm=n.version;if(rm!==`19.2.6`)throw Error(i(527,rm,`19.2.6`));oe.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=d(t),e=e===null?null:p(e),e=e===null?null:e.stateNode,e};var im={bundleType:0,version:`19.2.6`,rendererPackageName:`react-dom`,currentDispatcherRef:A,reconcilerVersion:`19.2.6`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var am=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!am.isDisabled&&am.supportsFiber)try{He=am.inject(im),Ue=am}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=rc,s=ic,c=ac;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=bp(e,1,!1,null,null,n,r,null,o,s,c,em),e[gt]=t.current,Vd(e),new tm(t)}})),g=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=h()})),_=c(u(),1),v=g(),y=e=>{throw TypeError(e)},b=(e,t,n)=>t.has(e)||y(`Cannot `+n),x=(e,t,n)=>(b(e,t,`read from private field`),n?n.call(e):t.get(e)),S=(e,t,n)=>t.has(e)?y(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),C=(e,t,n,r)=>(b(e,t,`write to private field`),r?r.call(e,n):t.set(e,n),n),w=(e,t,n)=>(b(e,t,`access private method`),n),T=class extends Error{constructor(){super(...arguments),this.status=500,this.name=`NoClientIdProvidedException`,this.message=`Missing Client ID. Pass it to the constructor (createClient("client_01HXRMBQ9BJ3E7QSTQ9X2PHVB7"))`}};function E(e,t){if(!t.has(`code`))return!1;let{pathname:n}=window.location,r=new URL(e).pathname;return n===r||n===`${r}/`}function D(){let e={};function t(t,n){e[t]=n}function n(t){return e[t]}function r(t){delete e[t]}function i(){e={}}return{setItem:t,getItem:n,removeItem:r,reset:i}}var O=D();async function ee(){let e=k();return{codeVerifier:e,codeChallenge:await te(e)}}function k(){return ne(crypto.getRandomValues(new Uint32Array(96)))}async function te(e){return ne(await re(e))}function ne(e){return btoa(Array.from(new Uint8Array(e),e=>String.fromCharCode(e)).join(``)).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}function re(e){let t=new TextEncoder().encode(e);return crypto.subtle.digest(`SHA-256`,t)}function ie(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=`=`.repeat((4-t.length%4)%4);return atob(t+n)}function ae(e){let t=e.split(`.`);if(t.length!==3)throw Error(`Invalid JWT format`);try{return{header:JSON.parse(ie(t[0])),payload:JSON.parse(ie(t[1]))}}catch(e){throw Error(`Failed to decode JWT: ${e instanceof Error?e.message:String(e)}`)}}var A={codeVerifier:`workos:code-verifier`,user:`workos:user`,accessToken:`workos:access-token`,refreshToken:`workos:refresh-token`,expiresAt:`workos:expires-at`,authenticationMethod:`
9workos:authentication-method`};function oe(e){return ae(e).payload}function se(e){return`${A.refreshToken}:${e}`}function ce(e,{devMode:t=!1,clientId:n}){let{user:r,accessToken:i,refreshToken:a,authenticationMethod:o}=e;O.setItem(A.user,r),O.setItem(A.accessToken,i),O.setItem(A.authenticationMethod,o),(t?window.localStorage:O).setItem(se(n),a);let{exp:s,iat:c}=oe(i),l=s-c,u=Date.now()+l*1e3;O.setItem(A.expiresAt,u)}function le({devMode:e=!1,clientId:t}){O.removeItem(A.user),O.removeItem(A.accessToken),O.removeItem(A.authenticationMethod);let n=e?window.localStorage:O;n.removeItem(se(t)),n.removeItem(A.refreshToken)}function ue({devMode:e=!1,clientId:t}){let n=e?window.localStorage:O,r=n.getItem(se(t))??n.getItem(A.refreshToken);return typeof r==`string`?r:void 0}function de(e){let t=new URLSearchParams,n=Object.keys(e).sort();for(let r of n){let n=e[r];n&&t.append(r,n)}return t.toString()}var fe=class extends Error{},pe=class extends fe{},me=class extends fe{},he=class extends fe{constructor(){super(...arguments),this.message=`No access token available`}},ge=class extends fe{constructor(){super(...arguments),this.message=`SignOut() called without an active session. Provide a returnTo URL to redirect anyway.`}},_e=class e{constructor(){this.locked=new Map,this.addToLocked=(e,t)=>{let n=this.locked.get(e);n===void 0?t===void 0?this.locked.set(e,[]):this.locked.set(e,[t]):t!==void 0&&(n.unshift(t),this.locked.set(e,n))},this.isLocked=e=>this.locked.has(e),this.lock=e=>new Promise((t,n)=>{this.isLocked(e)?this.addToLocked(e,t):(this.addToLocked(e),t())}),this.unlock=e=>{let t=this.locked.get(e);if(t===void 0||t.length===0){this.locked.delete(e);return}let n=t.pop();this.locked.set(e,t),n!==void 0&&setTimeout(n,0)}}static getInstance(){return e.instance===void 0&&(e.instance=new e),e.instance}};function ve(){return _e.getInstance()}var ye=`browser-tabs-lock-key`,be={key:async e=>{throw Error(`Unsupported`)},getItem:async e=>{throw Error(`Unsupported`)},clear:async()=>window.localStorage.clear(),removeItem:async e=>{throw Error(`Unsupported`)},setItem:async(e,t)=>{throw Error(`Unsupported`)},keySync:e=>window.localStorage.key(e),getItemSync:e=>window.localStorage.getItem(e),clearSync:()=>window.localStorage.clear(),removeItemSync:e=>window.localStorage.removeItem(e),setItemSync:(e,t)=>window.localStorage.setItem(e,t)};function xe(e){return new Promise(t=>setTimeout(t,e))}function Se(e){let t=``;for(let n=0;n<e;n++){let e=Math.floor(Math.random()*61);t+=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz`[e]}return t}function Ce(){return Date.now().toString()+Se(15)}var we=class e{constructor(t){this.acquiredIatSet=new Set,this.storageHandler=void 0,this.id=Ce(),this.acquireLock=this.acquireLock.bind(this),this.releaseLock=this.releaseLock.bind(this),this.releaseLock__private__=this.releaseLock__private__.bind(this),this.waitForSomethingToChange=this.waitForSomethingToChange.bind(this),this.refreshLockWhileAcquired=this.refreshLockWhileAcquired.bind(this),this.storageHandler=t,e.waiters===void 0&&(e.waiters=[])}async acquireLock(t,n=5e3){let r=Date.now()+Se(4),i=Date.now()+n,a=`${ye}-${t}`,o=this.storageHandler===void 0?be:this.storageHandler;for(;Date.now()<i;){if(await xe(30),o.getItemSync(a)===null){let e=`${this.id}-${t}-${r}`;await xe(Math.floor(Math.random()*25)),o.setItemSync(a,JSON.stringify({id:this.id,iat:r,timeoutKey:e,timeAcquired:Date.now(),timeRefreshed:Date.now()})),await xe(30);let n=o.getItemSync(a);if(n!==null){let e=JSON.parse(n);if(e.id===this.id&&e.iat===r)return this.acquiredIatSet.add(r),this.refreshLockWhileAcquired(a,r),!0}}else e.lockCorrector(this.storageHandler===void 0?be:this.storageHandler),await this.waitForSomethingToChange(i);r=Date.now()+Se(4)}return!1}async refreshLockWhileAcquired(e,t){setTimeout(async()=>{if(await ve().lock(t),!this.acquiredIatSet.has(t)){ve().unlock(t);return}let n=this.storageHandler===void 0?be:this.storageHandler,r=n.getItemSync(e);if(r!==null){let i=JSON.parse(r);i.timeRefreshed=Date.now(),n.setItemSync(e,JSON.stringify(i)),ve().unlock(t)}else{ve().unlock(t);return}this.refreshLockWhileAcquired(e,t)},1e3)}async waitForSomethingToChange(t){await new Promise(n=>{let r=!1,i=Date.now(),a=!1;function o(){if(a||=(window.removeEventListener(`storage`,o),e.removeFromWaiting(o),clearTimeout(s),!0),!r){r=!0;let e=50-(Date.now()-i);e>0?setTimeout(n,e):n(null)}}window.addEventListener(`storage`,o),e.addToWaiting(o);let s=setTimeout(o,Math.max(0,t-Date.now()))})}static addToWaiting(t){this.removeFromWaiting(t),e.waiters!==void 0&&e.waiters.push(t)}static removeFromWaiting(t){e.waiters!==void 0&&(e.waiters=e.waiters.filter(e=>e!==t))}static notifyWaiters(){e.waiters!==void 0&&[...e.waiters].forEac
9h(e=>e())}async releaseLock(e){return await this.releaseLock__private__(e)}async releaseLock__private__(t){let n=this.storageHandler===void 0?be:this.storageHandler,r=`${ye}-${t}`,i=n.getItemSync(r);if(i===null)return;let a=JSON.parse(i);a.id===this.id&&(await ve().lock(a.iat),this.acquiredIatSet.delete(a.iat),n.removeItemSync(r),ve().unlock(a.iat),e.notifyWaiters())}static lockCorrector(t){let n=Date.now()-5e3,r=t,i=[],a=0;for(;;){let e=r.keySync(a);if(e===null)break;i.push(e),a++}let o=!1;for(let e=0;e<i.length;e++){let t=i[e];if(t.includes(ye)){let e=r.getItemSync(t);if(e!==null){let i=JSON.parse(e);(i.timeRefreshed===void 0&&i.timeAcquired<n||i.timeRefreshed!==void 0&&i.timeRefreshed<n)&&(r.removeItemSync(t),o=!0)}}}o&&e.notifyWaiters()}};we.waiters=void 0;var Te=we,Ee=1e4;function De(e,t,{timeout:n=Ee}={}){if(!e)throw TypeError(`lockName is required and must be a non-empty string.`);return`locks`in navigator?Oe(e,t,n):ke(e,t,n)}async function Oe(e,t,n){try{return await navigator.locks.request(e,{signal:AbortSignal.timeout(n)},t)}catch(t){if(t instanceof DOMException)switch(t.name){case`AbortError`:throw new Ae(`AcquisitionTimeoutError`,e,`Native`);case`InvalidStateError`:case`NotSupportedError`:case`SecurityError`:}throw t}}async function ke(e,t,n){let r=new Te;try{if(await r.acquireLock(e,n))return await t();throw new Ae(`AcquisitionTimeoutError`,e,`Vendor`)}finally{await r.releaseLock(e)}}var Ae=class extends Error{constructor(e,t,n){super(`Lock acquisition timed out for "${t}" (${n})`),this.name=e,this.lockName=t}},je=e=>({object:e.object,id:e.id,email:e.email,emailVerified:e.email_verified,firstName:e.first_name,profilePictureUrl:e.profile_picture_url,lastName:e.last_name,lastSignInAt:e.last_sign_in_at,externalId:e.external_id,createdAt:e.created_at,updatedAt:e.updated_at}),Me=e=>{let{user:t,organization_id:n,access_token:r,refresh_token:i,authentication_method:a,impersonator:o,...s}=e;return{user:je(t),organizationId:n,accessToken:r,refreshToken:i,authenticationMethod:a,impersonator:o,...s}},Ne=`api.workos.com`,Pe,Fe,Ie,Le,Re=class{constructor({clientId:e,hostname:t=Ne,port:n,https:r=!0}){S(this,Ie),S(this,Pe),S(this,Fe),C(this,Pe,`${r?`https`:`http`}://${t}${n?`:${n}`:``}`),C(this,Fe,e)}async authenticateWithRefreshToken({refreshToken:e,organizationId:t,useCookie:n}){let r=await w(this,Ie,Le).call(this,`/user_management/authenticate`,{useCookie:n,body:{client_id:x(this,Fe),grant_type:`refresh_token`,...!n&&{refresh_token:e},organization_id:t}});if(r.ok)return Me(await r.json());throw new pe((await r.json()).error_description)}async authenticateWithCode({code:e,codeVerifier:t,useCookie:n}){let r=await w(this,Ie,Le).call(this,`/user_management/authenticate`,{useCookie:n,body:{code:e,client_id:x(this,Fe),grant_type:`authorization_code`,code_verifier:t}});if(r.ok)return Me(await r.json());throw new me((await r.json()).error_description)}getAuthorizationUrl({connectionId:e,context:t,domainHint:n,loginHint:r,organizationId:i,provider:a=`authkit`,redirectUri:o,state:s,screenHint:c,passwordResetToken:l,invitationToken:u,codeChallenge:d,codeChallengeMethod:f}){if(!a&&!e&&!i)throw TypeError(`Incomplete arguments. Need to specify either a 'connectionId', 'organizationId', or 'provider'.`);if(a!==`authkit`&&c)throw TypeError(`'screenHint' is only supported for 'authkit' provider`);t&&console.warn("`context` is deprecated. We previously required initiate login endpoints to return the\n`context` query parameter when getting the authorization URL. This is no longer necessary.");let p=de({connection_id:e,organization_id:i,domain_hint:n,login_hint:r,provider:a,client_id:x(this,Fe),redirect_uri:o,response_type:`code`,state:s,screen_hint:c,invitation_token:u,password_reset_token:l,code_challenge:d,code_challenge_method:f});return`${x(this,Pe)}/user_management/authorize?${p}`}getLogoutUrl({sessionId:e,returnTo:t}){let n=new URL(`/user_management/sessions/logout`,x(this,Pe));return n.searchParams.set(`session_id`,e),t&&n.searchParams.set(`return_to`,t),n}};Pe=new WeakMap,Fe=new WeakMap,Ie=new WeakSet,Le=function(e,{body:t,useCookie:n}){return fetch(new URL(e,x(this,Pe)),{method:`POST`,...n&&{credentials:`include`},headers:{Accept:`application/json, text/plain, */*`,"Content-Type":`application/json`},body:JSON.stringify(t)})};var ze=`workos_organization_id`;function Be(e){return`workos-org-id:${e}`}var Ve=`WORKOS_REFRESH_SESSION`;function He(e){let t=document.cookie.match(/(?:^|;\s*)workos-has-session=([^;]*)/);if(!t)return!1;let n=t[1];return n===`1`?!0:n.split(`.`).includes(e)}var Ue,We,Ge,Ke,qe,Je,Ye,Xe,Ze,Qe,$e,et,tt,nt,rt,it,at,ot,st,ct,lt,ut=class{constructor(e,{apiH
9ostname:t,https:n,port:r,redirectUri:i=window.origin,devMode:a=location.hostname===`localhost`||location.hostname===`127.0.0.1`,onBeforeAutoRefresh:o=()=>!document.hidden,onRedirectCallback:s=e=>{},onRefresh:c,onRefreshFailure:l,refreshBufferInterval:u=10}={}){if(S(this,et),S(this,Ue),S(this,We),S(this,Ge),S(this,Ke),S(this,qe),S(this,Je),S(this,Ye),S(this,Xe),S(this,Ze),S(this,Qe),S(this,$e),!e)throw new T;C(this,Ge,e),C(this,Ke,new Re({clientId:e,hostname:t,port:r,https:n})),C(this,Je,a),C(this,qe,i),C(this,Ue,{tag:`INITIAL`}),C(this,Ye,o),C(this,Xe,s),C(this,Ze,c),C(this,Qe,l),C(this,$e,u)}async initialize(){if(x(this,Ue).tag!==`INITIAL`)return;let e=new URLSearchParams(window.location.search);if(E(x(this,qe),e))await w(this,et,tt).call(this);else if(He(x(this,Ge))||ue({devMode:x(this,Je),clientId:x(this,Ge)}))try{await w(this,et,rt).call(this),w(this,et,nt).call(this)}catch{}}async getSignInUrl(e={}){return await w(this,et,ot).call(this,{...e})}async getSignUpUrl(e={}){return await w(this,et,ot).call(this,{...e,screenHint:`sign-up`})}async signIn(e={}){let t=await w(this,et,ot).call(this,{...e});window.location.assign(t)}async signUp(e={}){let t=await w(this,et,ot).call(this,{...e,screenHint:`sign-up`});window.location.assign(t)}signOut(e={navigate:!0}){let{navigate:t=!0,returnTo:n}=e,r=O.getItem(A.accessToken);if(typeof r!=`string`){if(!n){if(t)throw new ge;return Promise.reject(new ge)}if(t){window.location.assign(n);return}return Promise.resolve()}let{sid:i}=oe(r),a=x(this,Ke).getLogoutUrl({sessionId:i,returnTo:n});if(a)if(le({devMode:x(this,Je),clientId:x(this,Ge)}),sessionStorage.removeItem(Be(x(this,Ge))),sessionStorage.removeItem(ze),t)window.location.assign(a);else return new Promise(async e=>{fetch(a,{mode:`no-cors`,credentials:`include`}).catch(e=>{console.warn(`AuthKit: Failed to send logout request`,e)}).finally(e)})}async getAccessToken(e){if(e?.forceRefresh||w(this,et,at).call(this))try{await w(this,et,rt).call(this)}catch(e){throw e instanceof pe?new he:e}let t=w(this,et,st).call(this);if(!t)throw new he;return t}getUser(){return O.getItem(A.user)||null}dispose(){clearTimeout(x(this,We)),O.reset()}async switchToOrganization({organizationId:e,signInOpts:t={}}){try{await w(this,et,rt).call(this,{organizationId:e})}catch(n){if(n instanceof pe)this.signIn({...t,organizationId:e});else throw n}}};Ue=new WeakMap,We=new WeakMap,Ge=new WeakMap,Ke=new WeakMap,qe=new WeakMap,Je=new WeakMap,Ye=new WeakMap,Xe=new WeakMap,Ze=new WeakMap,Qe=new WeakMap,$e=new WeakMap,et=new WeakSet,tt=async function(){if(x(this,Ue).tag!==`INITIAL`)return;let e=new URL(window.location.href),t=e.searchParams.get(`code`),n=e.searchParams.get(`state`),r=n?JSON.parse(n):void 0,i=window.sessionStorage.getItem(A.codeVerifier);if(t)if(i)try{C(this,Ue,{tag:`AUTHENTICATING`,response:x(this,Ke).authenticateWithCode({code:t,codeVerifier:i,useCookie:x(this,et,ct)})});let e=await x(this,Ue).response;e&&(C(this,Ue,{tag:`AUTHENTICATED`}),w(this,et,nt).call(this),ce(e,{devMode:x(this,Je),clientId:x(this,Ge)}),w(this,et,lt).call(this,e),x(this,Xe).call(this,{state:r,...e}))}catch(e){C(this,Ue,{tag:`ERROR`}),console.error(e)}else C(this,Ue,{tag:`ERROR`}),console.error(`Couldn't exchange code. 10 11An authorization_code was supplied for a login which did not originate at the application. This could happen for various reasons: 12 13* This could have been an attempted Login CSRF attack. You were not affected. 14* The developer may not have configured a Login Initiation endpoint.`);let a=new URL(window.location.toString());a.search=``,window.sessionStorage.removeItem(A.codeVerifier),window.history.replaceState({},``,a)},nt=async function(){C(this,We,setTimeout(()=>{w(this,et,at).call(this)&&x(this,Ye).call(this)?w(this,et,rt).call(this).catch(e=>{console.debug(e)}).finally(()=>w(this,et,nt).call(this)):w(this,et,nt).call(this)},1e3))},rt=async function({organizationId:e}={}){if(x(this,Ue).tag===`AUTHENTICATING`){await x(this,Ue).response;return}let t=x(this,Ue);C(this,Ue,{tag:`AUTHENTICATING`,response:w(this,et,it).call(this,{organizationId:e,beginningState:t})}),await x(this,Ue).response},it=async function({organizationId:e,beginningState:t}){try{return await De(Ve,async()=>
14{if(e)sessionStorage.setItem(Be(x(this,Ge)),e);else{let t=w(this,et,st).call(this);e=t?oe(t)?.org_id:sessionStorage.getItem(Be(x(this,Ge)))??sessionStorage.getItem(ze)??void 0}let t=await x(this,Ke).authenticateWithRefreshToken({refreshToken:ue({devMode:x(this,Je),clientId:x(this,Ge)}),organizationId:e,useCookie:x(this,et,ct)});return C(this,Ue,{tag:`AUTHENTICATED`}),ce(t,{devMode:x(this,Je),clientId:x(this,Ge)}),w(this,et,lt).call(this,t),t})}catch(e){throw e instanceof Ae&&e.name===`AcquisitionTimeoutError`?(console.warn(`Couldn't acquire refresh lock.`),C(this,Ue,t),e):(t.tag!==`INITIAL`&&console.debug(e),e instanceof pe?(le({devMode:x(this,Je),clientId:x(this,Ge)}),sessionStorage.removeItem(Be(x(this,Ge))),sessionStorage.removeItem(ze),t.tag!==`INITIAL`&&x(this,Qe)&&x(this,Qe).call(this,{signIn:this.signIn.bind(this)}),C(this,Ue,{tag:`ERROR`})):C(this,Ue,{tag:`AUTHENTICATED`}),e)}},at=function(){switch(x(this,Ue).tag){case`INITIAL`:case`AUTHENTICATING`:return!0;case`ERROR`:return!1;case`AUTHENTICATED`:let e=O.getItem(A.accessToken),t=O.getItem(A.expiresAt);return!e||!t?!0:t-x(this,$e)*1e3<Date.now()}},ot=async function({context:e,invitationToken:t,loginHint:n,organizationId:r,passwordResetToken:i,state:a,screenHint:o}){let{codeVerifier:s,codeChallenge:c}=await ee();return window.sessionStorage.setItem(A.codeVerifier,s),x(this,Ke).getAuthorizationUrl({codeChallenge:c,codeChallengeMethod:`S256`,context:e,invitationToken:t,loginHint:n,organizationId:r,passwordResetToken:i,redirectUri:x(this,qe),screenHint:o,state:a?JSON.stringify(a):void 0})},st=function(){return O.getItem(A.accessToken)},ct=function(){return!x(this,Je)},lt=async function(e){if(x(this,Ze)){let{refreshToken:t,...n}=e;x(this,Ze).call(this,n)}};async function dt(e,t={}){let n=new ut(e,t);return await n.initialize(),n}var ft=Object.defineProperty,pt=Object.defineProperties,mt=Object.getOwnPropertyDescriptors,ht=Object.getOwnPropertySymbols,gt=Object.prototype.hasOwnProperty,_t=Object.prototype.propertyIsEnumerable,vt=(e,t,n)=>t in e?ft(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,yt=(e,t)=>{for(var n in t||={})gt.call(t,n)&&vt(e,n,t[n]);if(ht)for(var n of ht(t))_t.call(t,n)&&vt(e,n,t[n]);return e},bt=(e,t)=>pt(e,mt(t)),xt=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())}),St={isLoading:!0,user:null,role:null,roles:null,organizationId:null,permissions:[],featureFlags:[],impersonator:null,authenticationMethod:null},Ct=_.createContext(St);function wt(){let e=_.useContext(Ct);if(e===St)throw Error(`useAuth must be used within an AuthKitProvider`);return e}function Tt(e){let{clientId:t,devMode:n,apiHostname:r,https:i,port:a,redirectUri:o,children:s,onRefresh:c,onRefreshFailure:l,onRedirectCallback:u,refreshBufferInterval:d}=e,[f,p]=_.useState(Dt),[m,h]=_.useState(St),g=_.useCallback(e=>{let{user:t,accessToken:n,organizationId:r=null,impersonator:i=null,authenticationMethod:a=null}=e,{role:o=null,roles:s=null,permissions:l=[],feature_flags:u=[]}=oe(n);h(e=>{let n=bt(yt({},e),{user:t,organizationId:r,role:o,roles:s,permissions:l,featureFlags:u,impersonator:i,authenticationMethod:a});return Et(e,n)?e:n}),c?.(e)},[f]);return _.useEffect(()=>{function e(){let e=setTimeout(()=>{dt(t,{apiHostname:r,port:a,https:i,redirectUri:o,devMode:n,onRedirectCallback:u,onRefresh:g,onRefreshFailure:l,refreshBufferInterval:d}).then(e=>xt(this,null,function*(){let t=e.getUser();p({getAccessToken:e.getAccessToken.bind(e),getUser:e.getUser.bind(e),signIn:e.signIn.bind(e),signUp:e.signUp.bind(e),signOut:e.signOut.bind(e),switchToOrganization:e.switchToOrganization.bind(e),getSignInUrl:e.getSignInUrl.bind(e),getSignUpUrl:e.getSignUpUrl.bind(e)}),h(e=>bt(yt({},e),{isLoading:!1,user:t}))}))});return()=>{clearTimeout(e)}}return p(Dt),h(St),e()},[t,r,i,a,o,d]),_.createElement(Ct.Provider,{value:yt(yt({},f),m)},s)}function Et(e,t){return e.user?.updatedAt===t.user?.updatedAt&&e.organizationId===t.organizationId&&e.role===t.role&&e.roles===t.roles&&e.permissions.length===t.permissions.length&&e.permissions.every((e,n)=>e===t.permissions[n])&&e.featureFlags.length===t.featureFlags.length&&e.featureFlags.every((e,n)=>e===t.featureFlags[n])&&e.impersonator?.email===t.impersonator?.email&&e.impersonator?.reason===t.impersonator?.reason&&e.authenticationMethod===t.authenticationMethod}for(var Dt={signIn:()=>xt(void 0,null,function*(){}),signUp:()=>xt(void 0,null,function*(){}),getUser:()=>null,getAccessToken:()=>Promise.reject(new he),switchToOrganization:()=>Promise.resolve(),signOut:()=>xt(void 0,null,function*(){}),getSignInUrl:()=>xt(void 0,null,function*(){return``}),getSignUpUrl:()=>xt(void 0,null,function*(){return``})},Ot=[],kt=[],At=Uint8Array,jt=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
14+/`,Mt=0,Nt=jt.length;Mt<Nt;++Mt)Ot[Mt]=jt[Mt],kt[jt.charCodeAt(Mt)]=Mt;kt[45]=62,kt[95]=63;function Pt(e){var t=e.length;if(t%4>0)throw Error(`Invalid string. Length must be a multiple of 4`);var n=e.indexOf(`=`);n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function Ft(e,t,n){return(t+n)*3/4-n}function It(e){var t,n=Pt(e),r=n[0],i=n[1],a=new At(Ft(e,r,i)),o=0,s=i>0?r-4:r,c;for(c=0;c<s;c+=4)t=kt[e.charCodeAt(c)]<<18|kt[e.charCodeAt(c+1)]<<12|kt[e.charCodeAt(c+2)]<<6|kt[e.charCodeAt(c+3)],a[o++]=t>>16&255,a[o++]=t>>8&255,a[o++]=t&255;return i===2&&(t=kt[e.charCodeAt(c)]<<2|kt[e.charCodeAt(c+1)]>>4,a[o++]=t&255),i===1&&(t=kt[e.charCodeAt(c)]<<10|kt[e.charCodeAt(c+1)]<<4|kt[e.charCodeAt(c+2)]>>2,a[o++]=t>>8&255,a[o++]=t&255),a}function Lt(e){return Ot[e>>18&63]+Ot[e>>12&63]+Ot[e>>6&63]+Ot[e&63]}function Rt(e,t,n){for(var r,i=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(Lt(r));return i.join(``)}function zt(e){for(var t,n=e.length,r=n%3,i=[],a=16383,o=0,s=n-r;o<s;o+=a)i.push(Rt(e,o,o+a>s?s:o+a));return r===1?(t=e[n-1],i.push(Ot[t>>2]+Ot[t<<4&63]+`==`)):r===2&&(t=(e[n-2]<<8)+e[n-1],i.push(Ot[t>>10]+Ot[t>>4&63]+Ot[t<<2&63]+`=`)),i.join(``)}function Bt(e){if(e===void 0)return{};if(!Ht(e))throw Error(`The arguments to a Convex function must be an object. Received: ${e}`);return e}function Vt(e){if(e===void 0)throw Error(`Client created with undefined deployment address. If you used an environment variable, check that it's set.`);if(typeof e!=`string`)throw Error(`Invalid deployment address: found ${e}".`);if(!(e.startsWith(`http:`)||e.startsWith(`https:`)))throw Error(`Invalid deployment address: Must start with "https://" or "http://". Found "${e}".`);try{new URL(e)}catch{throw Error(`Invalid deployment address: "${e}" is not a valid URL. If you believe this URL is correct, use the \`skipConvexDeploymentUrlCheck\` option to bypass this.`)}if(e.endsWith(`.convex.site`))throw Error(`Invalid deployment address: "${e}" ends with .convex.site, which is used for HTTP Actions. Convex deployment URLs typically end with .convex.cloud? If you believe this URL is correct, use the \`skipConvexDeploymentUrlCheck\` option to bypass this.`)}function Ht(e){let t=typeof e==`object`,n=Object.getPrototypeOf(e),r=n===null||n===Object.prototype||n?.constructor?.name===`Object`;return t&&r}var Ut=!0,Wt=BigInt(`-9223372036854775808`),Gt=BigInt(`9223372036854775807`),Kt=BigInt(`0`),qt=BigInt(`8`),Jt=BigInt(`256`);function Yt(e){return Number.isNaN(e)||!Number.isFinite(e)||Object.is(e,-0)}function Xt(e){e<Kt&&(e-=Wt+Wt);let t=e.toString(16);t.length%2==1&&(t=`0`+t);let n=new Uint8Array(new ArrayBuffer(8)),r=0;for(let i of t.match(/.{2}/g).reverse())n.set([parseInt(i,16)],r++),e>>=qt;return zt(n)}function Zt(e){let t=It(e);if(t.byteLength!==8)throw Error(`Received ${t.byteLength} bytes, expected 8 for $integer`);let n=Kt,r=Kt;for(let e of t)n+=BigInt(e)*Jt**r,r++;return n>Gt&&(n+=Wt+Wt),n}function Qt(e){if(e<Wt||Gt<e)throw Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);let t=new ArrayBuffer(8);return new DataView(t).setBigInt64(0,e,!0),zt(new Uint8Array(t))}function $t(e){let t=It(e);if(t.byteLength!==8)throw Error(`Received ${t.byteLength} bytes, expected 8 for $integer`);return new DataView(t.buffer).getBigInt64(0,!0)}var en=DataView.prototype.setBigInt64?Qt:Xt,tn=DataView.prototype.getBigInt64?$t:Zt,nn=1024;function rn(e){if(e.length>nn)throw Error(`Field name ${e} exceeds maximum field name length ${nn}.`);if(e.startsWith(`$`))throw Error(`Field name ${e} starts with a '$', which is reserved.`);for(let t=0;t<e.length;t+=1){let n=e.charCodeAt(t);if(n<32||n>=127)throw Error(`Field name ${e} has invalid character '${e[t]}': Field names can only contain non-control ASCII characters`)}}function an(e){if(e===null||typeof e==`boolean`||typeof e==`number`||typeof e==`string`)return e;if(Array.isArray(e))return e.map(e=>an(e));if(typeof e!=`object`)throw Error(`Unexpected type of ${e}`);let t=Object.entries(e);if(t.length===1){let n=t[0][0];if(n===`$bytes`){if(typeof e.$bytes!=`string`)throw Error(`Malformed $bytes field on ${e}`);return It(e.$bytes).buffer}
14if(n===`$integer`){if(typeof e.$integer!=`string`)throw Error(`Malformed $integer field on ${e}`);return tn(e.$integer)}if(n===`$float`){if(typeof e.$float!=`string`)throw Error(`Malformed $float field on ${e}`);let t=It(e.$float);if(t.byteLength!==8)throw Error(`Received ${t.byteLength} bytes, expected 8 for $float`);let n=new DataView(t.buffer).getFloat64(0,Ut);if(!Yt(n))throw Error(`Float ${n} should be encoded as a number`);return n}if(n===`$set`)throw Error(`Received a Set which is no longer supported as a Convex type.`);if(n===`$map`)throw Error(`Received a Map which is no longer supported as a Convex type.`)}let n={};for(let[t,r]of Object.entries(e))rn(t),n[t]=an(r);return n}var on=16384;function sn(e){let t=JSON.stringify(e,(e,t)=>t===void 0?`undefined`:typeof t==`bigint`?`${t.toString()}n`:t);if(t.length>on){let e=on-14,n=t.codePointAt(e-1);return n!==void 0&&n>65535&&--e,t.substring(0,e)+`[...truncated]`}return t}function cn(e,t,n,r){if(e===void 0){let e=n&&` (present at path ${n} in original object ${sn(t)})`;throw Error(`undefined is not a valid Convex value${e}. To learn about Convex's supported types, see https://docs.convex.dev/using/types.`)}if(e===null)return e;if(typeof e==`bigint`){if(e<Wt||Gt<e)throw Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);return{$integer:en(e)}}if(typeof e==`number`)if(Yt(e)){let t=new ArrayBuffer(8);return new DataView(t).setFloat64(0,e,Ut),{$float:zt(new Uint8Array(t))}}else return e;if(typeof e==`boolean`||typeof e==`string`)return e;if(e instanceof ArrayBuffer)return{$bytes:zt(new Uint8Array(e))};if(Array.isArray(e))return e.map((e,r)=>cn(e,t,n+`[${r}]`,!1));if(e instanceof Set)throw Error(ln(n,`Set`,[...e],t));if(e instanceof Map)throw Error(ln(n,`Map`,[...e],t));if(!Ht(e)){let r=e?.constructor?.name,i=r?`${r} `:``;throw Error(ln(n,i,e,t))}let i={},a=Object.entries(e);a.sort(([e,t],[n,r])=>e===n?0:e<n?-1:1);for(let[e,o]of a)o===void 0?r&&(rn(e),i[e]=un(o,t,n+`.${e}`)):(rn(e),i[e]=cn(o,t,n+`.${e}`,!1));return i}function ln(e,t,n,r){return e?`${t}${sn(n)} is not a supported Convex type (present at path ${e} in original object ${sn(r)}). To learn about Convex's supported types, see https://docs.convex.dev/using/types.`:`${t}${sn(n)} is not a supported Convex type.`}function un(e,t,n){if(e===void 0)return{$undefined:null};if(t===void 0)throw Error(`Programming error. Current value is ${sn(e)} but original value is undefined`);return cn(e,t,n,!1)}function dn(e){return cn(e,e,``,!1)}var fn=Object.defineProperty,pn=(e,t,n)=>t in e?fn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mn=(e,t,n)=>pn(e,typeof t==`symbol`?t:t+``,n),hn=`https://docs.convex.dev/error#undefined-validator`;function gn(e,t){let n=t===void 0?``:` for field "${t}"`;throw Error(`A validator is undefined${n} in ${e}. This is often caused by circular imports. See ${hn} for details.`)}var _n=class{constructor({isOptional:e}){mn(this,`type`),mn(this,`fieldPaths`),mn(this,`isOptional`),mn(this,`isConvexValidator`),this.isOptional=e,this.isConvexValidator=!0}},vn=class e extends _n{constructor({isOptional:e,tableName:t}){if(super({isOptional:e}),mn(this,`tableName`),mn(this,`kind`,`id`),typeof t!=`string`)throw Error(`v.id(tableName) requires a string`);this.tableName=t}get json(){return{type:`id`,tableName:this.tableName}}asOptional(){return new e({isOptional:`optional`,tableName:this.tableName})}},yn=class e extends _n{constructor(){super(...arguments),mn(this,`kind`,`float64`)}get json(){return{type:`number`}}asOptional(){return new e({isOptional:`optional`})}},bn=class e extends _n{constructor(){super(...arguments),mn(this,`kind`,`int64`)}get json(){return{type:`bigint`}}asOptional(){return new e({isOptional:`optional`})}},xn=class e extends _n{constructor(){super(...arguments),mn(this,`kind`,`boolean`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},Sn=class e extends _n{constructor(){super(...arguments),mn(this,`kind`,`bytes`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},Cn=class e extends _n{constructor(){super(...arguments),mn(this,`kind`,`string`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},wn=class e extends _n{constructor(){super(...arguments),mn(this,`kind`,`null`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},Tn=class e extends _n{constructor(){super(...arguments),mn(this,`kind`,`any`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},En=class e extends _n{constructor({isOptional:e,fields:t}){super({isOptional:e}),mn(this,`fields`),mn(this,`kind`,`object`),globalThis.Object.entries(t).forEach(([e,t])=>
14{if(t===void 0&&gn(`v.object()`,e),!t.isConvexValidator)throw Error(`v.object() entries must be validators`)}),this.fields=t}get json(){return{type:this.kind,value:globalThis.Object.fromEntries(globalThis.Object.entries(this.fields).map(([e,t])=>[e,{fieldType:t.json,optional:t.isOptional===`optional`}]))}}asOptional(){return new e({isOptional:`optional`,fields:this.fields})}omit(...t){let n={...this.fields};for(let e of t)delete n[e];return new e({isOptional:this.isOptional,fields:n})}pick(...t){let n={};for(let e of t)n[e]=this.fields[e];return new e({isOptional:this.isOptional,fields:n})}partial(){let t={};for(let[e,n]of globalThis.Object.entries(this.fields))t[e]=n.asOptional();return new e({isOptional:this.isOptional,fields:t})}extend(t){return new e({isOptional:this.isOptional,fields:{...this.fields,...t}})}},Dn=class e extends _n{constructor({isOptional:e,value:t}){if(super({isOptional:e}),mn(this,`value`),mn(this,`kind`,`literal`),typeof t!=`string`&&typeof t!=`boolean`&&typeof t!=`number`&&typeof t!=`bigint`)throw Error(`v.literal(value) must be a string, number, or boolean`);this.value=t}get json(){return{type:this.kind,value:dn(this.value)}}asOptional(){return new e({isOptional:`optional`,value:this.value})}},On=class e extends _n{constructor({isOptional:e,element:t}){super({isOptional:e}),mn(this,`element`),mn(this,`kind`,`array`),t===void 0&&gn(`v.array()`),this.element=t}get json(){return{type:this.kind,value:this.element.json}}asOptional(){return new e({isOptional:`optional`,element:this.element})}},kn=class e extends _n{constructor({isOptional:e,key:t,value:n}){if(super({isOptional:e}),mn(this,`key`),mn(this,`value`),mn(this,`kind`,`record`),t===void 0&&gn(`v.record()`,`key`),n===void 0&&gn(`v.record()`,`value`),t.isOptional===`optional`)throw Error(`Record validator cannot have optional keys`);if(n.isOptional===`optional`)throw Error(`Record validator cannot have optional values`);if(!t.isConvexValidator||!n.isConvexValidator)throw Error(`Key and value of v.record() but be validators`);this.key=t,this.value=n}get json(){return{type:this.kind,keys:this.key.json,values:{fieldType:this.value.json,optional:!1}}}asOptional(){return new e({isOptional:`optional`,key:this.key,value:this.value})}},An=class e extends _n{constructor({isOptional:e,members:t}){super({isOptional:e}),mn(this,`members`),mn(this,`kind`,`union`),t.forEach((e,t)=>{if(e===void 0&&gn(`v.union()`,`member at index ${t}`),!e.isConvexValidator)throw Error(`All members of v.union() must be validators`)}),this.members=t}get json(){return{type:this.kind,value:this.members.map(e=>e.json)}}asOptional(){return new e({isOptional:`optional`,members:this.members})}};function jn(e){return!!e.isConvexValidator}var j={id:e=>
14new vn({isOptional:`required`,tableName:e}),null:()=>new wn({isOptional:`required`}),number:()=>new yn({isOptional:`required`}),float64:()=>new yn({isOptional:`required`}),bigint:()=>new bn({isOptional:`required`}),int64:()=>new bn({isOptional:`required`}),boolean:()=>new xn({isOptional:`required`}),string:()=>new Cn({isOptional:`required`}),bytes:()=>new Sn({isOptional:`required`}),literal:e=>new Dn({isOptional:`required`,value:e}),array:e=>new On({isOptional:`required`,element:e}),object:e=>new En({isOptional:`required`,fields:e}),record:(e,t)=>new kn({isOptional:`required`,key:e,value:t}),union:(...e)=>new An({isOptional:`required`,members:e}),any:()=>new Tn({isOptional:`required`}),optional:e=>e.asOptional(),nullable:e=>j.union(e,j.null())},Mn=Object.defineProperty,Nn=(e,t,n)=>t in e?Mn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Pn=(e,t,n)=>Nn(e,typeof t==`symbol`?t:t+``,n),Fn,In,Ln=Symbol.for(`ConvexError`),Rn=class extends (In=Error,Fn=Ln,In){constructor(e){super(typeof e==`string`?e:sn(e)),Pn(this,`name`,`ConvexError`),Pn(this,`data`),Pn(this,Fn,!0),this.data=e}},zn=`1.39.1`,Bn=Object.defineProperty,Vn=(e,t,n)=>t in e?Bn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Hn=(e,t,n)=>Vn(e,typeof t==`symbol`?t:t+``,n),Un=`color:rgb(0, 145, 255)`;function Wn(e){switch(e){case`query`:return`Q`;case`mutation`:return`M`;case`action`:return`A`;case`any`:return`?`}}var Gn=class{constructor(e){Hn(this,`_onLogLineFuncs`),Hn(this,`_verbose`),this._onLogLineFuncs={},this._verbose=e.verbose}addLogLineListener(e){let t=Math.random().toString(36).substring(2,15);for(let e=0;e<10&&this._onLogLineFuncs[t]!==void 0;e++)t=Math.random().toString(36).substring(2,15);return this._onLogLineFuncs[t]=e,()=>{delete this._onLogLineFuncs[t]}}logVerbose(...e){if(this._verbose)for(let t of Object.values(this._onLogLineFuncs))t(`debug`,`${new Date().toISOString()}`,...e)}log(...e){for(let t of Object.values(this._onLogLineFuncs))t(`info`,...e)}warn(...e){for(let t of Object.values(this._onLogLineFuncs))t(`warn`,...e)}error(...e){for(let t of Object.values(this._onLogLineFuncs))t(`error`,...e)}};function Kn(e){let t=new Gn(e);return t.addLogLineListener((e,...t)=>{switch(e){case`debug`:console.debug(...t);break;case`info`:console.log(...t);break;case`warn`:console.warn(...t);break;case`error`:console.error(...t);break;default:console.log(...t)}}),t}function qn(e){return new Gn(e)}function Jn(e,t,n,r,i){let a=Wn(n);if(typeof i==`object`&&(i=`ConvexError ${JSON.stringify(i.errorData,null,2)}`),t===`info`){let t=i.match(/^\[.*?\] /);if(t===null){e.error(`[CONVEX ${a}(${r})] Could not parse console.log`);return}let n=i.slice(1,t[0].length-2),o=i.slice(t[0].length);e.log(`%c[CONVEX ${a}(${r})] [${n}]`,Un,o)}else e.error(`[CONVEX ${a}(${r})] ${i}`)}function Yn(e,t){let n=`[CONVEX FATAL ERROR] ${t}`;return e.error(n),Error(n)}function Xn(e,t,n){return`[CONVEX ${Wn(e)}(${t})] ${n.errorMessage} 15 Called by client`}function Zn(e,t){return t.data=e.errorData,t}function Qn(e){let t=e.split(`:`),n,r;return t.length===1?(n=t[0],r=`default`):(n=t.slice(0,t.length-1).join(`:`),r=t[t.length-1]),n.endsWith(`.js`)&&(n=n.slice(0,-3)),`${n}:${r}`}function $n(e,t){return JSON.stringify({udfPath:Qn(e),args:dn(t)})}function er(e,t,n){let{initialNumItems:r,id:i}=n;return JSON.stringify({type:`paginated`,udfPath:Qn(e),args:dn(t),options:dn({initialNumItems:r,id:i})})}var tr=Object.defineProperty,nr=(e,t,n)=>t in e?tr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,rr=(e,t,n)=>nr(e,typeof t==`symbol`?t:t+``,n),ir=class{constructor(){rr(this,`nextQueryId`),rr(this,`querySetVersion`),rr(this,`querySet`),rr(this,`queryIdToToken`),rr(this,`identityVersion`),rr(this,`auth`),rr(this,`outstandingQueriesOlderThanRestart`),rr(this,`outstandingAuthOlderThanRestart`),rr(this,`paused`),rr(this,`pendingQuerySetModifications`),this.nextQueryId=0,this.querySetVersion=0,this.identityVersion=0,this.querySet=new Map,this.queryIdToToken=new Map,this.outstandingQueriesOlderThanRestart=new Set,this.outstandingAuthOlderThanRestart=!1,this.paused=!1,this.pendingQuerySetModifications=new Map}hasSyncedPastLastReconnect(){return this.outstandingQueriesOlderThanRestart.size===0&&!this.outstandingAuthOlderThanRestart}markAuthCompletion(){this.outstandingAuthOlderThanRestart=!1}subscribe(e,t,n,r){let i=Qn(e),a=$n(i,t),o=this.querySet.get(a);if(o!==void 0)return o.numSubscribers+=1,{queryToken:a,modification:null,unsubscribe:()=>this.removeSubscriber(a)};{let e=this.nextQueryId++,o={id:e,canonicalizedUdfPath:i,args:t,numSubscribers:1,journal:n,componentPath:r};this.querySet.set(a,o),this.queryIdToToken.set(e,a);let s=this.querySetVersion,c=this.querySetVersion+1,l={type:`Add`,queryId:e,udfPath:i,args:[dn(t)],journal:n,componentPath:r};return this.paused?this.pendingQuerySetModifications.set(e,l):this.querySetVersion=c,{queryToken:a,modification:{type:`ModifyQuerySet`,baseVersion:s,newVersion:c,modifications:[l]},unsubscribe:()=>this.removeSubscriber(a)}}}transition(e){for(let t of e.modifications)switch(t.type){case`QueryUpdated`:case`QueryFailed`:{this.outstandingQueriesOlderThanRestart.delete(t.queryId);let e=t.journal;if(e!==void 0){let n=this.queryIdToToken.get(t.queryId);n!==void 0&&(this.querySet.get(n).journal=e)}break}case`QueryRemoved`:this.outstandingQueriesOlderThanRestart.delete(t.queryId);break;default:throw Error(`Invalid modification ${t.type}`)}}queryId(e,t){let n=$n(Qn(e),t),r=this.querySet.get(n);return r===void 0?null:r.id}isCurrentOrNewerAuthVersion(e){return e>=this.identityVersion}getAuth(){return this.auth}setAuth(e){this.auth={tokenType:`User`,value:e};let t=this.identityVersion;return this.paused||(this.identityVersion=t+1),{type:`Authenticate`,baseVersion:t,...this.auth}}setAdminAuth(e,t){let n={tokenType:`Admin`,value:e,impersonating:t};this.auth=n;let r=this.identityVersion;return this.paused||(this.identityVersion=r+1),{type:`Authenticate`,baseVersion:r,...n}}clearAuth(){this.auth=void 0,this.markAuthCompletion();let e=this.identityVersion;return this.paused||(this.identityVersion=e+1),{type:`Authenticate`,tokenType:`None`,baseVersion:e}}hasAuth(){return!!this.auth}isNewAuth(e){return this.auth?.value!==e}queryPath(e){let t=this.queryIdToToken.get(e);return t?this.querySet.get(t).canonicalizedUdfPath:null}queryArgs(e){let t=this.queryIdToToken.get(e);return t?this.querySet.get(t).args:null}queryToken(e){return this.queryIdToToken.get(e)??null}queryJournal(e){return this.querySet.get(e)?.journal}restart(){this.unpause(),this.outstandingQueriesOlderThanRestart.clear();let e=[];for(let t of this.querySet.values()){let n={type:`Add`,queryId:t.id,udfPath:t.canonicalizedUdfPath,args:[dn(t.args)],journal:t.journal,componentPath:t.componentPath};e.push(n),this.outstandingQueriesOlderThanRestart.add(t.id)}this.querySetVersion=1;let t={type:`ModifyQuerySet`,baseVersion:0,newVersion:1,modifications:e};if(!this.auth)return this.identityVersion=0,[t,void 0];this.outstandingAuthOlderThanRestart=!0;let n={type:`Authenticate`,baseVersion:0,...this.auth};return this.identityVersion=1,[t,n]}pause(){this.paused=!0}resume(){let e=this.pendingQuerySetModifications.size>0?{type:`ModifyQuerySet`,baseVersion:this.querySetVersion,newVersion:++this.querySetVersion,modifications:Array.from(this.pendingQuerySetModifications.values())}:void 0,t=this.auth===void 0?void 0:{type:`Authenticate`,baseVersion:this.identityVersion++,...this.auth};return this.unpause(),[e,t]}unpause(){this.paused=!1,this.pendingQuerySetModifications.clear()}removeSubscriber(e){let t=this.querySet.get(e);if(t.numSubscribers>1)return--t.numSubscribers,null;{this.querySet.delete(e),this.queryIdToToken.delete(t.id),this.outstandingQueriesOlderThanRestart.delete(t.id);let n=this.querySetVersion,r=this.querySetVersion+1,i={type:`Remove`,queryId:t.id};return this.paused?this.pendingQuerySetModifications.has(t.id)?this.pendingQuerySetModifications.delete(t.id):this.pendingQuerySetModifications.set(t.id,i):this.querySetVersion=r,{type:`ModifyQuerySet`,baseVersion:n,newVersion:r,modifications:[i]}}}}
15,ar=Object.defineProperty,or=(e,t,n)=>t in e?ar(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,sr=(e,t,n)=>or(e,typeof t==`symbol`?t:t+``,n),cr=class{constructor(e,t){this.logger=e,this.markConnectionStateDirty=t,sr(this,`inflightRequests`),sr(this,`requestsOlderThanRestart`),sr(this,`inflightMutationsCount`,0),sr(this,`inflightActionsCount`,0),this.inflightRequests=new Map,this.requestsOlderThanRestart=new Set}request(e,t){let n=new Promise(n=>{let r=t?`Requested`:`NotSent`;this.inflightRequests.set(e.requestId,{message:e,status:{status:r,requestedAt:new Date,onResult:n}}),e.type===`Mutation`?this.inflightMutationsCount++:e.type===`Action`&&this.inflightActionsCount++});return this.markConnectionStateDirty(),n}onResponse(e){let t=this.inflightRequests.get(e.requestId);if(t===void 0||t.status.status===`Completed`)return null;let n=t.message.type===`Mutation`?`mutation`:`action`,r=t.message.udfPath;for(let t of e.logLines)Jn(this.logger,`info`,n,r,t);let i=t.status,a,o;if(e.success)a={success:!0,logLines:e.logLines,value:an(e.result)},o=()=>i.onResult(a);else{let t=e.result,{errorData:s}=e;Jn(this.logger,`error`,n,r,t),a={success:!1,errorMessage:t,errorData:s===void 0?void 0:an(s),logLines:e.logLines},o=()=>i.onResult(a)}return e.type===`ActionResponse`||!e.success?(o(),this.inflightRequests.delete(e.requestId),this.requestsOlderThanRestart.delete(e.requestId),t.message.type===`Action`?this.inflightActionsCount--:t.message.type===`Mutation`&&this.inflightMutationsCount--,this.markConnectionStateDirty(),{requestId:e.requestId,result:a}
15):(t.status={status:`Completed`,result:a,ts:e.ts,onResolve:o},null)}removeCompleted(e){let t=new Map;for(let[n,r]of this.inflightRequests.entries()){let i=r.status;i.status===`Completed`&&i.ts.lessThanOrEqual(e)&&(i.onResolve(),t.set(n,i.result),r.message.type===`Mutation`?this.inflightMutationsCount--:r.message.type===`Action`&&this.inflightActionsCount--,this.inflightRequests.delete(n),this.requestsOlderThanRestart.delete(n))}return t.size>0&&this.markConnectionStateDirty(),t}restart(){this.requestsOlderThanRestart=new Set(this.inflightRequests.keys());let e=[];for(let[t,n]of this.inflightRequests){if(n.status.status===`NotSent`){n.status.status=`Requested`,e.push(n.message);continue}if(n.message.type===`Mutation`)e.push(n.message);else if(n.message.type===`Action`){if(this.inflightRequests.delete(t),this.requestsOlderThanRestart.delete(t),this.inflightActionsCount--,n.status.status===`Completed`)throw Error(`Action should never be in 'Completed' state`);n.status.onResult({success:!1,errorMessage:`Connection lost while action was in flight`,logLines:[]})}}return this.markConnectionStateDirty(),e}resume(){let e=[];for(let[,t]of this.inflightRequests)if(t.status.status===`NotSent`){t.status.status=`Requested`,e.push(t.message);continue}return e}hasIncompleteRequests(){for(let e of this.inflightRequests.values())if(e.status.status===`Requested`)return!0;return!1}hasInflightRequests(){return this.inflightRequests.size>0}hasSyncedPastLastReconnect(){return this.requestsOlderThanRestart.size===0}timeOfOldestInflightRequest(){if(this.inflightRequests.size===0)return null;let e=Date.now();for(let t of this.inflightRequests.values())t.status.status!==`Completed`&&t.status.requestedAt.getTime()<e&&(e=t.status.requestedAt.getTime());return new Date(e)}inflightMutations(){return this.inflightMutationsCount}inflightActions(){return this.inflightActionsCount}},lr=Symbol.for(`functionName`),ur=Symbol.for(`toReferencePath`);function dr(e){return e[ur]??null}function fr(e){return e.startsWith(`function://`)}function pr(e){let t;if(typeof e==`string`)t=fr(e)?{functionHandle:e}:{name:e};else if(e[lr])t={name:e[lr]};else{let n=dr(e);if(!n)throw Error(`${e} is not a functionReference`);t={reference:n}}return t}function mr(e){let t=pr(e);if(t.name===void 0)throw t.functionHandle===void 0?t.reference===void 0?Error(`Expected function reference like "api.file.func" or "internal.file.func", but received ${JSON.stringify(t)}`):Error(`Expected function reference in the current component like "api.file.func" or "internal.file.func", but received reference ${t.reference}`):Error(`Expected function reference like "api.file.func" or "internal.file.func", but received function handle ${t.functionHandle}`);if(typeof e==`string`)return e;let n=e[lr];if(!n)throw Error(`${e} is not a functionReference`);return n}function hr(e){return{[lr]:e}}function gr(e=[]){return new Proxy({},{get(t,n){if(typeof n==`string`)return gr([...e,n]);if(n===lr){if(e.length<2){let t=[`api`,...e].join(`.`);throw Error(`API path is expected to be of the form \`api.moduleName.functionName\`. Found: \`${t}\``)}let t=e.slice(0,-1).join(`/`),n=e[e.length-1];return n===`default`?t:t+`:`+n}else if(n===Symbol.toStringTag)return`FunctionReference`;else return}})}var _r=gr(),vr=Object.defineProperty,yr=(e,t,n)=>t in e?vr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,br=(e,t,n)=>yr(e,typeof t==`symbol`?t:t+``,n),xr=class e{constructor(e){br(this,`queryResults`),br(this,`modifiedQueries`),this.queryResults=e,this.modifiedQueries=[]}getQuery(t,...n){let r=Bt(n[0]),i=mr(t),a=this.queryResults.get($n(i,r));if(a!==void 0)return e.queryValue(a.result)}getAllQueries(t){let n=[],r=mr(t);for(let t of this.queryResults.values())t.udfPath===Qn(r)&&n.push({args:t.args,value:e.queryValue(t.result)});return n}setQuery(e,t,n){let r=Bt(t),i=mr(e),a=$n(i,r),o;o=n===void 0?void 0:{success:!0,value:n,logLines:[]};let s={udfPath:i,args:r,result:o};this.queryResults.set(a,s),this.modifiedQueries.push(a)}static queryValue(e){if(e!==void 0&&e.success)return e.value}},Sr=class{constructor(){br(this,`queryResults`),br(this,`optimisticUpdates`),this.queryResults=new Map,this.optimisticUpdates=[]}ingestQueryResultsFromServer(e,t){this.optimisticUpdates=this.optimisticUpdates.filter(e=>!t.has(e.mutationId));let n=this.queryResults;this.queryResults=new Map(e);let r=new xr(this.queryResults);for(let e of this.optimisticUpdates)e.update(r);let i=[];for(let[e,t]of this.queryResults){let r=n.get(e);(r===void 0||r.result!==t.result)&&i.push(e)}return i}applyOptimisticUpdate(e,t){this.optimisticUpdates.push({update:e,mutationId:t});let n=new xr(this.queryResults);return e(n),n.modifiedQueries}rawQueryResult(e){let t=this.queryResults.get(e);if(t!==void 0)return t.result}queryResult(e){let t=this.queryResults.get(e);if(t===void 0)return;let n=t.result;if(n!==void 0){if(n.success)return n.value;throw n.errorData===void 0?Error(Xn(`query`,t.udfPath,n)):Zn(n,new Rn(Xn(`query`,t.udfPath,n)))}}hasQueryResult(e){return this.queryResults.get(e)!==void 0}queryLogs(e){return this.queryResults.get(e)?.result?.logLines}}
15,Cr=Object.defineProperty,wr=(e,t,n)=>t in e?Cr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Tr=(e,t,n)=>wr(e,typeof t==`symbol`?t:t+``,n),Er=class e{constructor(e,t){Tr(this,`low`),Tr(this,`high`),Tr(this,`__isUnsignedLong__`),this.low=e|0,this.high=t|0,this.__isUnsignedLong__=!0}static isLong(e){return(e&&e.__isUnsignedLong__)===!0}static fromBytesLE(t){return new e(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24)}toBytesLE(){let e=this.high,t=this.low;return[t&255,t>>>8&255,t>>>16&255,t>>>24,e&255,e>>>8&255,e>>>16&255,e>>>24]}static fromNumber(t){return isNaN(t)||t<0?Dr:t>=Ar?jr:new e(t%kr|0,t/kr|0)}toString(){return(BigInt(this.high)*BigInt(kr)+BigInt(this.low)).toString()}equals(t){return e.isLong(t)||(t=e.fromValue(t)),this.high>>>31==1&&t.high>>>31==1?!1:this.high===t.high&&this.low===t.low}notEquals(e){return!this.equals(e)}comp(t){return e.isLong(t)||(t=e.fromValue(t)),this.equals(t)?0:t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1}lessThanOrEqual(e){return this.comp(e)<=0}static fromValue(t){return typeof t==`number`?e.fromNumber(t):new e(t.low,t.high)}},Dr=new Er(0,0),Or=65536,kr=Or*Or,Ar=kr*kr,jr=new Er(-1,-1),Mr=Object.defineProperty,Nr=(e,t,n)=>t in e?Mr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Pr=(e,t,n)=>Nr(e,typeof t==`symbol`?t:t+``,n),Fr=class{constructor(e,t){Pr(this,`version`),Pr(this,`remoteQuerySet`),Pr(this,`queryPath`),Pr(this,`logger`),this.version={querySet:0,ts:Er.fromNumber(0),identity:0},this.remoteQuerySet=new Map,this.queryPath=e,this.logger=t}transition(e){let t=e.startVersion;if(this.version.querySet!==t.querySet||this.version.ts.notEquals(t.ts)||this.version.identity!==t.identity)throw Error(`Invalid start version: ${t.ts.toString()}:${t.querySet}:${t.identity}, transitioning from ${this.version.ts.toString()}:${this.version.querySet}:${this.version.identity}`);for(let t of e.modifications)switch(t.type){case`QueryUpdated`:{let e=this.queryPath(t.queryId);if(e)for(let n of t.logLines)Jn(this.logger,`info`,`query`,e,n);let n=an(t.value??null);this.remoteQuerySet.set(t.queryId,{success:!0,value:n,logLines:t.logLines});break}case`QueryFailed`:{let e=this.queryPath(t.queryId);if(e)for(let n of t.logLines)Jn(this.logger,`info`,`query`,e,n);let{errorData:n}=t;this.remoteQuerySet.set(t.queryId,{success:!1,errorMessage:t.errorMessage,errorData:n===void 0?void 0:an(n),logLines:t.logLines});break}case`QueryRemoved`:this.remoteQuerySet.delete(t.queryId);break;default:throw Error(`Invalid modification ${t.type}`)}this.version=e.endVersion}remoteQueryResults(){return this.remoteQuerySet}timestamp(){return this.version.ts}};function Ir(e){let t=It(e);return Er.fromBytesLE(Array.from(t))}function Lr(e){return zt(new Uint8Array(e.toBytesLE()))}function Rr(e){switch(e.type){case`FatalError`:case`AuthError`:case`ActionResponse`:case`TransitionChunk`:case`Ping`:return{...e};case`MutationResponse`:return e.success?{...e,ts:Ir(e.ts)}:{...e};case`Transition`:return{...e,startVersion:{...e.startVersion,ts:Ir(e.startVersion.ts)},endVersion:{...e.endVersion,ts:Ir(e.endVersion.ts)}};default:}}function zr(e){switch(e.type){case`Authenticate`:case`ModifyQuerySet`:case`Mutation`:case`Action`:case`Event`:return{...e};case`Connect`:return e.maxObservedTimestamp===void 0?{...e,maxObservedTimestamp:void 0}:{...e,maxObservedTimestamp:Lr(e.maxObservedTimestamp)};default:}}var Br=Object.defineProperty,Vr=(e,t,n)=>t in e?Br(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Hr=(e,t,n)=>Vr(e,typeof t==`symbol`?t:t+``,n),Ur=1e3,Wr=1001,Gr=1005,Kr=4040,qr;function Jr(){return qr===void 0&&(qr=Date.now()),typeof performance>`u`||!performance.now?Date.now():Math.round(qr+performance.now())}function Yr(){return`t=${Math.round((Jr()-qr)/100)/10}s`}var Xr={InternalServerError:{timeout:1e3},SubscriptionsWorkerFullError:{timeout:3e3},TooManyConcurrentRequests:{timeout:3e3},CommitterFullError:{timeout:3e3},AwsTooManyRequestsException:{timeout:3e3},ExecuteFullError:{timeout:3e3},SystemTimeoutError:{timeout:3e3},ExpiredInQueue:{timeout:3e3},VectorIndexesUnavailable:{timeout:1e3},SearchIndexesUnavailable:{timeout:1e3},TableSummariesUnavailable:{timeout:1e3},VectorIndexTooLarge:{timeout:3e3},SearchIndexTooLarge:{timeout:3e3},TooManyWritesInTimePeriod:{timeout:3e3}};function Zr(e){if(e===void 0)return`Unknown`;for(let t of Object.keys(Xr))if(e.startsWith(t))return t;return`Unknown`}var Qr=class{constructor(e,t,n,r,i,a){this.markConnectionStateDirty=i,this.debug=a,Hr(this,`socket`),Hr(this,`connectionCount`),Hr(this,`_hasEverConnected`,!1),Hr(this,`lastCloseReason`),Hr(this,`transitionChunkBuffer`,null),Hr(this,`defaultInitialBackoff`),Hr(this,`maxBackoff`),Hr(this,`retries`),Hr(this,`serverInactivityThreshold`),Hr(this,`reconnectDueToServerInactivityTimeout`),Hr(this,`scheduledReconnect`,null),Hr(this,`networkOnlineHandler`,null),Hr(this,`pendingNetworkRecoveryInfo`,null),Hr(this,`uri`),Hr(this,`onOpen`),Hr(this,`onResume`),Hr(this,`onMessage`),Hr(this,`webSocketConstructor`),Hr(this,`logger`),Hr(this,`onServerDisconnectError`),this.webSocketConstructor=n,this.socket={state:`disconnected`},this.connectionCount=0,this.lastCloseReason=`InitialConnect`,this.defaultInitialBackoff=1e3,this.maxBackoff=16e3,this.retries=0,this.serverInactivityThreshold=6e4,this.reconnectDueToServerInactivityTimeout=null,this.uri=e,this.onOpen=t.onOpen,this.onResume=t.onResume,this.onMessage=t.onMessage,this.onServerDisconnectError=t.onServerDisconnectError,this.logger=r,this.setupNetworkListener(),this.connect()}setSocketState(e){this.socket=e,this._logVerbose(`socket state changed: ${this.socket.state}, paused: ${`paused`in this.socket?this.socket.paused:void 0}`),this.markConnectionStateDirty()}setupNetworkListener(){typeof window>`u`||typeof window.addEventListener!=`function`||this.networkOnlineHandler===null&&(this.networkOnlineHandler=()=>{this._logVerbose(`network online event detected`),this.tryReconnectImmediately()},window.addEventListener(`online`,this.networkOnlineHandler),this._logVerbose(`network online event listener registered`))}cleanupNetworkListener(){this.networkOnlineHandler&&typeof window<`u`&&typeof window.removeEventListener==`function`&&(window.removeEventListener(`online`,this.networkOnlineHandler),this.networkOnlineHandler=null,this._logVerbose(`network online event listener removed`))}assembleTransition(e){if(e.partNumber<0||e.partNumber>=e.totalParts||e.totalParts===0||this.transitionChunkBuffer&&(this.transitionChunkBuffer.totalParts!==e.totalParts||this.transitionChunkBuffer.transitionId!==e.transitionId))throw this.transitionChunkBuffer=null,Error(`Invalid TransitionChunk`);if(this.transitionChunkBuffer===null&&(this.transitionChunkBuffer={chunks:[],totalParts:e.totalParts,transitionId:e.transitionId}),e.partNumber!==this.transitionChunkBuffer.chunks.length){let t=this.transitionChunkBuffer.chunks.length;
15throw this.transitionChunkBuffer=null,Error(`TransitionChunk received out of order: expected part ${t}, got ${e.partNumber}`)}if(this.transitionChunkBuffer.chunks.push(e.chunk),this.transitionChunkBuffer.chunks.length===e.totalParts){let e=this.transitionChunkBuffer.chunks.join(``);this.transitionChunkBuffer=null;let t=Rr(JSON.parse(e));if(t.type!==`Transition`)throw Error(`Expected Transition, got ${t.type} after assembling chunks`);return t}return null}connect(){if(this.socket.state===`terminated`)return;if(this.socket.state!==`disconnected`&&this.socket.state!==`stopped`)throw Error(`Didn't start connection from disconnected state: `+this.socket.state);let e=new this.webSocketConstructor(this.uri);this._logVerbose(`constructed WebSocket`),this.setSocketState({state:`connecting`,ws:e,paused:`no`}),this.resetServerInactivityTimeout(),e.onopen=()=>{if(this.logger.logVerbose(`begin ws.onopen`),this.socket.state!==`connecting`)throw Error(`onopen called with socket not in connecting state`);if(this.setSocketState({state:`ready`,ws:e,paused:this.socket.paused===`yes`?`uninitialized`:`no`}),this.resetServerInactivityTimeout(),this.socket.paused===`no`&&(this._hasEverConnected=!0,this.onOpen({connectionCount:this.connectionCount,lastCloseReason:this.lastCloseReason,clientTs:Jr()})),this.lastCloseReason!==`InitialConnect`&&(this.lastCloseReason?this.logger.log(`WebSocket reconnected at`,Yr(),`after disconnect due to`,this.lastCloseReason):this.logger.log(`WebSocket reconnected at`,Yr())),this.connectionCount+=1,this.lastCloseReason=null,this.pendingNetworkRecoveryInfo!==null){let{timeSavedMs:e}=this.pendingNetworkRecoveryInfo;this.pendingNetworkRecoveryInfo=null,this.sendMessage({type:`Event`,eventType:`NetworkRecoveryReconnect`,event:{timeSavedMs:e}}),this.logger.log(`Network recovery reconnect saved ~${Math.round(e/1e3)}s of waiting`)}},e.onerror=e=>{this.transitionChunkBuffer=null;let t=e.message;t&&this.logger.log(`WebSocket error message: ${t}`)},e.onmessage=e=>{this.resetServerInactivityTimeout();let t=e.data.length,n=Rr(JSON.parse(e.data));if(this._logVerbose(`received ws message with type ${n.type}`),n.type!==`Ping`){if(n.type===`TransitionChunk`){let e=this.assembleTransition(n);if(!e)return;n=e,this._logVerbose(`assembled full ws message of type ${n.type}`)}this.transitionChunkBuffer!==null&&(this.transitionChunkBuffer=null,this.logger.log(`Received unexpected ${n.type} while buffering TransitionChunks`)),n.type===`Transition`&&this.reportLargeTransition({messageLength:t,transition:n}),this.onMessage(n).hasSyncedPastLastReconnect&&(this.retries=0,this.markConnectionStateDirty())}},e.onclose=e=>{if(this._logVerbose(`begin ws.onclose`),this.transitionChunkBuffer=null,this.lastCloseReason===null&&(this.lastCloseReason=e.reason||`closed with code ${e.code}`),e.code!==Ur&&e.code!==Wr&&e.code!==Gr&&e.code!==Kr){let t=`WebSocket closed with code ${e.code}`;e.reason&&(t+=`: ${e.reason}`),this.logger.log(t),this.onServerDisconnectError&&e.reason&&this.onServerDisconnectError(t)}let t=Zr(e.reason);this.scheduleReconnect(t)}}socketState(){return this.socket.state}sendMessage(e){let t={type:e.type,...e.type===`Authenticate`&&e.tokenType===`User`?{value:`...${e.value.slice(-7)}`}:{}};if(this.socket.state===`ready`&&this.socket.paused===`no`){let n=zr(e),r=JSON.stringify(n),i=!1;try{this.socket.ws.send(r),i=!0}catch(e){this.logger.log(`Failed to send message on WebSocket, reconnecting: ${e}`),this.closeAndReconnect(`FailedToSendMessage`)}return this._logVerbose(`${i?`sent`:`failed to send`} message with type ${e.type}: ${JSON.stringify(t)}`),!0}return this._logVerbose(`message not sent (socket state: ${this.socket.state}, paused: ${`paused`in this.socket?this.socket.paused:void 0}): ${JSON.stringify(t)}`),!1}resetServerInactivityTimeout(){this.socket.state!==`terminated`&&(this.reconnectDueToServerInactivityTimeout!==null&&(clearTimeout(this.reconnectDueToServerInactivityTimeout),this.reconnectDueToServerInactivityTimeout=null),this.reconnectDueToServerInactivityTimeout=setTimeout(()=>{this.closeAndReconnect(`InactiveServer`)},this.serverInactivityThreshold))}scheduleReconnect(e){this.scheduledReconnect&&=(clearTimeout(this.scheduledReconnect.timeout),null),this.socket={state:`disconnected`};let t=this.nextBackoff(e);this.markConnectionStateDirty(),this.logger.log(`Attempting reconnect in ${Math.round(t)}ms`);let n=Jr(),r=setTimeout(()=>{this.scheduledReconnect?.timeout===r&&(this.scheduledReconnect=null,this.connect())},t);this.scheduledReconnect={timeout:r,scheduledAt:n,backoffMs:t}}closeAndReconnect(e){switch(this._logVerbose(`begin closeAndReconnect with reason ${e}`),this.socket.state){case`disconnected`:case`terminated`:case`stopped`:return;case`connecting`:case`ready`:this.lastCloseReason=e,this.close(),this.scheduleReconnect(`client`);return;default:this.socket}}close(){switch(this.transitionChunkBuffer=null,this.socket.state){case`disconnected`:case`terminated`:case`stopped`:return Promise.resolve();case`connecting`:{let e=this.socket.ws;return e.onmessage=e=>{this._logVerbose(`Ignoring message received after close`)},new Promise(t=>{e.onclose=()=>{this._logVerbose(`Closed after connecting`),t()},e.onopen=()=>{this._logVerbose(`Opened after connecting`),e.close()}})}case`ready`:{this._logVerbose(`ws.close called`);let e=this.socket.ws;e.onmessage=e=>{this._logVerbose(`Ignoring message received after close`)};let t=new Promise(t=>{e.onclose=()=>{t()}});return e.close(),t}default:return this.socket,Promise.resolve()}}terminate(){switch(this.reconnectDueToServerInactivityTimeout&&clearTimeout(this.reconnectDueToServerInactivityTimeout),this.scheduledReconnect&&=(clearTimeout(this.scheduledReconnect.timeout),null),this.cleanupNetworkListener(),this.socket.state){case`terminated`:case`stopped`:case`disconnected`:case`connecting`:case`ready`:{let e=this.close();return this.setSocketState({state:`terminated`}),e}default:throw this.socket,Error(`Invalid websocket state: ${this.socket.state}`)}}stop(){switch(this.socket.state){case`terminated`:return Promise.resolve();case`connecting`:case`stopped`:case`disconnected`:case`ready`:{this.cleanupNetworkListener();let e=this.close();return this.socket={state:`stopped`},e}default:return this.socket,Promise.resolve()}}tryRestart(){switch(this.socket.state){case`stopped`:break;case`terminated`:case`connecting`:case`ready`:case`disconnected`:this.logger.logVerbose(`Restart called without stopping first`);return;default:this.socket}this.setupNetworkListener(),this.connect()}pause(){switch(this.socket.state){case`disconnected`:case`stopped`:case`terminated`:return;case`connecting`:case`ready`:this.socket={...this.socket,paused:`yes`};return;default:this.socket;return}}tryReconnectImmediately(){if(this._logVerbose(`tryReconnectImmediately called`),this.socket.state!==`disconnected`){this._logVerbose(`tryReconnectImmediately called but socket state is ${this.socket.state}, no action taken`);return}let e=null;if(this.scheduledReconnect){let t=Jr()-this.scheduledReconnect.scheduledAt;e=Math.max(0,this.scheduledReconnect.backoffMs-t),this._logVerbose(`would have waited ${Math.round(e)}ms more (backoff was ${Math.round(this.scheduledReconnect.backoffMs)}ms, elapsed ${Math.round(t)}ms)`),clearTimeout(this.scheduledReconnect.timeout),this.scheduledReconnect=null,this._logVerbose(`canceled scheduled reconnect`)}this.logger.log(`Network recovery detected, reconnecting immediately`),this.pendingNetworkRecoveryInfo=e===null?null:{timeSavedMs:e},this.connect()}resume(){switch(this.socket.state){case`connecting`:this.socket={...this.socket,paused:`no`};return;case`ready`:this.socket.paused===`uninitialized`?(this.socket={...this.socket,paused:`no`},this._hasEverConnected=!0,this.onOpen({connectionCount:this.connectionCount,lastCloseReason:this.lastCloseReason,clientTs:Jr()})):this.socket.paused===`yes`&&(this.socket={...this.socket,paused:`no`},this.onResume());return;case`terminated`:case`stopped`:case`disconnected`:return;default:this.socket}this.connect()}connectionState(){return{isConnected:this.socket.state===`ready`,hasEverConnected:this._hasEverConnected,connectionCount:this.connectionCount,connectionRetries:this.retries}}_logVerbose(e){this.logger.logVerbose(e)}nextBackoff(e){let t=(e===`client`?100:e===`Unknown`?this.defaultInitialBackoff:Xr[e].timeout)*2**this.retries;this.retries+=1;let n=Math.min(t,this.maxBackoff);return n+n*(Math.random()-.5)}reportLargeTransition({transition:e,messageLength:t}){if(e.clientClockSkew===void 0||e.serverTs===void 0)return;let n=Jr()-e.clientClockSkew-e.serverTs/1e6,r=`${Math.round(n)}ms`,i=`${Math.round(t/1e4)/100}MB`,a=t/(n/1e3),o=`${Math.round(a/1e4)/100}MB per second`;this._logVerbose(`received ${i} transition in ${r} at ${o}`),t>2e7?this.logger.log(`received query results totaling more that 20MB (${i}
15) which will take a long time to download on slower connections`):n>2e4&&this.logger.log(`received query results totaling ${i} which took more than 20s to arrive (${r})`),this.debug&&this.sendMessage({type:`Event`,eventType:`ClientReceivedTransition`,event:{transitionTransitTime:n,messageLength:t}})}};function $r(){return ei()}function ei(){return`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e===`x`?t:t&3|8).toString(16)})}var ti=class extends Error{};ti.prototype.name=`InvalidTokenError`;function ni(e){return decodeURIComponent(atob(e).replace(/(.)/g,(e,t)=>{let n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n=`0`+n),`%`+n}))}function ri(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`);switch(t.length%4){case 0:break;case 2:t+=`==`;break;case 3:t+=`=`;break;default:throw Error(`base64 string is not of the correct length`)}try{return ni(t)}catch{return atob(t)}}function ii(e,t){if(typeof e!=`string`)throw new ti(`Invalid token specified: must be a string`);t||={};let n=t.header===!0?0:1,r=e.split(`.`)[n];if(typeof r!=`string`)throw new ti(`Invalid token specified: missing part #${n+1}`);let i;try{i=ri(r)}catch(e){throw new ti(`Invalid token specified: invalid base64 for part #${n+1} (${e.message})`)}try{return JSON.parse(i)}catch(e){throw new ti(`Invalid token specified: invalid json for part #${n+1} (${e.message})`)}}var ai=Object.defineProperty,oi=(e,t,n)=>t in e?ai(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,si=(e,t,n)=>oi(e,typeof t==`symbol`?t:t+``,n),ci=480*60*60*1e3,li=2,ui=class{constructor(e,t,n){si(this,`authState`,{state:`noAuth`}),si(this,`configVersion`,0),si(this,`syncState`),si(this,`authenticate`),si(this,`stopSocket`),si(this,`tryRestartSocket`),si(this,`pauseSocket`),si(this,`resumeSocket`),si(this,`clearAuth`),si(this,`logger`),si(this,`refreshTokenLeewaySeconds`),si(this,`tokenConfirmationAttempts`,0),this.syncState=e,this.authenticate=t.authenticate,this.stopSocket=t.stopSocket,this.tryRestartSocket=t.tryRestartSocket,this.pauseSocket=t.pauseSocket,this.resumeSocket=t.resumeSocket,this.clearAuth=t.clearAuth,this.logger=n.logger,this.refreshTokenLeewaySeconds=n.refreshTokenLeewaySeconds}async setConfig(e,t){this.resetAuthState(),this._logVerbose(`pausing WS for auth token fetch`),this.pauseSocket();let n=await this.fetchTokenAndGuardAgainstRace(e,{forceRefreshToken:!1});n.isFromOutdatedConfig||(n.value?(this.setAuthState({state:`waitingForServerConfirmationOfCachedToken`,config:{fetchToken:e,onAuthChange:t},hasRetried:!1}),this.authenticate(n.value)):(this.setAuthState({state:`initialRefetch`,config:{fetchToken:e,onAuthChange:t}}),await this.refetchToken()),this._logVerbose(`resuming WS after auth token fetch`),this.resumeSocket())}onTransition(e){if(this.syncState.isCurrentOrNewerAuthVersion(e.endVersion.identity)&&!(e.endVersion.identity<=e.startVersion.identity)){if(this._logVerbose(`auth state is ${this.authState.state} when handling transition`),this.syncState.markAuthCompletion(),this.authState.state===`waitingForServerConfirmationOfCachedToken`){this._logVerbose(`server confirmed auth token is valid`),this.refetchToken(),this.authState.config.onAuthChange(!0);return}this.authState.state===`waitingForServerConfirmationOfFreshToken`&&(this._logVerbose(`server confirmed new auth token is valid`),this.scheduleTokenRefetch(this.authState.token),this.tokenConfirmationAttempts=0,this.authState.hadAuth||this.authState.config.onAuthChange(!0))}}onAuthError(e){if(e.authUpdateAttempted===!1&&(this.authState.state===`waitingForServerConfirmationOfFreshToken`||this.authState.state===`waitingForServerConfirmationOfCachedToken`)){this._logVerbose(`ignoring non-auth token expired error`);return}let{baseVersion:t}=e;if(!this.syncState.isCurrentOrNewerAuthVersion(t+1)){this._logVerbose(`ignoring auth error for previous auth attempt`);return}this.tryToReauthenticate(e)}async tryToReauthenticate(e){if(this._logVerbose(`attempting to reauthenticate: ${e.error}
15`),this.authState.state===`noAuth`||this.authState.state===`waitingForServerConfirmationOfFreshToken`&&this.tokenConfirmationAttempts>=li){this.logger.error(`Failed to authenticate: "${e.error}", check your server auth config`),this.syncState.hasAuth()&&this.syncState.clearAuth(),this.authState.state!==`noAuth`&&this.setAndReportAuthFailed(this.authState.config.onAuthChange);return}this.authState.state===`waitingForServerConfirmationOfFreshToken`&&(this.tokenConfirmationAttempts++,this._logVerbose(`retrying reauthentication, ${li-this.tokenConfirmationAttempts} attempts remaining`)),await this.stopSocket();let t=await this.fetchTokenAndGuardAgainstRace(this.authState.config.fetchToken,{forceRefreshToken:!0});t.isFromOutdatedConfig||(t.value&&this.syncState.isNewAuth(t.value)?(this.authenticate(t.value),this.setAuthState({state:`waitingForServerConfirmationOfFreshToken`,config:this.authState.config,token:t.value,hadAuth:this.authState.state===`notRefetching`||this.authState.state===`waitingForScheduledRefetch`})):(this._logVerbose(`reauthentication failed, could not fetch a new token`),this.syncState.hasAuth()&&this.syncState.clearAuth(),this.setAndReportAuthFailed(this.authState.config.onAuthChange)),this.tryRestartSocket())}
15async refetchToken(){if(this.authState.state===`noAuth`)return;this._logVerbose(`refetching auth token`);let e=await this.fetchTokenAndGuardAgainstRace(this.authState.config.fetchToken,{forceRefreshToken:!0});e.isFromOutdatedConfig||(e.value?this.syncState.isNewAuth(e.value)?(this.setAuthState({state:`waitingForServerConfirmationOfFreshToken`,hadAuth:this.syncState.hasAuth(),token:e.value,config:this.authState.config}),this.authenticate(e.value)):this.setAuthState({state:`notRefetching`,config:this.authState.config}):(this._logVerbose(`refetching token failed`),this.syncState.hasAuth()&&this.clearAuth(),this.setAndReportAuthFailed(this.authState.config.onAuthChange)),this._logVerbose(`restarting WS after auth token fetch (if currently stopped)`),this.tryRestartSocket())}scheduleTokenRefetch(e){if(this.authState.state===`noAuth`)return;let t=this.decodeToken(e);if(!t){this.logger.error(`Auth token is not a valid JWT, cannot refetch the token`);return}let{iat:n,exp:r}=t;if(!n||!r){this.logger.error(`Auth token does not have required fields, cannot refetch the token`);return}let i=r-n;if(i<=2){this.logger.error(`Auth token does not live long enough, cannot refetch the token`);return}let a=Math.min(ci,(i-this.refreshTokenLeewaySeconds)*1e3);a<=0&&(this.logger.warn(`Refetching auth token immediately, configured leeway ${this.refreshTokenLeewaySeconds}s is larger than the token's lifetime ${i}s`),a=0);let o=setTimeout(()=>{this._logVerbose(`running scheduled token refetch`),this.refetchToken()},a);this.setAuthState({state:`waitingForScheduledRefetch`,refetchTokenTimeoutId:o,config:this.authState.config}),this._logVerbose(`scheduled preemptive auth token refetching in ${a}ms`)}async fetchTokenAndGuardAgainstRace(e,t){let n=++this.configVersion;this._logVerbose(`fetching token with config version ${n}`);let r=await e(t);return this.configVersion===n?{isFromOutdatedConfig:!1,value:r}:(this._logVerbose(`stale config version, expected ${n}, got ${this.configVersion}`),{isFromOutdatedConfig:!0})}stop(){this.resetAuthState(),this.configVersion++,this._logVerbose(`config version bumped to ${this.configVersion}`)}setAndReportAuthFailed(e){e(!1),this.resetAuthState()}resetAuthState(){this.setAuthState({state:`noAuth`})}setAuthState(e){let t=e.state===`waitingForServerConfirmationOfFreshToken`?{hadAuth:e.hadAuth,state:e.state,token:`...${e.token.slice(-7)}`}:{state:e.state};switch(this._logVerbose(`setting auth state to ${JSON.stringify(t)}`),e.state){case`waitingForScheduledRefetch`:case`notRefetching`:case`noAuth`:this.tokenConfirmationAttempts=0;break;case`waitingForServerConfirmationOfFreshToken`:case`waitingForServerConfirmationOfCachedToken`:case`initialRefetch`:break;default:}this.authState.state===`waitingForScheduledRefetch`&&clearTimeout(this.authState.refetchTokenTimeoutId),this.authState=e}decodeToken(e){try{return ii(e)}catch(e){return this._logVerbose(`Error decoding token: ${e instanceof Error?e.message:`Unknown error`}`),null}}_logVerbose(e){this.logger.logVerbose(`${e} [v${this.configVersion}]`)}},di=[`convexClientConstructed`,`convexWebSocketOpen`,`convexFirstMessageReceived`];function fi(e,t){let n={sessionId:t};typeof performance>`u`||!performance.mark||performance.mark(e,{detail:n})}function pi(e){let t=e.name.slice(6);return t=t.charAt(0).toLowerCase()+t.slice(1),{name:t,startTime:e.startTime}}function mi(e){if(typeof performance>`u`||!performance.getEntriesByName)return[];let t=[];for(let n of di){let r=performance.getEntriesByName(n).filter(e=>e.entryType===`mark`).filter(t=>t.detail.sessionId===e);t.push(...r)}return t.map(pi)}var hi=Object.defineProperty,gi=(e,t,n)=>t in e?hi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_i=(e,t,n)=>gi(e,typeof t==`symbol`?t:t+``,n),vi=class{constructor(e,t,n){if(_i(this,`address`),_i(this,`state`),_i(this,`requestManager`),_i(this,`webSocketManager`),_i(this,`authenticationManager`),_i(this,`remoteQuerySet`),_i(this,`optimisticQueryResults`),_i(this,`_transitionHandlerCounter`,0),_i(this,`_nextRequestId`),_i(this,`_onTransitionFns`,new Map),_i(this,`_sessionId`),_i(this,`firstMessageReceived`,!1),_i(this,`debug`),_i(this,`logger`),_i(this,`maxObservedTimestamp`),_i(this,`connectionStateSubscribers`,new Map),_i(this,`nextConnectionStateSubscriberId`,0),_i(this,`_lastPublishedConnectionState`),_i(this,`markConnectionStateDirty`,()=>{Promise.resolve().then(()=>{let e=this.connectionState();if(JSON.stringify(e)!==JSON.stringify(this._lastPublishedConnectionState)){this._lastPublishedConnectionState=e;for(let t of this.connectionStateSubscribers.values())t(e)}})}),_i(this,`mark`,e=>{this.debug&&fi(e,this.sessionId)}),typeof e==`object`)throw Error(`Passing a ClientConfig object is no longer supported. Pass the URL of the Convex deployment as a string directly.`);n?.skipConvexDeploymentUrlCheck!==!0&&Vt(e),n={...n};let r=n.authRefreshTokenLeewaySeconds??10,i=n.webSocketConstructor;if(!i&&typeof WebSocket>`u`)throw Error(`No WebSocket global variable defined! To use Convex in an environment without WebSocket try the HTTP client: https://docs.convex.dev/api/classes/browser.ConvexHttpCl
15ient`);i||=WebSocket,this.debug=n.reportDebugInfoToConvex??!1,this.address=e,this.logger=n.logger===!1?qn({verbose:n.verbose??!1}):n.logger!==!0&&n.logger?n.logger:Kn({verbose:n.verbose??!1});let a=e.search(`://`);if(a===-1)throw Error(`Provided address was not an absolute URL.`);let o=e.substring(a+3),s=e.substring(0,a),c;if(s===`http`)c=`ws`;else if(s===`https`)c=`wss`;else throw Error(`Unknown parent protocol ${s}`);let l=`${c}://${o}/api/${zn}/sync`;this.state=new ir,this.remoteQuerySet=new Fr(e=>this.state.queryPath(e),this.logger),this.requestManager=new cr(this.logger,this.markConnectionStateDirty);let u=()=>{this.webSocketManager.pause(),this.state.pause()};this.authenticationManager=new ui(this.state,{authenticate:e=>{let t=this.state.setAuth(e);return this.webSocketManager.sendMessage(t),t.baseVersion},stopSocket:()=>this.webSocketManager.stop(),tryRestartSocket:()=>this.webSocketManager.tryRestart(),pauseSocket:u,resumeSocket:()=>this.webSocketManager.resume(),clearAuth:()=>{this.clearAuth()}},{logger:this.logger,refreshTokenLeewaySeconds:r}),this.optimisticQueryResults=new Sr,this.addOnTransitionHandler(e=>{t(e.queries.map(e=>e.token))}),this._nextRequestId=0,this._sessionId=$r();let{unsavedChangesWarning:d}=n;if(typeof window>`u`||window.addEventListener===void 0){if(d===!0)throw Error(`unsavedChangesWarning requested, but window.addEventListener not found! Remove {unsavedChangesWarning: true} from Convex client options.`)}else d!==!1&&window.addEventListener(`beforeunload`,e=>{if(this.requestManager.hasIncompleteRequests()){e.preventDefault();let t=`Are you sure you want to leave? Your changes may not be saved.`;return(e||window.event).returnValue=t,t}});this.webSocketManager=new Qr(l,{onOpen:e=>{this.mark(`convexWebSocketOpen`),this.webSocketManager.sendMessage({...e,type:`Connect`,sessionId:this._sessionId,maxObservedTimestamp:this.maxObservedTimestamp}),this.remoteQuerySet=new Fr(e=>this.state.queryPath(e),this.logger);let[t,n]=this.state.restart();n&&this.webSocketManager.sendMessage(n),this.webSocketManager.sendMessage(t);for(let e of this.requestManager.restart())this.webSocketManager.sendMessage(e)},onResume:()=>{let[e,t]=this.state.resume();t&&this.webSocketManager.sendMessage(t),e&&this.webSocketManager.sendMessage(e);for(let e of this.requestManager.resume())this.webSocketManager.sendMessage(e)},onMessage:e=>{switch(this.firstMessageReceived||(this.firstMessageReceived=!0,this.mark(`convexFirstMessageReceived`),this.reportMarks()),e.type){case`Transition`:{this.observedTimestamp(e.endVersion.ts),this.authenticationManager.onTransition(e),this.remoteQuerySet.transition(e),this.state.transition(e);let t=this.requestManager.removeCompleted(this.remoteQuerySet.timestamp());this.notifyOnQueryResultChanges(t);break}case`MutationResponse`:{e.success&&this.observedTimestamp(e.ts);let t=this.requestManager.onResponse(e);t!==null&&this.notifyOnQueryResultChanges(new Map([[t.requestId,t.result]]));break}case`ActionResponse`:this.requestManager.onResponse(e);break;case`AuthError`:this.authenticationManager.onAuthError(e);break;case`FatalError`:{let t=Yn(this.logger,e.error);throw this.webSocketManager.terminate(),t}default:}return{hasSyncedPastLastReconnect:this.hasSyncedPastLastReconnect()}},onServerDisconnectError:n.onServerDisconnectError},i,this.logger,this.markConnectionStateDirty,this.debug),this.mark(`convexClientConstructed`),n.expectAuth&&u()}hasSyncedPastLastReconnect(){return this.requestManager.hasSyncedPastLastReconnect()&&this.state.hasSyncedPastLastReconnect()}observedTimestamp(e){(this.maxObservedTimestamp===void 0||this.maxObservedTimestamp.lessThanOrEqual(e))&&(this.maxObservedTimestamp=e)}getMaxObservedTimestamp(){return this.maxObservedTimestamp}notifyOnQueryResultChanges(e){let t=this.remoteQuerySet.remoteQueryResults(),n=new Map;for(let[e,r]of t){let t=this.state.queryToken(e);if(t!==null){let i={result:r,udfPath:this.state.queryPath(e),args:this.state.queryArgs(e)};n.set(t,i)}}let r=this.optimisticQueryResults.ingestQueryResultsFromServer(n,new Set(e.keys()));this.handleTransition({queries:r.map(e=>({token:e,modification:{kind:`Updated`,result:this.optimisticQueryResults.rawQueryResult(e)}})),reflectedMutations:Array.from(e).map(([e,t])=>({requestId:e,result:t})),timestamp:this.remoteQuerySet.timestamp()})}handleTransition(e){for(let t of this._onTransitionFns.values())t(e)}addOnTransitionHandler(e){let t=this._transitionHandlerCounter++;return this._onTransitionFns.set(t,e),()=>this._onTransitionFns.delete(t)}getCurrentAuthClaims(){let e=this.state.getAuth(),t={};if(e&&e.tokenType===`User`)try{t=e?ii(e.value):{}}catch{t={}}else return;return{token:e.value,decoded:t}}setAuth(e,t){this.authenticationManager.setConfig(e,t)}hasAuth(){return this.state.hasAuth()}setAdminAuth(e,t){let n=this.state.setAdminAuth(e,t);this.webSocketManager.sendMessage(n)}clearAuth(){let e=this.state.clearAuth();this.webSocketManager.sendMessage(e)}subscribe(e,t,n){let r=Bt(t),{modification:i,queryToken:a,unsubscribe:o}=this.state.subscribe(e,r,n?.journal,n?.componentPath);return i!==null&&this.webSocketManager.sendMessage(i),{queryToken:a,unsubscribe:()=>{let e=o();e&&this.webSocketManager.sendMessage(e)}}}localQueryResult(e,t){let n=$n(e,Bt(t));return this.optimisticQueryResults.queryResult(n)}localQueryResultByToken(e){return this.optimisticQueryResults.queryResult(e)}hasLocalQueryResultByToken(e){return this.optimisticQueryResults.hasQueryResult(e)}localQueryLogs(e,t){let n=$n(e,Bt(t));return this.optimisticQueryResults.queryLogs(n)}queryJournal(e,t){let n=$n(e,Bt(t));return this.state.queryJournal(n)}connectionState(){let e=this.webSocketManager.connectionState();return{hasInflightRequests:this.requestManager.hasInflightRequests(),isWebSocketConnected:e.isConnected,hasEverConnected:e.hasEverConnected,connectionCount:e.connectionCount,connectionRetries:e.connectionRetries,timeOfOldestInflightRequest:this.requestManager.timeOfOldestInflightRequest(),inflightMutations:this.requestManager.inflightMutations(),inflightActions:this.requestManager.inflightActions()}}subscribeToConnectionState(e){let t=this.nextConnectionStateSubscriberId++;return this.connectionStateSubscribers.set(t,e),()=>{this.connectionStateSubscribers.delete(t)}}async mutation(e,t,n){let r=await this.mutationInternal(e,t,n);if(!r.success)throw r.errorData===void 0?Error(Xn(`mutation`,e,r)):Zn(r,new Rn(Xn(`mutation`,e,r)));return r.value}async mutationInternal(e,t,n,r){let{mutationPromise:i}=this.enqueueMutation(e,t,n,r);return i}enqueueMutation(e,t,n,r){let i=Bt(t);this.tryReportLongDisconnect();let a=this.nextRequestId;if(this._nextRequestId++,n!==void 0){let e=n.optimisticUpdate;if(e!==void 0){let t=this.optimisticQueryResults.applyOptimisticUpdate(t=>{e(t,i)instanceof Promise&&this.logger.warn(`Optimistic update handler returned a Promise. Optimistic updates should be synchronous.`)},a).map(e=>{let t=this.localQueryResultByToken(e);return{token:e,modification:{kind:`Updated`,result:t===void 0?void 0:{success:!0,value:t,logLines:[]}}}});this.handleTransition({queries:t,reflectedMutations:[],timestamp:this.remoteQuerySet.timestamp()})}}let o={type:`Mutation`,requestId:a,udfPath:e,componentPath:r,args:[dn(i)]},s=this.webSocketManager.sendMessage(o);return{requestId:a,mutationPromise:this.requestManager.request(o,s)}}async action(e,t){let n=await this.actionInternal(e,t);if(!n.success)throw n.errorData===void 0?Error(Xn(`action`,e,n)):Zn(n,new Rn(Xn(`action`,e,n)));return n.value}async actionInternal(e,t,n){let r=Bt(t),i=this.nextRequestId;this._nextRequestId++,this.tryReportLongDisconnect();let a={type:`Action`,requestId:i,udfPath:e,componentPath:n,args:[dn(r)]},o=this.webSocketManager.sendMessage(a);return this.requestManager.request(a,o)}async close(){return this.authenticationManager.stop(),this.webSocketManager.terminate()}get url(){return this.address}get nextRequestId(){return this._nextRequestId}get sessionId(){return this._sessionId}
15reportMarks(){if(this.debug){let e=mi(this.sessionId);this.webSocketManager.sendMessage({type:`Event`,eventType:`ClientConnect`,event:e})}}tryReportLongDisconnect(){if(!this.debug)return;let e=this.connectionState().timeOfOldestInflightRequest;if(e===null||Date.now()-e.getTime()<=60*1e3)return;let t=`${this.address}/api/debug_event`;fetch(t,{method:`POST`,headers:{"Content-Type":`application/json`,"Convex-Client":`npm-${zn}`},body:JSON.stringify({event:`LongWebsocketDisconnect`})}).then(e=>{e.ok||this.logger.warn(`Analytics request failed with response:`,e.body)}).catch(e=>{this.logger.warn(`Analytics response failed with error:`,e)})}};function yi(e){if(typeof e!=`object`||!e||!Array.isArray(e.page)||typeof e.isDone!=`boolean`||typeof e.continueCursor!=`string`)throw Error(`Not a valid paginated query result: ${e?.toString()}`);return e}var bi=Object.defineProperty,xi=(e,t,n)=>t in e?bi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Si=(e,t,n)=>xi(e,typeof t==`symbol`?t:t+``,n),Ci=class{constructor(e,t){this.client=e,this.onTransition=t,Si(this,`paginatedQuerySet`,new Map),Si(this,`lastTransitionTs`),this.lastTransitionTs=Er.fromNumber(0),this.client.addOnTransitionHandler(e=>this.onBaseTransition(e))}subscribe(e,t,n){let r=Qn(e),i=er(r,t,n),a=()=>this.removePaginatedQuerySubscriber(i),o=this.paginatedQuerySet.get(i);return o?(o.numSubscribers+=1,{paginatedQueryToken:i,unsubscribe:a}):(this.paginatedQuerySet.set(i,{token:i,canonicalizedUdfPath:r,args:t,numSubscribers:1,options:{initialNumItems:n.initialNumItems},nextPageKey:0,pageKeys:[],pageKeyToQuery:new Map,ongoingSplits:new Map,skip:!1,id:n.id}),this.addPageToPaginatedQuery(i,null,n.initialNumItems),{paginatedQueryToken:i,unsubscribe:a})}localQueryResult(e,t,n){let r=er(Qn(e),t,n);return this.localQueryResultByToken(r)}localQueryResultByToken(e){let t=this.paginatedQuerySet.get(e);if(!t)return;let n=this.activePageQueryTokens(t);if(n.length===0)return{results:[],status:`LoadingFirstPage`,loadMore:t=>this.loadMoreOfPaginatedQuery(e,t)};let r=[],i=!1,a=!1;for(let e of n){let t=this.client.localQueryResultByToken(e);if(t===void 0){i=!0,a=!1;continue}let n=yi(t);r=r.concat(n.page),a=!!n.isDone}let o;return o=i?r.length===0?`LoadingFirstPage`:`LoadingMore`:a?`Exhausted`:`CanLoadMore`,{results:r,status:o,loadMore:t=>this.loadMoreOfPaginatedQuery(e,t)}}onBaseTransition(e){let t=e.queries.map(e=>e.token),n=this.queriesContainingTokens(t),r=[];n.length>0&&(this.processPaginatedQuerySplits(n,e=>this.client.localQueryResultByToken(e)),r=n.map(e=>({token:e,modification:{kind:`Updated`,result:this.localQueryResultByToken(e)}})));let i={...e,paginatedQueries:r};this.onTransition(i)}loadMoreOfPaginatedQuery(e,t){this.mustGetPaginatedQuery(e);let n=this.queryTokenForLastPageOfPaginatedQuery(e),r=this.client.localQueryResultByToken(n);if(!r)return!1;let i=yi(r);if(i.isDone)return!1;this.addPageToPaginatedQuery(e,i.continueCursor,t);let a={timestamp:this.lastTransitionTs,reflectedMutations:[],queries:[],paginatedQueries:[{token:e,modification:{kind:`Updated`,result:this.localQueryResultByToken(e)}}]};return this.onTransition(a),!0}queriesContainingTokens(e){if(e.length===0)return[];let t=[],n=new Set(e);for(let[e,r]of this.paginatedQuerySet)for(let i of this.allQueryTokens(r))if(n.has(i)){t.push(e);break}return t}processPaginatedQuerySplits(e,t){for(let n of e){let e=this.mustGetPaginatedQuery(n),{ongoingSplits:r,pageKeyToQuery:i,pageKeys:a}=e;for(let[n,[a,o]]of r)t(i.get(a).queryToken)!==void 0&&t(i.get(o).queryToken)!==void 0&&this.completePaginatedQuerySplit(e,n,a,o);for(let n of a){if(r.has(n))continue;let a=i.get(n).queryToken,o=t(a);if(!o)continue;let s=yi(o);s.splitCursor&&(s.pageStatus===`SplitRecommended`||s.pageStatus===`SplitRequired`||s.page.length>e.options.initialNumItems*2)&&this.splitPaginatedQueryPage(e,n,s.splitCursor,s.continueCursor)}}}splitPaginatedQueryPage(e,t,n,r){let i=e.nextPageKey++,a=e.nextPageKey++,o={cursor:r,numItems:e.options.initialNumItems,id:e.id},s=this.client.subscribe(e.canonicalizedUdfPath,{...e.args,paginationOpts:{...o,cursor:null,endCursor:n}});e.pageKeyToQuery.set(i,s);let c=this.client.subscribe(e.canonicalizedUdfPath,{...e.args,paginationOpts:{...o,cursor:n,endCursor:r}});e.pageKeyToQuery.set(a,c),e.ongoingSplits.set(t,[i,a])}addPageToPaginatedQuery(e,t,n){let r=this.mustGetPaginatedQuery(e),i=r.nextPageKey++,a={cursor:t,numItems:n,id:r.id},o={...r.args,paginationOpts:a},s=this.client.subscribe(r.canonicalizedUdfPath,o);return r.pageKeys.push(i),r.pageKeyToQuery.set(i,s),s}removePaginatedQuerySubscriber(e){let t=this.paginatedQuerySet.get(e);if(t&&(--t.numSubscribers,!(t.numSubscribers>
150))){for(let e of t.pageKeyToQuery.values())e.unsubscribe();this.paginatedQuerySet.delete(e)}}completePaginatedQuerySplit(e,t,n,r){let i=e.pageKeyToQuery.get(t);e.pageKeyToQuery.delete(t);let a=e.pageKeys.indexOf(t);e.pageKeys.splice(a,1,n,r),e.ongoingSplits.delete(t),i.unsubscribe()}activePageQueryTokens(e){return e.pageKeys.map(t=>e.pageKeyToQuery.get(t).queryToken)}allQueryTokens(e){return Array.from(e.pageKeyToQuery.values()).map(e=>e.queryToken)}queryTokenForLastPageOfPaginatedQuery(e){let t=this.mustGetPaginatedQuery(e),n=t.pageKeys[t.pageKeys.length-1];if(n===void 0)throw Error(`No pages for paginated query ${e}`);return t.pageKeyToQuery.get(n).queryToken}mustGetPaginatedQuery(e){let t=this.paginatedQuerySet.get(e);if(!t)throw Error(`paginated query no longer exists for token `+e);return t}};function wi({getCurrentValue:e,subscribe:t}){let[n,r]=(0,_.useState)(()=>({getCurrentValue:e,subscribe:t,value:e()})),i=n.value;return(n.getCurrentValue!==e||n.subscribe!==t)&&(i=e(),r({getCurrentValue:e,subscribe:t,value:i})),(0,_.useEffect)(()=>{let n=!1,i=()=>{n||r(n=>{if(n.getCurrentValue!==e||n.subscribe!==t)return n;let r=e();return n.value===r?n:{...n,value:r}})},a=t(i);return i(),()=>{n=!0,a()}},[e,t]),i}var Ti=Object.defineProperty,Ei=(e,t,n)=>t in e?Ti(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Di=(e,t,n)=>Ei(e,typeof t==`symbol`?t:t+``,n),Oi=5e3;if(_.default===void 0)throw Error(`Required dependency 'react' not found`);function ki(e,t,n){function r(r){return Ri(r),t.mutation(e,r,{optimisticUpdate:n})}return r.withOptimisticUpdate=function(r){if(n!==void 0)throw Error(`Already specified optimistic update for mutation ${mr(e)}`);return ki(e,t,r)},r}function Ai(e,t){return function(n){return t.action(e,n)}}var ji=class{constructor(e,t){if(Di(this,`address`),Di(this,`cachedSync`),Di(this,`cachedPaginatedQueryClient`),Di(this,`listeners`),Di(this,`options`),Di(this,`closed`,!1),Di(this,`_logger`),Di(this,`adminAuth`),Di(this,`fakeUserIdentity`),e===void 0)throw Error(`No address provided to ConvexReactClient. 16If trying to deploy to production, make sure to follow all the instructions found at https://docs.convex.dev/production/hosting/ 17If running locally, make sure to run \`convex dev\` and ensure the .env.local file is populated.`);if(typeof e!=`string`)throw Error(`ConvexReactClient requires a URL like 'https://happy-otter-123.convex.cloud', received something of type ${typeof e} instead.`);if(!e.includes(`://`))throw Error(`Provided address was not an absolute URL.`);this.address=e,this.listeners=new Map,this._logger=t?.logger===!1?qn({verbose:t?.verbose??!1}):t?.logger!==!0&&t?.logger?t.logger:Kn({verbose:t?.verbose??!1}),this.options={...t,logger:this._logger}}get url(){return this.address}get sync(){if(this.closed)throw Error(`ConvexReactClient has already been closed.`);return this.cachedSync?this.cachedSync:(this.cachedSync=new vi(this.address,()=>{},this.options),this.adminAuth&&this.cachedSync.setAdminAuth(this.adminAuth,this.fakeUserIdentity),this.cachedPaginatedQueryClient=new Ci(this.cachedSync,e=>this.handleTransition(e)),this.cachedSync)}get paginatedQueryClient(){if(this.sync,this.cachedPaginatedQueryClient)return this.cachedPaginatedQueryClient;throw Error(`Should already be instantiated`)}setAuth(e,t){if(typeof e==`string`)throw Error(`Passing a string to ConvexReactClient.setAuth is no longer supported, please upgrade to passing in an async function to handle reauthentication.`);this.sync.setAuth(e,t??(()=>{}))}clearAuth(){this.sync.clearAuth()}setAdminAuth(e,t){if(this.adminAuth=e,this.fakeUserIdentity=t,this.closed)throw Error(`ConvexReactClient has already been closed.`);this.cachedSync&&this.sync.setAdminAuth(e,t)}watchQuery(e,...t){let[n,r]=t,i=mr(e);return{onUpdate:e=>{let{queryToken:t,unsubscribe:a}=this.sync.subscribe(i,n,r),o=this.listeners.get(t);return o===void 0?this.listeners.set(t,new Set([e])):o.add(e),()=>{if(this.closed)return;let n=this.listeners.get(t);n.delete(e),n.size===0&&this.listeners.delete(t),a()}},localQueryResult:()=>{if(this.cachedSync)return this.cachedSync.localQueryResult(i,n)},localQueryLogs:()=>
17{if(this.cachedSync)return this.cachedSync.localQueryLogs(i,n)},journal:()=>{if(this.cachedSync)return this.cachedSync.queryJournal(i,n)}}}prewarmQuery(e){let t=e.extendSubscriptionFor??Oi,n=this.watchQuery(e.query,e.args||{}).onUpdate(()=>{});setTimeout(n,t)}watchPaginatedQuery(e,t,n){let r=mr(e);return{onUpdate:e=>{let{paginatedQueryToken:i,unsubscribe:a}=this.paginatedQueryClient.subscribe(r,t||{},n),o=this.listeners.get(i);return o===void 0?this.listeners.set(i,new Set([e])):o.add(e),()=>{if(this.closed)return;let t=this.listeners.get(i);t.delete(e),t.size===0&&this.listeners.delete(i),a()}},localQueryResult:()=>this.paginatedQueryClient.localQueryResult(r,t,n)}}mutation(e,...t){let[n,r]=t,i=mr(e);return this.sync.mutation(i,n,r)}action(e,...t){let n=mr(e);return this.sync.action(n,...t)}query(e,...t){let n=this.watchQuery(e,...t),r=n.localQueryResult();return r===void 0?new Promise((e,t)=>{let r=n.onUpdate(()=>{r();try{e(n.localQueryResult())}catch(e){t(e)}})}):Promise.resolve(r)}connectionState(){return this.sync.connectionState()}subscribeToConnectionState(e){return this.sync.subscribeToConnectionState(e)}get logger(){return this._logger}async close(){if(this.closed=!0,this.listeners=new Map,this.cachedPaginatedQueryClient&&=void 0,this.cachedSync){let e=this.cachedSync;this.cachedSync=void 0,await e.close()}}handleTransition(e){let t=e.queries.map(e=>e.token),n=e.paginatedQueries.map(e=>e.token);this.transition([...t,...n])}transition(e){for(let t of e){let e=this.listeners.get(t);if(e)for(let t of e)t()}}},Mi=_.createContext(void 0);function Ni(){return(0,_.useContext)(Mi)}var Pi=({client:e,children:t})=>_.createElement(Mi.Provider,{value:e},t);function Fi(e,...t){let n=t[0]===`skip`,r=t[0]===`skip`?{}:Bt(t[0]),i=typeof e==`string`?hr(e):e,a=mr(i),o=Ui((0,_.useMemo)(()=>n?{}:{query:{query:i,args:r}},[JSON.stringify(dn(r)),a,n])).query;if(o instanceof Error)throw o;return o}function Ii(e){let t=typeof e==`string`?hr(e):e,n=(0,_.useContext)(Mi);if(n===void 0)throw Error("Could not find Convex client! `useMutation` must be used in the React component tree under `ConvexProvider`. Did you forget it? See https://docs.convex.dev/quick-start#set-up-convex-in-your-react-app");return(0,_.useMemo)(()=>ki(t,n),[n,mr(t)])}function Li(e){let t=(0,_.useContext)(Mi),n=typeof e==`string`?hr(e):e;if(t===void 0)throw Error("Could not find Convex client! `useAction` must be used in the React component tree under `ConvexProvider`. Did you forget it? See https://docs.convex.dev/quick-start#set-up-convex-in-your-react-app");return(0,_.useMemo)(()=>Ai(n,t),[t,mr(n)])}function Ri(e){if(typeof e==`object`&&e&&`bubbles`in e&&`persist`in e&&`isDefaultPrevented`in e)throw Error("Convex function called with SyntheticEvent object. Did you use a Convex function as an event handler directly? Event handlers like onClick receive an event object as their first argument. These SyntheticEvent objects are not valid Convex values. Try wrapping the function like `const handler = () => myMutation();` and using `handler` in the event handler.")}var zi=Object.defineProperty,Bi=(e,t,n)=>t in e?zi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Vi=(e,t,n)=>Bi(e,typeof t==`symbol`?t:t+``,n),Hi=class{constructor(e){Vi(this,`createWatch`),Vi(this,`queries`),Vi(this,`listeners`),this.createWatch=e,this.queries={},this.listeners=new Set}setQueries(e){for(let t of Object.keys(e)){let{query:n,args:r,paginationOptions:i}=e[t];if(mr(n),this.queries[t]===void 0)this.addQuery(t,n,r,i?{paginationOptions:i}:{});else{let e=this.queries[t];(mr(n)!==mr(e.query)||JSON.stringify(dn(r))!==JSON.stringify(dn(e.args))||JSON.stringify(i)!==JSON.stringify(e.paginationOptions))&&(this.removeQuery(t),this.addQuery(t,n,r,i?{paginationOptions:i}:{}))}}for(let t of Object.keys(this.queries))e[t]===void 0&&this.removeQuery(t)}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}getLocalResults(e){let t={};for(let n of Object.keys(e)){let{query:r,args:i}=e[n],a=e[n].paginationOptions;mr(r);let o=this.createWatch(r,i,a?{paginationOptions:a}:{}),s;try{s=o.localQueryResult()}catch(e){if(e instanceof Error)s=e;else throw e}t[n]=s}return t}setCreateWatch(e){this.createWatch=e;for(let e of Object.keys(this.queries)){let{query:t,args:n,watch:r,paginationOptions:i}=this.queries[e],a=`journal`in r?r.journal():void 0;this.removeQuery(e),this.addQuery(e,t,n,{...a?{journal:a}:[],...i?{paginationOptions:i}:{}})}}destroy(){for(let e of Object.keys(this.queries))this.removeQuery(e);this.listeners=new Set}addQuery(e,t,n,{paginationOptions:r,journal:i}){if(this.queries[e]!==void 0)throw Error(`Tried to add a new query with identifier ${e} when it already exists.`);let a=this.createWatch(t,n,{...i?{journal:i}:[],...r?{paginationOptions:r}:{}}),o=a.onUpdate(()=>this.notifyListeners());this.queries[e]={query:t,args:n,watch:a,unsubscribe:o,...r?{paginationOptions:r}:{}}}removeQuery(e){let t=this.queries[e];if(t===void 0)throw Error(`No query found with identifier ${e}.`);t.unsubscribe(),delete this.queries[e]}notifyListeners(){for(let e of this.listeners)e()}};function Ui(e){let t=Ni();if(t===void 0)throw Error("Could not find Convex client! `useQuery` must be used in the React component tree under `ConvexProvider`. Did you forget it? See https://docs.convex.dev/quick-start#set-up-convex-in-your-react-app");return Wi(e,(0,_.useMemo)(()=>(e,n,{journal:r,paginationOptions:i})=>i?t.watchPaginatedQuery(e,n,i):t.watchQuery(e,n,r?{journal:r}:{}),[t]))}function Wi(e,t){let[n]=(0,_.useState)(()=>new Hi(t));return n.createWatch!==t&&n.setCreateWatch(t),(0,_.useEffect)(()=>()=>n.destroy(),[n]),wi((0,_.useMemo)(()=>({getCurrentValue:()=>
17n.getLocalResults(e),subscribe:t=>(n.setQueries(e),n.subscribe(t))}),[n,e]))}var Gi=(0,_.createContext)(void 0);function Ki(){let e=(0,_.useContext)(Gi);if(e===void 0)throw Error("Could not find `ConvexProviderWithAuth` (or `ConvexProviderWithClerk` or `ConvexProviderWithAuth0`) as an ancestor component. This component may be missing, or you might have two instances of the `convex/react` module loaded in your project.");return e}function qi({children:e,client:t,useAuth:n}){let{isLoading:r,isAuthenticated:i,fetchAccessToken:a}=n(),[o,s]=(0,_.useState)(null);return r&&o!==null&&s(null),!r&&!i&&o!==!1&&s(!1),_.createElement(Gi.Provider,{value:{isLoading:o===null,isAuthenticated:i&&(o??!1)}},_.createElement(Ji,{authProviderAuthenticated:i,fetchAccessToken:a,authProviderLoading:r,client:t,setIsConvexAuthenticated:s}),_.createElement(Pi,{client:t},e),_.createElement(Yi,{authProviderAuthenticated:i,fetchAccessToken:a,authProviderLoading:r,client:t,setIsConvexAuthenticated:s}))}function Ji({authProviderAuthenticated:e,fetchAccessToken:t,authProviderLoading:n,client:r,setIsConvexAuthenticated:i}){return(0,_.useEffect)(()=>{let n=!0;if(e)return r.setAuth(t,e=>{n&&i(()=>e)}),()=>{n=!1,i(e=>e?!1:null)}},[e,t,n,r,i]),null}function Yi({authProviderAuthenticated:e,fetchAccessToken:t,authProviderLoading:n,client:r,setIsConvexAuthenticated:i}){return(0,_.useEffect)(()=>{if(e)return()=>{r.clearAuth(),i(()=>null)}},[e,t,n,r,i]),null}function Xi({children:e}){let{isLoading:t,isAuthenticated:n}=Ki();return t||!n?null:_.createElement(_.Fragment,null,e)}function Zi({children:e}){let{isLoading:t,isAuthenticated:n}=Ki();return t||n?null:_.createElement(_.Fragment,null,e)}var Qi=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})),M=o(((e,t)=>{t.exports=Qi()}))();function $i({children:e,client:t,useAuth:n}){return(0,M.jsx)(qi,{client:t,useAuth:ea(n),children:e})}function ea(e){return(0,_.useMemo)(()=>function(){let{isLoading:t,user:n,getAccessToken:r}=e(),i=(0,_.useCallback)(async({forceRefreshToken:e})=>{try{return await r(e?{forceRefresh:!0}:void 0)}catch(e){return console.error(`Error fetching WorkOS access token:`,e),null}},[r]);return(0,_.useMemo)(()=>({isLoading:t,isAuthenticated:!!n,fetchAccessToken:i}),[t,n,i])},[e])}var ta={VITE_CONVEX_URL:`https://kindred-heron-303.convex.cloud`,VITE_WORKOS_CLIENT_ID:`client_01KRK1639BCBF9TENG9N601XK6`,VITE_WORKOS_REDIRECT_URI:`https://www.xobrain.ai/callback`};function na(){let e=[];for(let[t,n]of Object.entries(ta))(n===void 0||n===``)&&e.push(t);if(e.length>0)throw Error(`Missing required env vars: ${e.join(`, `)}. Set them in your Vite environment (.env.local for dev, Vercel project settings for production).`);return ta}var ra=na(),ia=(e,t,n,r,i,a,o,s)=>{let c=document.documentElement,l=[`light`,`dark`];function u(t){(Array.isArray(e)?e:[e]).forEach(e=>{let n=e===`class`,r=n&&a?i.map(e=>a[e]||e):i;n?(c.classList.remove(...r),c.classList.add(a&&a[t]?a[t]:t)):c.setAttribute(e,t)}),d(t)}function d(e){s&&l.includes(e)&&(c.style.colorScheme=e)}function f(){return window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}if(r)u(r);else try{let e=localStorage.getItem(t)||n;u(o&&e===`system`?f():e)}catch{}},aa=[`light`,`dark`],oa=`(prefers-color-scheme: dark)`,sa=typeof window>`u`,ca=_.createContext(void 0),la={setTheme:e=>{},themes:[]},ua=()=>_.useContext(ca)??la,da=e=>_.useContext(ca)?_.createElement(_.Fragment,null,e.children):_.createElement(pa,{...e}),fa=[`light`,`dark`],pa=({forcedTheme:e,disableTransitionOnChange:t=!1,enableSystem:n=!0,enableColorScheme:r=!0,storageKey:i=`theme`,themes:a=fa,defaultTheme:o=n?`system`:`light`,attribute:s=`data-theme`,value:c,children:l,nonce:u,scriptProps:d})=>{let[f,p]=_.useState(()=>ha(i,o)),[m,h]=_.useState(()=>f===`system`?_a():f),g=c?Object.values(c):a,v=_.useCallback(e=>{let i=e;if(!i)return;e===`system`&&n&&(i=_a());let a=c?c[i]:i,l=t?ga(u):null,d=document.documentElement,f=e=>{e===`class`?(d.classList.remove(...g),a&&d.classList.add(a)):e.startsWith(`data-`)&&(a?d.setAttribute(e,a):d.removeAttribute(e))};
17if(Array.isArray(s)?s.forEach(f):f(s),r){let e=aa.includes(o)?o:null,t=aa.includes(i)?i:e;d.style.colorScheme=t}l?.()},[u]),y=_.useCallback(e=>{let t=typeof e==`function`?e(f):e;p(t);try{localStorage.setItem(i,t)}catch{}},[f]),b=_.useCallback(t=>{h(_a(t)),f===`system`&&n&&!e&&v(`system`)},[f,e]);_.useEffect(()=>{let e=window.matchMedia(oa);return e.addListener(b),b(e),()=>e.removeListener(b)},[b]),_.useEffect(()=>{let e=e=>{e.key===i&&(e.newValue?p(e.newValue):y(o))};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[y]),_.useEffect(()=>{v(e??f)},[e,f]);let x=_.useMemo(()=>({theme:f,setTheme:y,forcedTheme:e,resolvedTheme:f===`system`?m:f,themes:n?[...a,`system`]:a,systemTheme:n?m:void 0}),[f,y,e,m,n,a]);return _.createElement(ca.Provider,{value:x},_.createElement(ma,{forcedTheme:e,storageKey:i,attribute:s,enableSystem:n,enableColorScheme:r,defaultTheme:o,value:c,themes:a,nonce:u,scriptProps:d}),l)},ma=_.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:r,enableColorScheme:i,defaultTheme:a,value:o,themes:s,nonce:c,scriptProps:l})=>{let u=JSON.stringify([n,t,a,e,s,o,r,i]).slice(1,-1);return _.createElement(`script`,{...l,suppressHydrationWarning:!0,nonce:typeof window>`u`?c:``,dangerouslySetInnerHTML:{__html:`(${ia.toString()})(${u})`}})}),ha=(e,t)=>{if(sa)return;let n;try{n=localStorage.getItem(e)||void 0}catch{}return n||t},ga=e=>{let t=document.createElement(`style`);return e&&t.setAttribute(`nonce`,e),t.appendChild(document.createTextNode(`*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}`)),document.head.appendChild(t),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(t)},1)}},_a=e=>(e||=window.matchMedia(oa),e.matches?`dark`:`light`);function va({children:e,...t}){return(0,M.jsx)(da,{attribute:`class`,defaultTheme:`dark`,enableSystem:!0,disableTransitionOnChange:!0,...t,children:e})}var ya=c(m(),1);function ba(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function xa(...e){return t=>{let n=!1,r=e.map(e=>{let r=ba(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():ba(e[t],null)}}}}function Sa(...e){return _.useCallback(xa(...e),e)}function Ca(e){let t=Ta(e),n=_.forwardRef((e,n)=>{let{children:r,...i}=e,a=_.Children.toArray(r),o=a.find(Oa);if(o){let e=o.props.children,r=a.map(t=>t===o?_.Children.count(e)>1?_.Children.only(null):_.isValidElement(e)?e.props.children:null:t);return(0,M.jsx)(t,{...i,ref:n,children:_.isValidElement(e)?_.cloneElement(e,void 0,r):null})}return(0,M.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}var wa=Ca(`Slot`);function Ta(e){let t=_.forwardRef((e,t)=>{let{children:n,...r}=e;if(_.isValidElement(n)){let e=Aa(n),i=ka(r,n.props);return n.type!==_.Fragment&&(i.ref=t?xa(t,e):e),_.cloneElement(n,i)}return _.Children.count(n)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ea=Symbol(`radix.slottable`);function Da(e){let t=({children:e})=>(0,M.jsx)(M.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=Ea,t}function Oa(e){return _.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Ea}function ka(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Aa(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var N=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Ca(`Primitive.${t}`),r=_.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,M.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function ja(e,t){e&&ya.flushSync(()=>
17e.dispatchEvent(t))}var Ma=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),Na=`VisuallyHidden`,Pa=_.forwardRef((e,t)=>(0,M.jsx)(N.span,{...e,ref:t,style:{...Ma,...e.style}}));Pa.displayName=Na;var Fa=Pa;function Ia(e,t){let n=_.createContext(t),r=e=>{let{children:t,...r}=e,i=_.useMemo(()=>r,Object.values(r));return(0,M.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=_.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function La(e,t=[]){let n=[];function r(t,r){let i=_.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=_.useMemo(()=>o,Object.values(o));return(0,M.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=_.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>_.createContext(e));return function(n){let r=n?.[e]||t;return _.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,Ra(i,...t)]}function Ra(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return _.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function za(e){let t=e+`CollectionProvider`,[n,r]=La(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=_.useRef(null),a=_.useRef(new Map).current;return(0,M.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=Ca(s),l=_.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,M.jsx)(c,{ref:Sa(t,a(s,n).collectionRef),children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=Ca(u),p=_.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=_.useRef(null),s=Sa(t,o),c=a(u,n);return _.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,M.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return _.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:p},m,r]}typeof window<`u`&&window.document&&window.document.createElement;function P(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}var Ba=globalThis?.document?_.useLayoutEffect:()=>{},Va=_.useInsertionEffect||Ba;function Ha({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=Ua({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=_.useRef(e!==void 0);_.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,_.useCallback(t=>{if(s){let n=Wa(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function Ua({defaultProp:e,onChange:t}){let[n,r]=_.useState(e),i=_.useRef(n),a=_.useRef(t);return Va(()=>{a.current=t},[t]),_.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function Wa(e){return typeof e==`function`}function Ga(e,t){return _.useReducer((e,n)=>t[e][n]??e,e)}var Ka=e=>{let{present:t,children:n}=e,r=qa(t),i=typeof n==`function`?n({present:r.isPresent}):_.Children.only(n),a=Sa(r.ref,Ya(i));return typeof n==`function`||r.isPresent?_.cloneElement(i,{ref:a}):null};Ka.displayName=`Presence`;function qa(e){let[t,n]=_.useState(),r=_.useRef(null),i=_.useRef(e),a=_.useRef(`none`),[o,s]=Ga(e?`mounted`:`unmounted`,{mou
17nted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return _.useEffect(()=>{let e=Ja(r.current);a.current=o===`mounted`?e:`none`},[o]),Ba(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=Ja(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),Ba(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=Ja(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=Ja(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:_.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function Ja(e){return e?.animationName||`none`}function Ya(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Xa=_.useId||(()=>void 0),Za=0;function Qa(e){let[t,n]=_.useState(Xa());return Ba(()=>{e||n(e=>e??String(Za++))},[e]),e||(t?`radix-${t}`:``)}var $a=`Collapsible`,[eo,to]=La($a),[no,ro]=eo($a),io=_.forwardRef((e,t)=>{let{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:o,...s}=e,[c,l]=Ha({prop:r,defaultProp:i??!1,onChange:o,caller:$a});return(0,M.jsx)(no,{scope:n,disabled:a,contentId:Qa(),open:c,onOpenToggle:_.useCallback(()=>l(e=>!e),[l]),children:(0,M.jsx)(N.div,{"data-state":uo(c),"data-disabled":a?``:void 0,...s,ref:t})})});io.displayName=$a;var ao=`CollapsibleTrigger`,oo=_.forwardRef((e,t)=>{let{__scopeCollapsible:n,...r}=e,i=ro(ao,n);return(0,M.jsx)(N.button,{type:`button`,"aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":uo(i.open),"data-disabled":i.disabled?``:void 0,disabled:i.disabled,...r,ref:t,onClick:P(e.onClick,i.onOpenToggle)})});oo.displayName=ao;var so=`CollapsibleContent`,co=_.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=ro(so,e.__scopeCollapsible);return(0,M.jsx)(Ka,{present:n||i.open,children:({present:e})=>(0,M.jsx)(lo,{...r,ref:t,present:e})})});co.displayName=so;var lo=_.forwardRef((e,t)=>{let{__scopeCollapsible:n,present:r,children:i,...a}=e,o=ro(so,n),[s,c]=_.useState(r),l=_.useRef(null),u=Sa(t,l),d=_.useRef(0),f=d.current,p=_.useRef(0),m=p.current,h=o.open||s,g=_.useRef(h),v=_.useRef(void 0);return _.useEffect(()=>{let e=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(e)},[]),Ba(()=>{let e=l.current;if(e){v.current=v.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();d.current=t.height,p.current=t.width,g.current||(e.style.transitionDuration=v.current.transitionDuration,e.style.animationName=v.current.animationName),c(r)}},[o.open,r]),(0,M.jsx)(N.div,{"data-state":uo(o.open),"data-disabled":o.disabled?``:void 0,id:o.contentId,hidden:!h,...a,ref:u,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...e.style},children:h&&i})});function uo(e){return e?`open`:`closed`}var fo=io,po=oo,mo=co,ho=_.createContext(void 0);function go(e){let t=_.useContext(ho);return e||t||`ltr`}var _o=`Accordion`,vo=[`Home`,`End`,`ArrowDown`,`ArrowUp`,`ArrowLeft`,`ArrowRight`],[yo,bo,xo]=za(_o),[So,Co]=La(_o,[xo,to]),wo=to(),To=_.forwardRef((e,t)=>{let{type:n,...r}=e,i=r,a=r;return(0,M.jsx)(yo.Provider,{scope:e.__scopeAccordion,children:n===`multiple`?(0,M.jsx)(jo,{...a,ref:t}):(0,M.jsx)(Ao,{...i,ref:t})})});To.displayName=_o;var[Eo,Do]=So(_o),[Oo,ko]=So(_o,{collapsible:!1}),Ao=_.forwardRef((e,t)=>
17{let{value:n,defaultValue:r,onValueChange:i=()=>{},collapsible:a=!1,...o}=e,[s,c]=Ha({prop:n,defaultProp:r??``,onChange:i,caller:_o});return(0,M.jsx)(Eo,{scope:e.__scopeAccordion,value:_.useMemo(()=>s?[s]:[],[s]),onItemOpen:c,onItemClose:_.useCallback(()=>a&&c(``),[a,c]),children:(0,M.jsx)(Oo,{scope:e.__scopeAccordion,collapsible:a,children:(0,M.jsx)(Po,{...o,ref:t})})})}),jo=_.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=Ha({prop:n,defaultProp:r??[],onChange:i,caller:_o}),c=_.useCallback(e=>s((t=[])=>[...t,e]),[s]),l=_.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,M.jsx)(Eo,{scope:e.__scopeAccordion,value:o,onItemOpen:c,onItemClose:l,children:(0,M.jsx)(Oo,{scope:e.__scopeAccordion,collapsible:!0,children:(0,M.jsx)(Po,{...a,ref:t})})})}),[Mo,No]=So(_o),Po=_.forwardRef((e,t)=>{let{__scopeAccordion:n,disabled:r,dir:i,orientation:a=`vertical`,...o}=e,s=Sa(_.useRef(null),t),c=bo(n),l=go(i)===`ltr`,u=P(e.onKeyDown,e=>{if(!vo.includes(e.key))return;let t=e.target,n=c().filter(e=>!e.ref.current?.disabled),r=n.findIndex(e=>e.ref.current===t),i=n.length;if(r===-1)return;e.preventDefault();let o=r,s=i-1,u=()=>{o=r+1,o>s&&(o=0)},d=()=>{o=r-1,o<0&&(o=s)};switch(e.key){case`Home`:o=0;break;case`End`:o=s;break;case`ArrowRight`:a===`horizontal`&&(l?u():d());break;case`ArrowDown`:a===`vertical`&&u();break;case`ArrowLeft`:a===`horizontal`&&(l?d():u());break;case`ArrowUp`:a===`vertical`&&d();break}n[o%i].ref.current?.focus()});return(0,M.jsx)(Mo,{scope:n,disabled:r,direction:i,orientation:a,children:(0,M.jsx)(yo.Slot,{scope:n,children:(0,M.jsx)(N.div,{...o,"data-orientation":a,ref:s,onKeyDown:r?void 0:u})})})}),Fo=`AccordionItem`,[Io,Lo]=So(Fo),Ro=_.forwardRef((e,t)=>{let{__scopeAccordion:n,value:r,...i}=e,a=No(Fo,n),o=Do(Fo,n),s=wo(n),c=Qa(),l=r&&o.value.includes(r)||!1,u=a.disabled||e.disabled;return(0,M.jsx)(Io,{scope:n,open:l,disabled:u,triggerId:c,children:(0,M.jsx)(fo,{"data-orientation":a.orientation,"data-state":Go(l),...s,...i,ref:t,disabled:u,open:l,onOpenChange:e=>{e?o.onItemOpen(r):o.onItemClose(r)}})})});Ro.displayName=Fo;var zo=`AccordionHeader`,Bo=_.forwardRef((e,t)=>{let{__scopeAccordion:n,...r}=e,i=No(_o,n),a=Lo(zo,n);return(0,M.jsx)(N.h3,{"data-orientation":i.orientation,"data-state":Go(a.open),"data-disabled":a.disabled?``:void 0,...r,ref:t})});Bo.displayName=zo;var Vo=`AccordionTrigger`,Ho=_.forwardRef((e,t)=>{let{__scopeAccordion:n,...r}=e,i=No(_o,n),a=Lo(Vo,n),o=ko(Vo,n),s=wo(n);return(0,M.jsx)(yo.ItemSlot,{scope:n,children:(0,M.jsx)(po,{"aria-disabled":a.open&&!o.collapsible||void 0,"data-orientation":i.orientation,id:a.triggerId,...s,...r,ref:t})})});Ho.displayName=Vo;var Uo=`AccordionContent`,Wo=_.forwardRef((e,t)=>{let{__scopeAccordion:n,...r}=e,i=No(_o,n),a=Lo(Uo,n),o=wo(n);return(0,M.jsx)(mo,{role:`region`,"aria-labelledby":a.triggerId,"data-orientation":i.orientation,...o,...r,ref:t,style:{"--radix-accordion-content-height":`var(--radix-collapsible-content-height)`,"--radix-accordion-content-width":`var(--radix-collapsible-content-width)`,...e.style}})});Wo.displayName=Uo;function Go(e){return e?`open`:`closed`}var Ko=To,qo=Ro,Jo=Bo,Yo=Ho,Xo=Wo;function Zo(e){let t=_.useRef(e);return _.useEffect(()=>{t.current=e}),_.useMemo(()=>(...e)=>t.current?.(...e),[])}function Qo(e,t=globalThis?.document){let n=Zo(e);_.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var $o=`DismissableLayer`,es=`dismissableLayer.update`,ts=`dismissableLayer.pointerDownOutside`,ns=`dismissableLayer.focusOutside`,rs,is=_.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),as=_.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=_.useContext(is),[u,d]=_.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=_.useState({}),m=Sa(t,e=>d(e)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),v=h.indexOf(g),y=u?h.indexOf(u):-1,b=l.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,S=ls(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!x||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),C=us(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return Qo(e=>{y===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),_.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(rs=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),ds(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=rs)}},[u,f,n,l]),_.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),ds())},[u,l]),_.useEffect(()=>{let e=()=>p({});return document.addEventListener(es,e),()=>document.removeEventListener(es,e)},[]),(0,M.jsx)(N.div,{...c,ref:m,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:P(e.onFocusCapture,C.onFocusCapture),onBlurCapture:P(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:P(e.onPointerDownCapture,S.onPointerDownCapture)})});as.displayName=$o;var ss=`DismissableLayerBranch`,cs=_.forwardRef((e,t)=>
vendor: 14,836 bytes, lines 17-57
17{let n=_.useContext(is),r=_.useRef(null),i=Sa(t,r);return _.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,M.jsx)(N.div,{...e,ref:i})});cs.displayName=ss;function ls(e,t=globalThis?.document){let n=Zo(e),r=_.useRef(!1),i=_.useRef(()=>{});return _.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){fs(ts,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function us(e,t=globalThis?.document){let n=Zo(e),r=_.useRef(!1);return _.useEffect(()=>{let e=e=>{e.target&&!r.current&&fs(ns,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function ds(){let e=new CustomEvent(es);document.dispatchEvent(e)}function fs(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?ja(i,a):i.dispatchEvent(a)}var ps=`focusScope.autoFocusOnMount`,ms=`focusScope.autoFocusOnUnmount`,hs={bubbles:!1,cancelable:!0},gs=`FocusScope`,_s=_.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=_.useState(null),l=Zo(i),u=Zo(a),d=_.useRef(null),f=Sa(t,e=>c(e)),p=_.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;_.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:ws(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||ws(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&ws(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),_.useEffect(()=>{if(s){Ts.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(ps,hs);s.addEventListener(ps,l),s.dispatchEvent(t),t.defaultPrevented||(vs(Os(bs(s)),{select:!0}),document.activeElement===e&&ws(s))}return()=>{s.removeEventListener(ps,l),setTimeout(()=>{let t=new CustomEvent(ms,hs);s.addEventListener(ms,u),s.dispatchEvent(t),t.defaultPrevented||ws(e??document.body,{select:!0}),s.removeEventListener(ms,u),Ts.remove(p)},0)}}},[s,l,u,p]);let m=_.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=ys(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&ws(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&ws(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,M.jsx)(N.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});_s.displayName=gs;function vs(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(ws(r,{select:t}),document.activeElement!==n)return}function ys(e){let t=bs(e);return[xs(t,e),xs(t.reverse(),e)]}function bs(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function xs(e,t){for(let n of e)if(!Ss(n,{upTo:t}))return n}function Ss(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function Cs(e){return e instanceof HTMLInputElement&&`select`in e}function ws(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Cs(e)&&t&&e.select()}}var Ts=Es();function Es(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=Ds(e,t),e.unshift(t)},remove(t){e=Ds(e,t),e[0]?.resume()}}}function Ds(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Os(e){return e.filter(e=>e.tagName!==`A`)}var ks=`Portal`,As=_.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=_.useState(!1);Ba(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?ya.createPortal((0,M.jsx)(N.div,{...r,ref:t}),o):null});As.displayName=ks;var js=0;function Ms(){_.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??Ns()),document.body.insertAdjacentElement(`beforeend`,e[1]??Ns()),js++,()=>{js===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),js--}},[])}function Ns(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var Ps=function(){return Ps=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Ps.apply(this,arguments)};function Fs(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Is(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var Ls=`right-scroll-bar-position`,Rs=`width-before-scroll-bar`,zs=`with-scroll-bars-hidden`,Bs=`--removed-body-scroll-bar-size`;function Vs(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Hs(e,t){var n=(0,_.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var Us=typeof window<`u`?_.useLayoutEffect:_.useEffect,Ws=new WeakMap;function Gs(e,t){var n=Hs(t||null,function(t){return e.forEach(function(e){return Vs(e,t)})});return Us(function(){var t=Ws.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||Vs(e,null)}),i.forEach(function(e){r.has(e)||Vs(e,a)})}Ws.set(n,e)},[e]),n}function Ks(e){return e}function qs(e,t){t===void 0&&(t=Ks);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function Js(e){e===void 0&&(e={});var t=qs(null);return t.options=Ps({async:!0,ssr:!1},e),t}var Ys=function(e){var t=e.sideCar,n=Fs(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return _.createElement(r,Ps({},n))};Ys.isSideCarExport=!0;function Xs(e,t){return e.useMedium(t),Ys}var Zs=Js(),Qs=function(){},$s=_.forwardRef(function(e,t){var n=_.useRef(null),r=_.useState({onScrollCapture:Qs,onWheelCapture:Qs,onTouchMoveCapture:Qs}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,v=e.as,y=v===void 0?`div`:v,b=e.gapMode,x=Fs(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),S=f,C=Gs([n,t]),w=Ps(Ps({},x),i);return _.createElement(_.Fragment,null,u&&_.createElement(S,{sideCar:Zs,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:b}),o?_.cloneElement(_.Children.only(s),Ps(Ps({},w),{ref:C})):_.createElement(y,Ps({},w,{className:c,ref:C}),s))});$s.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},$s.classNames={fullWidth:Rs,zeroRight:Ls};var ec,tc=function(){if(ec)return ec;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function nc(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=tc();return t&&e.setAttribute(`nonce`,t),e}function rc(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function ic(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var ac=function(){var e=0,t=null;return{add:function(n){e==0&&(t=nc())&&(rc(t,n),ic(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},oc=function(){var e=ac();return function(t,n){_.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},sc=function(){var e=oc();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},cc={left:0,top:0,right:0,gap:0},lc=function(e){return parseInt(e||``,10)||0},uc=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[lc(n),lc(r),lc(i)]},dc=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return cc;var t=uc(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},fc=sc(),pc=`data-scroll-locked`,mc=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),` 18 .${zs} { 19 overflow: hidden ${r}; 20 padding-right: ${s}px ${r}; 21 } 22 body[${pc}] { 23 overflow: hidden ${r}; 24 overscroll-behavior: contain; 25 ${[t&&`position: relative ${r};`,n===`margin`&&` 26 padding-left: ${i}px; 27 padding-top: ${a}px; 28 padding-right: ${o}px; 29 margin-left:0; 30 margin-top:0; 31 margin-right: ${s}px ${r}; 32 `,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)} 33 } 34 35 .${Ls} { 36 right: ${s}px ${r}; 37 } 38 39 .${Rs} { 40 margin-right: ${s}px ${r}; 41 } 42 43 .${Ls} .${Ls} { 44 right: 0 ${r}; 45 } 46 47 .${Rs} .${Rs} { 48 margin-right: 0 ${r}; 49 } 50 51 body[${pc}] { 52 ${Bs}: ${s}px; 53 } 54`},hc=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},gc=function(){_.useEffect(function(){return document.body.setAttribute(pc,(hc()+1).toString()),function(){var e=hc()-1;e<=0?document.body.removeAttribute(pc):document.body.setAttribute(pc,e.toString())}},[])},_c=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;gc();var a=_.useMemo(function(){return dc(i)},[i]);return _.createElement(fc,{styles:mc(a,!t,i,n?``:`!important`)})},vc=!1;if(typeof window<`u`)try{var yc=Object.defineProperty({},`passive`,{get:function(){return vc=!0,!0}});window.addEventListener(`test`,yc,yc),window.removeEventListener(`test`,yc,yc)}catch{vc=!1}var bc=vc?{passive:!1}:!1,xc=function(e){return e.tagName===`TEXTAREA`},Sc=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!xc(e)&&n[t]===`visible`)},Cc=function(e){return Sc(e,`overflowY`)},wc=function(e){return Sc(e,`overflowX`)},Tc=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),Oc(e,r)){var i=kc(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Ec=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},Dc=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},Oc=function(e,t){return e===`v`?Cc(t):wc(t)},kc=function(e,t){return e===`v`?Ec(t):Dc(t)},Ac=function(e,t){return e===`h`&&t===`rtl`?-1:1},jc=function(e,t,n,r,i){var a=Ac(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=kc(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&Oc(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},Mc=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Nc=function(e){return[e.deltaX,e.deltaY]},Pc=function(e){return e&&`current`in e?e.current:e},Fc=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Ic=function(e){return` 55 .block-interactivity-${e} {pointer-events: none;} 56 .allow-interactivity-${e} {pointer-events: all;} 57`},Lc=0,Rc=[];function zc(e){var t=_.useRef([]),n=_.useRef([0,0]),r=_.useRef(),i=_.useState(Lc++)[0],a=_.useState(sc)[0],o=_.useRef(e);_.useEffect(function(){o.current=e},[e]),_.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Is([e.lockRef.current],(e.shards||[]).map(Pc),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=_.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Mc(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=Tc(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Tc(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return jc(h,t,e,h===`h`?s:c,!0)},[]),c=_.useCallback(function(e){var n=e;if(!(!Rc.length||Rc[Rc.length-1]!==a)){var r=`deltaY`in n?Nc(n):Mc(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Fc(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}
vendor: 7,087 bytes, line 57
57if(!i){var c=(o.current.shards||[]).map(Pc).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=_.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Bc(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=_.useCallback(function(e){n.current=Mc(e),r.current=void 0},[]),d=_.useCallback(function(t){l(t.type,Nc(t),t.target,s(t,e.lockRef.current))},[]),f=_.useCallback(function(t){l(t.type,Mc(t),t.target,s(t,e.lockRef.current))},[]);_.useEffect(function(){return Rc.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,bc),document.addEventListener(`touchmove`,c,bc),document.addEventListener(`touchstart`,u,bc),function(){Rc=Rc.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,bc),document.removeEventListener(`touchmove`,c,bc),document.removeEventListener(`touchstart`,u,bc)}},[]);var p=e.removeScrollBar,m=e.inert;return _.createElement(_.Fragment,null,m?_.createElement(a,{styles:Ic(i)}):null,p?_.createElement(_c,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Bc(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Vc=Xs(Zs,zc),Hc=_.forwardRef(function(e,t){return _.createElement($s,Ps({},e,{ref:t,sideCar:Vc}))});Hc.classNames=$s.classNames;var Uc=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Wc=new WeakMap,Gc=new WeakMap,Kc={},qc=0,Jc=function(e){return e&&(e.host||Jc(e.parentNode))},Yc=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Jc(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Xc=function(e,t,n,r){var i=Yc(t,Array.isArray(e)?e:[e]);Kc[n]||(Kc[n]=new WeakMap);var a=Kc[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(Wc.get(e)||0)+1,l=(a.get(e)||0)+1;Wc.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Gc.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),qc++,function(){o.forEach(function(e){var t=Wc.get(e)-1,i=a.get(e)-1;Wc.set(e,t),a.set(e,i),t||(Gc.has(e)||e.removeAttribute(r),Gc.delete(e)),i||e.removeAttribute(n)}),qc--,qc||(Wc=new WeakMap,Wc=new WeakMap,Gc=new WeakMap,Kc={})}},Zc=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Uc(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Xc(r,i,n,`aria-hidden`)):function(){return null}},Qc=`Dialog`,[$c,el]=La(Qc),[tl,nl]=$c(Qc),rl=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=_.useRef(null),c=_.useRef(null),[l,u]=Ha({prop:r,defaultProp:i??!1,onChange:a,caller:Qc});return(0,M.jsx)(tl,{scope:t,triggerRef:s,contentRef:c,contentId:Qa(),titleId:Qa(),descriptionId:Qa(),open:l,onOpenChange:u,onOpenToggle:_.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})};rl.displayName=Qc;var il=`DialogTrigger`,al=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=nl(il,n),a=Sa(t,i.triggerRef);return(0,M.jsx)(N.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Tl(i.open),...r,ref:a,onClick:P(e.onClick,i.onOpenToggle)})});al.displayName=il;var ol=`DialogPortal`,[sl,cl]=$c(ol,{forceMount:void 0}),ll=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=nl(ol,t);return(0,M.jsx)(sl,{scope:t,forceMount:n,children:_.Children.map(r,e=>(0,M.jsx)(Ka,{present:n||a.open,children:(0,M.jsx)(As,{asChild:!0,container:i,children:e})}))})};ll.displayName=ol;var ul=`DialogOverlay`,dl=_.forwardRef((e,t)=>{let n=cl(ul,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=nl(ul,e.__scopeDialog);return a.modal?(0,M.jsx)(Ka,{present:r||a.open,children:(0,M.jsx)(pl,{...i,ref:t})}):null});dl.displayName=ul;var fl=Ca(`DialogOverlay.RemoveScroll`),pl=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=nl(ul,n);return(0,M.jsx)(Hc,{as:fl,allowPinchZoom:!0,shards:[i.contentRef],children:(0,M.jsx)(N.div,{"data-state":Tl(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),ml=`DialogContent`,hl=_.forwardRef((e,t)=>{let n=cl(ml,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=nl(ml,e.__scopeDialog);return(0,M.jsx)(Ka,{present:r||a.open,children:a.modal?(0,M.jsx)(gl,{...i,ref:t}):(0,M.jsx)(_l,{...i,ref:t})})});hl.displayName=ml;var gl=_.forwardRef((e,t)=>{let n=nl(ml,e.__scopeDialog),r=_.useRef(null),i=Sa(t,n.contentRef,r);return _.useEffect(()=>{let e=r.current;if(e)return Zc(e)},[]),(0,M.jsx)(vl,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:P(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:P(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:P(e.onFocusOutside,e=>e.preventDefault())})}),_l=_.forwardRef((e,t)=>{let n=nl(ml,e.__scopeDialog),r=_.useRef(!1),i=_.useRef(!1);return(0,M.jsx)(vl,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),vl=_.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=nl(ml,n),c=_.useRef(null),l=Sa(t,c);return Ms(),(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(_s,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,M.jsx)(as,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":Tl(s.open),...o,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(kl,{titleId:s.titleId}),(0,M.jsx)(jl,{contentRef:c,descriptionId:s.descriptionId})]})]})}),yl=`DialogTitle`,bl=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=nl(yl,n);return(0,M.jsx)(N.h2,{id:i.titleId,...r,ref:t})});bl.displayName=yl;var xl=`DialogDescription`,Sl=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=nl(xl,n);return(0,M.jsx)(N.p,{id:i.descriptionId,...r,ref:t})});Sl.displayName=xl;var Cl=`DialogClose`,wl=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=nl(Cl,n);return(0,M.jsx)(N.button,{type:`button`,...r,ref:t,onClick:P(e.onClick,()=>i.onOpenChange(!1))})});wl.displayName=Cl;function Tl(e){return e?`open`:`closed`}
57var El=`DialogTitleWarning`,[Dl,Ol]=Ia(El,{contentName:ml,titleName:yl,docsSlug:`dialog`}),kl=({titleId:e})=>{let t=Ol(El),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. 58 59If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. 60 61For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return _.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Al=`DialogDescriptionWarning`,jl=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Ol(Al).contentName}}.`;return _.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Ml=rl,Nl=al,Pl=ll,Fl=dl,Il=hl,Ll=bl,Rl=Sl,zl=wl,Bl=o((e=>{var t=u();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 d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),Vl=o(((e,t)=>{t.exports=Bl()})),Hl=Vl();function Ul(){return(0,Hl.useSyncExternalStore)(Wl,()=>!0,()=>!1)}function Wl(){return()=>{}}var Gl=`Avatar`,[Kl,ql]=La(Gl),[Jl,Yl]=Kl(Gl),Xl=_.forwardRef((e,t)=>{let{__scopeAvatar:n,...r}=e,[i,a]=_.useState(`idle`);return(0,M.jsx)(Jl,{scope:n,imageLoadingStatus:i,onImageLoadingStatusChange:a,children:(0,M.jsx)(N.span,{...r,ref:t})})});Xl.displayName=Gl;var Zl=`AvatarImage`,Ql=_.forwardRef((e,t)=>{let{__scopeAvatar:n,src:r,onLoadingStatusChange:i=()=>{},...a}=e,o=Yl(Zl,n),s=nu(r,a),c=Zo(e=>{i(e),o.onImageLoadingStatusChange(e)});return Ba(()=>{s!==`idle`&&c(s)},[s,c]),s===`loaded`?(0,M.jsx)(N.img,{...a,ref:t,src:r}):null});Ql.displayName=Zl;var $l=`AvatarFallback`,eu=_.forwardRef((e,t)=>{let{__scopeAvatar:n,delayMs:r,...i}=e,a=Yl($l,n),[o,s]=_.useState(r===void 0);return _.useEffect(()=>{if(r!==void 0){let e=window.setTimeout(()=>s(!0),r);return()=>window.clearTimeout(e)}},[r]),o&&a.imageLoadingStatus!==`loaded`?(0,M.jsx)(N.span,{...i,ref:t}):null});eu.displayName=$l;function tu(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?`loaded`:`loading`):`error`:`idle`}function nu(e,{referrerPolicy:t,crossOrigin:n}){let r=Ul(),i=_.useRef(null),a=r?(i.current||=new window.Image,i.current):null,[o,s]=_.useState(()=>tu(a,e));return Ba(()=>{s(tu(a,e))},[a,e]),Ba(()=>{let e=e=>()=>{s(e)};if(!a)return;let r=e(`loaded`),i=e(`error`);return a.addEventListener(`load`,r),a.addEventListener(`error`,i),t&&(a.referrerPolicy=t),typeof n==`string`&&(a.crossOrigin=n),()=>{a.removeEventListener(`load`,r),a.removeEventListener(`error`,i)}},[a,n,t]),o}var ru=Xl,iu=Ql,au=eu;function ou(e){let t=_.useRef({value:e,previous:e});return _.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function su(e){let[t,n]=_.useState(void 0);return Ba(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var cu=`Checkbox`,[lu,uu]=La(cu),[du,fu]=lu(cu);function pu(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=Ha({prop:n,defaultProp:i??!1,onChange:c,caller:cu}),[m,h]=_.useState(null),[g,v]=_.useState(null),y=_.useRef(!1),b=m?!!o||!!m.closest(`form`):!0,x={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:y,required:l,defaultChecked:Su(i)?!1:i,isFormControl:b,bubbleInput:g,setBubbleInput:v};
vendor: 4,889 bytes, line 61
61return(0,M.jsx)(du,{scope:t,...x,children:xu(d)?d(x):r})}var mu=`CheckboxTrigger`,hu=_.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i)=>{let{control:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,isFormControl:p,bubbleInput:m}=fu(mu,e),h=Sa(i,u),g=_.useRef(c);return _.useEffect(()=>{let e=a?.form;if(e){let t=()=>d(g.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,M.jsx)(N.button,{type:`button`,role:`checkbox`,"aria-checked":Su(c)?`mixed`:c,"aria-required":l,"data-state":Cu(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:h,onKeyDown:P(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:P(n,e=>{d(e=>Su(e)?!0:!e),m&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});hu.displayName=mu;var gu=_.forwardRef((e,t)=>{let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,M.jsx)(pu,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(hu,{...d,ref:t,__scopeCheckbox:n}),e&&(0,M.jsx)(bu,{__scopeCheckbox:n})]})})});gu.displayName=cu;var _u=`CheckboxIndicator`,vu=_.forwardRef((e,t)=>{let{__scopeCheckbox:n,forceMount:r,...i}=e,a=fu(_u,n);return(0,M.jsx)(Ka,{present:r||Su(a.checked)||a.checked===!0,children:(0,M.jsx)(N.span,{"data-state":Cu(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})});vu.displayName=_u;var yu=`CheckboxBubbleInput`,bu=_.forwardRef(({__scopeCheckbox:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:o,required:s,disabled:c,name:l,value:u,form:d,bubbleInput:f,setBubbleInput:p}=fu(yu,e),m=Sa(n,p),h=ou(a),g=su(r);_.useEffect(()=>{let e=f;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(h!==a&&n){let t=new Event(`click`,{bubbles:r});e.indeterminate=Su(a),n.call(e,Su(a)?!1:a),e.dispatchEvent(t)}},[f,h,a,i]);let v=_.useRef(Su(a)?!1:a);return(0,M.jsx)(N.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:o??v.current,required:s,disabled:c,name:l,value:u,form:d,...t,tabIndex:-1,ref:m,style:{...t.style,...g,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});bu.displayName=yu;function xu(e){return typeof e==`function`}function Su(e){return e===`indeterminate`}function Cu(e){return Su(e)?`indeterminate`:e?`checked`:`unchecked`}var wu=[`top`,`right`,`bottom`,`left`],Tu=Math.min,Eu=Math.max,Du=Math.round,Ou=Math.floor,ku=e=>({x:e,y:e}),Au={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function ju(e,t,n){return Eu(e,Tu(t,n))}function Mu(e,t){return typeof e==`function`?e(t):e}function Nu(e){return e.split(`-`)[0]}function Pu(e){return e.split(`-`)[1]}function Fu(e){return e===`x`?`y`:`x`}function Iu(e){return e===`y`?`height`:`width`}function Lu(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Ru(e){return Fu(Lu(e))}function zu(e,t,n){n===void 0&&(n=!1);let r=Pu(e),i=Ru(e),a=Iu(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Ju(o)),[o,Ju(o)]}function Bu(e){let t=Ju(e);return[Vu(e),t,Vu(t)]}function Vu(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Hu=[`left`,`right`],Uu=[`right`,`left`],Wu=[`top`,`bottom`],Gu=[`bottom`,`top`];function Ku(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Uu:Hu:t?Hu:Uu;case`left`:case`right`:return t?Wu:Gu;default:return[]}}function qu(e,t,n,r){let i=Pu(e),a=Ku(Nu(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Vu)))),a}function Ju(e){let t=Nu(e);return Au[t]+e.slice(t.length)}function Yu(e){return{top:0,right:0,bottom:0,left:0,...e}}function Xu(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Yu(e)}function Zu(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 Qu(e,t,n){let{reference:r,floating:i}=e,a=Lu(t),o=Ru(t),s=Iu(o),c=Nu(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(Pu(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function $u(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}=Mu(t,e),p=Xu(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Zu(await i.getClippingRect
vendor: 4,643 bytes, line 61
61({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=Zu(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 ed=50,td=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:$u},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Qu(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<ed&&(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}=Qu(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},nd=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}=Mu(e,t)||{};if(l==null)return{};let d=Xu(u),f={x:n,y:r},p=Ru(i),m=Iu(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=Tu(d[_],T),D=Tu(d[v],T),O=E,ee=C-h[m]-D,k=C/2-h[m]/2+w,te=ju(O,k,ee),ne=!c.arrow&&Pu(i)!=null&&k!==te&&a.reference[m]/2-(k<O?E:D)-h[m]/2<0,re=ne?k<O?k-O:k-ee:0;return{[p]:f[p]+re,data:{[p]:te,centerOffset:k-te-re,...ne&&{alignmentOffset:re}},reset:ne}}}),rd=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}=Mu(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Nu(r),_=Lu(o),v=Nu(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Ju(o)]:Bu(o)),x=p!==`none`;!d&&x&&b.push(...qu(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=zu(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`&&_!==Lu(t))||T.every(e=>Lu(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Lu(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 id(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ad(e){return wu.some(t=>e[t]>=0)}var od=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=Mu(e,t);switch(i){case`referenceHidden`:{let e=id(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:ad(e)}}}case`escaped`:{let e=id(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:ad(e)}}}default:return{}}}}},sd=new Set([`left`,`top`]);async function cd(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Nu(n),s=Pu(n),c=Lu(n)===`y`,l=sd.has(o)?-1:1,u=a&&c?-1:1,d=Mu(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}
vendor: 4,091 bytes, line 61
61:{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 ld=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 cd(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}}}}},ud=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}=Mu(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Lu(Nu(i)),p=Fu(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=ju(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=ju(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},dd=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}=Mu(e,t),u={x:n,y:r},d=Lu(i),f=Fu(d),p=u[f],m=u[d],h=Mu(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=sd.has(Nu(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}}}},fd=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=Mu(e,t),u=await o.detectOverflow(t,l),d=Nu(i),f=Pu(i),p=Lu(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=Tu(h-u[g],v),x=Tu(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=Eu(u.left,0),t=Eu(u.right,0),n=Eu(u.top,0),r=Eu(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:Eu(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:Eu(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function pd(){return typeof window<`u`}function md(e){return _d(e)?(e.nodeName||``).toLowerCase():`#document`}function hd(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function gd(e){return((_d(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function _d(e){return pd()?e instanceof Node||e instanceof hd(e).Node:!1}function vd(e){return pd()?e instanceof Element||e instanceof hd(e).Element:!1}function yd(e){return pd()?e instanceof HTMLElement||e instanceof hd(e).HTMLElement:!1}function bd(e){return!pd()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof hd(e).ShadowRoot}function xd(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Md(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Sd(e){return/^(table|td|th)$/.test(md(e))}function Cd(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var wd=/transform|translate|scale|rotate|perspective|filter/,Td=/paint|layout|strict|content/,Ed=e=>!!e&&e!==`none`,Dd;function Od(e){let t=vd(e)?Md(e):e;return Ed(t.transform)||Ed(t.translate)||Ed(t.scale)||Ed(t.rotate)||Ed(t.perspective)||!Ad()&&(Ed(t.backdropFilter)||Ed(t.filter))||wd.test(t.willChange||``)||Td.test(t.contain||``)}function kd(e){let t=Pd(e);for(;yd(t)&&!jd(t);){if(Od(t))return t;if(Cd(t))return null;t=Pd(t)}return null}function Ad(){return Dd??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Dd}
vendor: 7,061 bytes, line 61
61function jd(e){return/^(html|body|#document)$/.test(md(e))}function Md(e){return hd(e).getComputedStyle(e)}function Nd(e){return vd(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Pd(e){if(md(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||bd(e)&&e.host||gd(e);return bd(t)?t.host:t}function Fd(e){let t=Pd(e);return jd(t)?e.ownerDocument?e.ownerDocument.body:e.body:yd(t)&&xd(t)?t:Fd(t)}function Id(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Fd(e),i=r===e.ownerDocument?.body,a=hd(r);if(i){let e=Ld(a);return t.concat(a,a.visualViewport||[],xd(r)?r:[],e&&n?Id(e):[])}else return t.concat(r,Id(r,[],n))}function Ld(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Rd(e){let t=Md(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=yd(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Du(n)!==a||Du(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function zd(e){return vd(e)?e:e.contextElement}function Bd(e){let t=zd(e);if(!yd(t))return ku(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Rd(t),o=(a?Du(n.width):n.width)/r,s=(a?Du(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Vd=ku(0);function Hd(e){let t=hd(e);return!Ad()||!t.visualViewport?Vd:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Ud(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==hd(e)?!1:t}function Wd(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=zd(e),o=ku(1);t&&(r?vd(r)&&(o=Bd(r)):o=Bd(e));let s=Ud(a,n,r)?Hd(a):ku(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=hd(a),t=r&&vd(r)?hd(r):r,n=e,i=Ld(n);for(;i&&r&&t!==n;){let e=Bd(i),t=i.getBoundingClientRect(),r=Md(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=hd(i),i=Ld(n)}}return Zu({width:u,height:d,x:c,y:l})}function Gd(e,t){let n=Nd(e).scrollLeft;return t?t.left+n:Wd(gd(e)).left+n}function Kd(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Gd(e,n),y:n.top+t.scrollTop}}function qd(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=gd(r),s=t?Cd(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=ku(1),u=ku(0),d=yd(r);if((d||!d&&!a)&&((md(r)!==`body`||xd(o))&&(c=Nd(r)),d)){let e=Wd(r);l=Bd(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Kd(o,c):ku(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 Jd(e){return Array.from(e.getClientRects())}function Yd(e){let t=gd(e),n=Nd(e),r=e.ownerDocument.body,i=Eu(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Eu(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Gd(e),s=-n.scrollTop;return Md(r).direction===`rtl`&&(o+=Eu(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var Xd=25;function Zd(e,t){let n=hd(e),r=gd(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Ad();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=Gd(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=Xd&&(a-=o)}else l<=Xd&&(a+=l);return{width:a,height:o,x:s,y:c}}function Qd(e,t){let n=Wd(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=yd(e)?Bd(e):ku(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function $d(e,t,n){let r;if(t===`viewport`)r=Zd(e,n);else if(t===`document`)r=Yd(gd(e));else if(vd(t))r=Qd(t,n);else{let n=Hd(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Zu(r)}function ef(e,t){let n=Pd(e);return n===t||!vd(n)||jd(n)?!1:Md(n).position===`fixed`||ef(n,t)}function tf(e,t){let n=t.get(e);if(n)return n;let r=Id(e,[],!1).filter(e=>vd(e)&&md(e)!==`body`),i=null,a=Md(e).position===`fixed`,o=a?Pd(e):e;for(;vd(o)&&!jd(o);){let t=Md(o),n=Od(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||xd(o)&&!n&&ef(e,o))?r=r.filter(e=>e!==o):i=t,o=Pd(o)}return t.set(e,r),r}function nf(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Cd(t)?[]:tf(t,this._c):[].concat(n),r],o=$d(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=$d(t,a[e],i);s=Eu(n.top,s),c=Tu(n.right,c),l=Tu(n.bottom,l),u=Eu(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function rf(e){let{width:t,height:n}=Rd(e);return{width:t,height:n}}function af(e,t,n){let r=yd(t),i=gd(t),a=n===`fixed`,o=Wd(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=ku(0);function l(){c.x=Gd(i)}if(r||!r&&!a)if((md(t)!==`body`||xd(i))&&(s=Nd(t)),r){let e=Wd(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?Kd(i,s):ku(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function of(e){return Md(e).position===`static`}function sf(e,t){if(!yd(e)||Md(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return gd(e)===n&&(n=n.ownerDocument.body),n}function cf(e,t){let n=hd(e);if(Cd(e))return n;if(!yd(e)){let t=Pd(e);for(;t&&!jd(t);){if(vd(t)&&!of(t))return t;t=Pd(t)}return n}let r=sf(e,t);for(;r&&Sd(r)&&of(r);)r=sf(r,t);return r&&jd(r)&&of(r)&&!Od(r)?n:r||kd(e)||n}var lf=async function(e){let t=this.getOffsetParent||cf,n=this.getDimensions,r=await n(e.floating);return{reference:af(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function uf(e){return Md(e).direction===`rtl`}var df={convertOffsetParentRelativeRectToViewportRelativeRect:qd,getDocumentElement:gd,getClippingRect:nf,getOffsetParent:cf,getElementRects:lf,getClientRects:Jd,getDimensions:rf,getScale:Bd,isElement:vd,isRTL:uf};function ff(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function pf(e,t){let n=null,r,i=gd(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=Ou(d),h=Ou(i.clientWidth-(u+f)),g=Ou(i.clientHeight-(d+p)),_=Ou(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Eu(0,Tu(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!ff(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function mf(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=zd(e),u=i||a?[...l?Id(l):[],...t?Id(t):[]]:[];
vendor: 8,357 bytes, line 61
61u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?pf(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Wd(e):null;c&&g();function g(){let t=Wd(e);h&&!ff(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 hf=ld,gf=ud,_f=rd,vf=fd,yf=od,bf=nd,xf=dd,Sf=(e,t,n)=>{let r=new Map,i={platform:df,...n},a={...i.platform,_c:r};return td(e,t,{...i,platform:a})},Cf=typeof document<`u`?_.useLayoutEffect:function(){};function wf(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(!wf(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)&&!wf(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Tf(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ef(e,t){let n=Tf(e);return Math.round(t*n)/n}function Df(e){let t=_.useRef(e);return Cf(()=>{t.current=e}),t}function Of(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]=_.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=_.useState(r);wf(f,r)||p(r);let[m,h]=_.useState(null),[g,v]=_.useState(null),y=_.useCallback(e=>{e!==C.current&&(C.current=e,h(e))},[]),b=_.useCallback(e=>{e!==w.current&&(w.current=e,v(e))},[]),x=a||m,S=o||g,C=_.useRef(null),w=_.useRef(null),T=_.useRef(u),E=c!=null,D=Df(c),O=Df(i),ee=Df(l),k=_.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),Sf(C.current,w.current,e).then(e=>{let t={...e,isPositioned:ee.current!==!1};te.current&&!wf(T.current,t)&&(T.current=t,ya.flushSync(()=>{d(t)}))})},[f,t,n,O,ee]);Cf(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let te=_.useRef(!1);Cf(()=>(te.current=!0,()=>{te.current=!1}),[]),Cf(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,k);k()}},[x,S,k,D,E]);let ne=_.useMemo(()=>({reference:C,floating:w,setReference:y,setFloating:b}),[y,b]),re=_.useMemo(()=>({reference:x,floating:S}),[x,S]),ie=_.useMemo(()=>{let e={position:n,left:0,top:0};if(!re.floating)return e;let t=Ef(re.floating,u.x),r=Ef(re.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Tf(re.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,re.floating,u.x,u.y]);return _.useMemo(()=>({...u,update:k,refs:ne,elements:re,floatingStyles:ie}),[u,k,ne,re,ie])}var kf=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:bf({element:r.current,padding:i}).fn(n):r?bf({element:r,padding:i}).fn(n):{}}}},Af=(e,t)=>{let n=hf(e);return{name:n.name,fn:n.fn,options:[e,t]}},jf=(e,t)=>{let n=gf(e);return{name:n.name,fn:n.fn,options:[e,t]}},Mf=(e,t)=>({fn:xf(e).fn,options:[e,t]}),Nf=(e,t)=>{let n=_f(e);return{name:n.name,fn:n.fn,options:[e,t]}},Pf=(e,t)=>{let n=vf(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ff=(e,t)=>{let n=yf(e);return{name:n.name,fn:n.fn,options:[e,t]}},If=(e,t)=>{let n=kf(e);return{name:n.name,fn:n.fn,options:[e,t]}},Lf=`Arrow`,Rf=_.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,M.jsx)(N.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,M.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Rf.displayName=Lf;var zf=Rf,Bf=`Popper`,[Vf,Hf]=La(Bf),[Uf,Wf]=Vf(Bf),Gf=e=>{let{__scopePopper:t,children:n}=e,[r,i]=_.useState(null);return(0,M.jsx)(Uf,{scope:t,anchor:r,onAnchorChange:i,children:n})};Gf.displayName=Bf;var Kf=`PopperAnchor`,qf=_.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=Wf(Kf,n),o=_.useRef(null),s=Sa(t,o),c=_.useRef(null);return _.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,M.jsx)(N.div,{...i,ref:s})});qf.displayName=Kf;var Jf=`PopperContent`,[Yf,Xf]=Vf(Jf),Zf=_.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=Wf(Jf,n),[v,y]=_.useState(null),b=Sa(t,e=>y(e)),[x,S]=_.useState(null),C=su(x),w=C?.width??0,T=C?.height??0,E=r+(a===`center`?``:`-`+a),D=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},O=Array.isArray(l)?l:[l],ee=O.length>0,k={padding:D,boundary:O.filter(tp),altBoundary:ee},{refs:te,floatingStyles:ne,placement:re,isPositioned:ie,middlewareData:ae}=Of({strategy:`fixed`,placement:E,whileElementsMounted:(...e)=>mf(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[Af({mainAxis:i+T,alignmentAxis:o}),c&&jf({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?Mf():void 0,...k}),c&&Nf({...k}),Pf({...k,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),x&&If({element:x,padding:s}),np({arrowWidth:w,arrowHeight:T}),f&&Ff({strategy:`referenceHidden`,...k})]}),[A,oe]=rp(re),se=Zo(m);Ba(()=>{ie&&se?.()},[ie,se]);let ce=ae.arrow?.x,le=ae.arrow?.y,ue=ae.arrow?.centerOffset!==0,[de,fe]=_.useState();return Ba(()=>{v&&fe(window.getComputedStyle(v).zIndex)},[v]),(0,M.jsx)(`div`,{ref:te.setFloating,"data-radix-popper-content-wrapper":``,style:{...ne,transform:ie?ne.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:de,"--radix-popper-transform-origin":[ae.transformOrigin?.x,ae.transformOrigin?.y].join(` `),...ae.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,M.jsx)(Yf,{scope:n,placedSide:A,onArrowChange:S,arrowX:ce,arrowY:le,shouldHideArrow:ue,children:(0,M.jsx)(N.div,{"data-side":A,"data-align":oe,...h,ref:b,style:{...h.style,animation:ie?void 0:`none`}})})})});Zf.displayName=Jf;var Qf=`PopperArrow`,$f={top:`bottom`,right:`left`,bottom:`top`,left:`right`},ep=_.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=Xf(Qf,n),a=$f[i.placedSide];return(0,M.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,M.jsx)(zf,{...r,ref:t,style:{...r.style,display:`block`}})})});ep.displayName=Qf;function tp(e){return e!==null}var np=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=rp(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function rp(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var ip=Gf,ap=qf,op=Zf,sp=ep,cp=`rovingFocusGroup.onEntryFocus`,lp={bubbles:!1,cancelable:!0},up=`RovingFocusGroup`,[dp,fp,pp]=za(up),[mp,hp]=La(up,[pp]),[gp,_p]=mp(up),vp=_.forwardRef((e,t)=>
61(0,M.jsx)(dp.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,M.jsx)(dp.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,M.jsx)(yp,{...e,ref:t})})}));vp.displayName=up;var yp=_.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=_.useRef(null),p=Sa(t,f),m=go(a),[h,g]=Ha({prop:o,defaultProp:s??null,onChange:c,caller:up}),[v,y]=_.useState(!1),b=Zo(l),x=fp(n),S=_.useRef(!1),[C,w]=_.useState(0);return _.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(cp,b),()=>e.removeEventListener(cp,b)},[b]),(0,M.jsx)(gp,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:_.useCallback(e=>g(e),[g]),onItemShiftTab:_.useCallback(()=>y(!0),[]),onFocusableItemAdd:_.useCallback(()=>w(e=>e+1),[]),onFocusableItemRemove:_.useCallback(()=>w(e=>e-1),[]),children:(0,M.jsx)(N.div,{tabIndex:v||C===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:P(e.onMouseDown,()=>{S.current=!0}),onFocus:P(e.onFocus,e=>{let t=!S.current;if(e.target===e.currentTarget&&t&&!v){let t=new CustomEvent(cp,lp);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=x().filter(e=>e.focusable);Tp([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}S.current=!1}),onBlur:P(e.onBlur,()=>y(!1))})})}),bp=`RovingFocusGroupItem`,xp=_.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=Qa(),l=a||c,u=_p(bp,n),d=u.currentTabStopId===l,f=fp(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return _.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,M.jsx)(dp.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,M.jsx)(N.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:P(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:P(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:P(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=wp(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?Ep(n,r+1):n.slice(r+1)}setTimeout(()=>Tp(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});xp.displayName=bp;var Sp={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Cp(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function wp(e,t,n){let r=Cp(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Sp[r]}function Tp(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Ep(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Dp=vp,Op=xp,kp=[`Enter`,` `],Ap=[`ArrowDown`,`PageUp`,`Home`],jp=[`ArrowUp`,`PageDown`,`End`],Mp=[...Ap,...jp],Np={ltr:[...kp,`ArrowRight`],rtl:[...kp,`ArrowLeft`]},Pp={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},Fp=`Menu`,[Ip,Lp,Rp]=za(Fp),[zp,Bp]=La(Fp,[Rp,Hf,hp]),Vp=Hf(),Hp=hp(),[Up,Wp]=zp(Fp),[Gp,Kp]=zp(Fp),qp=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=Vp(t),[c,l]=_.useState(null),u=_.useRef(!1),d=Zo(a),f=go(i);return _.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,M.jsx)(ip,{...s,children:(0,M.jsx)(Up,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,M.jsx)(Gp,{scope:t,onClose:_.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};qp.displayName=Fp;var Jp=`MenuAnchor`,Yp=_.forwardRef((e,t)=>
vendor: 12,610 bytes, line 61
61{let{__scopeMenu:n,...r}=e,i=Vp(n);return(0,M.jsx)(ap,{...i,...r,ref:t})});Yp.displayName=Jp;var Xp=`MenuPortal`,[Zp,Qp]=zp(Xp,{forceMount:void 0}),$p=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=Wp(Xp,t);return(0,M.jsx)(Zp,{scope:t,forceMount:n,children:(0,M.jsx)(Ka,{present:n||a.open,children:(0,M.jsx)(As,{asChild:!0,container:i,children:r})})})};$p.displayName=Xp;var em=`MenuContent`,[tm,nm]=zp(em),rm=_.forwardRef((e,t)=>{let n=Qp(em,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Wp(em,e.__scopeMenu),o=Kp(em,e.__scopeMenu);return(0,M.jsx)(Ip.Provider,{scope:e.__scopeMenu,children:(0,M.jsx)(Ka,{present:r||a.open,children:(0,M.jsx)(Ip.Slot,{scope:e.__scopeMenu,children:o.modal?(0,M.jsx)(im,{...i,ref:t}):(0,M.jsx)(am,{...i,ref:t})})})})}),im=_.forwardRef((e,t)=>{let n=Wp(em,e.__scopeMenu),r=_.useRef(null),i=Sa(t,r);return _.useEffect(()=>{let e=r.current;if(e)return Zc(e)},[]),(0,M.jsx)(om,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:P(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),am=_.forwardRef((e,t)=>{let n=Wp(em,e.__scopeMenu);return(0,M.jsx)(om,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),eee=Ca(`MenuContent.ScrollLock`),om=_.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=Wp(em,n),v=Kp(em,n),y=Vp(n),b=Hp(n),x=Lp(n),[S,C]=_.useState(null),w=_.useRef(null),T=Sa(t,w,g.onContentChange),E=_.useRef(0),D=_.useRef(``),O=_.useRef(0),ee=_.useRef(null),k=_.useRef(`right`),te=_.useRef(0),ne=m?Hc:_.Fragment,re=m?{as:eee,allowPinchZoom:!0}:void 0,ie=e=>{let t=D.current+e,n=x().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=Hm(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){D.current=t,window.clearTimeout(E.current),t!==``&&(E.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};_.useEffect(()=>()=>window.clearTimeout(E.current),[]),Ms();let ae=_.useCallback(e=>k.current===ee.current?.side&&Wm(e,ee.current?.area),[]);return(0,M.jsx)(tm,{scope:n,searchRef:D,onItemEnter:_.useCallback(e=>{ae(e)&&e.preventDefault()},[ae]),onItemLeave:_.useCallback(e=>{ae(e)||(w.current?.focus(),C(null))},[ae]),onTriggerLeave:_.useCallback(e=>{ae(e)&&e.preventDefault()},[ae]),pointerGraceTimerRef:O,onPointerGraceIntentChange:_.useCallback(e=>{ee.current=e},[]),children:(0,M.jsx)(ne,{...re,children:(0,M.jsx)(_s,{asChild:!0,trapped:i,onMountAutoFocus:P(a,e=>{e.preventDefault(),w.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,M.jsx)(as,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,M.jsx)(Dp,{asChild:!0,...b,dir:v.dir,orientation:`vertical`,loop:r,currentTabStopId:S,onCurrentTabStopIdChange:C,onEntryFocus:P(c,e=>{v.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,M.jsx)(op,{role:`menu`,"aria-orientation":`vertical`,"data-state":Lm(g.open),"data-radix-menu-content":``,dir:v.dir,...y,...h,ref:T,style:{outline:`none`,...h.style},onKeyDown:P(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&ie(e.key));let i=w.current;if(e.target!==i||!Mp.includes(e.key))return;e.preventDefault();let a=x().filter(e=>!e.disabled).map(e=>e.ref.current);jp.includes(e.key)&&a.reverse(),Bm(a)}),onBlur:P(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(E.current),D.current=``)}),onPointerMove:P(e.onPointerMove,Gm(e=>{let t=e.target,n=te.current!==e.clientX;e.currentTarget.contains(t)&&n&&(k.current=e.clientX>te.current?`right`:`left`,te.current=e.clientX)}))})})})})})})});rm.displayName=em;var tee=`MenuGroup`,sm=_.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,M.jsx)(N.div,{role:`group`,...r,ref:t})});sm.displayName=tee;var nee=`MenuLabel`,cm=_.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,M.jsx)(N.div,{...r,ref:t})});cm.displayName=nee;var lm=`MenuItem`,um=`menu.itemSelect`,dm=_.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=_.useRef(null),o=Kp(lm,e.__scopeMenu),s=nm(lm,e.__scopeMenu),c=Sa(t,a),l=_.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(um,{bubbles:!0,cancelable:!0});e.addEventListener(um,e=>r?.(e),{once:!0}),ja(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,M.jsx)(fm,{...i,ref:c,disabled:n,onClick:P(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:P(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:P(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||kp.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});dm.displayName=lm;var fm=_.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=nm(lm,n),s=Hp(n),c=_.useRef(null),l=Sa(t,c),[u,d]=_.useState(!1),[f,p]=_.useState(``);return _.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,M.jsx)(Ip.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,M.jsx)(Op,{asChild:!0,...s,focusable:!r,children:(0,M.jsx)(N.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:P(e.onPointerMove,Gm(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:P(e.onPointerLeave,Gm(e=>o.onItemLeave(e))),onFocus:P(e.onFocus,()=>d(!0)),onBlur:P(e.onBlur,()=>d(!1))})})})}),pm=`MenuCheckboxItem`,mm=_.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,M.jsx)(Sm,{scope:e.__scopeMenu,checked:n,children:(0,M.jsx)(dm,{role:`menuitemcheckbox`,"aria-checked":Rm(n)?`mixed`:n,...i,ref:t,"data-state":zm(n),onSelect:P(i.onSelect,()=>r?.(Rm(n)?!0:!n),{checkForDefaultPrevented:!1})})})});mm.displayName=pm;var hm=`MenuRadioGroup`,[gm,_m]=zp(hm,{value:void 0,onValueChange:()=>{}}),vm=_.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=Zo(r);return(0,M.jsx)(gm,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,M.jsx)(sm,{...i,ref:t})})});vm.displayName=hm;var ym=`MenuRadioItem`,bm=_.forwardRef((e,t)=>{let{value:n,...r}=e,i=_m(ym,e.__scopeMenu),a=n===i.value;return(0,M.jsx)(Sm,{scope:e.__scopeMenu,checked:a,children:(0,M.jsx)(dm,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":zm(a),onSelect:P(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});bm.displayName=ym;var xm=`MenuItemIndicator`,[Sm,Cm]=zp(xm,{checked:!1}),wm=_.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=Cm(xm,n);return(0,M.jsx)(Ka,{present:r||Rm(a.checked)||a.checked===!0,children:(0,M.jsx)(N.span,{...i,ref:t,"data-state":zm(a.checked)})})});wm.displayName=xm;var Tm=`MenuSeparator`,Em=_.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,M.jsx)(N.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});Em.displayName=Tm;var Dm=`MenuArrow`,Om=_.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Vp(n);return(0,M.jsx)(sp,{...i,...r,ref:t})});Om.displayName=Dm;var km=`MenuSub`,[Am,jm]=zp(km),Mm=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=Wp(km,t),o=Vp(t),[s,c]=_.useState(null),[l,u]=_.useState(null),d=Zo(i);return _.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,M.jsx)(ip,{...o,children:(0,M.jsx)(Up,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,M.jsx)(Am,{scope:t,contentId:Qa(),triggerId:Qa(),trigger:s,onTriggerChange:c,children:n})})})};Mm.displayName=km;var Nm=`MenuSubTrigger`,Pm=_.forwardRef((e,t)=>{let n=Wp(Nm,e.__scopeMenu),r=Kp(Nm,e.__scopeMenu),i=jm(Nm,e.__scopeMenu),a=nm(Nm,e.__scopeMenu),o=_.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=_.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return _.useEffect(()=>u,[u]),_.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,M.jsx)(Yp,{asChild:!0,...l,children:(0,M.jsx)(fm,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":Lm(n.open),...e,ref:xa(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:P(e.onPointerMove,Gm(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:P(e.onPointerLeave,Gm(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:P(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||Np[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});Pm.displayName=Nm;var Fm=`MenuSubContent`,Im=_.forwardRef((e,t)=>{let n=Qp(em,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Wp(em,e.__scopeMenu),o=Kp(em,e.__scopeMenu),s=jm(Fm,e.__scopeMenu),c=_.useRef(null),l=Sa(t,c);return(0,M.jsx)(Ip.Provider,{scope:e.__scopeMenu,children:(0,M.jsx)(Ka,{present:r||a.open,children:(0,M.jsx)(Ip.Slot,{scope:e.__scopeMenu,children:(0,M.jsx)(om,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:P(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:P(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:P(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=Pp[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});Im.displayName=Fm;function Lm(e){return e?`open`:`closed`}function Rm(e){return e===`indeterminate`}function zm(e){return Rm(e)?`indeterminate`:e?`checked`:`unchecked`}function Bm(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Vm(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Hm(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Vm(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function Um(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Wm(e,t){return t?Um({x:e.clientX,y:e.clientY},t):!1}function Gm(e){return t=>t.pointerType===`mouse`?e(t):void 0}var Km=qp,qm=Yp,Jm=$p,Ym=rm,Xm=sm,Zm=cm,Qm=dm,$m=mm,eh=vm,th=bm,nh=wm,rh=Em,ih=Om,ah=Mm,oh=Pm,sh=Im,ch=`DropdownMenu`,[lh,ree]=La(ch,[Bp]),uh=Bp(),[dh,fh]=lh(ch),ph=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=uh(t),l=_.useRef(null),[u,d]=Ha({prop:i,defaultProp:a??!1,onChange:o,caller:ch});return(0,M.jsx)(dh,{scope:t,triggerId:Qa(),triggerRef:l,contentId:Qa(),open:u,onOpenChange:d,onOpenToggle:_.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,M.jsx)(Km,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};ph.displayName=ch;var mh=`DropdownMenuTrigger`,hh=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=fh(mh,n),o=uh(n);return(0,M.jsx)(qm,{asChild:!0,...o,children:(0,M.jsx)(N.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:xa(t,a.triggerRef),onPointerDown:P(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:P(e.onKeyDown,e=>
61{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});hh.displayName=mh;var gh=`DropdownMenuPortal`,_h=e=>{let{__scopeDropdownMenu:t,...n}=e,r=uh(t);return(0,M.jsx)(Jm,{...r,...n})};_h.displayName=gh;var vh=`DropdownMenuContent`,yh=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=fh(vh,n),a=uh(n),o=_.useRef(!1);return(0,M.jsx)(Ym,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:P(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:P(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});yh.displayName=vh;var bh=`DropdownMenuGroup`,xh=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=uh(n);return(0,M.jsx)(Xm,{...i,...r,ref:t})});xh.displayName=bh;var Sh=`DropdownMenuLabel`,Ch=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=uh(n);return(0,M.jsx)(Zm,{...i,...r,ref:t})});Ch.displayName=Sh;var wh=`DropdownMenuItem`,Th=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=uh(n);return(0,M.jsx)(Qm,{...i,...r,ref:t})});Th.displayName=wh;var Eh=`DropdownMenuCheckboxItem`,Dh=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=uh(n);return(0,M.jsx)($m,{...i,...r,ref:t})});Dh.displayName=Eh;var Oh=`DropdownMenuRadioGroup`,kh=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=uh(n);return(0,M.jsx)(eh,{...i,...r,ref:t})});kh.displayName=Oh;var Ah=`DropdownMenuRadioItem`,jh=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=uh(n);return(0,M.jsx)(th,{...i,...r,ref:t})});jh.displayName=Ah;var iee=`DropdownMenuItemIndicator`,aee=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=uh(n);return(0,M.jsx)(nh,{...i,...r,ref:t})});aee.displayName=iee;var oee=`DropdownMenuSeparator`,Mh=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=uh(n);return(0,M.jsx)(rh,{...i,...r,ref:t})});Mh.displayName=oee;var see=`DropdownMenuArrow`,cee=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=uh(n);return(0,M.jsx)(ih,{...i,...r,ref:t})});cee.displayName=see;var lee=e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,o=uh(t),[s,c]=Ha({prop:r,defaultProp:a??!1,onChange:i,caller:`DropdownMenuSub`});return(0,M.jsx)(ah,{...o,open:s,onOpenChange:c,children:n})},uee=`DropdownMenuSubTrigger`,Nh=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=uh(n);return(0,M.jsx)(oh,{...i,...r,ref:t})});Nh.displayName=uee;var dee=`DropdownMenuSubContent`,Ph=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=uh(n);return(0,M.jsx)(sh,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Ph.displayName=dee;var Fh=ph,Ih=hh,Lh=_h,Rh=yh,zh=xh,fee=Ch,Bh=Th,pee=Mh,mee=lee,hee=Nh,gee=Ph,_ee=`Label`,Vh=_.forwardRef((e,t)=>(0,M.jsx)(N.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));Vh.displayName=_ee;var vee=Vh;function Hh(e,[t,n]){return Math.min(n,Math.max(t,e))}var Uh=`Popover`,[Wh,yee]=La(Uh,[Hf]),Gh=Hf(),[bee,Kh]=Wh(Uh),qh=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=Gh(t),c=_.useRef(null),[l,u]=_.useState(!1),[d,f]=Ha({prop:r,defaultProp:i??!1,onChange:a,caller:Uh});return(0,M.jsx)(ip,{...s,children:(0,M.jsx)(bee,{scope:t,contentId:Qa(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:_.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:_.useCallback(()=>u(!0),[]),onCustomAnchorRemove:_.useCallback(()=>u(!1),[]),modal:o,children:n})})};qh.displayName=Uh;var Jh=`PopoverAnchor`,xee=_.forwardRef((e,t)=>
61{let{__scopePopover:n,...r}=e,i=Kh(Jh,n),a=Gh(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return _.useEffect(()=>(o(),()=>s()),[o,s]),(0,M.jsx)(ap,{...a,...r,ref:t})});xee.displayName=Jh;var Yh=`PopoverTrigger`,Xh=_.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Kh(Yh,n),a=Gh(n),o=Sa(t,i.triggerRef),s=(0,M.jsx)(N.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":og(i.open),...r,ref:o,onClick:P(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,M.jsx)(ap,{asChild:!0,...a,children:s})});Xh.displayName=Yh;var Zh=`PopoverPortal`,[See,Cee]=Wh(Zh,{forceMount:void 0}),Qh=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=Kh(Zh,t);return(0,M.jsx)(See,{scope:t,forceMount:n,children:(0,M.jsx)(Ka,{present:n||a.open,children:(0,M.jsx)(As,{asChild:!0,container:i,children:r})})})};Qh.displayName=Zh;var $h=`PopoverContent`,eg=_.forwardRef((e,t)=>{let n=Cee($h,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=Kh($h,e.__scopePopover);return(0,M.jsx)(Ka,{present:r||a.open,children:a.modal?(0,M.jsx)(Tee,{...i,ref:t}):(0,M.jsx)(Eee,{...i,ref:t})})});eg.displayName=$h;var wee=Ca(`PopoverContent.RemoveScroll`),Tee=_.forwardRef((e,t)=>{let n=Kh($h,e.__scopePopover),r=_.useRef(null),i=Sa(t,r),a=_.useRef(!1);return _.useEffect(()=>{let e=r.current;if(e)return Zc(e)},[]),(0,M.jsx)(Hc,{as:wee,allowPinchZoom:!0,children:(0,M.jsx)(tg,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:P(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:P(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:P(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),Eee=_.forwardRef((e,t)=>{let n=Kh($h,e.__scopePopover),r=_.useRef(!1),i=_.useRef(!1);return(0,M.jsx)(tg,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),tg=_.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=Kh($h,n),p=Gh(n);return Ms(),(0,M.jsx)(_s,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,M.jsx)(as,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,M.jsx)(op,{"data-state":og(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),ng=`PopoverClose`,rg=_.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Kh(ng,n);return(0,M.jsx)(N.button,{type:`button`,...r,ref:t,onClick:P(e.onClick,()=>i.onOpenChange(!1))})});rg.displayName=ng;var ig=`PopoverArrow`,ag=_.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Gh(n);return(0,M.jsx)(sp,{...i,...r,ref:t})});ag.displayName=ig;function og(e){return e?`open`:`closed`}var sg=qh,cg=Xh,Dee=Qh,lg=eg,ug=`Progress`,dg=100,[fg,Oee]=La(ug),[kee,Aee]=fg(ug),pg=_.forwardRef((e,t)=>{let{__scopeProgress:n,value:r=null,max:i,getValueLabel:a=jee,...o}=e;(i||i===0)&&!vg(i)&&console.error(bg(`${i}`,`Progress`));let s=vg(i)?i:dg;r!==null&&!yg(r,s)&&console.error(xg(`${r}`,`Progress`));let c=yg(r,s)?r:null,l=_g(c)?a(c,s):void 0;return(0,M.jsx)(kee,{scope:n,value:c,max:s,children:(0,M.jsx)(N.div,{"aria-valuemax":s,"aria-valuemin":0,"aria-valuenow":_g(c)?c:void 0,"aria-valuetext":l,role:`progressbar`,"data-state":gg(c,s),"data-value":c??void 0,"data-max":s,...o,ref:t})})});pg.displayName=ug;var mg=`ProgressIndicator`,hg=_.forwardRef((e,t)=>
vendor: 4,292 bytes, lines 61-66
61{let{__scopeProgress:n,...r}=e,i=Aee(mg,n);return(0,M.jsx)(N.div,{"data-state":gg(i.value,i.max),"data-value":i.value??void 0,"data-max":i.max,...r,ref:t})});hg.displayName=mg;function jee(e,t){return`${Math.round(e/t*100)}%`}function gg(e,t){return e==null?`indeterminate`:e===t?`complete`:`loading`}function _g(e){return typeof e==`number`}function vg(e){return _g(e)&&!isNaN(e)&&e>0}function yg(e,t){return _g(e)&&!isNaN(e)&&e<=t&&e>=0}function bg(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${dg}\`.`}function xg(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be: 62 - a positive number 63 - less than the value passed to \`max\` (or ${dg} if no \`max\` prop is set) 64 - \`null\` or \`undefined\` if the progress is indeterminate. 65 66Defaulting to \`null\`.`}var Sg=pg,Cg=hg,wg=[` `,`Enter`,`ArrowUp`,`ArrowDown`],Tg=[` `,`Enter`],Eg=`Select`,[Dg,Og,Mee]=za(Eg),[kg,Nee]=La(Eg,[Mee,Hf]),Ag=Hf(),[jg,Mg]=kg(Eg),[Ng,Pg]=kg(Eg),Fg=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m}=e,h=Ag(t),[g,v]=_.useState(null),[y,b]=_.useState(null),[x,S]=_.useState(!1),C=go(l),[w,T]=Ha({prop:r,defaultProp:i??!1,onChange:a,caller:Eg}),[E,D]=Ha({prop:o,defaultProp:s,onChange:c,caller:Eg}),O=_.useRef(null),ee=g?m||!!g.closest(`form`):!0,[k,te]=_.useState(new Set),ne=Array.from(k).map(e=>e.props.value).join(`;`);return(0,M.jsx)(ip,{...h,children:(0,M.jsxs)(jg,{required:p,scope:t,trigger:g,onTriggerChange:v,valueNode:y,onValueNodeChange:b,valueNodeHasChildren:x,onValueNodeHasChildrenChange:S,contentId:Qa(),value:E,onValueChange:D,open:w,onOpenChange:T,dir:C,triggerPointerDownPosRef:O,disabled:f,children:[(0,M.jsx)(Dg.Provider,{scope:t,children:(0,M.jsx)(Ng,{scope:e.__scopeSelect,onNativeOptionAdd:_.useCallback(e=>{te(t=>new Set(t).add(e))},[]),onNativeOptionRemove:_.useCallback(e=>{te(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),ee?(0,M.jsxs)(D_,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:d,value:E,onChange:e=>D(e.target.value),disabled:f,form:m,children:[E===void 0?(0,M.jsx)(`option`,{value:``}):null,Array.from(k)]},ne):null]})})};Fg.displayName=Eg;var Ig=`SelectTrigger`,Lg=_.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=Ag(n),o=Mg(Ig,n),s=o.disabled||r,c=Sa(t,o.onTriggerChange),l=Og(n),u=_.useRef(`touch`),[d,f,p]=k_(e=>{let t=l().filter(e=>!e.disabled),n=A_(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,M.jsx)(ap,{asChild:!0,...a,children:(0,M.jsx)(N.button,{type:`button`,role:`combobox`,"aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":O_(o.value)?``:void 0,...i,ref:c,onClick:P(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:P(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:P(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&wg.includes(e.key)&&(m(),e.preventDefault())})})})});Lg.displayName=Ig;var Rg=`SelectValue`,zg=_.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=Mg(Rg,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=Sa(t,c.onValueNodeChange);return Ba(()=>{l(u)},[l,u]),(0,M.jsx)(N.span,{...s,ref:d,style:{pointerEvents:`none`},children:O_(c.value)?(0,M.jsx)(M.Fragment,{children:o}):a})});zg.displayName=Rg;var Bg=`SelectIcon`,Vg=_.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,M.jsx)(N.span,{"aria-hidden":!0,...i,ref:t,children:r||`â¼`})});Vg.displayName=Bg;var Hg=`SelectPortal`,Ug=e=>(0,M.jsx)(As,{asChild:!0,...e});Ug.displayName=Hg;var Wg=`SelectContent`,Gg=_.forwardRef((e,t)=>
vendor: 6,006 bytes, line 66
66{let n=Mg(Wg,e.__scopeSelect),[r,i]=_.useState();if(Ba(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?ya.createPortal((0,M.jsx)(qg,{scope:e.__scopeSelect,children:(0,M.jsx)(Dg.Slot,{scope:e.__scopeSelect,children:(0,M.jsx)(`div`,{children:e.children})})}),t):null}return(0,M.jsx)(Yg,{...e,ref:t})});Gg.displayName=Wg;var Kg=10,[qg,Jg]=kg(Wg),Pee=`SelectContentImpl`,Fee=Ca(`SelectContent.RemoveScroll`),Yg=_.forwardRef((e,t)=>{let{__scopeSelect:n,position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,...v}=e,y=Mg(Wg,n),[b,x]=_.useState(null),[S,C]=_.useState(null),w=Sa(t,e=>x(e)),[T,E]=_.useState(null),[D,O]=_.useState(null),ee=Og(n),[k,te]=_.useState(!1),ne=_.useRef(!1);_.useEffect(()=>{if(b)return Zc(b)},[b]),Ms();let re=_.useCallback(e=>{let[t,...n]=ee().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&S&&(S.scrollTop=0),n===r&&S&&(S.scrollTop=S.scrollHeight),n?.focus(),document.activeElement!==i))return},[ee,S]),ie=_.useCallback(()=>re([T,b]),[re,T,b]);_.useEffect(()=>{k&&ie()},[k,ie]);let{onOpenChange:ae,triggerPointerDownPosRef:A}=y;_.useEffect(()=>{if(b){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(A.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(A.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():b.contains(n.target)||ae(!1),document.removeEventListener(`pointermove`,t),A.current=null};return A.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[b,ae,A]),_.useEffect(()=>{let e=()=>ae(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[ae]);let[oe,se]=k_(e=>{let t=ee().filter(e=>!e.disabled),n=A_(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),ce=_.useCallback((e,t,n)=>{let r=!ne.current&&!n;(y.value!==void 0&&y.value===t||r)&&(E(e),r&&(ne.current=!0))},[y.value]),le=_.useCallback(()=>b?.focus(),[b]),ue=_.useCallback((e,t,n)=>{let r=!ne.current&&!n;(y.value!==void 0&&y.value===t||r)&&O(e)},[y.value]),de=r===`popper`?Qg:Xg,fe=de===Qg?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,M.jsx)(qg,{scope:n,content:b,viewport:S,onViewportChange:C,itemRefCallback:ce,selectedItem:T,onItemLeave:le,itemTextRefCallback:ue,focusSelectedItem:ie,selectedItemText:D,position:r,isPositioned:k,searchRef:oe,children:(0,M.jsx)(Hc,{as:Fee,allowPinchZoom:!0,children:(0,M.jsx)(_s,{asChild:!0,trapped:y.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:P(i,e=>{y.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,M.jsx)(as,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:(0,M.jsx)(de,{role:`listbox`,id:y.contentId,"data-state":y.open?`open`:`closed`,dir:y.dir,onContextMenu:e=>e.preventDefault(),...v,...fe,onPlaced:()=>te(!0),ref:w,style:{display:`flex`,flexDirection:`column`,outline:`none`,...v.style},onKeyDown:P(v.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&se(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=ee().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>re(t)),e.preventDefault()}})})})})})})});Yg.displayName=Pee;var Iee=`SelectItemAlignedPosition`,Xg=_.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=Mg(Wg,n),o=Jg(Wg,n),[s,c]=_.useState(null),[l,u]=_.useState(null),d=Sa(t,e=>u(e)),f=Og(n),p=_.useRef(!1),m=_.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:v,focusSelectedItem:y}=o,b=_.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&v){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=v.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Kg,d=Hh(a,[Kg,Math.max(Kg,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Kg,d=Hh(a,[Kg,Math.max(Kg,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-Kg*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),_=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+_+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-Kg,D=c-E,O=g.offsetHeight/2,ee=g.offsetTop+O,k=m+_+ee,te=x-k;if(k<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=k+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+te;s.style.height=t+`px`,h.scrollTop=k-E+h.offsetTop}s.style.margin=`${Kg}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,v,a.dir,r]);Ba(()=>b(),[b]);let[x,S]=_.useState();return Ba(()=>{l&&S(window.getComputedStyle(l).zIndex)},[l]),(0,M.jsx)($g,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:_.useCallback(e=>
vendor: 4,685 bytes, line 66
66{e&&m.current===!0&&(b(),y?.(),m.current=!1)},[b,y]),children:(0,M.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:x},children:(0,M.jsx)(N.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});Xg.displayName=Iee;var Zg=`SelectPopperPosition`,Qg=_.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Kg,...a}=e,o=Ag(n);return(0,M.jsx)(op,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});Qg.displayName=Zg;var[$g,e_]=kg(Wg,{}),t_=`SelectViewport`,n_=_.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=Jg(t_,n),o=e_(t_,n),s=Sa(t,a.onViewportChange),c=_.useRef(0);return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,M.jsx)(Dg.Slot,{scope:n,children:(0,M.jsx)(N.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:P(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-Kg*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});n_.displayName=t_;var r_=`SelectGroup`,[i_,a_]=kg(r_),o_=_.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Qa();return(0,M.jsx)(i_,{scope:n,id:i,children:(0,M.jsx)(N.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});o_.displayName=r_;var s_=`SelectLabel`,c_=_.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=a_(s_,n);return(0,M.jsx)(N.div,{id:i.id,...r,ref:t})});c_.displayName=s_;var l_=`SelectItem`,[u_,d_]=kg(l_),f_=_.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=Mg(l_,n),c=Jg(l_,n),l=s.value===r,[u,d]=_.useState(a??``),[f,p]=_.useState(!1),m=Sa(t,e=>c.itemRefCallback?.(e,r,i)),h=Qa(),g=_.useRef(`touch`),v=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};if(r===``)throw Error(`A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,M.jsx)(u_,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:_.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,M.jsx)(Dg.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,M.jsx)(N.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:P(o.onFocus,()=>p(!0)),onBlur:P(o.onBlur,()=>p(!1)),onClick:P(o.onClick,()=>{g.current!==`mouse`&&v()}),onPointerUp:P(o.onPointerUp,()=>{g.current===`mouse`&&v()}),onPointerDown:P(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:P(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:P(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:P(o.onKeyDown,e=>{c.searchRef?.current!==``&&e.key===` `||(Tg.includes(e.key)&&v(),e.key===` `&&e.preventDefault())})})})})});f_.displayName=l_;var p_=`SelectItemText`,m_=_.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=Mg(p_,n),s=Jg(p_,n),c=d_(p_,n),l=Pg(p_,n),[u,d]=_.useState(null),f=Sa(t,e=>d(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=u?.textContent,m=_.useMemo(()=>(0,M.jsx)(`option`,{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:g}=l;return Ba(()=>(h(m),()=>g(m)),[h,g,m]),(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(N.span,{id:c.textId,...a,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?ya.createPortal(a.children,o.valueNode):null]})});m_.displayName=p_;var h_=`SelectItemIndicator`,g_=_.forwardRef((e,t)=>
66{let{__scopeSelect:n,...r}=e;return d_(h_,n).isSelected?(0,M.jsx)(N.span,{"aria-hidden":!0,...r,ref:t}):null});g_.displayName=h_;var __=`SelectScrollUpButton`,v_=_.forwardRef((e,t)=>{let n=Jg(__,e.__scopeSelect),r=e_(__,e.__scopeSelect),[i,a]=_.useState(!1),o=Sa(t,r.onScrollButtonChange);return Ba(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,M.jsx)(x_,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});v_.displayName=__;var y_=`SelectScrollDownButton`,b_=_.forwardRef((e,t)=>{let n=Jg(y_,e.__scopeSelect),r=e_(y_,e.__scopeSelect),[i,a]=_.useState(!1),o=Sa(t,r.onScrollButtonChange);return Ba(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,M.jsx)(x_,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});b_.displayName=y_;var x_=_.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=Jg(`SelectScrollButton`,n),o=_.useRef(null),s=Og(n),c=_.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return _.useEffect(()=>()=>c(),[c]),Ba(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,M.jsx)(N.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:P(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:P(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:P(i.onPointerLeave,()=>{c()})})}),S_=`SelectSeparator`,C_=_.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,M.jsx)(N.div,{"aria-hidden":!0,...r,ref:t})});C_.displayName=S_;var w_=`SelectArrow`,T_=_.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Ag(n),a=Mg(w_,n),o=Jg(w_,n);return a.open&&o.position===`popper`?(0,M.jsx)(sp,{...i,...r,ref:t}):null});T_.displayName=w_;var E_=`SelectBubbleInput`,D_=_.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=_.useRef(null),a=Sa(r,i),o=ou(t);return _.useEffect(()=>{let e=i.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(o!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[o,t]),(0,M.jsx)(N.select,{...n,style:{...Ma,...n.style},ref:a,defaultValue:t})});D_.displayName=E_;function O_(e){return e===``||e===void 0}function k_(e){let t=Zo(e),n=_.useRef(``),r=_.useRef(0),i=_.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=_.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return _.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function A_(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=j_(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function j_(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var M_=Fg,N_=Lg,Lee=zg,Ree=Vg,zee=Ug,Bee=Gg,Vee=n_,Hee=f_,Uee=m_,Wee=g_,Gee=v_,Kee=b_,qee=`Separator`,P_=`horizontal`,Jee=[`horizontal`,`vertical`],F_=_.forwardRef((e,t)=>{let{decorative:n,orientation:r=P_,...i}=e,a=Yee(r)?r:P_,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,M.jsx)(N.div,{"data-orientation":a,...o,...i,ref:t})});F_.displayName=qee;function Yee(e){return Jee.includes(e)}var Xee=F_,I_=[`PageUp`,`PageDown`],L_=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`],R_={"from-left":[`Home`,`PageDown`,`ArrowDown`,`ArrowLeft`],"from-right":[`Home`,`PageDown`,`ArrowDown`,`ArrowRight`],"from-bottom":[`Home`,`PageDown`,`ArrowDown`,`ArrowLeft`],"from-top":[`Home`,`PageDown`,`ArrowUp`,`ArrowLeft`]},z_=`Slider`,[B_,Zee,V_]=za(z_),[H_,Qee]=La(z_,[V_]),[U_,W_]=H_(z_),G_=_.forwardRef((e,t)=>
vendor: 4,129 bytes, line 66
66{let{name:n,min:r=0,max:i=100,step:a=1,orientation:o=`horizontal`,disabled:s=!1,minStepsBetweenThumbs:c=0,defaultValue:l=[r],value:u,onValueChange:d=()=>{},onValueCommit:f=()=>{},inverted:p=!1,form:m,...h}=e,g=_.useRef(new Set),v=_.useRef(0),y=o===`horizontal`?J_:Y_,[b=[],x]=Ha({prop:u,defaultProp:l,onChange:e=>{[...g.current][v.current]?.focus(),d(e)}}),S=_.useRef(b);function C(e){E(e,lv(b,e))}function w(e){E(e,v.current)}function T(){let e=S.current[v.current];b[v.current]!==e&&f(b)}function E(e,t,{commit:n}={commit:!1}){let o=mv(a),s=Hh(hv(Math.round((e-r)/a)*a+r,o),[r,i]);x((e=[])=>{let r=ov(e,s,t);if(fv(r,c*a)){v.current=r.indexOf(s);let t=String(r)!==String(e);return t&&n&&f(r),t?r:e}else return e})}return(0,M.jsx)(U_,{scope:e.__scopeSlider,name:n,disabled:s,min:r,max:i,valueIndexToChangeRef:v,thumbs:g.current,values:b,orientation:o,form:m,children:(0,M.jsx)(B_.Provider,{scope:e.__scopeSlider,children:(0,M.jsx)(B_.Slot,{scope:e.__scopeSlider,children:(0,M.jsx)(y,{"aria-disabled":s,"data-disabled":s?``:void 0,...h,ref:t,onPointerDown:P(h.onPointerDown,()=>{s||(S.current=b)}),min:r,max:i,inverted:p,onSlideStart:s?void 0:C,onSlideMove:s?void 0:w,onSlideEnd:s?void 0:T,onHomeKeyDown:()=>!s&&E(r,0,{commit:!0}),onEndKeyDown:()=>!s&&E(i,b.length-1,{commit:!0}),onStepKeyDown:({event:e,direction:t})=>{if(!s){let n=I_.includes(e.key)||e.shiftKey&&L_.includes(e.key)?10:1,r=v.current,i=b[r];E(i+a*n*t,r,{commit:!0})}}})})})})});G_.displayName=z_;var[K_,q_]=H_(z_,{startEdge:`left`,endEdge:`right`,size:`width`,direction:1}),J_=_.forwardRef((e,t)=>{let{min:n,max:r,dir:i,inverted:a,onSlideStart:o,onSlideMove:s,onSlideEnd:c,onStepKeyDown:l,...u}=e,[d,f]=_.useState(null),p=Sa(t,e=>f(e)),m=_.useRef(void 0),h=go(i),g=h===`ltr`,v=g&&!a||!g&&a;function y(e){let t=m.current||d.getBoundingClientRect(),i=pv([0,t.width],v?[n,r]:[r,n]);return m.current=t,i(e-t.left)}return(0,M.jsx)(K_,{scope:e.__scopeSlider,startEdge:v?`left`:`right`,endEdge:v?`right`:`left`,direction:v?1:-1,size:`width`,children:(0,M.jsx)(X_,{dir:h,"data-orientation":`horizontal`,...u,ref:p,style:{...u.style,"--radix-slider-thumb-transform":`translateX(-50%)`},onSlideStart:e=>{let t=y(e.clientX);o?.(t)},onSlideMove:e=>{let t=y(e.clientX);s?.(t)},onSlideEnd:()=>{m.current=void 0,c?.()},onStepKeyDown:e=>{let t=R_[v?`from-left`:`from-right`].includes(e.key);l?.({event:e,direction:t?-1:1})}})})}),Y_=_.forwardRef((e,t)=>{let{min:n,max:r,inverted:i,onSlideStart:a,onSlideMove:o,onSlideEnd:s,onStepKeyDown:c,...l}=e,u=_.useRef(null),d=Sa(t,u),f=_.useRef(void 0),p=!i;function m(e){let t=f.current||u.current.getBoundingClientRect(),i=pv([0,t.height],p?[r,n]:[n,r]);return f.current=t,i(e-t.top)}return(0,M.jsx)(K_,{scope:e.__scopeSlider,startEdge:p?`bottom`:`top`,endEdge:p?`top`:`bottom`,size:`height`,direction:p?1:-1,children:(0,M.jsx)(X_,{"data-orientation":`vertical`,...l,ref:d,style:{...l.style,"--radix-slider-thumb-transform":`translateY(50%)`},onSlideStart:e=>{let t=m(e.clientY);a?.(t)},onSlideMove:e=>{let t=m(e.clientY);o?.(t)},onSlideEnd:()=>{f.current=void 0,s?.()},onStepKeyDown:e=>{let t=R_[p?`from-bottom`:`from-top`].includes(e.key);c?.({event:e,direction:t?-1:1})}})})}),X_=_.forwardRef((e,t)=>{let{__scopeSlider:n,onSlideStart:r,onSlideMove:i,onSlideEnd:a,onHomeKeyDown:o,onEndKeyDown:s,onStepKeyDown:c,...l}=e,u=W_(z_,n);return(0,M.jsx)(N.span,{...l,ref:t,onKeyDown:P(e.onKeyDown,e=>{e.key===`Home`?(o(e),e.preventDefault()):e.key===`End`?(s(e),e.preventDefault()):I_.concat(L_).includes(e.key)&&(c(e),e.preventDefault())}),onPointerDown:P(e.onPointerDown,e=>{let t=e.target;t.setPointerCapture(e.pointerId),e.preventDefault(),u.thumbs.has(t)?t.focus():r(e)}),onPointerMove:P(e.onPointerMove,e=>{e.target.hasPointerCapture(e.pointerId)&&i(e)}),onPointerUp:P(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&(t.releasePointerCapture(e.pointerId),a(e))})})}),Z_=`SliderTrack`,Q_=_.forwardRef((e,t)=>{let{__scopeSlider:n,...r}=e,i=W_(Z_,n);return(0,M.jsx)(N.span,{"data-disabled":i.disabled?``:void 0,"data-orientation":i.orientation,...r,ref:t})});Q_.displayName=Z_;var $_=`SliderRange`,ev=_.forwardRef((e,t)=>
66{let{__scopeSlider:n,...r}=e,i=W_($_,n),a=q_($_,n),o=Sa(t,_.useRef(null)),s=i.values.length,c=i.values.map(e=>sv(e,i.min,i.max)),l=s>1?Math.min(...c):0,u=100-Math.max(...c);return(0,M.jsx)(N.span,{"data-orientation":i.orientation,"data-disabled":i.disabled?``:void 0,...r,ref:o,style:{...e.style,[a.startEdge]:l+`%`,[a.endEdge]:u+`%`}})});ev.displayName=$_;var tv=`SliderThumb`,nv=_.forwardRef((e,t)=>{let n=Zee(e.__scopeSlider),[r,i]=_.useState(null),a=Sa(t,e=>i(e)),o=_.useMemo(()=>r?n().findIndex(e=>e.ref.current===r):-1,[n,r]);return(0,M.jsx)(rv,{...e,ref:a,index:o})}),rv=_.forwardRef((e,t)=>{let{__scopeSlider:n,index:r,name:i,...a}=e,o=W_(tv,n),s=q_(tv,n),[c,l]=_.useState(null),u=Sa(t,e=>l(e)),d=c?o.form||!!c.closest(`form`):!0,f=su(c),p=o.values[r],m=p===void 0?0:sv(p,o.min,o.max),h=cv(r,o.values.length),g=f?.[s.size],v=g?uv(g,m,s.direction):0;return _.useEffect(()=>{if(c)return o.thumbs.add(c),()=>{o.thumbs.delete(c)}},[c,o.thumbs]),(0,M.jsxs)(`span`,{style:{transform:`var(--radix-slider-thumb-transform)`,position:`absolute`,[s.startEdge]:`calc(${m}% + ${v}
66px)`},children:[(0,M.jsx)(B_.ItemSlot,{scope:e.__scopeSlider,children:(0,M.jsx)(N.span,{role:`slider`,"aria-label":e[`aria-label`]||h,"aria-valuemin":o.min,"aria-valuenow":p,"aria-valuemax":o.max,"aria-orientation":o.orientation,"data-orientation":o.orientation,"data-disabled":o.disabled?``:void 0,tabIndex:o.disabled?void 0:0,...a,ref:u,style:p===void 0?{display:`none`}:e.style,onFocus:P(e.onFocus,()=>{o.valueIndexToChangeRef.current=r})})}),d&&(0,M.jsx)(av,{name:i??(o.name?o.name+(o.values.length>1?`[]`:``):void 0),form:o.form,value:p},r)]})});nv.displayName=tv;var iv=`RadioBubbleInput`,av=_.forwardRef(({__scopeSlider:e,value:t,...n},r)=>{let i=_.useRef(null),a=Sa(i,r),o=ou(t);return _.useEffect(()=>{let e=i.current;if(!e)return;let n=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(o!==t&&r){let n=new Event(`input`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[o,t]),(0,M.jsx)(N.input,{style:{display:`none`},...n,ref:a,defaultValue:t})});av.displayName=iv;function ov(e=[],t,n){let r=[...e];return r[n]=t,r.sort((e,t)=>e-t)}function sv(e,t,n){return Hh(100/(n-t)*(e-t),[0,100])}function cv(e,t){if(t>2)return`Value ${e+1} of ${t}`;if(t===2)return[`Minimum`,`Maximum`][e]}function lv(e,t){if(e.length===1)return 0;let n=e.map(e=>Math.abs(e-t)),r=Math.min(...n);return n.indexOf(r)}function uv(e,t,n){let r=e/2;return(r-pv([0,50],[0,r])(t)*n)*n}function dv(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function fv(e,t){if(t>0){let n=dv(e);return Math.min(...n)>=t}return!0}function pv(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function mv(e){return(String(e).split(`.`)[1]||``).length}function hv(e,t){let n=10**t;return Math.round(e*n)/n}var gv=G_,_v=Q_,vv=ev,yv=nv,bv=`Switch`,[xv,$ee]=La(bv),[Sv,Cv]=xv(bv),wv=_.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c=`on`,onCheckedChange:l,form:u,...d}=e,[f,p]=_.useState(null),m=Sa(t,e=>p(e)),h=_.useRef(!1),g=f?u||!!f.closest(`form`):!0,[v,y]=Ha({prop:i,defaultProp:a??!1,onChange:l,caller:bv});return(0,M.jsxs)(Sv,{scope:n,checked:v,disabled:s,children:[(0,M.jsx)(N.button,{type:`button`,role:`switch`,"aria-checked":v,"aria-required":o,"data-state":kv(v),"data-disabled":s?``:void 0,disabled:s,value:c,...d,ref:m,onClick:P(e.onClick,e=>{y(e=>!e),g&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})}),g&&(0,M.jsx)(Ov,{control:f,bubbles:!h.current,name:r,value:c,checked:v,required:o,disabled:s,form:u,style:{transform:`translateX(-100%)`}})]})});wv.displayName=bv;var Tv=`SwitchThumb`,Ev=_.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=Cv(Tv,n);return(0,M.jsx)(N.span,{"data-state":kv(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});Ev.displayName=Tv;var Dv=`SwitchBubbleInput`,Ov=_.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=_.useRef(null),s=Sa(o,a),c=ou(n),l=su(t);return _.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(t,`checked`).set;if(c!==n&&i){let t=new Event(`click`,{bubbles:r});i.call(e,n),e.dispatchEvent(t)}},[c,n,r]),(0,M.jsx)(`input`,{type:`checkbox`,"aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...i.style,...l,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});Ov.displayName=Dv;function kv(e){return e?`checked`:`unchecked`}var Av=wv,jv=Ev,Mv=`Tabs`,[Nv,ete]=La(Mv,[hp]),Pv=hp(),[Fv,Iv]=Nv(Mv),Lv=_.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=go(s),[d,f]=Ha({prop:r,onChange:i,defaultProp:a??``,caller:Mv});return(0,M.jsx)(Fv,{scope:n,baseId:Qa(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,M.jsx)(N.div,{dir:u,"data-orientation":o,...l,ref:t})})});Lv.displayName=Mv;var Rv=`TabsList`,zv=_.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=Iv(Rv,n),o=Pv(n);return(0,M.jsx)(Dp,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,M.jsx)(N.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});zv.displayName=Rv;var Bv=`TabsTrigger`,Vv=_.forwardRef((e,t)=>
vendor: 4,603 bytes, line 66
66{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=Iv(Bv,n),s=Pv(n),c=Wv(o.baseId,r),l=Gv(o.baseId,r),u=r===o.value;return(0,M.jsx)(Op,{asChild:!0,...s,focusable:!i,active:u,children:(0,M.jsx)(N.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:P(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:P(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:P(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});Vv.displayName=Bv;var Hv=`TabsContent`,Uv=_.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=Iv(Hv,n),c=Wv(s.baseId,r),l=Gv(s.baseId,r),u=r===s.value,d=_.useRef(u);return _.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,M.jsx)(Ka,{present:i||u,children:({present:n})=>(0,M.jsx)(N.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});Uv.displayName=Hv;function Wv(e,t){return`${e}-trigger-${t}`}function Gv(e,t){return`${e}-content-${t}`}var Kv=Lv,qv=zv,Jv=Vv,Yv=Uv,[Xv,tte]=La(`Tooltip`,[Hf]),Zv=Hf(),Qv=`TooltipProvider`,$v=700,ey=`tooltip.open`,[nte,ty]=Xv(Qv),ny=e=>{let{__scopeTooltip:t,delayDuration:n=$v,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=_.useRef(!0),s=_.useRef(!1),c=_.useRef(0);return _.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,M.jsx)(nte,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:_.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:_.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:_.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};ny.displayName=Qv;var ry=`Tooltip`,[rte,iy]=Xv(ry),ay=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=ty(ry,e.__scopeTooltip),l=Zv(t),[u,d]=_.useState(null),f=Qa(),p=_.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=_.useRef(!1),[v,y]=Ha({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(ey))):c.onClose(),a?.(e)},caller:ry}),b=_.useMemo(()=>v?g.current?`delayed-open`:`instant-open`:`closed`,[v]),x=_.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,y(!0)},[y]),S=_.useCallback(()=>{window.clearTimeout(p.current),p.current=0,y(!1)},[y]),C=_.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,y(!0),p.current=0},h)},[h,y]);return _.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,M.jsx)(ip,{...l,children:(0,M.jsx)(rte,{scope:t,contentId:f,open:v,stateAttribute:b,trigger:u,onTriggerChange:d,onTriggerEnter:_.useCallback(()=>{c.isOpenDelayedRef.current?C():x()},[c.isOpenDelayedRef,C,x]),onTriggerLeave:_.useCallback(()=>{m?S():(window.clearTimeout(p.current),p.current=0)},[S,m]),onOpen:x,onClose:S,disableHoverableContent:m,children:n})})};ay.displayName=ry;var oy=`TooltipTrigger`,sy=_.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=iy(oy,n),a=ty(oy,n),o=Zv(n),s=Sa(t,_.useRef(null),i.onTriggerChange),c=_.useRef(!1),l=_.useRef(!1),u=_.useCallback(()=>c.current=!1,[]);return _.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,M.jsx)(ap,{asChild:!0,...o,children:(0,M.jsx)(N.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:P(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:P(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:P(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:P(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:P(e.onBlur,i.onClose),onClick:P(e.onClick,i.onClose)})})});sy.displayName=oy;var cy=`TooltipPortal`,[ite,ate]=Xv(cy,{forceMount:void 0}),ly=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=iy(cy,t);return(0,M.jsx)(ite,{scope:t,forceMount:n,children:(0,M.jsx)(Ka,{present:n||a.open,children:(0,M.jsx)(As,{asChild:!0,container:i,children:r})})})};ly.displayName=cy;var uy=`TooltipContent`,dy=_.forwardRef((e,t)=>
vendor: 4,127 bytes, line 66
66{let n=ate(uy,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=iy(uy,e.__scopeTooltip);return(0,M.jsx)(Ka,{present:r||o.open,children:o.disableHoverableContent?(0,M.jsx)(fy,{side:i,...a,ref:t}):(0,M.jsx)(ote,{side:i,...a,ref:t})})}),ote=_.forwardRef((e,t)=>{let n=iy(uy,e.__scopeTooltip),r=ty(uy,e.__scopeTooltip),i=_.useRef(null),a=Sa(t,i),[o,s]=_.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=_.useCallback(()=>{s(null),d(!1)},[d]),p=_.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=dte(r,ute(r,n.getBoundingClientRect())),a=fte(t.getBoundingClientRect());s(mte([...i,...a])),d(!0)},[d]);return _.useEffect(()=>()=>f(),[f]),_.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),_.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!pte(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,M.jsx)(fy,{...e,ref:a})}),[ste,cte]=Xv(ry,{isInside:!1}),lte=Da(`TooltipContent`),fy=_.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=iy(uy,n),l=Zv(n),{onClose:u}=c;return _.useEffect(()=>(document.addEventListener(ey,u),()=>document.removeEventListener(ey,u)),[u]),_.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,M.jsx)(as,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,M.jsxs)(op,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,M.jsx)(lte,{children:r}),(0,M.jsx)(ste,{scope:n,isInside:!0,children:(0,M.jsx)(Fa,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});dy.displayName=uy;var py=`TooltipArrow`,my=_.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Zv(n);return cte(py,n).isInside?null:(0,M.jsx)(sp,{...i,...r,ref:t})});my.displayName=py;function ute(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function dte(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function fte(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function pte(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function mte(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),hte(t)}function hte(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}
vendor: 4,773 bytes, line 66
66var gte=ny,_te=ay,vte=sy,yte=ly,bte=dy,xte=my;function hy(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=hy(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function gy(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=hy(e))&&(r&&(r+=` `),r+=t);return r}var Ste=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},Cte=(e,t)=>({classGroupId:e,validator:t}),_y=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),vy=`-`,yy=[],wte=`arbitrary..`,Tte=e=>{let t=Dte(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return Ete(e);let n=e.split(vy);return by(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?Ste(i,t):t:i||yy}return n[e]||yy}}},by=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=by(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(vy):e.slice(t).join(vy),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},Ete=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?wte+r:void 0})(),Dte=e=>{let{theme:t,classGroups:n}=e;return Ote(n,t)},Ote=(e,t)=>{let n=_y();for(let r in e){let i=e[r];xy(i,n,r,t)}return n},xy=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];kte(i,t,n,r)}},kte=(e,t,n,r)=>{if(typeof e==`string`){Ate(e,t,n);return}if(typeof e==`function`){jte(e,t,n,r);return}Mte(e,t,n,r)},Ate=(e,t,n)=>{let r=e===``?t:Sy(t,e);r.classGroupId=n},jte=(e,t,n,r)=>{if(Nte(e)){xy(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Cte(n,e))},Mte=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];xy(o,Sy(t,a),n,r)}},Sy=(e,t)=>{let n=e,r=t.split(vy),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=_y(),n.nextPart.set(t,i)),n=i}return n},Nte=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,Pte=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},Cy=`!`,wy=`:`,Fte=[],Ty=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Ite=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===wy){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(Cy)?(c=s.slice(0,-1),l=!0):s.startsWith(Cy)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return Ty(t,l,c,u)};if(t){let e=t+wy,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Ty(Fte,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},Lte=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},Rte=e=>({cache:Pte(e.cacheSize),parseClassName:Ite(e),sortModifiers:Lte(e),postfixLookupClassGroupIds:zte(e),...Tte(e)}),zte=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},Bte=/\s+/,Ey=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(Bte),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h){l=t+(l.length>0?` `+l:l);continue}if(g=r(p),!g){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+Cy:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e<b.length;++e){let t=b[e];s.push(v+t)}l=t+(l.length>0?` `+l:l)}return l},Dy=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=Oy(n))&&(i&&(i+=` `),i+=r);return i},Oy=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=Oy(e[r]))&&(n&&(n+=` `),n+=t);return n},ky=(e,...t)=>{let n,r,i,a,o=o=>(n=Rte(t.reduce((e,t)=>
vendor: 10,464 bytes, line 66
66t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=Ey(e,n);return i(e,a),a};return a=o,(...e)=>a(Dy(...e))},Ay=[],jy=e=>{let t=t=>t[e]||Ay;return t.isThemeGetter=!0,t},My=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Ny=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Py=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Fy=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Iy=/\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$/,Ly=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Ry=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,zy=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,By=e=>Py.test(e),Vy=e=>!!e&&!Number.isNaN(Number(e)),Hy=e=>!!e&&Number.isInteger(Number(e)),Uy=e=>e.endsWith(`%`)&&Vy(e.slice(0,-1)),Wy=e=>Fy.test(e),Gy=()=>!0,Ky=e=>Iy.test(e)&&!Ly.test(e),qy=()=>!1,Jy=e=>Ry.test(e),Yy=e=>zy.test(e),Xy=e=>!F(e)&&!I(e),Zy=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),Qy=e=>pb(e,_b,qy),F=e=>My.test(e),$y=e=>pb(e,vb,Ky),eb=e=>pb(e,yb,Vy),tb=e=>pb(e,xb,Gy),nb=e=>pb(e,bb,qy),rb=e=>pb(e,hb,qy),ib=e=>pb(e,gb,Yy),ab=e=>pb(e,Sb,Jy),I=e=>Ny.test(e),ob=e=>mb(e,vb),sb=e=>mb(e,bb),cb=e=>mb(e,hb),lb=e=>mb(e,_b),ub=e=>mb(e,gb),db=e=>mb(e,Sb,!0),fb=e=>mb(e,xb,!0),pb=(e,t,n)=>{let r=My.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},mb=(e,t,n=!1)=>{let r=Ny.exec(e);return r?r[1]?t(r[1]):n:!1},hb=e=>e===`position`||e===`percentage`,gb=e=>e===`image`||e===`url`,_b=e=>e===`length`||e===`size`||e===`bg-size`,vb=e=>e===`length`,yb=e=>e===`number`,bb=e=>e===`family-name`,xb=e=>e===`number`||e===`weight`,Sb=e=>e===`shadow`,Cb=ky(()=>{let e=jy(`color`),t=jy(`font`),n=jy(`text`),r=jy(`font-weight`),i=jy(`tracking`),a=jy(`leading`),o=jy(`breakpoint`),s=jy(`container`),c=jy(`spacing`),l=jy(`radius`),u=jy(`shadow`),d=jy(`inset-shadow`),f=jy(`text-shadow`),p=jy(`drop-shadow`),m=jy(`blur`),h=jy(`perspective`),g=jy(`aspect`),_=jy(`ease`),v=jy(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),I,F],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[I,F,c],T=()=>[By,`full`,`auto`,...w()],E=()=>[Hy,`none`,`subgrid`,I,F],D=()=>[`auto`,{span:[`full`,Hy,I,F]},Hy,I,F],O=()=>[Hy,`auto`,I,F],ee=()=>[`auto`,`min`,`max`,`fr`,I,F],k=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],te=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],ne=()=>[`auto`,...w()],re=()=>[By,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],ie=()=>[By,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],ae=()=>[By,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],A=()=>[e,I,F],oe=()=>[...b(),cb,rb,{position:[I,F]}],se=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ce=()=>[`auto`,`cover`,`contain`,lb,Qy,{size:[I,F]}],le=()=>[Uy,ob,$y],ue=()=>[``,`none`,`full`,l,I,F],de=()=>[``,Vy,ob,$y],fe=()=>[`solid`,`dashed`,`dotted`,`double`],pe=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],me=()=>[Vy,Uy,cb,rb],he=()=>[``,`none`,m,I,F],ge=()=>[`none`,Vy,I,F],_e=()=>[`none`,Vy,I,F],ve=()=>[Vy,I,F],ye=()=>[By,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Wy],breakpoint:[Wy],color:[Gy],container:[Wy],"drop-shadow":[Wy],ease:[`in`,`out`,`in-out`],font:[Xy],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Wy],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Wy],shadow:[Wy],spacing:[`px`,Vy],text:[Wy],"text-shadow":[Wy],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,By,F,I,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,I,F]}],"container-named":[Zy],columns:[{columns:[Vy,F,I,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[Hy,`auto`,I,F]}],basis:[{basis:[By,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[Vy,By,`auto`,`initial`,`none`,F]}],grow:[{grow:[``,Vy,I,F]}],shrink:[{shrink:[``,Vy,I,F]}],order:[{order:[Hy,`first`,`last`,`none`,I,F]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":ee()}],"auto-rows":[{"auto-rows":ee()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...k(),`normal`]}],"justify-items":[{"justify-items":[...te(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...te()]}],"align-content":[{content:[`normal`,...k()]}],"align-items":[{items:[...te(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...te(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":k()}],"place-items":[{"place-items":[...te(),`baseline`]}],"place-self":[{"place-self":[`auto`,...te()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:ne()}],mx:[{mx:ne()}],my:[{my:ne()}],ms:[{ms:ne()}],me:[{me:ne()}],mbs:[{mbs:ne()}],mbe:[{mbe:ne()}],mt:[{mt:ne()}],mr:[{mr:ne()}],mb:[{mb:ne()}],ml:[{ml:ne()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:re()}],"inline-size":[{inline:[`auto`,...ie()]}],"min-inline-size":[{"min-inline":[`auto`,...ie()]}],"max-inline-size":[{"max-inline":[`none`,...ie()]}],"block-size":[{block:[`auto`,...ae()]}],"min-block-size":[{"min-block":[`auto`,...ae()]}],"max-block-size":[{"max-block":[`none`,...ae()]}],w:[{w:[s,`screen`,...re()]}],"min-w":[{"min-w":[s,`screen`,`none`,...re()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...re()]}],h:[{h:[`screen`,`lh`,...re()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...re()]}],"max-h":[{"max-h":[`screen`,`lh`,...re()]}],"font-size":[{text:[`base`,n,ob,$y]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,fb,tb]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Uy,F]}],"font-family":[{font:[sb,nb,t]}],"font-features":[{"font-features":[F]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,I,F]}],"line-clamp":[{"line-clamp":[Vy,`none`,I,eb]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,I,F]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,I,F]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:A()}],"text-color":[{text:A()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...fe(),`wavy`]}],"text-decoration-thickness":[{decoration:[Vy,`from-font`,`auto`,I,$y]}],"text-decoration-color":[{decoration:A()}],"underline-offset":[{"underline-offset":[Vy,`auto`,I,F]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[Hy,I,F]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,I,F]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,I,F]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:oe()}],"bg-repeat":[{bg:se()}],"bg-size":[{bg:ce()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Hy,I,F],radial:[``,I,F],conic:[Hy,I,F]},ub,ib]}],"bg-color":[{bg:A()}],"gradient-from-pos":[{from:le()}
vendor: 7,849 bytes, line 66
66],"gradient-via-pos":[{via:le()}],"gradient-to-pos":[{to:le()}],"gradient-from":[{from:A()}],"gradient-via":[{via:A()}],"gradient-to":[{to:A()}],rounded:[{rounded:ue()}],"rounded-s":[{"rounded-s":ue()}],"rounded-e":[{"rounded-e":ue()}],"rounded-t":[{"rounded-t":ue()}],"rounded-r":[{"rounded-r":ue()}],"rounded-b":[{"rounded-b":ue()}],"rounded-l":[{"rounded-l":ue()}],"rounded-ss":[{"rounded-ss":ue()}],"rounded-se":[{"rounded-se":ue()}],"rounded-ee":[{"rounded-ee":ue()}],"rounded-es":[{"rounded-es":ue()}],"rounded-tl":[{"rounded-tl":ue()}],"rounded-tr":[{"rounded-tr":ue()}],"rounded-br":[{"rounded-br":ue()}],"rounded-bl":[{"rounded-bl":ue()}],"border-w":[{border:de()}],"border-w-x":[{"border-x":de()}],"border-w-y":[{"border-y":de()}],"border-w-s":[{"border-s":de()}],"border-w-e":[{"border-e":de()}],"border-w-bs":[{"border-bs":de()}],"border-w-be":[{"border-be":de()}],"border-w-t":[{"border-t":de()}],"border-w-r":[{"border-r":de()}],"border-w-b":[{"border-b":de()}],"border-w-l":[{"border-l":de()}],"divide-x":[{"divide-x":de()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":de()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...fe(),`hidden`,`none`]}],"divide-style":[{divide:[...fe(),`hidden`,`none`]}],"border-color":[{border:A()}],"border-color-x":[{"border-x":A()}],"border-color-y":[{"border-y":A()}],"border-color-s":[{"border-s":A()}],"border-color-e":[{"border-e":A()}],"border-color-bs":[{"border-bs":A()}],"border-color-be":[{"border-be":A()}],"border-color-t":[{"border-t":A()}],"border-color-r":[{"border-r":A()}],"border-color-b":[{"border-b":A()}],"border-color-l":[{"border-l":A()}],"divide-color":[{divide:A()}],"outline-style":[{outline:[...fe(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[Vy,I,F]}],"outline-w":[{outline:[``,Vy,ob,$y]}],"outline-color":[{outline:A()}],shadow:[{shadow:[``,`none`,u,db,ab]}],"shadow-color":[{shadow:A()}],"inset-shadow":[{"inset-shadow":[`none`,d,db,ab]}],"inset-shadow-color":[{"inset-shadow":A()}],"ring-w":[{ring:de()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:A()}],"ring-offset-w":[{"ring-offset":[Vy,$y]}],"ring-offset-color":[{"ring-offset":A()}],"inset-ring-w":[{"inset-ring":de()}],"inset-ring-color":[{"inset-ring":A()}],"text-shadow":[{"text-shadow":[`none`,f,db,ab]}],"text-shadow-color":[{"text-shadow":A()}],opacity:[{opacity:[Vy,I,F]}],"mix-blend":[{"mix-blend":[...pe(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":pe()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[Vy]}],"mask-image-linear-from-pos":[{"mask-linear-from":me()}],"mask-image-linear-to-pos":[{"mask-linear-to":me()}],"mask-image-linear-from-color":[{"mask-linear-from":A()}],"mask-image-linear-to-color":[{"mask-linear-to":A()}],"mask-image-t-from-pos":[{"mask-t-from":me()}],"mask-image-t-to-pos":[{"mask-t-to":me()}],"mask-image-t-from-color":[{"mask-t-from":A()}],"mask-image-t-to-color":[{"mask-t-to":A()}],"mask-image-r-from-pos":[{"mask-r-from":me()}],"mask-image-r-to-pos":[{"mask-r-to":me()}],"mask-image-r-from-color":[{"mask-r-from":A()}],"mask-image-r-to-color":[{"mask-r-to":A()}],"mask-image-b-from-pos":[{"mask-b-from":me()}],"mask-image-b-to-pos":[{"mask-b-to":me()}],"mask-image-b-from-color":[{"mask-b-from":A()}],"mask-image-b-to-color":[{"mask-b-to":A()}],"mask-image-l-from-pos":[{"mask-l-from":me()}],"mask-image-l-to-pos":[{"mask-l-to":me()}],"mask-image-l-from-color":[{"mask-l-from":A()}],"mask-image-l-to-color":[{"mask-l-to":A()}],"mask-image-x-from-pos":[{"mask-x-from":me()}],"mask-image-x-to-pos":[{"mask-x-to":me()}],"mask-image-x-from-color":[{"mask-x-from":A()}],"mask-image-x-to-color":[{"mask-x-to":A()}],"mask-image-y-from-pos":[{"mask-y-from":me()}],"mask-image-y-to-pos":[{"mask-y-to":me()}],"mask-image-y-from-color":[{"mask-y-from":A()}],"mask-image-y-to-color":[{"mask-y-to":A()}],"mask-image-radial":[{"mask-radial":[I,F]}],"mask-image-radial-from-pos":[{"mask-radial-from":me()}],"mask-image-radial-to-pos":[{"mask-radial-to":me()}],"mask-image-radial-from-color":[{"mask-radial-from":A()}],"mask-image-radial-to-color":[{"mask-radial-to":A()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[Vy]}],"mask-image-conic-from-pos":[{"mask-conic-from":me()}],"mask-image-conic-to-pos":[{"mask-conic-to":me()}],"mask-image-conic-from-color":[{"mask-conic-from":A()}],"mask-image-conic-to-color":[{"mask-conic-to":A()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:oe()}],"mask-repeat":[{mask:se()}],"mask-size":[{mask:ce()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,I,F]}],filter:[{filter:[``,`none`,I,F]}],blur:[{blur:he()}],brightness:[{brightness:[Vy,I,F]}],contrast:[{contrast:[Vy,I,F]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,db,ab]}],"drop-shadow-color":[{"drop-shadow":A()}],grayscale:[{grayscale:[``,Vy,I,F]}],"hue-rotate":[{"hue-rotate":[Vy,I,F]}],invert:[{invert:[``,Vy,I,F]}],saturate:[{saturate:[Vy,I,F]}],sepia:[{sepia:[``,Vy,I,F]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,I,F]}],"backdrop-blur":[{"backdrop-blur":he()}],"backdrop-brightness":[{"backdrop-brightness":[Vy,I,F]}],"backdrop-contrast":[{"backdrop-contrast":[Vy,I,F]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,Vy,I,F]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Vy,I,F]}],"backdrop-invert":[{"backdrop-invert":[``,Vy,I,F]}],"backdrop-opacity":[{"backdrop-opacity":[Vy,I,F]}],"backdrop-saturate":[{"backdrop-saturate":[Vy,I,F]}],"backdrop-sepia":[{"backdrop-sepia":[``,Vy,I,F]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,I,F]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[Vy,`initial`,I,F]}],ease:[{ease:[`linear`,`initial`,_,I,F]}],delay:[{delay:[Vy,I,F]}],animate:[{animate:[`none`,v,I,F]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,I,F]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:ge()}],"rotate-x":[{"rotate-x":ge()}],"rotate-y":[{"rotate-y":ge()}],"rotate-z":[{"rotate-z":ge()}],scale:[{scale:_e()}],"scale-x":[{"scale-x":_e()}],"scale-y":[{"scale-y":_e()}],"scale-z":[{"scale-z":_e()}],"scale-3d":[`scale-3d`],skew:[{skew:ve()}],"skew-x":[{"skew-x":ve()}],"skew-y":[{"skew-y":ve()}],transform:[{transform:[I,F,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:ye()}],"translate-x":[{"translate-x":ye()}],"translate-y":[{"translate-y":ye()}],"translate-z":[{"translate-z":ye()}],"translate-none":[`translate-none`],zoom:[{zoom:[Hy,I,F]}],accent:[{accent:A()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:A()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom
66-in`,`zoom-out`,I,F]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":A()}],"scrollbar-track-color":[{"scrollbar-track":A()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}
66],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`,I,F]}],fill:[{fill:[`none`,...A()]}],"stroke-w":[{stroke:[Vy,ob,$y,eb]}],stroke:[{stroke:[`none`,...A()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function L(...e){return Cb(gy(e))}function wb({delayDuration:e=0,...t}){return(0,M.jsx)(gte,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function Tb({...e}){return(0,M.jsx)(_te,{"data-slot":`tooltip`,...e})}function Eb({...e}){return(0,M.jsx)(vte,{"data-slot":`tooltip-trigger`,...e})}function Db({className:e,sideOffset:t=0,children:n,...r}){return(0,M.jsx)(yte,{children:(0,M.jsxs)(bte,{"data-slot":`tooltip-content`,sideOffset:t,className:L(`z-50 inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[n,(0,M.jsx)(xte,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground`})]})})}function Ob(e){if(!e||typeof document>`u`)return;let t=document.head||document.getElementsByTagName(`head`)[0],n=document.createElement(`style`);n.type=`text/css`,t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}var kb=e=>{switch(e){case`success`:return Mb;case`info`:return Pb;case`warning`:return Nb;case`error`:return Fb;default:return null}},Ab=Array(12).fill(0),jb=({visible:e,className:t})=>_.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(
66Boolean).join(` `),"data-visible":e},_.createElement(`div`,{className:`sonner-spinner`},Ab.map((e,t)=>_.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),Mb=_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},_.createElement(`path`,{fillRule:`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,clipRule:`evenodd`})),Nb=_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`},_.createElement(`path`,{fillRule:`evenodd`,d:`M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z`,clipRule:`evenodd`})),Pb=_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},_.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z`,clipRule:`evenodd`})),Fb=_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},_.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z`,clipRule:`evenodd`})),Ib=_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`},_.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),_.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),Lb=()=>{let[e,t]=_.useState(document.hidden);return _.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>window.removeEventListener(`visibilitychange`,e)},[]),e},Rb=1,zb=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{let{message:t,...n}=e,r=typeof e?.id==`number`||e.id?.length>0?e.id:Rb++,i=this.toasts.find(e=>e.id===r),a=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(r)&&this.dismissedToasts.delete(r),i?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:a,title:t}):n):this.addToast({title:t,...n,dismissible:a,id:r}),r},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(t=>t({id:e,dismiss:!0})))):this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>
66this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=Promise.resolve(e instanceof Function?e():e),i=n!==void 0,a,o=r.then(async e=>{if(a=[`resolve`,e],_.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(Vb(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,a=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description,o=typeof r==`object`&&!_.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(e instanceof Error){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!_.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!_.isValidElement(r)?r:{message:r};this.create({id:n,type:`success`,description:a,...o})}}).catch(async e=>{if(a=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!_.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),t.finally==null||t.finally.call(t)}),s=()=>new Promise((e,t)=>o.then(()=>a[0]===`reject`?t(a[1]):e(a[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=t?.id||Rb++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Bb=(e,t)=>{let n=t?.id||Rb++;return zb.addToast({title:e,...t,id:n}),n},Vb=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,Hb=Object.assign(Bb,{success:zb.success,info:zb.info,warning:zb.warning,error:zb.error,custom:zb.custom,message:zb.message,promise:zb.promise,dismiss:zb.dismiss,loading:zb.loading},{getHistory:()=>zb.toasts,getToasts:()=>zb.getActiveToasts()});Ob(`
vendor: 14,859 bytes, line 66
66[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
66`);function Ub(e){return e.label!==void 0}var Wb=3,Gb=`24px`,Kb=`16px`,qb=4e3,Jb=356,Yb=14,Xb=45,Zb=200;function Qb(...e){return e.filter(Boolean).join(` `)}function $b(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var ex=e=>{let{invert:t,toast:n,unstyled:r,interacting:i,setHeights:a,visibleToasts:o,heights:s,index:c,toasts:l,expanded:u,removeToast:d,defaultRichColors:f,closeButton:p,style:m,cancelButtonStyle:h,actionButtonStyle:g,className:v=``,descriptionClassName:y=``,duration:b,position:x,gap:S,expandByDefault:C,classNames:w,icons:T,closeButtonAriaLabel:E=`Close toast`}=e,[D,O]=_.useState(null),[ee,k]=_.useState(null),[te,ne]=_.useState(!1),[re,ie]=_.useState(!1),[ae,A]=_.useState(!1),[oe,se]=_.useState(!1),[ce,le]=_.useState(!1),[ue,de]=_.useState(0),[fe,pe]=_.useState(0),me=_.useRef(n.duration||b||qb),he=_.useRef(null),ge=_.useRef(null),_e=c===0,ve=c+1<=o,ye=n.type,be=n.dismissible!==!1,xe=n.className||``,Se=n.descriptionClassName||``,Ce=_.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),we=_.useMemo(()=>n.closeButton??p,[n.closeButton,p]),Te=_.useMemo(()=>n.duration||b||qb,[n.duration,b]),Ee=_.useRef(0),De=_.useRef(0),Oe=_.useRef(0),ke=_.useRef(null),[Ae,je]=x.split(`-`),Me=_.useMemo(()=>
66s.reduce((e,t,n)=>n>=Ce?e:e+t.height,0),[s,Ce]),Ne=Lb(),Pe=n.invert||t,Fe=ye===`loading`;De.current=_.useMemo(()=>Ce*S+Me,[Ce,Me]),_.useEffect(()=>{me.current=Te},[Te]),_.useEffect(()=>{ne(!0)},[]),_.useEffect(()=>{let e=ge.current;if(e){let t=e.getBoundingClientRect().height;return pe(t),a(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>a(e=>e.filter(e=>e.toastId!==n.id))}},[a,n.id]),_.useLayoutEffect(()=>{if(!te)return;let e=ge.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,pe(r),a(e=>e.find(e=>e.toastId===n.id)?e.map(e=>e.toastId===n.id?{...e,height:r}:e):[{toastId:n.id,height:r,position:n.position},...e])},[te,n.title,n.description,a,n.id,n.jsx,n.action,n.cancel]);let Ie=_.useCallback(()=>{ie(!0),de(De.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{d(n)},Zb)},[n,d,a,De]);_.useEffect(()=>{if(n.promise&&ye===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return u||i||Ne?(()=>{if(Oe.current<Ee.current){let e=new Date().getTime()-Ee.current;me.current-=e}Oe.current=new Date().getTime()})():me.current!==1/0&&(Ee.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),Ie()},me.current)),()=>clearTimeout(e)},[u,i,n,ye,Ne,Ie]),_.useEffect(()=>{n.delete&&(Ie(),n.onDismiss==null||n.onDismiss.call(n,n))},[Ie,n.delete]);function Le(){return T?.loading?_.createElement(`div`,{className:Qb(w?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":ye===`loading`},T.loading):_.createElement(jb,{className:Qb(w?.loader,n?.classNames?.loader),visible:ye===`loading`})}let Re=n.icon||T?.[ye]||kb(ye);return _.createElement(`li`,{tabIndex:0,ref:ge,className:Qb(v,xe,w?.toast,n?.classNames?.toast,w?.default,w?.[ye],n?.classNames?.[ye]),"data-sonner-toast":``,"data-rich-colors":n.richColors??f,"data-styled":!(n.jsx||n.unstyled||r),"data-mounted":te,"data-promise":!!n.promise,"data-swiped":ce,"data-removed":re,"data-visible":ve,"data-y-position":Ae,"data-x-position":je,"data-index":c,"data-front":_e,"data-swiping":ae,"data-dismissible":be,"data-type":ye,"data-invert":Pe,"data-swipe-out":oe,"data-swipe-direction":ee,"data-expanded":!!(u||C&&te),"data-testid":n.testId,style:{"--index":c,"--toasts-before":c,"--z-index":l.length-c,"--offset":`${re?ue:De.current}px`,"--initial-height":C?`auto`:`${fe}px`,...m,...n.style},onDragEnd:()=>{A(!1),O(null),ke.current=null},onPointerDown:e=>{e.button!==2&&(Fe||!be||(he.current=new Date,de(De.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(A(!0),ke.current={x:e.clientX,y:e.clientY})))},onPointerUp:()=>{if(oe||!be)return;ke.current=null;let e=Number(ge.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(ge.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-he.current?.getTime(),i=D===`x`?e:t,a=Math.abs(i)/r;if(Math.abs(i)>=Xb||a>.11){de(De.current),n.onDismiss==null||n.onDismiss.call(n,n),k(D===`x`?e>0?`right`:`left`:t>0?`down`:`up`),Ie(),se(!0);return}else{var o,s;(o=ge.current)==null||o.style.setProperty(`--swipe-amount-x`,`0px`),(s=ge.current)==null||s.style.setProperty(`--swipe-amount-y`,`0px`)}le(!1),A(!1),O(null)},onPointerMove:t=>{var n,r;if(!ke.current||!be||window.getSelection()?.toString().length>0)return;let i=t.clientY-ke.current.y,a=t.clientX-ke.current.x,o=e.swipeDirections??$b(x);!D&&(Math.abs(a)>1||Math.abs(i)>1)&&O(Math.abs(a)>Math.abs(i)?`x`:`y`);let s={x:0,y:0},c=e=>1/(1.5+Math.abs(e)/20);if(D===`y`){if(o.includes(`top`)||o.includes(`bottom`))if(o.includes(`top`)&&i<0||o.includes(`bottom`)&&i>0)s.y=i;else{let e=i*c(i);s.y=Math.abs(e)<Math.abs(i)?e:i}}else if(D===`x`&&(o.includes(`left`)||o.includes(`right`)))if(o.includes(`left`)&&a<0||o.includes(`right`)&&a>0)s.x=a;else{let e=a*c(a);s.x=Math.abs(e)<Math.abs(a)?e:a}(Math.abs(s.x)>0||Math.abs(s.y)>0)&&le(!0),(n=ge.current)==null||n.style.setProperty(`--swipe-amount-x`,`${s.x}px`),(r=ge.current)==null||r.style.setProperty(`--swipe-amount-y`,`${s.y}px`)}},we&&!n.jsx&&ye!==`loading`?_.createElement(`button`,{"aria-label":E,"data-disabled":Fe,"data-close-button":!0,onClick:Fe||!be?()=>{}:()=>{Ie(),n.onDismiss==null||n.onDismiss.call(n,n)},className:Qb(w?.closeButton,n?.classNames?.closeButton)},T?.close??Ib):null,(ye||n.icon||n.promise)&&n.icon!==null&&(T?.[ye]!==null||n.icon)?_.createElement(`div`,{"data-icon":``,className:Qb(w?.icon,n?.classNames?.icon)},n.promise||n.type===`loading`&&!n.icon?n.icon||Le():null,n.type===`loading`?null:Re):null,_.createElement(`div`,{"data-content":``,className:Qb(w?.content,n?.classNames?.content)},_.createElement(`div`,{"data-title":``,className:Qb(w?.title,n?.classNames?.title)},n.jsx?n.jsx:typeof n.title==`function`?n.title():n.title),n.description?_.createElement(`div`,{"data-description":``,className:Qb(y,Se,w?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),_.isValidElement(n.cancel)?n.c
66ancel:n.cancel&&Ub(n.cancel)?_.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||h,onClick:e=>{Ub(n.cancel)&&be&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),Ie())},className:Qb(w?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,_.isValidElement(n.action)?n.action:n.action&&Ub(n.action)?_.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||g,onClick:e=>{Ub(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&Ie())},className:Qb(w?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function tx(){if(typeof window>`u`||typeof document>`u`)return`ltr`;let e=document.documentElement.getAttribute(`dir`);return e===`auto`||!e?window.getComputedStyle(document.documentElement).direction:e}function nx(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?Kb:Gb;function o(e){[`top`,`right`,`bottom`,`left`].forEach(t=>{n[`${i}-${t}`]=typeof e==`number`?`${e}px`:e})}typeof e==`number`||typeof e==`string`?o(e):typeof e==`object`?[`top`,`right`,`bottom`,`left`].forEach(t=>{e[t]===void 0?n[`${i}-${t}`]=a:n[`${i}-${t}`]=typeof e[t]==`number`?`${e[t]}px`:e[t]}):o(a)}),n}var rx=_.forwardRef(function(e,t){let{id:n,invert:r,position:i=`bottom-right`,hotkey:a=[`altKey`,`KeyT`],expand:o,closeButton:s,className:c,offset:l,mobileOffset:u,theme:d=`light`,richColors:f,duration:p,style:m,visibleToasts:h=Wb,toastOptions:g,dir:v=tx(),gap:y=Yb,icons:b,containerAriaLabel:x=`Notifications`}=e,[S,C]=_.useState([]),w=_.useMemo(()=>n?S.filter(e=>e.toasterId===n):S.filter(e=>!e.toasterId),[S,n]),T=_.useMemo(()=>Array.from(new Set([i].concat(w.filter(e=>e.position).map(e=>e.position)))),[w,i]),[E,D]=_.useState([]),[O,ee]=_.useState(!1),[k,te]=_.useState(!1),[ne,re]=_.useState(d===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:d),ie=_.useRef(null),ae=a.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),A=_.useRef(null),oe=_.useRef(!1),se=_.useCallback(e=>{C(t=>(t.find(t=>t.id===e.id)?.delete||zb.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return _.useEffect(()=>zb.subscribe(e=>{if(e.dismiss){requestAnimationFrame(()=>{C(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))});return}setTimeout(()=>{ya.flushSync(()=>{C(t=>{let n=t.findIndex(t=>t.id===e.id);return n===-1?[e,...t]:[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]})})})}),[S]),_.useEffect(()=>{if(d!==`system`){re(d);return}if(d===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?re(`dark`):re(`light`)),typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);try{e.addEventListener(`change`,({matches:e})=>{re(e?`dark`:`light`)})}catch{e.addListener(({matches:e})=>{try{re(e?`dark`:`light`)}catch(e){console.error(e)}})}},[d]),_.useEffect(()=>{S.length<=1&&ee(!1)},[S]),_.useEffect(()=>{let e=e=>{if(a.every(t=>e[t]||e.code===t)){var t;ee(!0),(t=ie.current)==null||t.focus()}e.code===`Escape`&&(document.activeElement===ie.current||ie.current?.contains(document.activeElement))&&ee(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a]),_.useEffect(()=>{if(ie.current)return()=>{A.current&&(A.current.focus({preventScroll:!0}),A.current=null,oe.current=!1)}},[ie.current]),_.createElement(`section`,{ref:t,"aria-label":`${x} ${ae}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0},T.map((t,n)=>{let[i,a]=t.split(`-`);return w.length?_.createElement(`ol`,{key:t,dir:v===`auto`?tx():v,tabIndex:-1,ref:ie,className:c,"data-sonner-toaster":!0,"data-sonner-theme":ne,"data-y-position":i,"data-x-position":a,style:{"--front-toast-height":`${E[0]?.height||0}px`,"--width":`${Jb}px`,"--gap":`${y}px`,...m,...nx(l,u)},onBlur:e=>{oe.current&&!e.currentTarget.contains(e.relatedTarget)&&(oe.current=!1,A.current&&=(A.current.focus({preventScroll:!0}),null))},onFocus:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`fal
66se`||oe.current||(oe.current=!0,A.current=e.relatedTarget)},onMouseEnter:()=>ee(!0),onMouseMove:()=>ee(!0),onMouseLeave:()=>{k||ee(!1)},onDragEnd:()=>ee(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||te(!0)},onPointerUp:()=>te(!1)},w.filter(e=>!e.position&&n===0||e.position===t).map((n,i)=>_.createElement(ex,{key:n.id,icons:b,index:i,toast:n,defaultRichColors:f,duration:g?.duration??p,className:g?.className,descriptionClassName:g?.descriptionClassName,invert:r,visibleToasts:h,closeButton:g?.closeButton??s,interacting:k,position:t,style:g?.style,unstyled:g?.unstyled,classNames:g?.classNames,cancelButtonStyle:g?.cancelButtonStyle,actionButtonStyle:g?.actionButtonStyle,closeButtonAriaLabel:g?.closeButtonAriaLabel,removeToast:se,toasts:w.filter(e=>e.position==n.position),heights:E.filter(e=>e.position==n.position),setHeights:D,expandByDefault:o,gap:y,expanded:O,swipeDirections:e.swipeDirections}))):null}))}),ix=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),ax=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),ox=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),sx=e=>{let t=ox(e);return t.charAt(0).toUpperCase()+t.slice(1)},cx={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`},lx=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},ux=(0,_.createContext)({}),dx=()=>(0,_.useContext)(ux),fx=(0,_.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=dx()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,_.createElement)(`svg`,{ref:c,...cx,width:t??l??cx.width,height:t??l??cx.height,stroke:e??f,strokeWidth:m,className:ix(`lucide`,p,i),...!a&&!lx(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,_.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),R=(e,t)=>{let n=(0,_.forwardRef)(({className:n,...r},i)=>(0,_.createElement)(fx,{ref:i,iconNode:t,className:ix(`lucide-${ax(sx(e))}`,`lucide-${e}`,n),...r}));return n.displayName=sx(e),n},px=R(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),mx=R(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),hx=R(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),gx=R(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),_x=R(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),vx=R(`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`}]]),yx=R(`book-open`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),bx=R(`brain-circuit`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M9 13a4.5 4.5 0 0 0 3-4`,key:`10igwf`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M12 13h4`,key:`1ku699`}],[`path`,{d:`M12 18h6a2 2 0 0 1 2 2v1`,key:`105ag5`}],[`path`,{d:`M12 8h8`,key:`1lhi5i`}],[`path`,{d:`M16 8V5a2 2 0 0 1 2-2`,key:`u6izg6`}],[`circle`,{cx:`16`,cy:`13`,r:`.5`,key:`ry7gng`}],[`circle`,{cx:`18`,cy:`3`,r:`.5`,key:`1aiba7`}],[`circle`,{cx:`20`,cy:`21`,r:`.5`,key:`yhc1fs`}],[`circle`,{cx:`20`,cy:`8`,r:`.5`,key:`1e43v0`}]]),xx=R(`calendar-clock`,[[`path`,{d:`M16 14v2.2l1.6 1`,key:`fo4ql5`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),Sx=R(`calendar`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}
66]]),Cx=R(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),wx=R(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Tx=R(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Ex=R(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Dx=R(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),Ox=R(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),kx=R(`circle-question-mark`,[[`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`}]]),Ax=R(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),jx=R(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),Mx=R(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),Nx=R(`cloud-off`,[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Px=R(`cloud-upload`,[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`m8 17 4-4 4 4`,key:`1quai1`}]]),Fx=R(`cloud`,[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]),Ix=R(`compass`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}]]),Lx=R(`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`}]]),Rx=R(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),zx=R(`dumbbell`,[[`path`,{d:`M17.596 12.768a2 2 0 1 0 2.829-2.829l-1.768-1.767a2 2 0 0 0 2.828-2.829l-2.828-2.828a2 2 0 0 0-2.829 2.828l-1.767-1.768a2 2 0 1 0-2.829 2.829z`,key:`9m4mmf`}],[`path`,{d:`m2.5 21.5 1.4-1.4`,key:`17g3f0`}],[`path`,{d:`m20.1 3.9 1.4-1.4`,key:`1qn309`}],[`path`,{d:`M5.343 21.485a2 2 0 1 0 2.829-2.828l1.767 1.768a2 2 0 1 0 2.829-2.829l-6.364-6.364a2 2 0 1 0-2.829 2.829l1.768 1.767a2 2 0 0 0-2.828 2.829z`,key:`1t2c92`}],[`path`,{d:`m9.6 14.4 4.8-4.8`,key:`6umqxw`}]]),Bx=R(`ear-off`,[[`path`,{d:`M6 18.5a3.5 3.5 0 1 0 7 0c0-1.57.92-2.52 2.04-3.46`,key:`1qngmn`}],[`path`,{d:`M6 8.5c0-.75.13-1.47.36-2.14`,key:`b06bma`}],[`path`,{d:`M8.8 3.15A6.5 6.5 0 0 1 19 8.5c0 1.63-.44 2.81-1.09 3.76`,key:`g10hsz`}],[`path`,{d:`M12.5 6A2.5 2.5 0 0 1 15 8.5M10 13a2 2 0 0 0 1.82-1.18`,key:`ygzou7`}],[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}]]),Vx=R(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Hx=R(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),Ux=R(`files`,[[`path`,{d:`M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8`,key:`14sh0y`}],[`path`,{d:`M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z`,key:`1970lx`}],[`path`,{d:`M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1`,key:`l4dndm`}]]),Wx=R(`fingerprint-pattern`,[[`path`,{d:`M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4`,key:`1nerag`}],[`path`,{d:`M14 13.12c0 2.38 0 6.38-1 8.88`,key:`o46ks0`}],[`path`,{d:`M17.29 21.02c.12-.6.43-2.3.5-3.02`,key:`ptglia`}],[`path`,{d:`M2 12a10 10 0 0 1 18-6`,key:`ydlgp0`}],[`path`,{d:`M2 16h.01`,key:`1gqxmh`}],[`path`,{d:`M21.8 16c.2-2 .131-5.354 0-6`,key:`drycrb`}],[`path`,{d:`M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2`,key:`1tidbn`}],[`path`,{d:`M8.65 22c.21-.66.45-1.32.57-2`,key:`13wd9y`}],[`path`,{d:`M9 6.8a6 6 0 0 1 9 5.2v2`,key:`1fr1j5`}]]),Gx=R(`folder-input`,[[`path`,{d:`M2 9V5a2 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 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),Kx=R(`folder-kanban`,[[`path`,{d:`M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z`,key:`1fr9dc`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M12 10v2`,key:`hh53o1`}],[`path`,{d:`M16 10v6`,key:`1d6xys`}]]),qx=R(`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`}]]),Jx=R(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),Yx=R(`heart`,[[`path`,{d:`M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5`,key:`mvr1a0`}]]),Xx=R(`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`}]]),Zx=R(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}
66]]),Qx=R(`landmark`,[[`path`,{d:`M10 18v-7`,key:`wt116b`}],[`path`,{d:`M11.119 2.205a2 2 0 0 1 1.762 0l7.84 3.846A.5.5 0 0 1 20.5 7h-17a.5.5 0 0 1-.22-.949z`,key:`yxxwt6`}],[`path`,{d:`M14 18v-7`,key:`vav6t3`}],[`path`,{d:`M18 18v-7`,key:`aexdmj`}],[`path`,{d:`M3 22h18`,key:`8prr45`}],[`path`,{d:`M6 18v-7`,key:`1ivflk`}]]),$x=R(`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`}]]),eS=R(`library`,[[`path`,{d:`m16 6 4 14`,key:`ji33uf`}],[`path`,{d:`M12 6v14`,key:`1n7gus`}],[`path`,{d:`M8 8v12`,key:`1gg7y9`}],[`path`,{d:`M4 4v16`,key:`6qkkli`}]]),tS=R(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),nS=R(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),rS=R(`list-todo`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]),iS=R(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),aS=R(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),oS=R(`log-in`,[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]),sS=R(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),cS=R(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),lS=R(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),uS=R(`message-circle`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}]]),dS=R(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),fS=R(`messages-square`,[[`path`,{d:`M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z`,key:`1n2ejm`}],[`path`,{d:`M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1`,key:`1qfcsi`}]]),pS=R(`mic`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`,key:`1vc78b`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`13`,rx:`3`,key:`s6n7sd`}]]),mS=R(`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`}]]),hS=R(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),gS=R(`octagon-x`,[[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z`,key:`2d38gg`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),_S=R(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),vS=R(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),yS=R(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),bS=R(`pen-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),xS=R(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),SS=R(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),CS=R(`radio`,[[`path`,{d:`M16.247 7.761a6 6 0 0 1 0 8.478`,key:`1fwjs5`}],[`path`,{d:`M19.075 4.933a10 10 0 0 1 0 14.134`,key:`ehdyv1`}],[`path`,{d:`M4.925 19.067a10 10 0 0 1 0-14.134`,key:`1q22gi`}],[`path`,{d:`M7.753 16.239a6 6 0 0 1 0-8.478`,key:`r2q7qm`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]),wS=R(`repeat`,[[`path`,{d:`m17 2 4 4-4 4`,key:`nntrym`}],[`path`,{d:`M3 11v-1a4 4 0 0 1 4-4h14`,key:`84bu3i`}],[`path`,{d:`m7 22-4-4 4-4`,key:`1wqhfi`}],[`path`,{d:`M21 13v1a4 4 0 0 1-4 4H3`,key:`1rx37r`}]]),TS=R(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),ES=R(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),DS=R(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}
66]]),OS=R(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),kS=R(`share`,[[`path`,{d:`M12 2v13`,key:`1km8f5`}],[`path`,{d:`m16 6-4-4-4 4`,key:`13yo43`}],[`path`,{d:`M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8`,key:`1b2hhj`}]]),AS=R(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),jS=R(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),MS=R(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),NS=R(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),PS=R(`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`}]]),FS=R(`target`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`6`,key:`1vlfrh`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]),IS=R(`trash`,[[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),LS=R(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),RS=R(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),zS=R(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),BS=R(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),VS=({...e})=>{let{theme:t=`system`}=ua();return(0,M.jsx)(rx,{theme:t,className:`toaster group`,icons:{success:(0,M.jsx)(Ox,{className:`size-4`}),info:(0,M.jsx)(Zx,{className:`size-4`}),warning:(0,M.jsx)(LS,{className:`size-4`}),error:(0,M.jsx)(gS,{className:`size-4`}),loading:(0,M.jsx)(iS,{className:`size-4 animate-spin`})},style:{"--normal-bg":`var(--popover)`,"--normal-text":`var(--popover-foreground)`,"--normal-border":`var(--border)`,"--border-radius":`var(--radius)`},toastOptions:{classNames:{toast:`cn-toast`}},...e})};function HS({...e}){return(0,M.jsx)(Fh,{"data-slot":`dropdown-menu`,...e})}function US({...e}){return(0,M.jsx)(Ih,{"data-slot":`dropdown-menu-trigger`,...e})}function WS({className:e,align:t=`start`,sideOffset:n=4,...r}){return(0,M.jsx)(Lh,{children:(0,M.jsx)(Rh,{"data-slot":`dropdown-menu-content`,sideOffset:n,align:t,className:L(`z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground
66/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:overflow-hidden data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r})})}function GS({...e}){return(0,M.jsx)(zh,{"data-slot":`dropdown-menu-group`,...e})}function KS({className:e,inset:t,variant:n=`default`,...r}){return(0,M.jsx)(Bh,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:L(`group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive`,e),...r})}function qS({className:e,inset:t,...n}){return(0,M.jsx)(fee,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:L(`px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7`,e),...n})}function JS({className:e,...t}){return(0,M.jsx)(pee,{"data-slot":`dropdown-menu-separator`,className:L(`-mx-1 my-1 h-px bg-border`,e),...t})}function YS({...e}){return(0,M.jsx)(mee,{"data-slot":`dropdown-menu-sub`,...e})}function XS({className:e,inset:t,children:n,...r}){return(0,M.jsxs)(hee,{"data-slot":`dropdown-menu-sub-trigger`,"data-inset":t,className:L(`flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,M.jsx)(Tx,{className:`ml-auto`})]})}function ZS({className:e,...t}){return(0,M.jsx)(gee,{"data-slot":`dropdown-menu-sub-content`,className:L(`z-50 min-w-[96px] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...t})}var QS=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,$S=gy,eC=(e,t)=>n=>{if(t?.variants==null)return $S(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=QS(t)||QS(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 $S(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)},tC=768;function nC(){let[e,t]=_.useState(void 0);return _.useEffect(()=>{let e=window.matchMedia(`(max-width: ${tC-1}px)`),n=()=>{t(window.innerWidth<tC)};return e.addEventListener(`change`,n),t(window.innerWidth<tC),()=>e.removeEventListener(`change`,n)},[]),!!e}var rC=eC(`group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,outline:`border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focu
66s-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,xs:`h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,icon:`size-8`,"icon-xs":`size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg`,"icon-lg":`size-9`}},defaultVariants:{variant:`default`,size:`default`}});function z({className:e,variant:t=`default`,size:n=`default`,asChild:r=!1,...i}){return(0,M.jsx)(r?wa:`button`,{"data-slot":`button`,"data-variant":t,"data-size":n,className:L(rC({variant:t,size:n,className:e})),...i})}function iC({className:e,type:t,...n}){return(0,M.jsx)(`input`,{type:t,"data-slot":`input`,className:L(`h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...n})}function aC({className:e,orientation:t=`horizontal`,decorative:n=!0,...r}){return(0,M.jsx)(Xee,{"data-slot":`separator`,decorative:n,orientation:t,className:L(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,e),...r})}function oC({...e}){return(0,M.jsx)(Ml,{"data-slot":`sheet`,...e})}function sC({...e}){return(0,M.jsx)(Pl,{"data-slot":`sheet-portal`,...e})}function cC({className:e,...t}){return(0,M.jsx)(Fl,{"data-slot":`sheet-overlay`,className:L(`fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function lC({className:e,children:t,side:n=`right`,showCloseButton:r=!0,...i}){return(0,M.jsxs)(sC,{children:[(0,M.jsx)(cC,{}),(0,M.jsxs)(Il,{"data-slot":`sheet-content`,"data-side":n,className:L(`fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-[side=bottom]:data-open:slide-in-from-bottom-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:animate-out data-closed:fade-out-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=right]:data-closed:sli
66de-out-to-right-10 data-[side=top]:data-closed:slide-out-to-top-10`,e),...i,children:[t,r&&(0,M.jsx)(zl,{"data-slot":`sheet-close`,asChild:!0,children:(0,M.jsxs)(z,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`,children:[(0,M.jsx)(BS,{}),(0,M.jsx)(`span`,{className:`sr-only`,children:`Close`})]})})]})]})}function uC({className:e,...t}){return(0,M.jsx)(`div`,{"data-slot":`sheet-header`,className:L(`flex flex-col gap-0.5 p-4`,e),...t})}function dC({className:e,...t}){return(0,M.jsx)(Ll,{"data-slot":`sheet-title`,className:L(`font-heading text-base font-medium text-foreground`,e),...t})}function fC({className:e,...t}){return(0,M.jsx)(Rl,{"data-slot":`sheet-description`,className:L(`text-sm text-muted-foreground`,e),...t})}function pC({className:e,...t}){return(0,M.jsx)(`div`,{"data-slot":`skeleton`,className:L(`animate-pulse rounded-md bg-muted`,e),...t})}var mC=`sidebar_state`,hC=3600*24*7,gC=`16rem`,_C=`18rem`,vC=`3rem`,yC=`b`,bC=_.createContext(null);function xC(){let e=_.useContext(bC);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function SC({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:i,children:a,...o}){let s=nC(),[c,l]=_.useState(!1),[u,d]=_.useState(e),f=t??u,p=_.useCallback(e=>{let t=typeof e==`function`?e(f):e;n?n(t):d(t),document.cookie=`${mC}=${t}; path=/; max-age=${hC}`},[n,f]),m=_.useCallback(()=>s?l(e=>!e):p(e=>!e),[s,p,l]);_.useEffect(()=>{let e=e=>{e.key===yC&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),m())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[m]);let h=f?`expanded`:`collapsed`,g=_.useMemo(()=>({state:h,open:f,setOpen:p,isMobile:s,openMobile:c,setOpenMobile:l,toggleSidebar:m}),[h,f,p,s,c,l,m]);return(0,M.jsx)(bC.Provider,{value:g,children:(0,M.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:{"--sidebar-width":gC,"--sidebar-width-icon":vC,...i},className:L(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),...o,children:a})})}function CC({side:e=`left`,variant:t=`sidebar`,collapsible:n=`offcanvas`,className:r,children:i,dir:a,...o}){let{isMobile:s,state:c,openMobile:l,setOpenMobile:u}=xC();return n===`none`?(0,M.jsx)(`div`,{"data-slot":`sidebar`,className:L(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),...o,children:i}):s?(0,M.jsx)(oC,{open:l,onOpenChange:u,...o,children:(0,M.jsxs)(lC,{dir:a,"data-sidebar":`sidebar`,"data-slot":`sidebar`,"data-mobile":`true`,className:`w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden`,style:{"--sidebar-width":_C},side:e,children:[(0,M.jsxs)(uC,{className:`sr-only`,children:[(0,M.jsx)(dC,{children:`Sidebar`}),(0,M.jsx)(fC,{children:`Displays the mobile sidebar.`})]}),(0,M.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:i})]})}):(0,M.jsxs)(`div`,{className:`group peer hidden text-sidebar-foreground md:block`,"data-state":c,"data-collapsible":c===`collapsed`?n:``,"data-variant":t,"data-side":e,"data-slot":`sidebar`,children:[(0,M.jsx)(`div`,{"data-slot":`sidebar-gap`,className:L(`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,M.jsx)(`div`,{"data-slot":`sidebar-container`,"data-side":e,className:L(`fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex`,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),...o,children:(0,M.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:i})})]})}function wC({className:e,onClick:t,...n}){let{toggleSidebar:r}=xC();return(0,M.jsxs)(z,{"data-sidebar":`trigger`,"data-slot":`sidebar-tr
66igger`,variant:`ghost`,size:`icon-sm`,className:L(e),onClick:e=>{t?.(e),r()},...n,children:[(0,M.jsx)(vS,{}),(0,M.jsx)(`span`,{className:`sr-only`,children:`Toggle Sidebar`})]})}function TC({className:e,...t}){return(0,M.jsx)(`main`,{"data-slot":`sidebar-inset`,className:L(`relative flex w-full flex-1 flex-col bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2`,e),...t})}function EC({className:e,...t}){return(0,M.jsx)(`div`,{"data-slot":`sidebar-header`,"data-sidebar":`header`,className:L(`flex flex-col gap-2 p-2`,e),...t})}function DC({className:e,...t}){return(0,M.jsx)(`div`,{"data-slot":`sidebar-footer`,"data-sidebar":`footer`,className:L(`flex flex-col gap-2 p-2`,e),...t})}function OC({className:e,...t}){return(0,M.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:L(`no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,e),...t})}function kC({className:e,...t}){return(0,M.jsx)(`div`,{"data-slot":`sidebar-group`,"data-sidebar":`group`,className:L(`relative flex w-full min-w-0 flex-col p-2`,e),...t})}function AC({className:e,asChild:t=!1,...n}){return(0,M.jsx)(t?wa:`div`,{"data-slot":`sidebar-group-label`,"data-sidebar":`group-label`,className:L(`flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,e),...n})}function jC({className:e,...t}){return(0,M.jsx)(`div`,{"data-slot":`sidebar-group-content`,"data-sidebar":`group-content`,className:L(`w-full text-sm`,e),...t})}function MC({className:e,...t}){return(0,M.jsx)(`ul`,{"data-slot":`sidebar-menu`,"data-sidebar":`menu`,className:L(`flex w-full min-w-0 flex-col gap-0`,e),...t})}function NC({className:e,...t}){return(0,M.jsx)(`li`,{"data-slot":`sidebar-menu-item`,"data-sidebar":`menu-item`,className:L(`group/menu-item relative`,e),...t})}var PC=eC(`peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate`,{variants:{variant:{default:`hover:bg-sidebar-accent hover:text-sidebar-accent-foreground`,outline:`bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]`},size:{default:`h-8 text-sm`,sm:`h-7 text-xs`,lg:`h-12 text-sm group-data-[collapsible=icon]:p-0!`}},defaultVariants:{variant:`default`,size:`default`}});function FC({asChild:e=!1,isActive:t=!1,variant:n=`default`,size:r=`default`,tooltip:i,className:a,...o}){let s=e?wa:`button`,{isMobile:c,state:l}=xC(),u=(0,M.jsx)(s,{"data-slot":`sidebar-menu-button`,"data-sidebar":`menu-button`,"data-size":r,"data-active":t,className:L(PC({variant:n,size:r}),a),...o});return i?(typeof i==`string`&&(i={children:i}),(0,M.jsxs)(Tb,{children:[(0,M.jsx)(Eb,{asChild:!0,children:u}),(0,M.jsx)(Db,{side:`right`,align:`center`,hidden:l!==`collapsed`||c,...i})]})):u}function IC({className:e,asChild:t=!1,showOnHover:n=!1,...r}){return(0,M.jsx)(t?wa:`button`,{"data-slot":`sidebar-menu-action`,"data-sidebar":`menu-action`,className:L(`absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0`,n&&`group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-active/menu-button:text-sidebar-accent-foreground aria-expanded:opacity-100 md:opacity-0`,e),...r})}var LC=new Set([`/inbox`,`/notes`,`/tasks`,`/capture`,`/chat`,`/voice`,`/held`,`/projects`,`/areas`,`/resources`,`/settings`,`/playground`,`/mockup`]),RC=new Set([`/inbox`,`/notes`]),zC=new Set([`/projects`,`/areas`,`/resources`]);function BC(e){let t=e.replace(/^#/,``)||`/chat`,n=t.match(/^(\/inbox|\/notes|\/projects|\/areas|\/resources|\/chat)(?:\/([^/]+))?$/);return n&&RC.has(n[1])?{page:n[1],noteId:n[2]?n[2]:null}:n&&zC.has(n[1])?{page:n[1],noteId:null,containerId:n[2]?n[2]:null}:n&&n[1]===`/chat`?{page:`/chat`,noteId:null,chatSessionId:n[2]?n[2]:null}:LC.has(t)?{page:t,noteId:null}:{page:`/inbox`,noteId:null}}function VC(e){return`containerId`in e&&e.containerId!==null?`#${e.page}/${e.containerId}`:`chatSessionId`in e&&e.chatSessionId!==null?`#${e.page}/${e.chatSessionId}`:e.noteId===null?`#${e.page}`:`#${e.page}/${e.noteId}`}function HC(){let[e,t]=(0,_.useState)(()=>BC(window.location.hash));return(0,_.useEffect)(()=>{let e=()=>t(BC(window.location.hash));return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[]),e}function UC(){return HC().page}function WC(e,t){let n=typeof e==`string`?e===`/inbox`||e===`/notes`?{page:e,noteId:t??null}:e===`/projects`||e===`/areas`||e===`/resources`?{page:e,noteId:null,containerId:null}:e===`/chat`?{page:`/chat`,noteId:null,chatSessionId:null}:{page:e,noteId:null}:e;window.location.hash=VC(n)}function GC(e,t){WC({page:e,noteId:null,containerId:t})}function KC(e){WC({page:`/chat`,noteId:null,chatSessionId:e})}function qC(){return HC().noteId}function JC(){let e=HC();return`containerId`in e?e.containerId:null}function YC(){let e=HC();return`chatSessionId`in e?e.chatSessionId:null}function XC({to:e,children:t,onClick:n,...r}){return(0,M.jsx)(`a`,{...r,href:`#${e}`,onClick:t=>{n?.(t),!t.defaultPrevented&&(t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(t.preventDefault(),WC(e)))},children:t})}function ZC(e,t){return new Proxy({},{get(n,r){if(typeof r==`string`)return ZC(e,[...t,r]);if(r===ur){if(t.length<1){let n=[e,...t].join(`.`);throw Error(`API path is expected to be of the form \`${e}.childComponent.functionName\`. Found: \`${n}\``)}return`_reference/childComponent/`+t.join(`/`)}else return}})}var QC=()=>ZC(`components`,[]),$C=Object.defineProperty,ew=(e,t,n)=>t in e?$C(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,tw=(e,t,n)=>ew(e,typeof t==`symbol`?t:t+``,n),nw=class{constructor(e){tw(this,`indexes`),tw(this,`stagedDbIndexes`),tw(this,`searchIndexes`),tw(this,`stagedSearchIndexes`),tw(this,`vectorIndexes`),tw(this,`stagedVectorIndexes`),tw(this,`validator`),this.indexes=[],this.stagedDbIndexes=[],this.searchIndexes=[],this.stagedSearchIndexes=[],this.vectorIndexes=[],this.stagedVectorIndexes=[],this.validator=e}" indexes"(){return this.indexes}index(e,t){return Array.isArray(t)?this.indexes.push({indexDescriptor:e,fields:t}):t.staged?this.stagedDbIndexes.push({indexDescriptor:e,fields:t.fields}):this.indexes.push({indexDescriptor:e,fields:t.fields}),this}searchIndex(e,t){return t.staged?this.stagedSearchIndexes.push({indexDescriptor:e,searchField:t.searchField,filterFields:t.filterFields||[]}):this.searchIndexes.push({indexDescriptor:e,searchField:t.searchField,filterFields:t.filterFields||[]}),this}
66vectorIndex(e,t){return t.staged?this.stagedVectorIndexes.push({indexDescriptor:e,vectorField:t.vectorField,dimensions:t.dimensions,filterFields:t.filterFields||[]}):this.vectorIndexes.push({indexDescriptor:e,vectorField:t.vectorField,dimensions:t.dimensions,filterFields:t.filterFields||[]}),this}self(){return this}export(){let e=this.validator.json;if(typeof e!=`object`)throw Error("Invalid validator: please make sure that the parameter of `defineTable` is valid (see https://docs.convex.dev/database/schemas)");return{indexes:this.indexes,stagedDbIndexes:this.stagedDbIndexes,searchIndexes:this.searchIndexes,stagedSearchIndexes:this.stagedSearchIndexes,vectorIndexes:this.vectorIndexes,stagedVectorIndexes:this.stagedVectorIndexes,documentType:e}}};function rw(e){return jn(e)?new nw(e):new nw(j.object(e))}var iw=class{constructor(e,t){tw(this,`tables`),tw(this,`strictTableNameTypes`),tw(this,`schemaValidation`),this.tables=e,this.schemaValidation=t?.schemaValidation===void 0?!0:t.schemaValidation}export(){return JSON.stringify({tables:Object.entries(this.tables).map(([e,t])=>{let{indexes:n,stagedDbIndexes:r,searchIndexes:i,stagedSearchIndexes:a,vectorIndexes:o,stagedVectorIndexes:s,documentType:c}=t.export();return{tableName:e,indexes:n,stagedDbIndexes:r,searchIndexes:i,stagedSearchIndexes:a,vectorIndexes:o,stagedVectorIndexes:s,documentType:c}}),schemaValidation:this.schemaValidation})}};function aw(e,t){return new iw(e,t)}aw({_scheduled_functions:rw({name:j.string(),args:j.array(j.any()),scheduledTime:j.float64(),completedTime:j.optional(j.float64()),state:j.union(j.object({kind:j.literal(`pending`)}),j.object({kind:j.literal(`inProgress`)}),j.object({kind:j.literal(`success`)}),j.object({kind:j.literal(`failed`),error:j.string()}),j.object({kind:j.literal(`canceled`)}))}),_storage:rw({sha256:j.string(),size:j.float64(),contentType:j.optional(j.string())})});var B=_r;QC();function ow({...e}){return(0,M.jsx)(fo,{"data-slot":`collapsible`,...e})}function sw({...e}){return(0,M.jsx)(oo,{"data-slot":`collapsible-trigger`,...e})}function cw({...e}){return(0,M.jsx)(co,{"data-slot":`collapsible-content`,...e})}function lw({...e}){return(0,M.jsx)(Ml,{"data-slot":`dialog`,...e})}function uw({...e}){return(0,M.jsx)(Nl,{"data-slot":`dialog-trigger`,...e})}function dw({...e}){return(0,M.jsx)(Pl,{"data-slot":`dialog-portal`,...e})}function fw({...e}){return(0,M.jsx)(zl,{"data-slot":`dialog-close`,...e})}function pw({className:e,...t}){return(0,M.jsx)(Fl,{"data-slot":`dialog-overlay`,className:L(`fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function mw({className:e,children:t,showCloseButton:n=!0,...r}){return(0,M.jsxs)(dw,{children:[(0,M.jsx)(pw,{}),(0,M.jsxs)(Il,{"data-slot":`dialog-content`,className:L(`fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[t,n&&(0,M.jsx)(zl,{"data-slot":`dialog-close`,asChild:!0,children:(0,M.jsxs)(z,{variant:`ghost`,className:`absolute top-2 right-2`,size:`icon-sm`,children:[(0,M.jsx)(BS,{}),(0,M.jsx)(`span`,{className:`sr-only`,children:`Close`})]})})]})]})}function hw({className:e,...t}){return(0,M.jsx)(`div`,{"data-slot":`dialog-header`,className:L(`flex flex-col gap-2`,e),...t})}function gw({className:e,showCloseButton:t=!1,children:n,...r}){return(0,M.jsxs)(`div`,{"data-slot":`dialog-footer`,className:L(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,M.jsx)(zl,{asChild:!0,children:(0,M.jsx)(z,{variant:`outline`,children:`Close`})})]})}function _w({className:e,...t}){return(0,M.jsx)(Ll,{"data-slot":`dialog-title`,className:L(`font-heading text-base leading-none font-medium`,e),...t})}function vw({className:e,...t}){return(0,M.jsx)(Rl,{"data-slot":`dialog-description`,className:L(`text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function yw(){let{isAuthenticated:e}=Ki(),t=YC(),n=Fi(B.chatSessions.queries.list,e?{}:`skip`),r=Ii(B.chatSessions.mutations.create),i=Ii(B.chatSessions.mutations.archive),[a,o]=(0,_.useState)(null);if(!e)return null;let s=t??n?.[0]?._id??null;return(0,M.jsxs)(ow,{defaultOpen:!0,className:`group/chat-sessions`,children:[(0,M.jsxs)(kC,{children:[(0,M.jsx)(AC,{asChild:!0,children:(0,M.jsxs)(sw,{className:`flex w-full items-center`,children:[(0,M.jsx)(`span`,{children:`Chats`}),(0,M.jsx)(wx,{className:`ml-auto size-4 transition-transform group-data-[state=closed]/chat-sessions:-rotate-90`})]})}),(0,M.jsx)(cw,{children:(0,M.jsx)(jC,{children:(0,M.jsxs)(MC,{children:[(0,M.jsx)(NC,{children:(0,M.jsxs)(FC,{tooltip:`New chat`,onClick:()=>{(async()=>{KC(await r({}))})()},children:[(0,M.jsx)(SS,{}),(0,M.jsx)(`span`,{children:`New chat`})]})}),n?.map(e=>(0,M.jsxs)(NC,{className:`group/menu-item`,children:[(0,M.jsxs)(FC,{isActive:e._id===s,tooltip:e.title,onClick:()=>
66KC(e._id),children:[(0,M.jsx)(uS,{}),(0,M.jsx)(`span`,{className:`truncate`,children:e.title})]}),(0,M.jsxs)(HS,{children:[(0,M.jsx)(US,{asChild:!0,children:(0,M.jsxs)(IC,{showOnHover:!0,children:[(0,M.jsx)(Vx,{}),(0,M.jsx)(`span`,{className:`sr-only`,children:`Session options`})]})}),(0,M.jsxs)(WS,{side:`right`,align:`start`,children:[(0,M.jsxs)(KS,{onSelect:()=>o({id:e._id,title:e.title}),children:[(0,M.jsx)(xS,{}),` Rename`]}),(0,M.jsxs)(KS,{variant:`destructive`,onSelect:()=>{(async()=>{await i({id:e._id}),e._id===s&&KC(null)})()},children:[(0,M.jsx)(px,{}),` Archive`]})]})]})]},e._id))]})})})]}),(0,M.jsx)(Vte,{session:a,onOpenChange:e=>{e||o(null)}})]})}function Vte({session:e,onOpenChange:t}){return(0,M.jsx)(lw,{open:e!==null,onOpenChange:t,children:(0,M.jsxs)(mw,{children:[(0,M.jsx)(hw,{children:(0,M.jsx)(_w,{children:`Rename chat`})}),e!==null&&(0,M.jsx)(Hte,{session:e,onDone:()=>t(!1)},e.id)]})})}function Hte({session:e,onDone:t}){let n=Ii(B.chatSessions.mutations.rename),[r,i]=(0,_.useState)(e.title);return(0,M.jsxs)(`form`,{onSubmit:i=>{i.preventDefault();let a=r.trim();a!==``&&(async()=>{await n({id:e.id,title:a}),t()})()},children:[(0,M.jsx)(iC,{autoFocus:!0,value:r,onChange:e=>i(e.target.value),placeholder:`Chat title`}),(0,M.jsx)(gw,{className:`mt-4`,children:(0,M.jsx)(z,{type:`submit`,disabled:r.trim()===``,children:`Save`})})]})}function bw(){return typeof window>`u`?!1:window.matchMedia(`(display-mode: standalone)`).matches}function Ute(){return typeof navigator>`u`?!1:/iPad|iPhone|iPod/.test(navigator.userAgent)}function xw(){return typeof window>`u`?!1:(window.location.hash.replace(/^#/,``)||`/inbox`)===`/capture`}function Wte(){let[e,t]=(0,_.useState)(()=>xw()&&bw());return(0,_.useEffect)(()=>{let e=()=>{t(xw()&&bw())};return e(),window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[]),e}function Gte(){let[e,t]=(0,_.useState)(null),[n,r]=(0,_.useState)(bw);(0,_.useEffect)(()=>{let e=e=>{e.preventDefault(),t(e)},n=()=>{r(!0),t(null)};return window.addEventListener(`beforeinstallprompt`,e),window.addEventListener(`appinstalled`,n),()=>{window.removeEventListener(`beforeinstallprompt`,e),window.removeEventListener(`appinstalled`,n)}},[]);let i=(0,_.useCallback)(async()=>{if(e===null)return!1;await e.prompt();let{outcome:n}=await e.userChoice;return n===`accepted`?(t(null),r(!0),!0):!1},[e]);return n?{status:`installed`}:e===null?{status:`manual`,platform:Ute()?`ios`:`other`}:{status:`promptable`,promptInstall:i}}function Sw({variant:e=`default`}){let t=Gte();return t.status===`installed`?null:t.status===`promptable`?(0,M.jsx)(Kte,{variant:e,onClick:()=>void t.promptInstall()}):(0,M.jsx)(qte,{variant:e,platform:t.platform})}function Kte({variant:e,onClick:t}){return e===`prominent`?(0,M.jsxs)(`div`,{className:`rounded-lg border border-border bg-muted/40 px-4 py-3 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,M.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,M.jsx)(MS,{className:`size-5 shrink-0 mt-0.5 text-primary`}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`p`,{className:`text-sm font-medium`,children:`Install for one-tap capture`}),(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Add XO Brain to your home screen â opens straight to capture.`})]})]}),(0,M.jsxs)(z,{onClick:t,className:`shrink-0`,children:[(0,M.jsx)(Rx,{}),`Install app`]})]}):(0,M.jsxs)(z,{variant:`outline`,size:`sm`,onClick:t,className:`w-full`,children:[(0,M.jsx)(Rx,{}),`Install app`]})}function qte({variant:e,platform:t}){let[n,r]=(0,_.useState)(!1),i=e===`prominent`?(0,M.jsxs)(z,{variant:`outline`,className:`shrink-0`,children:[(0,M.jsx)(Rx,{}),`How to install`]}):(0,M.jsxs)(z,{variant:`outline`,size:`sm`,className:`w-full`,children:[(0,M.jsx)(Rx,{}),`Install app`]});return(0,M.jsxs)(lw,{open:n,onOpenChange:r,children:[e===`prominent`?(0,M.jsxs)(`div`,{className:`rounded-lg border border-border bg-muted/40 px-4 py-3 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,M.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,M.jsx)(MS,{className:`size-5 shrink-0 mt-0.5 text-primary`}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`p`,{className:`text-sm font-medium`,children:`Install for one-tap capture`}),(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Add XO Brain to your home screen â opens straight to capture.`})]})]}),(0,M.jsx)(uw,{asChild:!0,children:i})]}):(0,M.jsx)(uw,{asChild:!0,children:i}),(0,M.jsxs)(mw,{children:[(0,M.jsxs)(hw,{children:[(0,M.jsx)(_w,{children:`Install XO Brain`}),(0,M.jsx)(vw,{children:`A home-screen icon opens capture in one tap â no browser chrome.`})]}),t===`ios`?(0,M.jsx)(Jte,{}):(0,M.jsx)(Yte,{})]})]})}function Jte(){return(0,M.jsxs)(`ol`,{className:`list-decimal space-y-2 pl-5 text-sm text-muted-foreground`,children:[(0,M.jsxs)(`li`,{children:[`Tap the `,(0,M.jsx)(kS,{className:`inline size-4 align-text-bottom`}),` `,(0,M.jsx)(`strong`,{className:`text-foreground`,children:`Share`}),` button in Safari's toolbar.`]}),(0,M.jsxs)(`li`,{children:[`Scroll down and tap`,` `,(0,M.jsx)(`strong`,{className:`text-foreground`,children:`Add to Home Screen`}),`.`]}),(0,M.jsxs)(`li`,{children:[`Tap `,(0,M.jsx)(`strong`,{className:`text-foreground`,children:`Add`}),`. The icon opens straight to capture.`]})]})}function Yte(){return(0,M.jsxs)(`ol`,{className:`list-decimal space-y-2 pl-5 text-sm text-muted-foreground`,children:[(0,M.jsxs)(`li`,{children:[`Look for the `,(0,M.jsx)(`strong`,{className:`text-foreground`,children:`install`}),` icon in your browser's address bar (Chrome, Edge) or the`,` `,(0,M.jsx)(`strong`,{className:`text-foreground`,children:`Share / Install`}),` menu.`]}),(0,M.jsxs)(`li`,{children:[`Choose `,(0,M.jsx)(`strong`,{className:`text-foreground`,children:`Install XO Brain`}),` (or âAdd to Dockâ on macOS).`]}),(0,M.jsxs)(`li`,{children:[`If you don't see it yet, use a production build (`,(0,M.jsx)(`code`,{className:`text-foreground`,children:`npm run build && npm run preview`}),`) â local dev may not register the install prompt until the service worker is active.`]})]})}function Xte(){return typeof navigator>`u`?!0:navigator.onLine}function Cw(){let[e,t]=(0,_.useState)(Xte);return(0,_.useEffect)(()=>{let e=()=>t(!0),n=()=>t(!1);return window.addEventListener(`online`,e),window.addEventListener(`offline`,n),()=>{window.removeEventListener(`online`,e),window.removeEventListener(`offline`,n)}},[]),{isOnline:e}}var Zte=`xo-brain-offline`,Qte=1,ww=`pendingCaptures`;function $te(){return new Promise((e,t)=>
66{let n=indexedDB.open(Zte,Qte);n.onerror=()=>t(n.error??Error(`IndexedDB open failed`)),n.onupgradeneeded=()=>{let e=n.result;e.objectStoreNames.contains(ww)||e.createObjectStore(ww,{keyPath:`localId`})},n.onsuccess=()=>e(n.result)})}function Tw(e,t){return $te().then(n=>new Promise((r,i)=>{let a=n.transaction(ww,e),o=t(a.objectStore(ww)),s;o.onerror=()=>i(o.error??Error(`IndexedDB request failed`)),o.onsuccess=()=>{s=o.result},a.onerror=()=>i(a.error??Error(`IndexedDB transaction failed`)),a.oncomplete=()=>{n.close(),r(s)}}))}function ene(){return{async add(e){let t={localId:crypto.randomUUID(),body:e,createdAt:Date.now(),syncStatus:`pending`};return await Tw(`readwrite`,e=>e.put(t)),t},async list(){return(await Tw(`readonly`,e=>e.getAll())).sort((e,t)=>t.createdAt-e.createdAt)},async update(e,t){let n=await Tw(`readonly`,t=>t.get(e));if(n===void 0)throw Error(`Pending capture not found: ${e}`);await Tw(`readwrite`,e=>e.put({...n,...t}))},async remove(e){await Tw(`readwrite`,t=>t.delete(e))}}}async function tne(e,t){let n=(await e.list()).filter(e=>e.syncStatus!==`syncing`),r=0,i=0;for(let a of n){await e.update(a.localId,{syncStatus:`syncing`,lastSyncError:void 0});try{await t(a.body),await e.remove(a.localId),r+=1}catch(t){i+=1,await e.update(a.localId,{syncStatus:`failed`,lastSyncError:t instanceof Error?t.message:`Upload failed`})}}return{syncedCount:r,failedCount:i}}function nne(e){let t=[],n=!1,r=!1,i=new Set,a={pendingCaptures:t,isSyncing:n,canSyncToServer:e.getCanSyncToServer()},o=()=>{for(let e of i)e()},s=()=>{let r=e.getCanSyncToServer();a.pendingCaptures===t&&a.isSyncing===n&&a.canSyncToServer===r||(a={pendingCaptures:t,isSyncing:n,canSyncToServer:r},o())},c=()=>a,l=async()=>{t=await e.store.list(),s()},u=async()=>{if(!(!e.getCanSyncToServer()||r)){r=!0,n=!0,s();try{await tne(e.store,e.upload),await l()}finally{r=!1,n=!1,s()}}},d=()=>{s(),e.getCanSyncToServer()&&t.length>0&&u()};return l(),{enqueueCapture:async t=>{let n=t.trim();if(n===``)throw Error(`Body cannot be empty`);if(e.getCanSyncToServer())try{return await e.upload(n),`server`}catch{}return await e.store.add(n),await l(),d(),`local`},syncPending:u,refreshPending:l,getSnapshot:c,subscribe:e=>(i.add(e),()=>i.delete(e)),notifyConnectivityChanged:d,dispose:()=>{i.clear()}}}var Ew=(0,_.createContext)(null);function rne({children:e,store:t}){let n=(0,_.useMemo)(()=>t??ene(),[t]),{isOnline:r}=Cw(),{user:i}=wt(),a=Ii(B.notes.mutations.captureBrainDump),o=(0,_.useRef)(r),s=(0,_.useRef)(i);o.current=r,s.current=i;let c=(0,_.useRef)(null);c.current===null&&(c.current=nne({store:n,upload:e=>a({body:e}),getCanSyncToServer:()=>o.current&&!!s.current}));let l=c.current,u=(0,_.useSyncExternalStore)(e=>l.subscribe(e),()=>l.getSnapshot(),()=>l.getSnapshot());(0,_.useEffect)(()=>{l.notifyConnectivityChanged()},[l,r,i]),(0,_.useEffect)(()=>()=>l.dispose(),[l]);let d=(0,_.useMemo)(()=>({isOnline:r,canSyncToServer:u.canSyncToServer,pendingCaptures:u.pendingCaptures,isSyncing:u.isSyncing,enqueueCapture:e=>l.enqueueCapture(e),syncPending:()=>l.syncPending(),refreshPending:()=>l.refreshPending()}),[r,u,l]);return(0,M.jsx)(Ew.Provider,{value:d,children:e})}function Dw(){let e=(0,_.useContext)(Ew);if(e===null)throw Error(`useOfflineCapture must be used within OfflineCaptureProvider`);return e}function ine(e){let{route:t,isOnline:n,isAuthenticated:r,pendingCaptureCount:i}=e,a=n&&r,o=a,s=a,c=!n&&(t===`/notes`||t===`/tasks`||t===`/projects`||t===`/areas`||t===`/resources`||t===`/chat`||t===`/voice`||t===`/held`||t===`/settings`||t===`/playground`),l=n&&!r?`sign-in-required`:`editor`,u=n?`live-inbox`:`pending-only`,d=n?[`chat`,`voice`,`capture`,`inbox`,`tasks`,`all-notes`,`projects`,`areas`,`resources`,`held`]:[`capture`,`inbox`],f=n?`Inbox`:`Pending uploads${i>0?` (${i})`:``}`;return{isOnline:n,isAuthenticated:r,routeAccess:c?`redirect`:`render`,redirectTo:c?`/inbox`:void 0,canCaptureToServer:s,canViewLiveNotes:o,canSyncPendingCaptures:a,capture:{presentation:l,saveLabel:n?`Save to inbox`:`Save offline`},inbox:{presentation:u},nav:{notesGroupLabel:n?`Notes`:`Offline`,visibleItems:d,inboxLabel:f},showOfflineStatusBanner:!n||i>0}}function Ow(){let e=UC(),{isOnline:t}=Cw(),{user:n}=wt(),{pendingCaptures:r}=Dw();return(0,_.useMemo)(()=>ine({route:e,isOnline:t,isAuthenticated:!!n,pendingCaptureCount:r.length}),[e,t,n,r.length])}var kw={capture:{id:`capture`,to:`/capture`,label:`Capture`,icon:SS},inbox:{id:`inbox`,to:`/inbox`,label:`Inbox`,icon:Xx},tasks:{id:`tasks`,to:`/tasks`,label:`Actions`,icon:rS},"all-notes":{id:`all-notes`,to:`/notes`,label:`All notes`,icon:Ux},projects:{id:`projects`,to:`/projects`,label:`Projects`,icon:Kx},areas:{id:`areas`,to:`/areas`,label:`Areas`,icon:$x},resources:{id:`resources`,to:`/resources`,label:`Resources`,icon:yx},chat:{id:`chat`,to:`/chat`,label:`Chat`,icon:uS},voice:{id:`voice`,to:`/voice`,label:`Voice`,icon:pS}
66,held:{id:`held`,to:`/held`,label:`Held`,icon:tS},playground:{id:`playground`,to:`/playground`,label:`UI Playground`,icon:OS},mockup:{id:`mockup`,to:`/mockup`,label:`Design mockup`,icon:OS}},ane=[{label:`Talk to XO`,items:[`chat`,`voice`]},{label:`Second brain`,items:[`inbox`,`tasks`,`all-notes`]},{label:`Organise`,items:[`projects`,`areas`,`resources`]}];function one(){let e=UC(),t=Ow(),n=new Set(t.nav.visibleItems);return(0,M.jsxs)(CC,{children:[(0,M.jsx)(EC,{children:(0,M.jsxs)(XC,{to:`/chat`,className:`flex items-center gap-2.5 px-2 py-2`,children:[(0,M.jsx)(`span`,{className:`flex size-8 items-center justify-center rounded-xl bg-primary/15 text-primary`,children:(0,M.jsx)(bx,{className:`size-4.5`})}),(0,M.jsxs)(`span`,{className:`flex flex-col leading-tight`,children:[(0,M.jsx)(`span`,{className:`font-serif text-lg font-medium tracking-tight`,children:`XO`}),(0,M.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`your exocortex`})]})]})}),(0,M.jsxs)(OC,{children:[n.has(`capture`)&&(0,M.jsx)(kC,{children:(0,M.jsx)(jC,{children:(0,M.jsx)(MC,{children:(0,M.jsx)(NC,{children:(0,M.jsx)(FC,{asChild:!0,isActive:e===`/capture`,tooltip:`Capture a new note`,className:`bg-primary text-primary-foreground hover:bg-primary/90 hover:text-primary-foreground data-[active=true]:bg-primary data-[active=true]:text-primary-foreground`,children:(0,M.jsxs)(XC,{to:`/capture`,children:[(0,M.jsx)(SS,{}),(0,M.jsx)(`span`,{children:`Capture`})]})})})})})}),ane.map(r=>{let i=r.items.filter(e=>n.has(e));return i.length===0?null:(0,M.jsxs)(kC,{children:[(0,M.jsx)(AC,{children:t.nav.notesGroupLabel===`Offline`?`Offline`:r.label}),(0,M.jsx)(jC,{children:(0,M.jsx)(MC,{children:i.map(n=>{let r=kw[n],i=n===`inbox`?t.nav.inboxLabel:r.label;return(0,M.jsx)(Aw,{item:{...r,label:i},active:e===r.to},n)})})})]},r.label)}),(0,M.jsx)(yw,{})]}),(0,M.jsx)(DC,{children:(0,M.jsxs)(MC,{children:[n.has(`held`)&&(0,M.jsx)(Aw,{item:kw.held,active:e===`/held`}),(0,M.jsx)(NC,{children:(0,M.jsx)(Sw,{})}),(0,M.jsx)(NC,{children:(0,M.jsx)(FC,{asChild:!0,isActive:e===`/settings`,tooltip:`Settings`,children:(0,M.jsxs)(XC,{to:`/settings`,children:[(0,M.jsx)(OS,{}),(0,M.jsx)(`span`,{children:`Settings`})]})})}),(0,M.jsx)(sne,{}),(0,M.jsx)(cne,{})]})})]})}function Aw({item:e,active:t}){let n=e.icon;return(0,M.jsx)(NC,{children:(0,M.jsx)(FC,{asChild:!0,isActive:t,tooltip:e.label,children:(0,M.jsxs)(XC,{to:e.to,children:[(0,M.jsx)(n,{}),(0,M.jsx)(`span`,{children:e.label})]})})})}function sne(){let{setTheme:e}=ua();return(0,M.jsx)(NC,{children:(0,M.jsxs)(HS,{children:[(0,M.jsx)(US,{asChild:!0,children:(0,M.jsxs)(FC,{tooltip:`Theme`,children:[(0,M.jsx)(PS,{className:`dark:hidden`}),(0,M.jsx)(hS,{className:`hidden dark:block`}),(0,M.jsx)(`span`,{children:`Theme`})]})}),(0,M.jsxs)(WS,{side:`right`,align:`end`,children:[(0,M.jsxs)(KS,{onSelect:()=>e(`light`),children:[(0,M.jsx)(PS,{}),` Light`]}),(0,M.jsxs)(KS,{onSelect:()=>e(`dark`),children:[(0,M.jsx)(hS,{}),` Dark`]}),(0,M.jsxs)(KS,{onSelect:()=>e(`system`),children:[(0,M.jsx)(mS,{}),` System`]})]})]})})}function cne(){let{user:e,signIn:t,signOut:n}=wt();return e?(0,M.jsx)(NC,{children:(0,M.jsxs)(FC,{onClick:()=>n(),tooltip:`Sign out`,children:[(0,M.jsx)(sS,{}),(0,M.jsx)(`span`,{children:`Sign out`})]})}):(0,M.jsx)(NC,{children:(0,M.jsxs)(FC,{onClick:()=>void t({state:{returnTo:window.location.hash||`#/chat`}}),tooltip:`Sign in`,children:[(0,M.jsx)(oS,{}),(0,M.jsx)(`span`,{children:`Sign in`})]})})}function lne({feed:e,title:t,description:n,pendingDescription:r,emptyHint:i,pendingEmptyHint:a,onSelectNote:o,onSelectTask:s,onCompleteTask:c}){let l=e.pendingUploads.length>0,u=(e.inboxTasks.length>0||e.isTasksLoading)&&s!==void 0,d=e.inboxNotes.length>0||e.isNotesLoading,f=!l&&!u&&!d;return(0,M.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[l?(0,M.jsxs)(`section`,{className:`container mx-auto flex flex-col gap-6 px-4 py-8 max-w-3xl border-b border-border/60`,children:[(0,M.jsx)(jw,{title:`Pending uploads`,description:r}),(0,M.jsx)(dne,{items:e.pendingUploads.filter(e=>e.kind===`pending-upload`),emptyHint:a})]}):null,u?(0,M.jsxs)(`section`,{className:`container mx-auto flex flex-col gap-4 px-4 py-8 max-w-3xl border-b border-border/60`,children:[(0,M.jsx)(jw,{title:`Actions to clarify`,description:`Captured tasks waiting to become next actions. Tick what's done, or open the board to sort them.`}),e.isTasksLoading?(0,M.jsx)(`div`,{className:`flex flex-col gap-2`,children:(0,M.jsx)(pC,{className:`h-14 w-full`})}):(0,M.jsx)(`ul`,{className:`flex flex-col gap-2`,children:e.inboxTasks.filter(e=>e.kind===`inbox-task`).map(e=>(0,M.jsx)(une,{item:e,onSelect:()=>s?.(e.taskId),onComplete:()=>c?.(e.taskId)},e.key))})]}):null,d?(0,M.jsxs)(`section`,{className:`container mx-auto flex flex-col gap-6 px-4 py-8 max-w-3xl`,children:[(0,M.jsx)(jw,{title:t,description:n}),e.isNotesLoading?(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(pC,{className:`h-16 w-full`}),(0,M.jsx)(pC,{className:`h-16 w-full`})]}):e.inboxNotes.length===0?(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i}):(0,M.jsx)(`ul`,{className:`flex flex-col gap-2`,children:e.inboxNotes.filter(e=>e.kind===`inbox-note`).map(e=>(0,M.jsx)(fne,{item:e,onSelect:()=>o(e.noteId)},e.key))})]}):null,f?(0,M.jsxs)(`main`,{className:`container mx-auto flex flex-col gap-6 px-4 py-8 max-w-3xl`,children:[(0,M.jsx)(jw,{title:t,description:n}),(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.pendingUploads.length===0&&e.inboxNotes.length===0?i:a})]}):null]})}function une({item:e,onSelect:t,onComplete:n}){return(0,M.jsxs)(`li`,{className:`flex items-center gap-3 rounded-md border border-border bg-card px-4 py-3`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:n,"aria-label":`Complete task`,className:L(`flex size-5 shrink-0 items-center justify-center rounded-full border transition-colors`,`border-border hover:border-primary/60`),children:(0,M.jsx)(Cx,{className:`size-3 opacity-0`,strokeWidth:3})}),(0,M.jsxs)(`button`,{type:`button`,onClick:t,className:`min-w-0 flex-1 text-left focus-visible:outline-none`,children:[(0,M.jsx)(`span`,{className:`block truncate font-medium`,children:e.title||`Untitled action`}),e.context?(0,M.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.context}):null]})]})}function jw({title:e,description:t}){return(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:e}),(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t})]})}function dne({items:e,emptyHint:t}){return e.length===0?(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t}):(0,M.jsx)(`ul`,{className:`flex flex-col gap-2`,children:e.map(e=>(0,M.jsxs)(`li`,{className:`rounded-md border border-border bg-card px-4 py-3`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,M.jsx)(`span`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:pne(e.syncStatus)}),(0,M.jsx)(`time`,{className:`text-xs text-muted-foreground`,children:mne(e.createdAt)})]}),(0,M.jsx)(`p`,{className:`mt-2 line-clamp-3 whitespace-pre-wrap text-sm`,children:e.preview||`(empty)`}),e.lastSyncError?(0,M.jsxs)(`p`,{className:`mt-2 text-xs text-destructive`,children:[`Upload failed: `,e.lastSyncError]}):null]},e.key))})}function fne({item:e,onSelect:t}){return(0,M.jsx)(`li`,{children:(0,M.jsxs)(`button`,{type:`button`,onClick:t,className:`w-full rounded-md border border-border bg-card px-4 py-3 text-left transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,M.jsx)(`div`,{className:`font-medium`,children:e.title||`Untitled`}),(0,M.jsx)(`div`,{className:`mt-1 line-clamp-2 text-sm text-muted-foreground whitespace-pre-wrap`,children:e.preview||`(empty)`})]})})}function pne(e){switch(e){case`pending`:return`Waiting to upload`;case`syncing`:return`Uploadingâ¦`;case`failed`:return`Upload failed`}}function mne(e){return new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(new Date(e))}function hne({message:e,isSyncing:t}){return(0,M.jsxs)(`span`,{className:`flex items-center gap-2`,children:[t?(0,M.jsx)(iS,{className:`size-4 shrink-0 animate-spin`}):(0,M.jsx)(Px,{className:`size-4 shrink-0`}),e]})}function Mw(){let e=Ow(),{pendingCaptures:t,isSyncing:n,syncPending:r}=Dw();return e.showOfflineStatusBanner?e.isOnline?(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-b border-border/60 bg-muted/50 px-4 py-2 text-sm`,children:[(0,M.jsx)(hne,{isSyncing:n,message:n?`Uploading pending c
66apturesâ¦`:`${t.length} capture${t.length===1?``:`s`} waiting to upload`}),e.canSyncPendingCaptures&&!n?(0,M.jsx)(z,{size:`sm`,variant:`outline`,onClick:()=>void r(),children:`Upload now`}):null]}):(0,M.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/60 bg-muted/50 px-4 py-2 text-sm`,children:[(0,M.jsx)(Nx,{className:`size-4 shrink-0 text-muted-foreground`}),(0,M.jsx)(`span`,{children:`Offline â capture saves locally and uploads when you're back online.`})]}):null}function Nw({className:e,size:t=`default`,...n}){return(0,M.jsx)(`div`,{"data-slot":`card`,"data-size":t,className:L(`group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-card py-4 text-sm text-card-foreground ring-1 ring-foreground/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl`,e),...n})}function Pw({className:e,...t}){return(0,M.jsx)(`div`,{"data-slot":`card-header`,className:L(`group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3`,e),...t})}function Fw({className:e,...t}){return(0,M.jsx)(`div`,{"data-slot":`card-title`,className:L(`font-heading text-base leading-snug font-medium group-data-[size=sm]/card:text-sm`,e),...t})}function Iw({className:e,...t}){return(0,M.jsx)(`div`,{"data-slot":`card-description`,className:L(`text-sm text-muted-foreground`,e),...t})}function Lw({className:e,...t}){return(0,M.jsx)(`div`,{"data-slot":`card-content`,className:L(`px-4 group-data-[size=sm]/card:px-3`,e),...t})}function Rw({className:e,...t}){return(0,M.jsx)(`div`,{"data-slot":`card-footer`,className:L(`flex items-center rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/card:p-3`,e),...t})}function zw(){let{signIn:e}=wt(),t=window.location.hash||`#/chat`;return(0,M.jsxs)(Nw,{className:`mx-auto w-full max-w-md`,children:[(0,M.jsxs)(Pw,{children:[(0,M.jsx)(Fw,{children:`Sign in to XO`}),(0,M.jsx)(Iw,{children:`Your exocortex â private to your account.`})]}),(0,M.jsx)(Lw,{children:(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Capture everything, find anything, and think it through with an AI that remembers. Your thoughts land the instant you type them.`})}),(0,M.jsx)(Rw,{children:(0,M.jsx)(z,{onClick:()=>void e({state:{returnTo:t}}),className:`w-full`,children:`Sign in`})})]})}function Bw({className:e,...t}){return(0,M.jsx)(`textarea`,{"data-slot":`textarea`,className:L(`flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...t})}function Vw(){let e=Ow();return e.capture.presentation===`sign-in-required`?(0,M.jsx)(`main`,{className:`container mx-auto flex flex-col gap-6 px-4 py-8 max-w-3xl`,children:(0,M.jsx)(zw,{})}):(0,M.jsx)(gne,{saveLabel:e.capture.saveLabel})}function gne({saveLabel:e}){let{enqueueCapture:t,isOnline:n}=Dw(),[r,i]=(0,_.useState)(``),[a,o]=(0,_.useState)(!1),s=r.trim(),c=s.length>0&&!a,l=async()=>{if(c){o(!0);try{await t(s)===`local`&&Hb.success(n?`Saved locally â will upload when you sign in`:`Saved offline â will upload when you reconnect`),i(``),WC(`/inbox`)}finally{o(!1)}}};return(0,M.jsxs)(`main`,{className:`container mx-auto flex flex-col gap-4 px-4 py-6 max-w-3xl`,children:[(0,M.jsx)(Sw,{variant:`prominent`}),(0,M.jsx)(Bw,{"aria-label":`Brain dump`,autoFocus:!0,placeholder:`What's on your mind?`,value:r,onChange:e=>i(e.target.value),className:`min-h-[50vh] resize-y text-base leading-relaxed`}),(0,M.jsx)(`div`,{className:`flex justify-end`,children:(0,M.jsx)(z,{onClick:()=>void l(),disabled:!c,size:`lg`,children:a?`Savingâ¦`:e})})]})}function _ne(e,t){return Object.fromEntries(Object.entries(e).filter(([e])=>t.includes(e)))}function vne(e,t){return Object.fromEntries(Object.entries(e).filter(([e])=>!t.includes(e)))}function Hw(e,t){if(!e)throw Error(typeof t==`function`?t():t)}var Uw=(...e)=>j.union(...e.map(j.literal));j.string(),j.float64(),j.float64(),j.boolean(),j.int64(),j.int64(),j.any(),j.null();var{id:yne,object:bne,array:xne,bytes:Sne,literal:Cne,optional:wne,union:Tne}=j;j.bytes(),j.optional(j.any());var Ww={model:j.string(),table:j.string(),userId:j.optional(j.string()),threadId:j.optional(j.string()),model_table_userId:j.optional(j.array(j.string())),model_table_threadId:j.optional(j.array(j.string())),vector:j.array(j.number())};j.object(vne(Ww,[`model_table_userId`,`model_table_threadId`]));function Ene(e){return rw(Ww).vectorIndex(`vector`,{vectorField:`vector`,dimensions:e,filterFields:[`model_table_userId`,`model_table_threadId`]}).index(`model_table_threadId`,[`model`,`table`,`threadId`])}var Gw=[128,256,512,768,1024,1408,1536,2048,3072,4096],Kw=Gw.map(e=>`embeddings_${e}`),qw=Uw(...Gw);Uw(...Kw),j.union(...Kw.map(e=>j.id(e))),Object.fromEntries(Gw.map(e=>[`embeddings_${e}`,Ene(e)]));var Jw=j.record(j.string(),j.record(j.string(),j.any())),Yw=j.optional(Jw),Dne=Jw,Xw=Yw,One=j.union(j.literal(`active`),j.literal(`archived`)),Zw=j.union(j.literal(`pending`),j.literal(`success`),j.literal(`failed`));j.union(j.literal(`system`),j.literal(`user`),j.literal(`assistant`),j.literal(`tool`));var Qw=j.object({type:j.literal(`text`),text:j.string(),providerOptions:Yw,providerMetadata:Xw}),kne=j.object({type:j.literal(`image`),image:j.union(j.string(),j.bytes()),mediaType:j.optional(j.string()),mimeType:j.optional(j.string()),providerOptions:Yw}
66),$w=j.object({type:j.literal(`file`),data:j.union(j.string(),j.bytes()),filename:j.optional(j.string()),mediaType:j.optional(j.string()),mimeType:j.optional(j.string()),providerOptions:Yw,providerMetadata:Xw}),eT=j.union(j.string(),j.array(j.union(Qw,kne,$w))),tT=j.object({type:j.literal(`reasoning`),text:j.string(),signature:j.optional(j.string()),providerOptions:Yw,providerMetadata:Xw}),Ane=j.object({type:j.literal(`redacted-reasoning`),data:j.string(),providerOptions:Yw,providerMetadata:Xw}),nT=j.array(j.union(tT,j.object({type:j.literal(`text`),text:j.string(),signature:j.optional(j.string())}),j.object({type:j.literal(`redacted`),data:j.string()}))),jne=j.union(j.object({type:j.literal(`source`),sourceType:j.literal(`url`),id:j.string(),url:j.string(),title:j.optional(j.string()),providerOptions:Yw,providerMetadata:Xw}),j.object({type:j.literal(`source`),sourceType:j.literal(`document`),id:j.string(),mediaType:j.string(),title:j.string(),filename:j.optional(j.string()),providerOptions:Yw,providerMetadata:Xw})),Mne=j.union(j.object({type:j.literal(`tool-call`),toolCallId:j.string(),toolName:j.string(),input:j.any(),args:j.optional(j.any()),providerExecuted:j.optional(j.boolean()),providerOptions:Yw,providerMetadata:Xw}),j.object({type:j.literal(`tool-call`),toolCallId:j.string(),toolName:j.string(),args:j.any(),input:j.optional(j.any()),providerExecuted:j.optional(j.boolean()),providerOptions:Yw,providerMetadata:Xw})),Nne=j.array(j.union(j.object({type:j.literal(`text`),text:j.string()}),j.object({type:j.literal(`image`),data:j.string(),mimeType:j.optional(j.string())}))),Pne=j.union(j.object({type:j.literal(`text`),value:j.string(),providerOptions:Yw}),j.object({type:j.literal(`json`),value:j.any(),providerOptions:Yw}),j.object({type:j.literal(`error-text`),value:j.string(),providerOptions:Yw}),j.object({type:j.literal(`error-json`),value:j.any(),providerOptions:Yw}),j.object({type:j.literal(`execution-denied`),reason:j.optional(j.string()),providerOptions:Yw}),j.object({type:j.literal(`content`),value:j.array(j.union(j.object({type:j.literal(`text`),text:j.string(),providerOptions:Yw}),j.object({type:j.literal(`media`),data:j.string(),mediaType:j.string()}),j.object({type:j.literal(`file-data`),data:j.string(),mediaType:j.string(),filename:j.optional(j.string()),providerOptions:Yw}),j.object({type:j.literal(`file-url`),url:j.string(),providerOptions:Yw}),j.object({type:j.literal(`file-id`),fileId:j.union(j.string(),j.record(j.string(),j.string())),providerOptions:Yw}),j.object({type:j.literal(`image-data`),data:j.string(),mediaType:j.string(),providerOptions:Yw}),j.object({type:j.literal(`image-url`),url:j.string(),providerOptions:Yw}),j.object({type:j.literal(`image-file-id`),fileId:j.union(j.string(),j.record(j.string(),j.string())),providerOptions:Yw}),j.object({type:j.literal(`custom`),providerOptions:Yw})))})),Fne=j.object({type:j.literal(`tool-approval-request`),approvalId:j.string(),toolCallId:j.string(),providerMetadata:Xw,providerOptions:Yw}),Ine=j.object({type:j.literal(`tool-approval-response`),approvalId:j.string(),approved:j.boolean(),reason:j.optional(j.string()),providerExecuted:j.optional(j.boolean()),providerMetadata:Xw,providerOptions:Yw}),rT=j.object({type:j.literal(`tool-result`),toolCallId:j.string(),toolName:j.string(),output:j.optional(Pne),providerOptions:Yw,providerMetadata:Xw,providerExecuted:j.optional(j.boolean()),result:j.optional(j.any()),isError:j.optional(j.boolean()),args:j.optional(j.any()),experimental_content:j.optional(Nne)}),iT=j.array(j.union(rT,Ine)),aT=j.union(j.string(),j.array(j.union(Qw,$w,tT,Ane,Mne,rT,jne,Fne)));j.union(eT,aT,iT);var Lne=j.object({role:j.literal(`user`),content:eT,providerOptions:Yw}),Rne=j.object({role:j.literal(`assistant`),content:aT,providerOptions:Yw}),zne=j.object({role:j.literal(`tool`),content:iT,providerOptions:Yw}),Bne=j.object({role:j.literal(`system`),content:j.string(),providerOptions:Yw}),oT=j.union(Lne,Rne,zne,Bne),sT=j.union(j.object({type:j.optional(j.literal(`source`)),sourceType:j.literal(`url`),id:j.string(),url:j.string(),title:j.optional(j.string()),providerOptions:Yw,providerMetadata:Xw}),j.object({type:j.literal(`source`),sourceType:j.literal(`document`),id:j.string(),mediaType:j.string(),title:j.string(),filename:j.optional(j.string()),providerOptions:Yw,providerMetadata:Xw}));j.object({body:j.optional(j.any()),headers:j.optional(j.record(j.string(),j.string())),method:j.optional(j.string()),url:j.optional(j.string())});var cT=j.union(j.literal(`stop`),j.literal(`length`),j.literal(`content-filter`),j.literal(`tool-calls`),j.literal(`error`),j.literal(`other`),j.literal(`unknown`)),lT=j.object({promptTokens:j.number(),completionTokens:j.number(),totalTokens:j.number(),reasoningTokens:j.optional(j.number()),cachedInputTokens:j.optional(j.number())}),uT=j.union(j.object({type:j.literal(`unsupported-setting`),setting:j.string(),details:j.optional(j.string())}),j.object({type:j.literal(`unsupported-tool`),tool:j.any(),details:j.optional(j.string())}),j.object({type:j.literal(`other`),message:j.string()})),Vne=j.object({message:oT,text:j.optional(j.string()),fileIds:j.optional(j.array(j.id(`files`))),status:j.optional(Zw),finishReason:j.optional(cT),model:j.optional(j.string()),provider:j.optional(j.string()),providerMetadata:Xw,sources:j.optional(j.array(sT)),reasoning:j.optional(j.string()),reasoningDetails:j.optional(nT),usage:j.optional(lT),warnings:j.optional(j.array(uT)),error:j.optional(j.string())});j.object({...Vne.fields,fileIds:j.optional(j.array(j.string()))}),j.object({model:j.string(),dimension:qw,vectors:j.array(j.union(j.array(j.number()),j.null()))}),j.object({model:j.string(),vectors:j.array(j.union(j.array(j.number()),j.null()))});var Hne=j.object({limit:j.number(),textSearch:j.optional(j.boolean()),vectorSearch:j.optional(j.boolean()),vectorScoreThreshold:j.optional(j.number()),messageRange:j.optional(j.object({before:j.number(),after:j.number()}))}
66),Une=j.object({excludeToolMessages:j.optional(j.boolean()),recentMessages:j.optional(j.number()),searchOptions:j.optional(Hne),searchOtherThreads:j.optional(j.boolean())}),Wne=j.object({saveMessages:j.optional(j.union(j.literal(`all`),j.literal(`none`),j.literal(`promptAndOutput`)))}),Gne={system:j.optional(j.string()),prompt:j.optional(j.string()),messages:j.optional(j.array(oT)),promptMessageId:j.optional(j.string())},Kne=j.object({maxOutputTokens:j.optional(j.number()),temperature:j.optional(j.number()),topP:j.optional(j.number()),topK:j.optional(j.number()),presencePenalty:j.optional(j.number()),frequencyPenalty:j.optional(j.number()),stopSequences:j.optional(j.array(j.string())),seed:j.optional(j.number()),maxRetries:j.optional(j.number()),headers:j.optional(j.record(j.string(),j.string()))}),dT={userId:j.optional(j.string()),threadId:j.optional(j.string()),contextOptions:j.optional(Une),storageOptions:j.optional(Wne),providerOptions:Yw,callSettings:j.optional(Kne),...Gne};j.object({...dT,stream:j.optional(j.boolean()),toolChoice:j.optional(j.union(j.literal(`auto`),j.literal(`none`),j.literal(`required`),j.object({type:j.literal(`tool`),toolName:j.string()}))),maxSteps:j.optional(j.number()),experimental_continueSteps:j.optional(j.boolean())}),j.object(dT),j.object({vectors:j.array(j.union(j.array(j.number()),j.null())),dimension:qw,model:j.string()});var qne=j.object({streamId:j.string(),cursor:j.number()});j.optional(j.union(j.object({kind:j.literal(`list`),startOrder:j.optional(j.number())}),j.object({kind:j.literal(`deltas`),cursors:j.array(qne)}))),j.object({streamId:j.string(),status:j.union(j.literal(`streaming`),j.literal(`finished`),j.literal(`aborted`)),format:j.optional(j.union(j.literal(`UIMessageChunk`),j.literal(`TextStreamPart`))),order:j.number(),stepOrder:j.number(),userId:j.optional(j.string()),agentName:j.optional(j.string()),model:j.optional(j.string()),provider:j.optional(j.string()),providerOptions:Yw}),j.object({streamId:j.string(),start:j.number(),end:j.number(),parts:j.array(j.any())}),j.object({_id:j.string(),_creationTime:j.number(),userId:j.optional(j.string()),threadId:j.string(),order:j.number(),stepOrder:j.number(),embeddingId:j.optional(j.string()),fileIds:j.optional(j.array(j.string())),error:j.optional(j.string()),status:Zw,agentName:j.optional(j.string()),model:j.optional(j.string()),provider:j.optional(j.string()),providerOptions:Yw,message:j.optional(oT),tool:j.boolean(),text:j.optional(j.string()),usage:j.optional(lT),providerMetadata:j.optional(Dne),sources:j.optional(j.array(sT)),warnings:j.optional(j.array(uT)),finishReason:j.optional(cT),reasoning:j.optional(j.string()),reasoningDetails:j.optional(nT),id:j.optional(j.string())}),j.object({_id:j.string(),_creationTime:j.number(),userId:j.optional(j.string()),title:j.optional(j.string()),summary:j.optional(j.string()),status:One});function fT(e){return e.filter(e=>e.type===`text`).map(e=>e.text).filter(Boolean).join(` `)}function pT(e,t=`asc`){return[...e].sort(t===`asc`?(e,t)=>e.order-t.order||e.stepOrder-t.stepOrder:(e,t)=>t.order-e.order||t.stepOrder-e.stepOrder)}function Jne(e){return e.reduce((e,t)=>{if(!e.length)return[t];let n=e.at(-1);if(t.order!==n.order||n.role!==t.role||t.role!==`assistant`)return e.push(t),e;e.pop();let r=[...n.parts];for(let e of t.parts){let t=mT(e);if(!t){r.push(e);continue}let n=r.findIndex(e=>mT(e)===t);if(n===-1){r.push(e);continue}let i=r.splice(n,1)[0];r.push(Yne(i,e))}return e.push({...n,..._ne(t,[`status`,`metadata`,`agentName`]),parts:r,text:fT(r)}),e},[])}function mT(e){return e.toolCallId}function Yne(e,t){let n={...e};for(let[e,r]of Object.entries(t))r!==void 0&&(n[e]=r);return n}var hT=1e3/20,Xne=128;function Zne(e,{charsPerSec:t=Xne,startStreaming:n=!1}={}){let[r,i]=(0,_.useState)(n?``:e||``),a=(0,_.useRef)({tick:Date.now(),cursor:r.length,lastUpdate:Date.now(),lastUpdateLength:e.length,charsPerMs:t/1e3,initial:!0}),o=a.current.cursor<e.length;return(0,_.useEffect)(()=>{if(!o)return;if(a.current.lastUpdateLength!==e.length){let t=Date.now()-a.current.lastUpdate,n=(e.length-a.current.lastUpdateLength)/t,r=n-a.current.charsPerMs,i=(a.current.lastUpdateLength-a.current.cursor)/t,o=n+(a.current.initial?0:Math.max(0,(r+i)/2));a.current.initial=!1,a.current.charsPerMs=Math.min((2*o+a.current.charsPerMs)/3,a.current.charsPerMs*2)}a.current.tick=Math.max(a.current.tick,Date.now()-hT),a.current.lastUpdate=Date.now(),a.current.lastUpdateLength=e.length;function t(){if(a.current.cursor>=e.length)return;let t=Date.now()-a.current.tick,n=Math.floor(t*a.current.charsPerMs),r=Math.min(n,e.length-a.current.cursor);a.current.cursor+=r,a.current.tick+=r/a.current.charsPerMs,i(e.slice(0,a.current.cursor))}t();let n=setInterval(t,hT);return()=>clearInterval(n)},[e,o,t]),[r,{cursor:a.current.cursor,isStreaming:o}]}function Qne(e,t,n){if(typeof n?.initialNumItems!=`number`||n.initialNumItems<=0)throw Error(`\`options.initialNumItems\` must be a positive number. Received \`${n?.initialNumItems}\`.`);let r=t===`skip`,i=r?{}:t,a=mr(e),o=(0,_.useMemo)(()=>()=>({query:e,args:i,nextPageKey:1,pageKeys:r?[]:[0],queries:r?{}:{0:{query:e,args:{...i,paginationOpts:{numItems:n.initialNumItems,cursor:null}}}},ongoingSplits:{},skip:r}),[JSON.stringify(dn(i)),a,n.initialNumItems,r]),[s,c]=(0,_.useState)(o),l=s;(r!==s.skip||mr(e)!==mr(s.query)||JSON.stringify(dn(i))!==JSON.stringify(dn(s.args)))&&(l=o(),c(l));let u=Ni().logger,d=Ui(l.queries),[f,p]=(0,_.useMemo)(()=>{let e,t=[];for(let r of l.pageKeys){if(e=d[r],e===void 0)break;if(e instanceof Error){if(e.message.includes(`InvalidCursor`)||e instanceof Rn&&typeof e.data==`object`&&e.data?.isConvexSystemError===!0&&e.data?.paginationError===`InvalidCursor`)return u.warn(`usePaginatedQuery hit error, resetting pagination state: `+e.message),c(o),[[],void 0];throw e}let i=l.ongoingSplits[r];if(i===void 0?e.splitCursor&&(e.pageStatus===`SplitRecommended`||e.pageStatus===`SplitRequired`||e.page.length>n.initialNumItems)&&c($ne(r,e.splitCursor,e.continueCursor)):d[i[0]]!==void 0&&d[i[1]]!==void 0&&c(ere(r)),e.pageStatus===`SplitRequired`)return[t,void 0];t.push(...e.page)}return[t,e]},[d,l.pageKeys,l.ongoingSplits,n.initialNumItems,o,u]);return{results:f,...(0,_.useMemo)(()=>
66{if(p===void 0&&l.pageKeys.length<=1)return{status:`LoadingFirstPage`,isLoading:!0,loadMore:e=>{}};if(p===void 0||l.ongoingSplits[l.pageKeys.at(-1)]!==void 0)return{status:`LoadingMore`,isLoading:!0,loadMore:e=>{}};if(p.isDone)return{status:`Exhausted`,isLoading:!1,loadMore:e=>{}};let e=p.continueCursor,t=!1;return{status:`CanLoadMore`,isLoading:!1,loadMore:n=>{t||(t=!0,c(t=>{let r=t.nextPageKey,i={...t.queries},a=t.ongoingSplits,o=t.pageKeys.at(-1),s=r;return i[s]={query:t.query,args:{...t.args,paginationOpts:{...i[o].args.paginationOpts,endCursor:e}}},r++,a={...a,[o]:[s,r]},i[r]={query:t.query,args:{...t.args,paginationOpts:{numItems:n,cursor:e}}},r++,{...t,nextPageKey:r,queries:i,ongoingSplits:a}}))}}},[p,l.nextPageKey])}}function $ne(e,t,n){return r=>{let i={...r.queries},a=r.nextPageKey,o=r.nextPageKey+1,s=r.nextPageKey+2;i[a]={query:r.query,args:{...r.args,paginationOpts:{...r.queries[e].args.paginationOpts,endCursor:t}}},i[o]={query:r.query,args:{...r.args,paginationOpts:{...r.queries[e].args.paginationOpts,cursor:t,endCursor:n}}};let c={...r.ongoingSplits};return c[e]=[a,o],{...r,nextPageKey:s,queries:i,ongoingSplits:c}}}function ere(e){return t=>{let n=t.ongoingSplits[e];if(n===void 0)return t;let r={...t.queries};delete r[e];let i={...t.ongoingSplits};delete i[e];let a=t.pageKeys.slice(),o=t.pageKeys.findIndex(t=>t===e);return o>=0&&(a=[...t.pageKeys.slice(0,o),...n,...t.pageKeys.slice(o+1)]),{...t,queries:r,pageKeys:a,ongoingSplits:i}}}function tre(e,t){return{id:`stream:${e.streamId}`,key:`${t}-${e.order}-${e.stepOrder}`,order:e.order,stepOrder:e.stepOrder,status:gT(e.status),agentName:e.agentName,text:``,_creationTime:Date.now(),role:`assistant`,parts:[],...e.metadata?{metadata:e.metadata}:{}}}function gT(e){switch(e){case`streaming`:return`streaming`;case`finished`:return`success`;case`aborted`:return`failed`;default:return`pending`}}function _T(e,t){Object.assign(e,t)}function nre(){return{activeText:{},activeReasoning:{},toolInputText:{}}}function rre(e,t,n){let r=structuredClone(e),i={...n.activeText},a={...n.activeReasoning},o={...n.toolInputText},s=new Set,c=new Map;r.parts.forEach((e,t)=>{`toolCallId`in e&&(e.type.startsWith(`tool-`)||e.type===`dynamic-tool`)&&c.set(e.toolCallId,t)});let l=e=>{let t=c.get(e);return t===void 0?void 0:r.parts[t]},u=e=>{e!=null&&(r.metadata={...r.metadata,...e})};for(let e of t)switch(e.type){case`text-start`:{let t={type:`text`,text:``,state:`streaming`,providerMetadata:e.providerMetadata};r.parts.push(t),i[e.id]=r.parts.length-1;break}case`text-delta`:{let t=i[e.id];if(t!==void 0){let n=r.parts[t];n.text+=e.delta,n.providerMetadata=vT(n.providerMetadata,e.providerMetadata)}break}case`text-end`:{let t=i[e.id];if(t!==void 0){let n=r.parts[t];n.state=`done`,n.providerMetadata=vT(n.providerMetadata,e.providerMetadata),delete i[e.id]}break}case`reasoning-start`:{let t={type:`reasoning`,text:``,state:`streaming`,providerMetadata:e.providerMetadata};r.parts.push(t),a[e.id]=r.parts.length-1;break}case`reasoning-delta`:{let t=a[e.id];if(t!==void 0){let n=r.parts[t];n.text+=e.delta,n.providerMetadata=vT(n.providerMetadata,e.providerMetadata)}break}case`reasoning-end`:{let t=a[e.id];if(t!==void 0){let n=r.parts[t];n.state=`done`,n.providerMetadata=vT(n.providerMetadata,e.providerMetadata),delete a[e.id]}break}case`tool-input-start`:{let t=e.dynamic?{type:`dynamic-tool`,toolCallId:e.toolCallId,toolName:e.toolName,state:`input-streaming`,input:void 0}:{type:`tool-${e.toolName}`,toolCallId:e.toolCallId,state:`input-streaming`,input:void 0,providerExecuted:e.providerExecuted};r.parts.push(t),c.set(e.toolCallId,r.parts.length-1),o[e.toolCallId]=``;break}case`tool-input-delta`:c.has(e.toolCallId)?(o[e.toolCallId]=(o[e.toolCallId]??``)+e.inputTextDelta,s.add(e.toolCallId)):console.warn(`tool-input-delta for unknown toolCallId ${e.toolCallId}`);break;case`tool-input-available`:{let t=l(e.toolCallId);t&&_T(t,{state:`input-available`,input:e.input,callProviderMetadata:vT(t.callProviderMetadata,e.providerMetadata)}),s.delete(e.toolCallId),delete o[e.toolCallId];break}case`tool-input-error`:{let t=l(e.toolCallId);t&&_T(t,{state:`output-error`,errorText:e.errorText,providerExecuted:e.providerExecuted,...t.type===`dynamic-tool`?{input:e.input}:{input:void 0,rawInput:e.input},callProviderMetadata:vT(t.callProviderMetadata,e.providerMetadata)}),s.delete(e.toolCallId),delete o[e.toolCallId];break}case`tool-output-available`:{let t=l(e.toolCallId);
66t&&_T(t,{state:`output-available`,output:e.output,preliminary:e.preliminary,providerExecuted:e.providerExecuted});break}case`tool-output-error`:{let t=l(e.toolCallId);t&&_T(t,{state:`output-error`,errorText:e.errorText,providerExecuted:e.providerExecuted});break}case`tool-output-denied`:{let t=l(e.toolCallId);t&&_T(t,{state:`output-denied`});break}case`tool-approval-request`:{let t=l(e.toolCallId);t&&_T(t,{state:`approval-requested`,approval:{id:e.approvalId}});break}case`source-url`:r.parts.push({type:`source-url`,url:e.url,sourceId:e.sourceId,title:e.title,providerMetadata:e.providerMetadata});break;case`source-document`:r.parts.push({type:`source-document`,mediaType:e.mediaType,sourceId:e.sourceId,title:e.title,filename:e.filename,providerMetadata:e.providerMetadata});break;case`file`:r.parts.push({type:`file`,mediaType:e.mediaType,url:e.url});break;case`start-step`:r.parts.push({type:`step-start`});break;case`finish-step`:for(let e of Object.keys(i))delete i[e];for(let e of Object.keys(a))delete a[e];break;case`start`:case`finish`:case`message-metadata`:u(e.messageMetadata);break;case`abort`:case`error`:break;default:if(typeof e.type==`string`&&e.type.startsWith(`data-`)){let t=e,n=t.id==null?-1:r.parts.findIndex(e=>e.type===t.type&&e.id===t.id);n>=0?r.parts[n].data=t.data:r.parts.push(t)}else console.warn(`applyUIMessageChunksIncremental: unhandled chunk type ${String(e.type)}`);break}for(let e of s){let t=l(e);if(t&&t.state===`input-streaming`)try{t.input=JSON.parse(o[e]??``)}catch{}}return r.text=fT(r.parts),{message:r,streamState:{activeText:i,activeReasoning:a,toolInputText:o}}}function ire(e,t){let n=[],r=t??0;for(let t of e.sort((e,t)=>e.start-t.start)){if(t.parts.length===0){console.debug(`Got delta with no parts: ${JSON.stringify(t)}`);continue}if(r!==t.start){if(r>=t.end)continue;if(r<t.start){console.warn(`Got delta for stream ${t.streamId} that has a gap ${r} -> ${t.start}`);break}else throw Error(`Got unexpected delta for stream ${t.streamId}: delta: ${t.start} -> ${t.end} existing cursor: ${r}`)}n.push(...t.parts),r=t.end}return{parts:n,cursor:r}}function vT(e,t){if(!e&&!t)return;if(!e)return t;if(!t)return e;let n=e;for(let[e,r]of Object.entries(t))n[e]={...n[e],...r};return n}function are(e,t,n){let[r]=(0,_.useState)({startOrder:n?.startOrder??0,deltaStreams:void 0,threadId:t===`skip`?void 0:t.threadId}),[i,a]=(0,_.useState)({});if(t!==`skip`&&r.threadId!==t.threadId&&(r.threadId=t.threadId,r.deltaStreams=void 0,r.startOrder=n?.startOrder??0,a({})),r.deltaStreams?.length||n?.startOrder&&n.startOrder<r.startOrder){let e=n?.startOrder?n.startOrder-n.startOrder%10:0;e!==r.startOrder&&(r.startOrder=e)}let o=Fi(e,t===`skip`?t:{...t,streamArgs:{kind:`list`,startOrder:r.startOrder}}),s=t===`skip`?void 0:o?pT(o.streams.messages.filter(({streamId:e,order:t})=>!n?.skipStreamIds?.includes(e)&&(!n?.startOrder||t>=n.startOrder))):r.deltaStreams?.map(({streamMessage:e})=>e);s!==void 0&&s.length===0&&(r.deltaStreams=void 0);let c=Fi(e,t===`skip`||!s?.length?`skip`:{...t,streamArgs:{kind:`deltas`,cursors:s.map(({streamId:e})=>({streamId:e,cursor:i[e]??0}))}})?.streams.deltas;if(c?.length&&s){let e=new Map;for(let t of c){let n=i[t.streamId];if(n&&t.start<n)continue;let r=e.get(t.streamId);if(r){let e=r.at(-1).end;Hw(e===t.start,`Gap found in deltas for ${t.streamId} jumping to ${t.start} from ${e}`),r.push(t)}else Hw(!n||n===t.start,`Gap found - first delta after ${n} is ${t.start} for stream ${t.streamId}`),e.set(t.streamId,[t])}let t={};for(let{streamId:n}of s){let r=e.get(n)?.at(-1)?.end??i[n];r!==void 0&&(t[n]=r)}a(t),r.deltaStreams=s.map(t=>{let n=t.streamId,i=r.deltaStreams?.find(e=>e.streamMessage.streamId===n),a=e.get(n);return!a&&t===i?.streamMessage?i:{streamMessage:t,deltas:[...i?.deltas??[],...a??[]]}})}return r.deltaStreams}var ore=`modulepreload`,sre=function(e){return`/`+e},yT={};`structuredClone`in globalThis||function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=sre(t,n),t in yT)return;yT[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:ore,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n
66)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})}(async()=>{let{default:e}=await import(`./esm-CMwDDaWP.js`);return{default:e}},[]).then(({default:e})=>globalThis.structuredClone=e);function cre(e,t,n){let[r,i]=(0,_.useState)({}),a=are(e,t,n),o=t===`skip`?void 0:t.threadId;return(0,_.useEffect)(()=>{if(!a)return;let e=!0;for(let t of a){let n=r[t.streamMessage.streamId],i=n?.cursor;if(n===void 0||i===void 0){e=!1;break}if(t.deltas.some(e=>e.parts.length>0&&e.end>i)){e=!1;break}if(n&&n.uiMessage.status!==gT(t.streamMessage.status)){e=!1;break}}if(e)return;let t=new AbortController;return(async()=>{let e=Object.fromEntries(await Promise.all(a.map(async({deltas:e,streamMessage:t})=>{let n=t.streamId,i=r[n],a=i?.cursor??0,s=gT(t.status),c=i?.streamState??nre(),{parts:l,cursor:u}=ire(e,a),d=i?.uiMessage??tre(t,o);if(l.length===0)return i&&i.uiMessage.status!==s?[n,{uiMessage:{...i.uiMessage,status:s},cursor:i.cursor,streamState:c}]:[n,i??{uiMessage:d,cursor:0,streamState:c}];let{message:f,streamState:p}=rre(d,l,c);return f.status=s,[n,{uiMessage:f,cursor:u,streamState:p}]})));t.signal.aborted||i(e)})(),()=>{t.abort()}},[r,a,o]),(0,_.useMemo)(()=>{if(a)return a.map(({streamMessage:e})=>r[e.streamId]?.uiMessage).filter(e=>e!==void 0)},[r,a])}function lre(e,t,n){let r=Qne(e,t,{initialNumItems:n.initialNumItems}),i=r.results.length?Math.min(...r.results.map(e=>e.order)):0,a=cre(e,!n.stream||t===`skip`||r.status===`LoadingFirstPage`?`skip`:{...t,paginationOpts:{cursor:null,numItems:0}},{startOrder:i,skipStreamIds:n.skipStreamIds});return(0,_.useMemo)(()=>({...r,results:ure(r.results,a??[])}),[r,a])}function ure(e,t){return Jne(dre(e,t))}function dre(e,t){return pT(e.concat(t)).reduce((e,t)=>{let n=e.at(-1);return n?n.order!==t.order||n.stepOrder!==t.stepOrder?[...e,t]:(n.status===`pending`||n.status===`streaming`)&&t.status!==`pending`?[...e.slice(0,-1),t]:e:[t]},[])}var fre=eC(`group/bubble relative flex w-fit max-w-[80%] min-w-0 flex-col gap-1 group-data-[align=end]/message:self-end data-[align=end]:self-end data-[variant=ghost]:max-w-full`,{variants:{variant:{default:`*:data-[slot=bubble-content]:bg-primary *:data-[slot=bubble-content]:text-primary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-primary/80`,secondary:`*:data-[slot=bubble-content]:bg-secondary *:data-[slot=bubble-content]:text-secondary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)]`,muted:`*:data-[slot=bubble-content]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--muted),var(--foreground)_5%)]`,tinted:`*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.93_calc(c*0.4)_h)] *:data-[slot=bubble-content]:text-foreground dark:*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.3_calc(c*0.4)_h)] [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.88_calc(c*0.5)_h)] dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.35_calc(c*0.5)_h)]`,outline:`*:data-[slot=bubble-content]:border-border *:data-[slot=bubble-content]:bg-background [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-input/30`,ghost:`border-none *:data-[slot=bubble-content]:rounded-none *:data-[slot=bubble-content]:bg-transparent *:data-[slot=bubble-content]:p-0 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted/50`,destructive:`*:data-[slot=bubble-content]:bg-destructive/10 *:data-[slot=bubble-content]:text-destructive dark:*:data-[slot=bubble-content]:bg-destructive/20 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/20 dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/30`}},defaultVariants:{variant:`default`}});function pre({variant:e=`default`,align:t=`start`,className:n,...r}){return(0,M.jsx)(`div`,{"data-slot":`bubble`,"data-variant":e,"data-align":t,className:L(fre({variant:e}),n),...r})}function mre({asChild:e=!1,className:t,...n}){return(0,M.jsx)(e?wa:`div`,{"data-slot":`bubble-content`,className:L(`w-fit max-w-full min-w-0 overflow-hidden rounded-xl border border-transparent px-3 py-2 text-sm leading-relaxed wrap-break-word group-data-[align=end]/bubble:self-end [button]:text-left [button,a]:transition-colors [button,a]:outline-none [button,a]:focus-visible:border-ring [button,a]:focus-visible:ring-3 [button,a]:focus-visible:ring-ring/50`,t),...n})}function hre({className:e,align:t=`start`,...n}){return(0,M.jsx)(`div`,{"data-slot":`message`,"data-align":t,className:L(`group/message relative flex w-full min-w-0 gap-2 text-sm data-[align=end]:flex-row-reverse`,e),...n})}function gre({className:e,...t}){return(0,M.jsx)(`div`,{"data-slot":`message-content`,className:L(`flex w-full min-w-0 flex-col gap-2.5 wrap-break-word group-data-[align=end]/message:*:data-slot:self-end`,e),...t})}function _re({defaultTagName:e,props:t,render:n,state:r={},stateAttributesMapping:i}){let a=bT(vre(r,i),t);if(!n)return _.createElement(e,a);if(typeof n==`function`)return n(a,r);if(!_.isValidElement(n))return null;let o=n.props,s={...bT(a,o),ref:xT(a.ref,o.ref)};return _.cloneElement(n,s)}function bT(...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];
66n===`className`?t[n]=[i,r].filter(Boolean).join(` `):n===`style`?t[n]={...i,...r}:n===`ref`?t[n]=xT(i,r):bre(n)&&typeof i==`function`&&typeof r==`function`?t[n]=yre(r,i):t[n]=r}}return t}function vre(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 yre(e,t){return function(n){e(n),n.defaultPrevented||t(n)}}function bre(e){return/^on[A-Z]/.test(e)}function xT(...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 xre=8,Sre=64,Cre=0,ST=.5,wre=180,Tre=new Set([`ArrowDown`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`,` `]),CT={start:!1,end:!1},wT={currentAnchorId:null,visibleMessageIds:[]};function Ere({content:e,scrollEdgeThreshold:t,spacer:n,viewport:r}){if(!r||!e)return CT;let i=OT({content:e,spacer:n,viewport:r});return{start:r.scrollTop>t,end:i-r.scrollTop-r.clientHeight>t}}function Dre({content:e,scrollMargin:t,scrollPreviousItemPeek:n,spacer:r,viewport:i,visibleMessageIds:a}){if(!e||!i)return wT;let o=i.getBoundingClientRect(),s=o.top+t+n,c=typeof IntersectionObserver>`u`,l=[],u=null;for(let t of TT(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+ST&&(u=e)}return l.length===0&&u===null?wT:{currentAnchorId:u,visibleMessageIds:l}}function TT(e,t){return Array.from(e.children).filter(e=>e instanceof HTMLElement&&e!==t)}function Ore(e,t){for(let n=t;n<e.length;n++){let t=e[n];if(t?.dataset.scrollAnchor===`true`)return t}return null}function kre(e,t){for(let n of e)if(n.dataset.scrollAnchor===`true`&&!t.has(n))return n;return null}function Are(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 jre(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n?.dataset.scrollAnchor===`true`)return n}return null}function Mre({content:e,spacer:t,viewport:n}){let r=n.getBoundingClientRect();for(let n of TT(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 Nre({align:e,element:t,scrollMargin:n,spacer:r,viewport:i}){let a=ET(t,i),o=t.getBoundingClientRect().height,s=Ire(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 ET(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return n.top-r.top+t.scrollTop}function DT(e,t){return e.getBoundingClientRect().top-t.getBoundingClientRect().top}function Pre({content:e,scrollTop:t,spacer:n,viewport:r}){let i=OT({content:e,spacer:n,viewport:r});return t+r.clientHeight-i}function OT({content:e,spacer:t,viewport:n}){let r=TT(e,t),i=kT(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 Fre(e){return Math.max(0,e.scrollHeight-e.clientHeight)}function kT(e){let t=window.getComputedStyle(e);return{end:AT(t.paddingBlockEnd||t.paddingBottom),start:AT(t.paddingBlockStart||t.paddingTop)}}function Ire(e){let t=e?.parentElement;return t?kT(t):{end:0,start:0}}function Lre(e){if(!e)return 0;let t=window.getComputedStyle(e);return AT(t.rowGap===`normal`?t.gap:t.rowGap)}function AT(e){if(!e)return 0;let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function Rre({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:v,spacerHeightRef:y,spacerRef:b,viewportRef:x}=e,S=_.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()},wre))},[t]),C=_.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?`${-v.current}px`:``)},[]),w=_.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)<=ST){a.scrollTop=o,t();return}i&&S(!0),a.scrollTo({top:o,behavior:r}),n()},[t,n,S]),T=_.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=_.useCallback(({behavior:e=`auto`}={})=>{let t=x.current;return t?(C(0),i.current=null,f.current=a.current?`following-bottom`:`free-scrolling`,w(Fre(t),{autoscrolling:!0,behavior:e}),r(),!0):!1},[r,w,C]),D=_.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=Nre({align:t,element:e,scrollMargin:o?a+g.current:a,spacer:b.current,viewport:l});return C(Pre({content:s,scrollTop:u,spacer:b.current,viewport:l})),m.current={element:e,viewportTop:DT(e,l)}
66,f.current=o?`anchored-to-message`:`settling-jump`,i.current=o?e:null,w(u,{behavior:n}),r(),!0},[r,w,C]),O=_.useCallback(()=>{let e=i.current;return!e||!e.isConnected||f.current!==`anchored-to-message`?!1:D(e,{align:`start`},{keepPreviousPeek:!0})},[D]),ee=_.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:_.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:ee,scrollToStart:T}}function jT(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 zre(e,t){return jT(e,t)}function Bre(){return jT(wT,Hre)}function Vre(e,t){return e.start===t.start&&e.end===t.end}function Hre(e,t){return e.currentAnchorId!==t.currentAnchorId||e.visibleMessageIds.length!==t.visibleMessageIds.length?!1:e.visibleMessageIds.every((e,n)=>e===t.visibleMessageIds[n])}function Ure({autoScroll:e,scrollEdgeThreshold:t,scrollMargin:n,scrollPreviousItemPeek:r}){let i=_.useRef(e),a=_.useRef(!1),o=_.useRef(null),s=_.useRef(!1),c=_.useRef(t),l=_.useRef(0),u=_.useRef(null),d=_.useRef(e?`following-bottom`:`free-scrolling`),f=_.useRef(new Map),p=_.useRef(null),m=_.useRef(null),h=_.useRef(null),g=_.useRef(r),v=_.useRef(!0),y=_.useRef(null),b=_.useRef(n),x=_.useRef(null),S=_.useRef(0),C=_.useRef(0),w=_.useRef(null),T=_.useRef(null),E=_.useRef(null),D=_.useRef(null),O=_.useRef(null),ee=_.useRef(null),k=_.useRef(null),te=_.useRef(null),ne=_.useRef(new Set),re=_.useRef(new WeakSet);return E.current===null&&(E.current=zre(CT,Vre)),te.current===null&&(te.current=Bre()),i.current=e,c.current=t,b.current=n,g.current=r,{autoScrollRef:i,autoscrollingRef:a,autoscrollingTimeoutRef:D,streamingTurnRef:h,contentRef:o,defaultScrollPositionAppliedRef:s,firstItemRef:u,itemCountRef:l,messageElementsRef:f,modeRef:d,pendingScrollFrameRef:x,pendingScrollToMessageRef:p,prependRestoreRef:m,preserveScrollOnPrependRef:v,rootRef:y,scrollEdgeThresholdRef:c,scrollMarginRef:b,scrollPreviousItemPeekRef:g,spacerGapRef:S,spacerHeightRef:C,spacerRef:w,stateFrameRef:T,stateStore:E.current,viewportRef:O,visibilityFrameRef:ee,visibilityObserverRef:k,visibilityStore:te.current,visibleMessageIdsRef:ne,handledScrollAnchorsRef:re}}function MT(e,t){return _.useCallback(n=>{e.current=n,n&&t()},[e,t])}function Wre({autoScroll:e=!1,defaultScrollPosition:t=`end`,scrollEdgeThreshold:n=xre,scrollPreviousItemPeek:r=Sre,scrollMargin:i=Cre}){let a=Ure({autoScroll:e,scrollEdgeThreshold:n,scrollMargin:i,scrollPreviousItemPeek:r}),{streamingTurnRef:o,autoScrollRef:s,autoscrollingRef:c,autoscrollingTimeoutRef:l,contentRef:u,defaultScrollPositionAppliedRef:d,firstItemRef:f,itemCountRef:p,messageElementsRef:m,modeRef:h,pendingScrollFrameRef:g,pendingScrollToMessageRef:v,prependRestoreRef:y,preserveScrollOnPrependRef:b,rootRef:x,scrollEdgeThresholdRef:S,scrollMarginRef:C,scrollPreviousItemPeekRef:w,spacerGapRef:T,spacerRef:E,stateFrameRef:D,stateStore:O,viewportRef:ee,visibilityFrameRef:k,visibilityObserverRef:te,visibilityStore:ne,visibleMessageIdsRef:re,handledScrollAnchorsRef:ie}=a,ae=_.useRef(t);ae.current!==t&&(ae.current=t,d.current=!1);let A=_.useCallback(e=>{let t=x.current,n=ee.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))},[]),oe=_.useCallback(e=>{s.current&&!e.end&&h.current!==`settling-jump`?h.current=`following-bottom`:h.current===`following-bottom`&&e.end&&!c.current&&(h.current=`free-scrolling`)},[]),se=_.useCallback(()=>{let e=Ere({content:u.current,scrollEdgeThreshold:S.current,spacer:E.current,viewport:ee.current});oe(e),A(e),O.setSnapshot(e)},[oe,O,A]),ce=_.useCallback(()=>{D.current===null&&(D.current=window.requestAnimationFrame(()=>{D.current=null,se()}))},[se]),le=_.useCallback(()=>{ne.hasListeners()&&k.current===null&&(k.current=window.requestAnimationFrame(()=>{k.current=null,ne.hasListeners()&&ne.setSnapshot(Dre({content:u.current,scrollMargin:C.current,scrollPreviousItemPeek:w.current,spacer:E.current,viewport:ee.current,visibleMessageIds:re.current}))}))},[ne]),{flushPendingScrollToMessage:ue,reanchorToAnchoredMessage:de,scrollToElement:fe,scrollToEnd:pe,scrollToMessage:me,scrollToStart:he}=Rre({refs:a,commitScrollState:se,scheduleStateCommit:ce,scheduleVisibilitySync:le}),ge=_.useCallback(()=>{let e=y.current,t=ee.current;if(!e||!t||!e.element.isConnected)return!1;let n=DT(e.element,t)-e.viewportTop;return Math.abs(n)<=ST?!1:(t.scrollTop+=n,e.viewportTop=DT(e.element,t),ce(),le(),!0)},[ce,le]),_e=_.useCallback(()=>{let e=u.current,t=ee.current;if(!e||!t){y.current=null;return}let n=Mre({content:e,spacer:E.current,viewport:t});y.current=n?{element:n,viewportTop:DT(n,t)}:null},[]),ve=_.useCallback(()=>{g.current===null&&(g.current=window.requestAnimationFrame(()=>{g.current=null,ue()&&_e()}))},[_e,ue]),ye=_.useCallback(()=>
66{if(!t||d.current||p.current===0)return!1;let e=!1;if(t===`last-anchor`){let t=u.current,n=ee.current,r=t&&n?jre(TT(t,E.current)):null;if(!t||!n||!r)e=pe({behavior:`auto`});else{let i=ET(r,n);e=OT({content:t,spacer:E.current,viewport:n})-i<=n.clientHeight?pe({behavior:`auto`}):fe(r,{align:`start`},{keepPreviousPeek:!0})}}else e=t===`end`?pe({behavior:`auto`}):he({behavior:`auto`});return e?(d.current=!0,!0):!1},[t,fe,pe,he]),be=_.useCallback(()=>{let e=u.current;if(!e)return;let t=TT(e,E.current),n=p.current,r=f.current;p.current=t.length,f.current=t[0]??null,(()=>{if(ue())return;if(n===0){if(ye()||t.length>0&&s.current&&pe({behavior:`auto`}))return;se(),le();return}let e=r?t.indexOf(r):-1;if(b.current&&e>0){ge();return}if(t.length>n){let e=Ore(t,n);if(e){if(s.current&&h.current===`following-bottom`&&Are(t,n)){pe({behavior:`auto`});return}fe(e,{align:`start`},{keepPreviousPeek:!0}),ie.current.add(e);return}}if(t.length===n){let e=kre(t,ie.current);if(e){fe(e,{align:`start`},{keepPreviousPeek:!0}),ie.current.add(e);return}}h.current===`following-bottom`&&s.current?pe({behavior:`auto`}):(se(),le())})(),_e()},[ye,_e,se,ue,ge,le,fe,pe]),xe=_.useCallback(()=>{if(h.current===`following-bottom`&&s.current){pe({behavior:`auto`});return}de()||(ce(),le())},[de,ce,le,pe]),Se=_.useCallback(()=>{let e=ee.current;if(!(!e||!ne.hasListeners())){if(typeof IntersectionObserver>`u`){le();return}te.current||=new IntersectionObserver(e=>{for(let t of e){let e=t.target.dataset.messageId;e&&(t.isIntersecting?re.current.add(e):re.current.delete(e))}le()},{root:e,rootMargin:`${-(C.current+w.current)}px 0px 0px 0px`,threshold:[0,.01,.5,1]}),m.current.forEach(e=>{te.current?.observe(e)}),le()}},[le,ne]),Ce=_.useCallback(()=>{k.current!==null&&(window.cancelAnimationFrame(k.current),k.current=null),te.current?.disconnect(),te.current=null,re.current.clear(),ne.setSnapshot(wT)},[ne]),we=_.useCallback((e,t,n)=>{if(t){m.current.set(e,t),te.current?.observe(t),le(),v.current?.messageId===e&&ve();return}n&&m.current.get(e)===n&&(m.current.delete(e),re.current.delete(e),te.current?.unobserve(n),le())},[ve,le]),Te=_.useCallback(()=>{(h.current===`following-bottom`||h.current===`anchored-to-message`||h.current===`settling-jump`)&&(o.current=null,h.current=`free-scrolling`)},[]),Ee=_.useCallback(()=>A(O.getSnapshot()),[O,A]),De=MT(x,Ee),Oe=MT(ee,Ee),ke=_.useCallback(e=>{u.current=e},[]),Ae=_.useCallback(e=>{E.current=e,T.current=Lre(e?.parentElement??null)},[]),je=_.useCallback(()=>{se(),le(),_e()},[_e,se,le]),Me=_.useMemo(()=>({handleContentChange:be,handleResize:xe,observeVisibility:Se,preserveScrollOnPrependRef:b,scrollToEnd:pe,scrollToMessage:me,scrollToStart:he,setContentElement:ke,setRootElement:De,setSpacerElement:Ae,setViewportElement:Oe,stateStore:O,syncAfterScroll:je,unobserveVisibility:Ce,userScrollIntent:Te,viewportRef:ee,visibilityStore:ne}),[be,xe,Se,pe,me,he,ke,De,Ae,Oe,O,je,Ce,Te,ne]);return _.useLayoutEffect(()=>{ye()},[ye]),_.useEffect(()=>()=>{D.current!==null&&(window.cancelAnimationFrame(D.current),D.current=null),k.current!==null&&(window.cancelAnimationFrame(k.current),k.current=null),l.current!==null&&(window.clearTimeout(l.current),l.current=null),g.current!==null&&(window.cancelAnimationFrame(g.current),g.current=null),te.current?.disconnect(),te.current=null},[]),_.useLayoutEffect(()=>{if(e&&h.current===`following-bottom`&&p.current>0){pe({behavior:`auto`});return}se()},[e,se,pe]),{context:Me,registerMessage:we}}function Gre(e){let t=_.useRef(e);return t.current=e,t}var NT=_.createContext(null),PT=_.createContext(null);function FT(){let e=_.useContext(NT);if(!e)throw Error(`useMessageScroller must be used within a MessageScroller.`);return e}function Kre(){let e=_.useContext(PT);if(!e)throw Error(`MessageScrollerItem must be used within a MessageScroller.`);return e}function qre({autoScroll:e=!1,children:t,defaultScrollPosition:n=`end`,scrollEdgeThreshold:r,scrollPreviousItemPeek:i,scrollMargin:a}){let{context:o,registerMessage:s}=Wre({autoScroll:e,defaultScrollPosition:n,scrollEdgeThreshold:r,scrollPreviousItemPeek:i,scrollMargin:a});return(0,M.jsx)(NT.Provider,{value:o,children:(0,M.jsx)(PT.Provider,{value:s,children:t})})}function Jre({children:e,...t}){let{setRootElement:n}=FT();return(0,M.jsx)(`div`,{ref:n,...t,children:e})}function Yre({"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}=FT();f.current=o;let v=_.useCallback(e=>{p(e),xT(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){Tre.has(e.key)&&h(),n?.(e)}return _.useEffect(()=>{let e=g.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(d);return t.observe(e),()=>t.disconnect()},[d,g]),(0,M.jsx)(`div`,{ref:v,role:c??`region`,"aria-label":e??`Messages`,tabIndex:l??0,onKeyDown:S,onScroll:y,onTouchMove:x,onWheel:b,...u,children:t})}function Xre({"aria-relevant":e,children:t,ref:n,role:r,spacerClassName:i,...a}){let{handleContentChange:o,handleResize:s,setContentElement:c,setSpacerElement:l}=FT(),u=_.useRef(null),d=_.useCallback(e=>{u.current=e,c(e),xT(n)?.(e)},[n,c]);return _.useLayoutEffect(()=>{let e=u.current;
66if(!e||(o(),typeof MutationObserver>`u`))return;let t=new MutationObserver(()=>{o()});return t.observe(e,{childList:!0}),()=>t.disconnect()},[o]),_.useEffect(()=>{let e=u.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(s);return t.observe(e),()=>t.disconnect()},[s]),(0,M.jsxs)(`div`,{ref:d,role:r??`log`,"aria-relevant":e??`additions`,...a,children:[t,(0,M.jsx)(`div`,{ref:l,"aria-hidden":`true`,"data-message-scroller-spacer":``,hidden:!0,className:i})]})}function Zre({messageId:e,ref:t,scrollAnchor:n=!1,...r}){let i=Kre(),a=_.useRef(null);return(0,M.jsx)(`div`,{ref:_.useCallback(n=>{let r=a.current;a.current=n,e&&i(e,n,r),xT(t)?.(n)},[e,t,i]),"data-message-id":e,"data-scroll-anchor":n?`true`:`false`,...r})}function Qre({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}=FT(),d=Gre(r),f=_.useCallback(e=>u.subscribe(e),[u]),p=_.useCallback(()=>{let e=u.getSnapshot();return n===`start`?e.start:e.end},[n,u]),m=_.useSyncExternalStore(f,p,p),h=_.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 _re({defaultTagName:`button`,props:bT({type:o,inert:!m,tabIndex:m?a:-1,children:t??(0,M.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 IT={Provider:qre,Root:Jre,Viewport:Yre,Content:Xre,Item:Zre,Button:Qre};function $re(e){return(0,M.jsx)(IT.Provider,{...e})}function eie({className:e,...t}){return(0,M.jsx)(IT.Root,{"data-slot":`message-scroller`,className:L(`group/message-scroller relative flex size-full min-h-0 flex-col overflow-hidden`,e),...t})}function tie({className:e,...t}){return(0,M.jsx)(IT.Viewport,{"data-slot":`message-scroller-viewport`,className:L(`size-full min-h-0 min-w-0 scroll-fade-b scrollbar-thin scrollbar-gutter-stable overflow-y-auto overscroll-contain contain-content data-autoscrolling:scrollbar-thumb-transparent data-autoscrolling:scrollbar-track-transparent`,e),...t})}function nie({className:e,...t}){return(0,M.jsx)(IT.Content,{"data-slot":`message-scroller-content`,className:L(`flex h-max min-h-full flex-col gap-6`,e),...t})}function LT({className:e,scrollAnchor:t=!1,...n}){return(0,M.jsx)(IT.Item,{"data-slot":`message-scroller-item`,scrollAnchor:t,className:L(`min-w-0 shrink-0 [contain-intrinsic-size:auto_10rem] [content-visibility:auto]`,e),...n})}function rie({direction:e=`end`,className:t,children:n,render:r,variant:i=`secondary`,size:a=`icon-sm`,...o}){return(0,M.jsx)(IT.Button,{"data-slot":`message-scroller-button`,"data-direction":e,"data-variant":i,"data-size":a,direction:e,className:L(`absolute inset-s-1/2 -translate-x-1/2 border-border bg-background text-foreground transition-[translate,scale,opacity] duration-200 hover:bg-muted hover:text-foreground data-[active=false]:pointer-events-none data-[active=false]:scale-95 data-[active=false]:opacity-0 data-[active=false]:duration-400 data-[active=false]:ease-[cubic-bezier(0.7,0,0.84,0)] data-[active=true]:translate-y-0 data-[active=true]:scale-100 data-[active=true]:opacity-100 data-[active=true]:ease-[cubic-bezier(0.23,1,0.32,1)] data-[direction=end]:bottom-4 data-[direction=end]:data-[active=false]:translate-y-full data-[direction=start]:top-4 data-[direction=start]:data-[active=false]:-translate-y-full rtl:translate-x-1/2 data-[direction=start]:[&_svg]:rotate-180`,t),render:r??(0,M.jsx)(z,{variant:i,size:a}),...o,children:n??(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(mx,{}),(0,M.jsx)(`span`,{className:`sr-only`,children:e===`end`?`Scroll to end`:`Scroll to start`})]})})}function iie(){let{isLoading:e,isAuthenticated:t}=Ki();return e?null:t?(0,M.jsx)(aie,{}):(0,M.jsx)(`div`,{className:`flex flex-1 items-center p-4`,children:(0,M.jsx)(zw,{})})}function aie(){let e=YC(),t=Fi(B.chatSessions.queries.list,{}),n=e??t?.[0]?._id??null,r=(t?.find(e=>e._id===n)??null)?.threadId??null,i=Ii(B.chat.mutations.send),[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(!1),{results:l}=lre(B.chat.queries.listMessages,r?{threadId:r}:`skip`,{initialNumItems:30,stream:!0}),u=(0,_.useCallback)(async()=>{let e=a.trim();if(!(e===``||s)){o(``),c(!0);try{await i({prompt:e,chatSessionId:n??void 0})}finally{c(!1)}}},[a,s,i,n]),d=l[l.length-1],f=d!==void 0&&d.role===`user`&&d.status!==`streaming`;return(0,M.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl min-h-0 flex-1 flex-col`,children:[(0,M.jsx)($re,{autoScroll:!0,
66children:(0,M.jsxs)(eie,{children:[(0,M.jsx)(tie,{children:(0,M.jsxs)(nie,{className:`gap-4 p-4`,children:[l.length===0&&(0,M.jsxs)(`div`,{className:`flex flex-col items-center gap-2 pt-16 text-center`,children:[(0,M.jsx)(`p`,{className:`font-serif text-2xl tracking-tight text-foreground`,children:`What's on your mind?`}),(0,M.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:`Think out loud with XO. It remembers what matters and can find anything you've captured.`})]}),l.map(e=>(0,M.jsx)(LT,{messageId:e.key,scrollAnchor:e.role===`user`,children:(0,M.jsx)(oie,{text:e.text,role:e.role,streaming:e.status===`streaming`})},e.key)),f&&(0,M.jsx)(LT,{messageId:`awaiting-reply`,children:(0,M.jsx)(`p`,{className:`shimmer text-sm text-muted-foreground`,children:`XO is thinkingâ¦`})})]})}),(0,M.jsx)(rie,{})]})}),(0,M.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),u()},className:`flex items-end gap-2 border-t border-border/60 p-4`,children:[(0,M.jsx)(Bw,{value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),u())},placeholder:`Message XOâ¦`,rows:1,className:`max-h-40`}),(0,M.jsx)(z,{type:`submit`,disabled:a.trim()===``||s,children:`Send`})]})]})}function oie({text:e,role:t,streaming:n}){let[r]=Zne(e,{startStreaming:n}),i=t===`user`;return(0,M.jsx)(hre,{align:i?`end`:`start`,children:(0,M.jsx)(gre,{children:(0,M.jsx)(pre,{align:i?`end`:`start`,variant:i?`muted`:`ghost`,children:(0,M.jsx)(mre,{className:`whitespace-pre-wrap`,children:r})})})})}var RT={projects:{route:`/projects`,title:`Projects`,singular:`project`,description:`Active work toward an outcome. Notes filed here support something you're moving forward.`,emptyHint:`No projects yet. Name the first thing you're actively working toward.`,api:{list:B.projects.queries.listOwned,get:B.projects.queries.get,create:B.projects.mutations.create,rename:B.projects.mutations.rename,setArchived:B.projects.mutations.setArchived}},areas:{route:`/areas`,title:`Areas`,singular:`area`,description:`Ongoing responsibilities â health, work, home. No finish line, just standards to hold.`,emptyHint:`No areas yet. Add a responsibility you hold over time.`,api:{list:B.areas.queries.listOwned,get:B.areas.queries.get,create:B.areas.mutations.create,rename:B.areas.mutations.rename,setArchived:B.areas.mutations.setArchived}},resources:{route:`/resources`,title:`Resources`,singular:`resource`,description:`Topics of ongoing interest. Reference material for the curious mind.`,emptyHint:`No resources yet. Add a topic you keep coming back to.`,api:{list:B.resources.queries.listOwned,get:B.resources.queries.get,create:B.resources.mutations.create,rename:B.resources.mutations.rename,setArchived:B.resources.mutations.setArchived}}};function zT({kind:e}){return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Xi,{children:(0,M.jsx)(sie,{kind:e})}),(0,M.jsx)(Zi,{children:(0,M.jsx)(`main`,{className:`container mx-auto flex flex-col gap-6 px-4 py-8 max-w-3xl`,children:(0,M.jsx)(zw,{})})})]})}function sie({kind:e}){let t=JC();return t===null?(0,M.jsx)(cie,{kind:e}):(0,M.jsx)(lie,{kind:e,containerId:t})}function cie({kind:e}){let t=RT[e],n=Fi(t.api.list,{}),r=Ii(t.api.create),[i,a]=(0,_.useState)(``),o=async()=>{let e=i.trim();if(e===``)return;a(``);let n=await r({name:e});GC(t.route,n)};return(0,M.jsxs)(`main`,{className:`container mx-auto flex flex-col gap-6 px-4 py-8 max-w-3xl`,children:[(0,M.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,M.jsx)(`h1`,{className:`text-2xl font-semibold`,children:t.title}),(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t.description})]}),(0,M.jsxs)(`form`,{className:`flex gap-2`,onSubmit:e=>{e.preventDefault(),o()},children:[(0,M.jsx)(iC,{value:i,onChange:e=>a(e.target.value),placeholder:`New ${t.singular} name`,"aria-label":`New ${t.singular} name`}),(0,M.jsxs)(z,{type:`submit`,disabled:i.trim()===``,children:[(0,M.jsx)(SS,{className:`size-4`}),` Add`]})]}),n===void 0?(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(pC,{className:`h-14 w-full`}),(0,M.jsx)(pC,{className:`h-14 w-full`})]}):n.length===0?(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t.emptyHint}):(0,M.jsx)(`ul`,{className:`flex flex-col gap-2`,children:n.map(e=>(0,M.jsx)(`li`,{children:(0,M.jsx)(`button`,{type:`button`,onClick:()=>GC(t.route,e._id),className:`w-full rounded-lg border border-border/60 px-4 py-3 text-left transition-colors hover:bg-accent`,children:(0,M.jsx)(`span`,{className:`font-medium`,children:e.name})})},e._id))})]})}function lie({kind:e,containerId:t}){let n=RT[e],r=Fi(n.api.get,{id:t}),i=Fi(B.notes.queries.listByContainer,{containerId:t}),a=Ii(n.api.rename),o=Ii(n.api.setArchived),[s,c]=(0,_.useState)(null);if(r===void 0)return(0,M.jsxs)(`main`,{className:`container mx-auto flex flex-col gap-4 px-4 py-8 max-w-3xl`,children:[(0,M.jsx)(pC,{className:`h-10 w-full`}),(0,M.jsx)(pC,{className:`h-32 w-full`})]});let l=t,u=async()=>
66{if(s===null)return;let e=s.trim();c(null),e!==``&&e!==r.name&&await a({id:l,name:e})},d=async()=>{await o({id:l,archived:!0}),GC(n.route,null)};return(0,M.jsxs)(`main`,{className:`container mx-auto flex flex-col gap-6 px-4 py-8 max-w-3xl`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsxs)(z,{variant:`ghost`,size:`sm`,onClick:()=>GC(n.route,null),"aria-label":`Back to ${n.title}`,children:[(0,M.jsx)(hx,{className:`size-4`}),` `,n.title]}),(0,M.jsxs)(z,{variant:`ghost`,size:`sm`,className:`ml-auto`,onClick:()=>void d(),"aria-label":`Archive ${n.singular}`,children:[(0,M.jsx)(px,{className:`size-4`}),` Archive`]})]}),(0,M.jsx)(`header`,{className:`flex items-center gap-2`,children:s===null?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`h1`,{className:`text-2xl font-semibold`,children:r.name}),(0,M.jsx)(z,{variant:`ghost`,size:`icon`,onClick:()=>c(r.name),"aria-label":`Rename`,children:(0,M.jsx)(xS,{className:`size-4`})})]}):(0,M.jsxs)(`form`,{className:`flex w-full gap-2`,onSubmit:e=>{e.preventDefault(),u()},children:[(0,M.jsx)(iC,{value:s,onChange:e=>c(e.target.value),"aria-label":`${n.singular} name`,autoFocus:!0}),(0,M.jsx)(z,{type:`submit`,size:`icon`,"aria-label":`Save name`,children:(0,M.jsx)(Cx,{className:`size-4`})})]})}),e===`projects`?(0,M.jsx)(uie,{projectId:t}):null,(0,M.jsx)(`h2`,{className:`text-sm font-semibold uppercase tracking-wide text-muted-foreground`,children:`Notes`}),i===void 0?(0,M.jsx)(pC,{className:`h-24 w-full`}):i.length===0?(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Nothing filed here yet. File notes from the inbox or a note's File button.`}):(0,M.jsx)(`ul`,{className:`flex flex-col gap-2`,children:i.map(e=>(0,M.jsx)(`li`,{children:(0,M.jsxs)(`button`,{type:`button`,onClick:()=>WC(`/notes`,e._id),className:`w-full rounded-lg border border-border/60 px-4 py-3 text-left transition-colors hover:bg-accent`,children:[(0,M.jsx)(`span`,{className:`block font-medium`,children:e.title||`Untitled`}),e.preview?(0,M.jsx)(`span`,{className:`block truncate text-sm text-muted-foreground`,children:e.preview}):null]})},e._id))})]})}function uie({projectId:e}){let t=Fi(B.tasks.queries.listByProject,{projectId:e}),n=Ii(B.tasks.mutations.create),r=Ii(B.tasks.mutations.complete),i=Ii(B.tasks.mutations.reopen),[a,o]=(0,_.useState)(``),s=async()=>{let t=a.trim();t!==``&&(o(``),await n({title:t,status:`next`,projectId:e}))},c=(t??[]).filter(e=>e.status!==`done`),l=(t??[]).filter(e=>e.status===`done`);return(0,M.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,M.jsx)(`h2`,{className:`text-sm font-semibold uppercase tracking-wide text-muted-foreground`,children:`Next actions`}),(0,M.jsxs)(`form`,{className:`flex gap-2`,onSubmit:e=>{e.preventDefault(),s()},children:[(0,M.jsx)(iC,{value:a,onChange:e=>o(e.target.value),placeholder:`Add a next action for this projectâ¦`,"aria-label":`Add a next action`}),(0,M.jsx)(z,{type:`submit`,size:`icon`,disabled:a.trim()===``,"aria-label":`Add next action`,children:(0,M.jsx)(SS,{className:`size-4`})})]}),t===void 0?(0,M.jsx)(pC,{className:`h-12 w-full`}):t.length===0?(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No next action yet. What's the smallest step that moves this forward?`}):(0,M.jsx)(`ul`,{className:`flex flex-col divide-y divide-border rounded-lg border border-border/60`,children:[...c,...l].map(e=>(0,M.jsxs)(`li`,{className:`flex items-center gap-3 px-4 py-2.5`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:()=>void(e.status===`done`?i({id:e._id}):r({id:e._id})),"aria-label":e.status===`done`?`Reopen task`:`Complete task`,className:L(`flex size-5 shrink-0 items-center justify-center rounded-full border transition-colors`,e.status===`done`?`border-primary bg-primary text-primary-foreground`:`border-border hover:border-primary/60`),children:e.status===`done`?(0,M.jsx)(Cx,{className:`size-3`,strokeWidth:3}):null}),(0,M.jsx)(`span`,{className:L(`min-w-0 flex-1 truncate text-sm`,e.status===`done`&&`text-muted-foreground line-through`),children:e.title||`Untitled action`}),e.status===`waiting`?(0,M.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:`waiting`}):null]},e._id))})]})}function die(){let{isLoading:e,isAuthenticated:t}
66=Ki(),[n,r]=(0,_.useState)(!1),i=Fi(B.theories.queries.topHeldQuestion,n?{}:`skip`);return e?null:t?(0,M.jsx)(`div`,{className:`mx-auto flex w-full max-w-md flex-1 flex-col justify-center gap-4 p-4`,children:n?(0,M.jsx)(fie,{theory:i}):(0,M.jsxs)(Nw,{children:[(0,M.jsxs)(Pw,{children:[(0,M.jsx)(Fw,{children:`Held`}),(0,M.jsx)(Iw,{children:`XO holds theories quietly. Nothing surfaces unless you ask.`})]}),(0,M.jsx)(Lw,{children:(0,M.jsx)(z,{onClick:()=>r(!0),className:`w-full`,children:`What are you holding?`})})]})}):(0,M.jsx)(`div`,{className:`flex flex-1 items-center p-4`,children:(0,M.jsx)(zw,{})})}function fie({theory:e}){return e===void 0?(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loadingâ¦`}):e===null?(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Nothing held right now.`}):(0,M.jsxs)(Nw,{children:[(0,M.jsx)(Pw,{children:(0,M.jsx)(Fw,{children:e.subject})}),(0,M.jsxs)(Lw,{className:`flex flex-col gap-3`,children:[(0,M.jsx)(`p`,{className:`text-sm`,children:e.hypothesis}),(0,M.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`confidence `,e.confidence,` â `,e.status]}),e.evidenceLinks.length>0&&(0,M.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.evidenceLinks.map(e=>(0,M.jsx)(`li`,{children:(0,M.jsx)(`code`,{className:`text-xs`,children:e})},e))})]}),(0,M.jsx)(Rw,{children:(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.retirementPolicy})})]})}function BT(e){this.content=e}BT.prototype={constructor:BT,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 BT(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 BT(n)},addToStart:function(e,t){return new BT([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new BT(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 BT(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=BT.from(e),e.size?new BT(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=BT.from(e),e.size?new BT(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=BT.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}},BT.from=function(e){if(e instanceof BT)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new BT(t)};function VT(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){for(let e=0;i.text[e]==a.text[e];e++)n++;return n}if(i.content.size||a.content.size){let e=VT(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function HT(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=0,t=Math.min(o.text.length,s.text.length);for(;e<t&&o.text[o.text.length-e-1]==s.text[s.text.length-e-1];)e++,n--,r--;return{a:n,b:r}}if(o.content.size||s.content.size){let e=HT(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}var V=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)}
vendor: 15,686 bytes, line 66
66textBetween(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 VT(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return HT(this,e,t,n)}findIndex(e){if(e==0)return WT(0,e);if(e==this.size)return WT(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?WT(t+1,i):WT(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)`:``))}};V.empty=new V([],0);var UT={index:0,offset:0};function WT(e,t){return UT.index=e,UT.offset=t,UT}function GT(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(!GT(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!GT(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var KT=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&>(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}};KT.none=[];var qT=class extends Error{},H=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=YT(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(JT(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(V.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)}};H.empty=new H(V.empty,0,0);function JT(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(JT(a.content,t-i-1,n-i-1)))}function YT(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=YT(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 pie(e,t,n){if(n.openStart>e.depth)throw new qT(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new qT(`Inconsistent open depths`);return XT(e,t,n,0)}function XT(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=XT(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return tE(a,rE(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return tE(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=mie(n,e);return tE(a,nE(e,i,o,t,r))}}function ZT(e,t){if(!t.type.compatibleContent(e.type))throw new qT(`Cannot join `+t.type.name+` onto `+e.type.name)}function QT(e,t,n){let r=e.node(n);return ZT(r,t.node(n)),r}function $T(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 eE(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&&($T(e.nodeAfter,r),a++));for(let e=a;e<o;e++)$T(i.child(e),r);t&&t.depth==n&&t.textOffset&&$T(t.nodeBefore,r)}function tE(e,t){return e.type.checkContent(t),e.copy(t)}function nE(e,t,n,r,i){let a=e.depth>i&&QT(e,t,i+1),o=r.depth>i&&QT(n,r,i+1),s=[];return eE(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(ZT(a,o),$T(tE(a,nE(e,t,n,r,i+1)),s)):(a&&$T(tE(a,rE(e,t,i+1)),s),eE(t,n,i,s),o&&$T(tE(o,rE(n,r,i+1)),s)),eE(r,null,i,s),new V(s)}function rE(e,t,n){let r=[];return eE(null,e,n,r),e.depth>n&&$T(tE(QT(e,t,n+1),rE(e,t,n+1)),r),eE(t,null,n,r),new V(r)}function mie(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(V.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var iE=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 KT.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 oE(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=aE.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 aE.set(t,r=new hie);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%gie,i}},hie=class{constructor(){this.elts=[],this.i=0}},gie=12,aE=new WeakMap,oE=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)}},_ie=Object.create(null),sE=class e{constructor(e,t,n,r=KT.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||V.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&>(this.attrs,t||e.defaultAttrs||_ie)&&KT.sameSet(this.marks,n||KT.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 H.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new H(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return pie(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 iE.resolveCached(this,e)}resolveNoCache(e){return iE.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()+`)`),cE(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=V.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=KT.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(!KT.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>
66e.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=V.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};sE.prototype.text=void 0;var vie=class e extends sE{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):cE(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 cE(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var lE=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new yie(t,n);if(r.next==null)return e.empty;let i=uE(r);r.next&&r.err(`Unexpected trailing text`);let a=Eie(Tie(i));return Die(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 V.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(` 67`)}};lE.empty=new lE(!0);var yie=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 uE(e){let t=[];do t.push(bie(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function bie(e){let t=[];do t.push(xie(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function xie(e){let t=wie(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=Sie(e,t);else break;return t}function dE(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function Sie(e,t){let n=dE(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:dE(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function Cie(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 wie(e){if(e.eat(`(`)){let t=uE(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=Cie(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 Tie(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}
vendor: 54,580 bytes, lines 67-70
67function 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 fE(e,t){return t-e}function pE(e,t){let n=[];return r(t),n.sort(fE);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 Eie(e){let t=Object.create(null);return n(pE(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]);pE(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new lE(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(fE);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function Die(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 mE(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 hE(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 gE(e,t,n,r){for(let r in t)if(!(r in e))throw RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let n in e){let r=e[n];r.validate&&r.validate(t[n])}}function _E(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new kie(e,r,t[r]);return n}var vE=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=_E(e,n.attrs),this.defaultAttrs=mE(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==lE.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:hE(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new sE(this,this.computeAttrs(e),V.from(t),KT.setFrom(n))}createChecked(e=null,t,n){return t=V.from(t),this.checkContent(t),new sE(this,this.computeAttrs(e),t,KT.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=V.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(V.empty,!0);return i?new sE(this,e,t.append(i),KT.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){gE(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:KT.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 Oie(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 kie=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?Oie(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},yE=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=_E(e,r.attrs),this.excluded=null;let i=mE(this.attrs);this.instance=i?new KT(this,i):null}create(e=null){return!e&&this.instance?this.instance:new KT(this,hE(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){gE(this.attrs,e,`mark`,this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},bE=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=BT.from(e.nodes),t.marks=BT.from(e.marks||{}),this.nodes=vE.compile(this.spec.nodes,this),this.marks=yE.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]=lE.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?xE(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==``?[]:xE(this,n.split(` `))}this.nodeFromJSON=e=>sE.fromJSON(this,e),this.markFromJSON=e=>KT.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 vE))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 vie(n,n.defaultAttrs,e,KT.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 xE(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 SE(e){return e.tag!=null}function Aie(e){return e.style!=null}var CE=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(SE(e))this.tags.push(e);else if(Aie(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 ME(this,t,!1);return n.addAll(e,KT.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new ME(this,t,!0);return n.addAll(e,KT.none,t.from,t.to),H.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(NE(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=PE(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=PE(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)))}},wE={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},TE={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},EE={ol:!0,ul:!0},DE=1,OE=2,kE=4;function AE(e,t,n){return t==null?e&&e.whitespace==`pre`?DE|OE:n&~kE:(t?DE:0)|(t===`full`?OE:0)}var jE=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=KT.none,this.match=i||(a&kE?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(V.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&DE)){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=V.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(V.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&&!wE.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},ME=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=AE(null,t.preserveWhitespace,0)|(n?kE:0);i=r?new jE(r.type,r.attrs,KT.none,!0,t.topMatch||r.type.contentMatch,a):n?new jE(null,null,KT.none,!0,null,a):new jE(e.schema.topNodeType,null,KT.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&OE?`full`:this.localPreserveWS||(r.options&DE)>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,` 68`);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;EE.hasOwnProperty(a)&&this.parser.normalizeLists&&jie(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));out:if(s?s.ignore:TE.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(wE.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(` 69`),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=KT.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):FE(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=AE(e,i,a.options);a.options&kE&&a.content.length==0&&(o|=kE);let s=KT.none;return n=n.filter(t=>(a.type?a.type.allowsMarkType(t.type):FE(t.type,e))?(s=t.addToSet(s),!1):!0),this.nodes.push(new jE(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|=DE);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 jie(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=t.nodeType==1?t.nodeName.toLowerCase():null;e&&EE.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):e==`li`?n=t:e&&(n=null)}}function NE(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function PE(e){let t={};for(let n in e)t[n]=e[n];return t}function FE(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 IE=class e{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||=RE(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 RE(t).createTextNode(e.text);let{dom:n,contentDOM:r}=VE(RE(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&&VE(RE(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return typeof t==`string`?{dom:e.createTextNode(t)}:VE(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=LE(e.nodes);return t.text||=e=>e.text,t}static marksFromSchema(e){return LE(e.marks)}};function LE(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function RE(e){return e.document||window.document}var zE=new WeakMap;function BE(e){let t=zE.get(e);return t===void 0&&zE.set(e,t=Mie(e)),t}function Mie(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 VE(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=BE(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}=VE(e,a,n,r);if(c.appendChild(t),i){if(s)throw RangeError(`Multiple content holes`);s=i}}}return{dom:c,contentDOM:s}}var HE=65535,UE=2**16;function WE(e,t){return e+t*UE}function GE(e){return e&HE}function KE(e){return(e-(e&HE))/UE}var qE=1,JE=2,YE=4,XE=8,ZE=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&XE)>0}get deletedBefore(){return(this.delInfo&(qE|YE))>0}get deletedAfter(){return(this.delInfo&(JE|YE))>0}get deletedAcross(){return(this.delInfo&YE)>0}},QE=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=GE(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+KE(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:WE(o/3,e-s),f=e==s?JE:e==u?qE:YE;return(t<0?e!=s:e!=u)&&(f|=XE),new ZE(a,f,d)}r+=l-c}return n?e+r:new ZE(e+r,0,null)}touches(e,t){let n=0,r=GE(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])}};QE.empty=new QE([]);var $E=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 ZE(e,r,null)}},eD=Object.create(null),tD=class{getMap(){return QE.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError(`Invalid input for Step.fromJSON`);let n=eD[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in eD)throw RangeError(`Duplicate use of step JSON ID `+e);return eD[e]=t,t.prototype.jsonID=e,t}},nD=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 qT)return e.fail(t.message);throw t}}};function rD(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let a=e.child(i);a.content.size&&(a=a.copy(rD(a.content,t,a))),a.isInline&&(a=t(a,n,i)),r.push(a)}return V.fromArray(r)}var iD=class e extends tD{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 H(rD(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 nD.fromReplace(e,this.from,this.to,i)}invert(){return new aD(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))}};tD.jsonID(`addMark`,iD);var aD=class e extends tD{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 H(rD(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return nD.fromReplace(e,this.from,this.to,n)}invert(){return new iD(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))}};tD.jsonID(`removeMark`,aD);var oD=class e extends tD{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return nD.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return nD.fromReplace(e,this.pos,this.pos+1,new H(V.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 sD(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))}};tD.jsonID(`addNodeMark`,oD);var sD=class e extends tD{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return nD.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return nD.fromReplace(e,this.pos,this.pos+1,new H(V.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new oD(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))}};tD.jsonID(`removeNodeMark`,sD);var cD=class e extends tD{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&uD(e,this.from,this.to)?nD.fail(`Structure replace would overwrite content`):nD.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new QE([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?H.empty:new H(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?H.empty:new H(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,H.fromJSON(t,n.slice),!!n.structure)}};cD.MAP_BIAS=1,tD.jsonID(`replace`,cD);var lD=class e extends tD{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&&(uD(e,this.from,this.gapFrom)||uD(e,this.gapTo,this.to)))return nD.fail(`Structure gap-replace would overwrite content`);let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return nD.fail(`Gap is not a flat range`);let n=this.slice.insertAt(this.insert,t.content);return n?nD.fromReplace(e,this.from,this.to,n):nD.fail(`Content does not fit in gap`)}getMap(){return new QE([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,H.fromJSON(t,n.slice),n.insert,!!n.structure)}};tD.jsonID(`replaceAround`,lD);function uD(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 dD(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 aD(l,d,u[e])));s&&s.to==l?s.to=d:a.push(s=new iD(l,d,r))}}),i.forEach(t=>e.step(t)),a.forEach(t=>e.step(t))}function fD(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 yE){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 aD(t.from,t.to,t.style)))}function pD(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 cD(s,l,H.empty));else{r=u;for(let t=0;t<c.marks.length;t++)n.allowsMarkType(c.marks[t].type)||e.step(new aD(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 H(V.from(n.schema.text(` `,n.allowedMarks(c.marks))),0,0),o.push(new cD(s+e.index,s+e.index+e[0].length,r))}}s=l}if(!r.validEnd){let t=r.fillBefore(V.empty,!0);e.replace(s,s,new H(t,0,0))}for(let t=o.length-1;t>=0;t--)e.step(o[t])}function mD(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function hD(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||!mD(a,o,s))break;o&&(r=1),s<a.childCount&&(i=1)}return null}function gD(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=V.empty,d=0;for(let e=a,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,u=V.from(r.node(e).copy(u)),d++):c--;let f=V.empty,p=0;for(let e=a,t=!1;e>n;e--)t||i.after(e+1)<i.end(e)?(t=!0,f=V.from(i.node(e).copy(f)),p++):l++;e.step(new lD(c,l,o,s,new H(u.append(f),d,p),u.size-d,!0))}function _D(e,t,n=null,r=e){let i=yD(e,t),a=i&&bD(r,t);return a?i.map(vD).concat({type:t,attrs:n}).concat(a.map(vD)):null}function vD(e){return{type:e,attrs:null}}function yD(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 bD(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 xD(e,t,n){let r=V.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=V.from(n[e].type.create(n[e].attrs,r))}let i=t.start,a=t.end;e.step(new lD(i,a,i,a,new H(r,0,0),n.length,!0))}function SD(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)&&TD(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&&wD(e,t,n,a),pD(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 lD(c,l,c+1,l-1,new H(V.from(r.create(o,null,t.marks)),0,0),1,!0)),i===!0&&CD(e,t,n,a),!1}})}function CD(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 wD(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(` 70`))}})}function TD(e,t,n){let r=e.resolve(t),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function ED(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 lD(t,t+a.nodeSize,t+1,t+a.nodeSize-1,new H(V.from(o),0,0),1,!0))}function DD(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 OD(e,t,n=1,r){let i=e.doc.resolve(t),a=V.empty,o=V.empty;for(let e=i.depth,t=i.depth-n,s=n-1;e>t;e--,s--){a=V.from(i.node(e).copy(a));let t=r&&r[s];o=V.from(t?t.type.create(t.attrs,o):i.node(e).copy(o))}e.step(new cD(t,t,new H(a.append(o),n,n),!0))}function kD(e,t){let n=e.resolve(t),r=n.index();return jD(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function AD(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 jD(e,t){return!!(e&&t&&!e.isLeaf&&AD(e,t))}function MD(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&&jD(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 ND(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);wD(e,r.node(),r.before(),s)}o.inlineContent&&pD(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 cD(l,c.map(t+n,-1),H.empty,!0)),r===!0){let t=e.doc.resolve(l);CD(e,t.node(),t.before(),e.steps.length)}return e}function PD(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 FD(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 ID(e,t,n=t,r=H.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),a=e.resolve(n);return LD(i,a,r)?new cD(t,n,r):new RD(i,a,r).fit()}function LD(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}var RD=class{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=V.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=V.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 H(i,a,o);return e>-1?new lD(n.pos,e,this.$to.pos,this.$to.end(),s,t):s.size||n.pos!=this.$to.pos?new cD(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=VD(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(V.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=VD(e,t);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new H(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=VD(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new H(zD(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new H(zD(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(HD(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=BD(this.placed,t,V.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?H.empty:new H(zD(a.content,e-1,1),e-1,f<0?a.openEnd:e-1):new H(zD(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||!UD(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=UD(e,t,r,n,i);if(a){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],i=UD(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=BD(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=BD(this.placed,this.depth,V.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(V.empty,!0);e.childCount&&(this.placed=BD(this.placed,this.frontier.length,e))}};function zD(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(zD(e.firstChild.content,t-1,n)))}function BD(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(BD(e.lastChild.content,t-1,n)))}function VD(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function HD(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,HD(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(V.empty,!0)))),e.copy(r)}function UD(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&&!Nie(n,a.content,o)?s:null}function Nie(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}function Pie(e){return e.spec.defining||e.spec.definingForContent}function Fie(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let i=e.doc.resolve(t),a=e.doc.resolve(n);if(LD(i,a,r))return e.step(new cD(t,n,r));let o=GD(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=Pie(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 H(WD(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 WD(e,t,n,r,i){if(t<n){let i=e.firstChild;e=e.replaceChild(0,i.copy(WD(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(V.empty,!0))}return e}function Iie(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let i=PD(e.doc,t,r.type);i!=null&&(t=n=i)}e.replaceRange(t,n,new H(V.from(r),0,0))}function Lie(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=GD(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 GD(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 KD=class e extends tD{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 nD.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 nD.fromReplace(e,this.pos,this.pos+1,new H(V.from(r),0,+!t.isLeaf))}getMap(){return QE.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)}};tD.jsonID(`attr`,KD);var qD=class e extends tD{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 nD.ok(n)}getMap(){return QE.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)}};tD.jsonID(`docAttr`,qD);var JD=class extends Error{};JD=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},JD.prototype=Object.create(Error.prototype),JD.prototype.constructor=JD,JD.prototype.name=`TransformError`;var YD=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new $E}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new JD(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=H.empty){let r=ID(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new H(V.from(n),0,0))}delete(e,t){return this.replace(e,t,H.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return Fie(this,e,t,n),this}replaceRangeWith(e,t,n){return Iie(this,e,t,n),this}deleteRange(e,t){return Lie(this,e,t),this}lift(e,t){return gD(this,e,t),this}join(e,t=1){return ND(this,e,t),this}wrap(e,t){return xD(this,e,t),this}setBlockType(e,t=e,n,r=null){return SD(this,e,t,n,r),this}setNodeMarkup(e,t,n=null,r){return ED(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new KD(e,t,n)),this}setDocAttribute(e,t){return this.step(new qD(e,t)),this}addNodeMark(e,t){return this.step(new oD(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw RangeError(`No node at position `+e);if(t instanceof KT)t.isInSet(n.marks)&&this.step(new sD(e,t));else{let r=n.marks,i,a=[];for(;i=t.isInSet(r);)a.push(new sD(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 OD(this,e,t,n),this}addMark(e,t,n){return dD(this,e,t,n),this}removeMark(e,t,n){return fD(this,e,t,n),this}clearIncompatible(e,t,n){return pD(this,e,t,n),this}},XD=Object.create(null),ZD=class{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new QD(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=H.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?H.empty:t),o==0&&sO(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),sO(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new tO(e):oO(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?oO(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):oO(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(i)return i}return null}
70static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new iO(e.node(0))}static atStart(e){return oO(e,e,0,0,1)||new iO(e)}static atEnd(e){return oO(e,e,e.content.size,e.childCount,-1)||new iO(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError(`Invalid input for Selection.fromJSON`);let n=XD[t.type];if(!n)throw RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in XD)throw RangeError(`Duplicate use of selection JSON ID `+e);return XD[e]=t,t.prototype.jsonID=e,t}getBookmark(){return tO.between(this.$anchor,this.$head).getBookmark()}};ZD.prototype.visible=!0;var QD=class{constructor(e,t){this.$from=e,this.$to=t}},$D=!1;function eO(e){!$D&&!e.parent.inlineContent&&($D=!0,console.warn(`TextSelection endpoint not pointing into a node with inline content (`+e.parent.type.name+`)`))}var tO=class e extends ZD{constructor(e,t=e){eO(e),eO(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 ZD.near(r);let i=t.resolve(n.map(this.anchor));return new e(i.parent.inlineContent?i:r,r)}replace(e,t=H.empty){if(super.replace(e,t),t==H.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 nO(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=ZD.findFrom(n,r,!0)||ZD.findFrom(n,-r,!0);if(e)n=e.$head;else return ZD.near(n,r)}return t.parent.inlineContent||(i==0?t=n:(t=(ZD.findFrom(t,-r,!0)||ZD.findFrom(t,r,!0)).$anchor,t.pos<n.pos!=i<0&&(t=n))),new e(t,n)}};ZD.jsonID(`text`,tO);var nO=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 tO.between(e.resolve(this.anchor),e.resolve(this.head))}},U=class e extends ZD{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?ZD.near(a):new e(a)}content(){return new H(V.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 rO(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}};U.prototype.visible=!1,ZD.jsonID(`node`,U);var rO=class e{constructor(e){this.anchor=e}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new nO(r,r):new e(r)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&U.isSelectable(n)?new U(t):ZD.near(t)}},iO=class e extends ZD{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=H.empty){if(t==H.empty){e.delete(0,e.doc.content.size);let t=ZD.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 aO}};ZD.jsonID(`all`,iO);var aO={map(){return this},resolve(e){return new iO(e)}};function oO(e,t,n,r,i,a=!1){if(t.inlineContent)return tO.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=oO(e,r,n+i,i<0?r.childCount:0,i,a);if(t)return t}else if(!a&&U.isSelectable(r))return U.create(e,n-(i<0?r.nodeSize:0));n+=r.nodeSize*i}return null}function sO(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof cD||i instanceof lD))return;let a=e.mapping.maps[r],o;a.forEach((e,t,n,r)=>{o??=r}),e.setSelection(ZD.near(e.doc.resolve(o),n))}var cO=1,lO=2,uO=4,dO=class extends YD{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|cO)&~lO,this.storedMarks=null,this}get selectionSet(){return(this.updated&cO)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=lO,this}ensureMarks(e){return KT.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&lO)>0}addStep(e,t){super.addStep(e,t),this.updated&=~lO,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)||KT.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(ZD.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|=uO,this}get scrolledIntoView(){return(this.updated&uO)>0}};function fO(e,t){return!t||!e?e:e.bind(t)}var pO=class{constructor(e,t,n){this.name=e,this.init=fO(t.init,
70n),this.apply=fO(t.apply,n)}},mO=[new pO(`doc`,{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new pO(`selection`,{init(e,t){return e.selection||ZD.atStart(t.doc)},apply(e){return e.selection}}),new pO(`storedMarks`,{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new pO(`scrollToSelection`,{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})],hO=class{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=mO.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 pO(e.key,e.spec.state,e))})}},gO=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 dO(this)}static create(t){let n=new hO(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 hO(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 hO(t.schema,t.plugins),a=new e(i);return i.fields.forEach(e=>{if(e.name==`doc`)a.doc=sE.fromJSON(t.schema,n.doc);else if(e.name==`selection`)a.selection=ZD.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 _O(e,t,n){for(let r in e){let i=e[r];i instanceof Function?i=i.bind(t):r==`handleDOMEvents`&&(i=_O(i,t,{})),n[r]=i}return n}var vO=class{constructor(e){this.spec=e,this.props={},e.props&&_O(e.props,this,this.props),this.key=e.key?e.key.key:bO(`plugin`)}getState(e){return e[this.key]}},yO=Object.create(null);function bO(e){return e in yO?e+`$`+ ++yO[e]:(yO[e]=0,e+`$`)}var xO=class{constructor(e=`key`){this.key=bO(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}},SO=(e,t)=>
vendor: 9,208 bytes, lines 70-71
70e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function CO(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`backward`,e):n.parentOffset>0)?null:n}var wO=(e,t,n)=>{let r=CO(e,n);if(!r)return!1;let i=AO(r);if(!i){let n=r.blockRange(),i=n&&hD(n);return i==null?!1:(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)}let a=i.nodeBefore;if(GO(e,i,t,-1))return!0;if(r.parent.content.size==0&&(OO(a,`end`)||U.isSelectable(a)))for(let n=r.depth;;n--){let o=ID(e.doc,r.before(n),r.after(n),H.empty);if(o&&o.slice.size<o.to-o.from){if(t){let n=e.tr.step(o);n.setSelection(OO(a,`end`)?ZD.findFrom(n.doc.resolve(n.mapping.map(i.pos,-1)),-1):U.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},TO=(e,t,n)=>{let r=CO(e,n);if(!r)return!1;let i=AO(r);return i?DO(e,i,t):!1},EO=(e,t,n)=>{let r=jO(e,n);if(!r)return!1;let i=PO(r);return i?DO(e,i,t):!1};function DO(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=ID(e.doc,i,o,H.empty);if(!s||s.from!=i||s instanceof cD&&s.slice.size>=o-i)return!1;if(n){let t=e.tr.step(s);t.setSelection(tO.create(t.doc,i)),n(t.scrollIntoView())}return!0}function OO(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 kO=(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=AO(r)}let o=a&&a.nodeBefore;return!o||!U.isSelectable(o)?!1:(t&&t(e.tr.setSelection(U.create(e.doc,a.pos-o.nodeSize)).scrollIntoView()),!0)};function AO(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 jO(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`forward`,e):n.parentOffset<n.parent.content.size)?null:n}var MO=(e,t,n)=>{let r=jO(e,n);if(!r)return!1;let i=PO(r);if(!i)return!1;let a=i.nodeAfter;if(GO(e,i,t,1))return!0;if(r.parent.content.size==0&&(OO(a,`start`)||U.isSelectable(a))){let n=ID(e.doc,r.before(),r.after(),H.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(OO(a,`start`)?ZD.findFrom(r.doc.resolve(r.mapping.map(i.pos)),1):U.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},NO=(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=PO(r)}let o=a&&a.nodeAfter;return!o||!U.isSelectable(o)?!1:(t&&t(e.tr.setSelection(U.create(e.doc,a.pos)).scrollIntoView()),!0)};function PO(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 FO=(e,t)=>{let n=e.selection,r=n instanceof U,i;if(r){if(n.node.isTextblock||!kD(e.doc,n.from))return!1;i=n.from}else if(i=MD(e.doc,n.from,-1),i==null)return!1;if(t){let n=e.tr.join(i);r&&n.setSelection(U.create(n.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(n.scrollIntoView())}return!0},IO=(e,t)=>{let n=e.selection,r;if(n instanceof U){if(n.node.isTextblock||!kD(e.doc,n.to))return!1;r=n.to}else if(r=MD(e.doc,n.to,1),r==null)return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0},LO=(e,t)=>{let{$from:n,$to:r}=e.selection,i=n.blockRange(r),a=i&&hD(i);return a==null?!1:(t&&t(e.tr.lift(i,a).scrollIntoView()),!0)},RO=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(` 71`).scrollIntoView()),!0)};function zO(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 BO=(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=zO(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(ZD.near(i.doc.resolve(r),1)),t(i.scrollIntoView())}return!0},VO=(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof iO||r.parent.inlineContent||i.parent.inlineContent)return!1;let a=zO(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(tO.create(o.doc,n+1)),t(o.scrollIntoView())}return!0},HO=(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(DD(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),i=r&&hD(r);return i==null?!1:(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)};function UO(e){return(t,n)=>{let{$from:r,$to:i}=t.selection;if(t.selection instanceof U&&t.selection.node.isBlock)return!r.parentOffset||!DD(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=zO(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 tO||t.selection instanceof iO)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=DD(u.doc,d,a.length,a);if(f||=(a[0]=s?{type:s}:null,DD(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 WO=UO(),Rie=(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(U.create(e.doc,i))),!0)},zie=(e,t)=>(t&&t(e.tr.setSelection(new iO(e.doc))),!0);function Bie(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||kD(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function GO(e,t,n,r){let i=t.nodeBefore,a=t.nodeAfter,o,s,c=i.type.spec.isolating||a.type.spec.isolating;if(!c&&Bie(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=V.empty;for(let e=o.length-1;e>=0;e--)s=V.from(o[e].create(null,s));s=V.from(i.copy(s));let c=e.tr.step(new lD(t.pos-1,r,t.pos,r,new H(s,1,0),o.length,!0)),l=c.doc.resolve(r+2*o.length);l.nodeAfter&&l.nodeAfter.type==i.type&&kD(c.doc,l.pos)&&c.join(l.pos),n(c.scrollIntoView())}return!0}let u=a.type.spec.isolating||r>0&&c?null:ZD.findFrom(t,1),d=u&&u.$from.blockRange(u.$to),f=d&&hD(d);if(f!=null&&f>=t.depth)return n&&n(e.tr.lift(d,f).scrollIntoView()),!0;if(l&&OO(a,`start`,!0)&&OO(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=V.empty;for(let e=o.length-1;e>=0;e--)r=V.from(o[e].copy(r));n(e.tr.step(new lD(t.pos-o.length,t.pos+a.nodeSize,t.pos+c,t.pos+a.nodeSize-c,new H(r,o.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function KO(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(tO.create(t.doc,e<0?i.start(a):i.end(a)))),!0):!1}}var qO=KO(-1),JO=KO(1);function Vie(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a),s=o&&_D(o,e,t);return s?(r&&r(n.tr.wrap(o,s).scrollIntoView()),!0):!1}}function YO(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 XO(...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 ZO=XO(SO,wO,kO),QO=XO(SO,MO,NO),$O={Enter:XO(RO,VO,HO,WO),"Mod-Enter":BO,Backspace:ZO,"Mod-Backspace":ZO,"Shift-Backspace":ZO,Delete:QO,"Mod-Delete":QO,"Mod-a":zie},Hie={"Ctrl-h":$O.Backspace,"Alt-Backspace":$O[`Mod-Backspace`],"Ctrl-d":$O.Delete,"Ctrl-Alt-Backspace":$O[`Mod-Delete`],"Alt
71-Delete":$O[`Mod-Delete`],"Alt-d":$O[`Mod-Delete`],"Ctrl-a":qO,"Ctrl-e":JO};for(let e in $O)Hie[e]=$O[e];typeof navigator<`u`?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<`u`&&os.platform&&os.platform();function Uie(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 Wie(s,o,e,t)?(r&&r(s.scrollIntoView()),!0):!1}}function Wie(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 oE(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new oE(t.$from,o.resolve(t.$to.end(t.depth)),t.depth)),i=!0}let s=_D(a,n,r,t);return s?(e&&Gie(e,t,s,i,n),!0):!1}function Gie(e,t,n,r,i){let a=V.empty;for(let e=n.length-1;e>=0;e--)a=V.from(n[e].type.create(n[e].attrs,a));e.step(new lD(t.start-(r?2:0),t.end,t.start,t.end,new H(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&&DD(e.doc,c,s)&&(e.split(c,s),c+=2*s),c+=l.child(n).nodeSize;return e}function Kie(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?qie(t,n,e,a):Jie(t,n,a):!0:!1}}function qie(e,t,n,r){let i=e.tr,a=r.end,o=r.$to.end(r.depth);a<o&&(i.step(new lD(a-1,o,a,o,new H(V.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new oE(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));let s=hD(r);if(s==null)return!1;i.lift(r,s);let c=i.doc.resolve(i.mapping.map(a,-1)-1);return kD(i.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&i.join(c.pos),t(i.scrollIntoView()),!0}function Jie(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?V.empty:V.from(i))))return!1;let d=a.pos,f=d+o.nodeSize;return r.step(new lD(d-+!!s,f+ +!!c,d+1,f-1,new H((s?V.empty:V.from(i.copy(V.empty))).append(c?V.empty:V.from(i.copy(V.empty))),+!s,+!c),+!s)),t(r.scrollIntoView()),!0}function Yie(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=V.from(r?e.create():null),o=new H(V.from(e.create(null,V.from(s.type.create(null,i)))),r?3:1,0),l=a.start,u=a.end;n(t.tr.step(new lD(l-(r?3:1),u,l,u,o,1,!0)).scrollIntoView())}return!0}}var ek=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},tk=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t},nk=null,rk=function(e,t,n){let r=nk||=document.createRange();return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},Xie=function(){nk=null},ik=function(e,t,n,r){return n&&(ak(e,t,n,r,-1)||ak(e,t,n,r,1))},Zie=/^(img|br|input|textarea|hr)$/i;function ak(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:ok(e))){let n=e.parentNode;if(!n||n.nodeType!=1||sk(e)||Zie.test(e.nodeName)||e.contentEditable==`false`)return!1;t=ek(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?ok(e):0}else return!1}}function ok(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Qie(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=ok(e)}else if(e.parentNode&&!sk(e))t=ek(e),e=e.parentNode;else return null}}function $ie(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&&!sk(e))t=ek(e)+1,e=e.parentNode;else return null}}function eae(e,t,n){for(let r=t==0,i=t==ok(e);r||i;){if(e==n)return!0;let t=ek(e);if(e=e.parentNode,!e)return!1;r&&=t==0,i&&=t==ok(e)}}function sk(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 ck=function(e){return e.focusNode&&ik(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function lk(e,t){let n=document.createEvent(`Event`);return n.initEvent(`keydown`,!0,!0),n.keyCode=e,n.key=n.code=t,n}function uk(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function dk(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);
vendor: 121,780 bytes, lines 71-77
71if(r)return{node:r.offsetNode,offset:Math.min(ok(r.offsetNode),r.offset)}}catch{}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(ok(r.startContainer),r.startOffset)}}}var fk=typeof navigator<`u`?navigator:null,pk=typeof document<`u`?document:null,mk=fk&&fk.userAgent||``,hk=/Edge\/(\d+)/.exec(mk),gk=/MSIE \d/.exec(mk),_k=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(mk),vk=!!(gk||_k||hk),yk=gk?document.documentMode:_k?+_k[1]:hk?+hk[1]:0,bk=!vk&&/gecko\/(\d+)/i.test(mk);bk&&+(/Firefox\/(\d+)/.exec(mk)||[0,0])[1];var xk=!vk&&/Chrome\/(\d+)/.exec(mk),Sk=!!xk,Ck=xk?+xk[1]:0,wk=!vk&&!!fk&&/Apple Computer/.test(fk.vendor),Tk=wk&&(/Mobile\/\w+/.test(mk)||!!fk&&fk.maxTouchPoints>2),Ek=Tk||(fk?/Mac/.test(fk.platform):!1),Dk=fk?/Win/.test(fk.platform):!1,Ok=/Android \d/.test(mk),kk=!!pk&&`webkitFontSmoothing`in pk.documentElement.style,Ak=kk?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function jk(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 Mk(e,t){return typeof e==`number`?e:e[t]}function Nk(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 Pk(e,t,n){let r=e.someProp(`scrollThreshold`)||0,i=e.someProp(`scrollMargin`)||5,a=e.dom.ownerDocument;for(let o=n||e.dom;o;){if(o.nodeType!=1){o=tk(o);continue}let e=o,n=e==a.body,s=n?jk(a):Nk(e),c=0,l=0;if(t.top<s.top+Mk(r,`top`)?l=-(s.top-t.top+Mk(i,`top`)):t.bottom>s.bottom-Mk(r,`bottom`)&&(l=t.bottom-t.top>s.bottom-s.top?t.top+Mk(i,`top`)-s.top:t.bottom-s.bottom+Mk(i,`bottom`)),t.left<s.left+Mk(r,`left`)?c=-(s.left-t.left+Mk(i,`left`)):t.right>s.right-Mk(r,`right`)&&(c=t.right-s.right+Mk(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:tk(o)}}function Fk(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:Ik(e.dom)}}function Ik(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=tk(r));return t}function Lk({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;Rk(n,r==0?0:r-t)}function Rk(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 zk=null;function Bk(e){if(e.setActive)return e.setActive();if(zk)return e.focus(zk);let t=Ik(e);e.focus(zk==null?{get preventScroll(){return zk={preventScroll:!0},!0}}:void 0),zk||(zk=!1,Rk(t,0))}function Vk(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=rk(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?Hk(n,i):!n||r&&n.nodeType==1?{node:e,offset:a}:Vk(n,i)}function Hk(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=Xk(r,1);if(n.top!=n.bottom&&Uk(t,n)){i={node:e,offset:a+ +(t.left>=(n.left+n.right)/2)};break}}return r.detach(),i||{node:e,offset:0}}function Uk(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function Wk(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function Gk(e,t,n){let{node:r,offset:i}=Vk(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 Kk(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 qk(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(Uk(t,i))return qk(n,t,i)}}if((a=(a+1)%r)==i)break}return e}function Jk(e,t){let n=e.dom.ownerDocument,r,i=0,a=dk(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(!Uk(t,n)||(o=qk(e.dom,t,n),!o))return null}if(wk)for(let e=o;r&&e;e=tk(e))e.draggable&&(r=void 0);if(o=Wk(o,t),r){if(bk&&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;kk&&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=Kk(e,r,i,t))}s??=Gk(e,o,t);let c=e.docView.nearestDesc(o,!0);return{pos:s,inside:c?c.posAtStart-c.border:-1}}function Yk(e){return e.top<e.bottom||e.left<e.right}function Xk(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(Yk(e))return e}return Array.prototype.find.call(n,Yk)||e.getBoundingClientRect()}var Zk=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Qk(e,t,n){let{node:r,offset:i,atom:a}=e.docView.domFromPos(t,n<0?-1:1),o=kk||bk;if(r.nodeType==3)if(o&&(Zk.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let e=Xk(rk(r,i,i),n);if(bk&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let t=Xk(rk(r,i-1,i-1),-1);if(t.top==e.top){let n=Xk(rk(r,i,i+1),-1);if(n.top!=e.top)return $k(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++,$k(Xk(rk(r,e,t),a),a<0)}if(!e.state.doc.resolve(t-(a||0)).parent.inlineContent){if(a==null&&i&&(n<0||i==ok(r))){let e=r.childNodes[i-1];if(e.nodeType==1)return eA(e.getBoundingClientRect(),!1)}if(a==null&&i<ok(r)){let e=r.childNodes[i];if(e.nodeType==1)return eA(e.getBoundingClientRect(),!0)}return eA(r.getBoundingClientRect(),n>=0)}if(a==null&&i&&(n<0||i==ok(r))){let e=r.childNodes[i-1],t=e.nodeType==3?rk(e,ok(e)-+!o):e.nodeType==1&&(e.nodeName!=`BR`||!e.nextSibling)?e:null;if(t)return $k(Xk(t,1),!1)}if(a==null&&i<ok(r)){let e=r.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?e.nodeType==3?rk(e,0,+!o):e.nodeType==1?e:null:null;if(t)return $k(Xk(t,-1),!0)}return $k(Xk(r.nodeType==3?rk(r):r,-n),n>=0)}function $k(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 eA(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 tA(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 nA(e,t,n){let r=t.selection,i=n==`up`?r.$from:r.$to;return tA(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=Qk(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=rk(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 rA=/[\u0590-\u08ac]/;function iA(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?!rA.test(r.parent.textContent)||!s.modify?n==`left`||n==`backward`?a:o:tA(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 aA=null,oA=null,sA=!1;function cA(e,t,n){return aA==t&&oA==n?sA:(aA=t,oA=n,sA=n==`up`||n==`down`?nA(e,t,n):iA(e,t,n))}var lA=0,uA=1,dA=2,fA=3,pA=class{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=lA,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>ek(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 bA){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 mA&&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?ek(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?ek(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=ek(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=ek(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((bk||wk)&&e==t){let{node:e,offset:t}=o;if(e.nodeType==3){if(u=!!(t&&e.nodeValue[t-1]==` 72`),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:ek(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(bk&&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&&wk)&&ik(o.node,o.offset,l.anchorNode,l.anchorOffset)&&ik(s.node,s.offset,l.focusNode,l.focusOffset))return;let d=!1;if((c.extend||e==t)&&!(u&&bk)){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?dA:uA,e==r&&t==o&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=fA:i.markDirty(e-r,t-r);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?dA:fA}n=a}this.dirty=dA}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=e==1?dA:uA;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}},mA=class extends pA{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==lA&&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}},hA=class extends pA{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}},gA=class e extends pA{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=IE.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&fA||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=fA&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=lA){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=lA}}slice(t,n,r){let i=e.create(this.parent,this.mark,!0,r),a=this.children,o=this.size;n<o&&(a=LA(a,n,o,r)),t>0&&(a=LA(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()}},_A=class e extends pA{constructor(e,t,n,r,i,a,o,s,c){super(e,[],i,a),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=o}static create(t,n,r,i,a,o){let s=a.nodeViews[n.type.name],c,l=s&&s(n,a,()=>{if(!c)return o;if(c.parent)return c.parent.posBeforeChild(c)},r,i),u=l&&l.dom,d=l&&l.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw RangeError(`Text must be rendered as a DOM text node`)}else if(!u){let e=IE.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=OA(u,r,n),l?c=new xA(t,n,r,i,u,d||null,f,l,a,o+1):n.isText?new yA(t,n,r,i,u,f,a):new e(t,n,r,i,u,d||null,f,a,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace==`pre`&&(e.preserveWhitespace=`full`),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>V.empty)}return e}matchesNode(e,t,n){return this.dirty==lA&&e.eq(this.node)&&kA(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 jA(this,a&&a.node,e);PA(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?KT.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==dA)&&(a&&this.protectLocalComposition(e,a),SA(this.contentDOM,this.children,e),Tk&&FA(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof tO)||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=IA(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 hA(this,i,t,r);e.input.compositionNodes.push(a),this.children=LA(this.children,n,n+r.length,e,a)}update(e,t,n,r){return this.dirty==fA||!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=lA}updateOuterDeco(e){if(kA(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,n=this.dom;this.dom=EA(this.dom,this.nodeDOM,TA(this.outerDeco,this.node,t),TA(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 vA(e,t,n,r,i){OA(r,t,e);let a=new _A(void 0,e,t,n,r,r,r,i,0);return a.contentDOM&&a.updateChildren(i,0),a}var yA=class e extends _A{constructor(e,t,n,r,i,a,o){super(e,t,n,r,i,null,a,o,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return this.dirty==fA||this.dirty!=lA&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=lA||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=lA,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return e.type!=`characterData`&&e.type!=`selection`}slice(t,n,r){let i=this.node.cut(t,n),a=document.createTextNode(i.text);return new e(this.parent,i,this.outerDeco,this.innerDeco,a,a,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=fA)}get domAtom(){return!1}isText(e){return this.node.text==e}},bA=class extends pA{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==lA&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName==`IMG`}},xA=class extends _A{constructor(e,t,n,r,i,a,o,s,c,l){super(e,t,n,r,i,a,o,c,l),this.spec=s}update(e,t,n,r){if(this.dirty==fA)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 SA(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=AA(r),i=!0;r=r.nextSibling}else i=!0,e.insertBefore(s,r);if(o instanceof gA){let t=r?r.previousSibling:e.lastChild;SA(o.contentDOM,o.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=AA(r),i=!0;i&&n.trackWrites==e&&(n.trackWrites=null)}var CA=function(e){e&&(this.nodeName=e)};CA.prototype=Object.create(null);var wA=[new CA];function TA(e,t,n){if(e.length==0)return wA;let r=n?wA[0]:new CA,i=[r];for(let a=0;a<e.length;a++){let o=e[a].type.attrs;if(o){o.nodeName&&i.push(r=new CA(o.nodeName));for(let e in o){let a=o[e];a!=null&&(n&&i.length==1&&i.push(r=new CA(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 EA(e,t,n,r){if(n==wA&&r==wA)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=wA[0],i=t)}DA(i,o||wA[0],a)}return i}function DA(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 OA(e,t,n){return EA(e,e,wA,TA(t,n,e.nodeType!=1))}function kA(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 AA(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}var jA=class{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=MA(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=lA,this.index=this.stack.pop(),this.top=this.stack.pop(),a--;for(;a<e.length;){this.stack.push(this.top,this.index+1);let i=-1,o=this.top.children.length;r<this.preMatch.index&&(o=Math.min(this.index+3,o));for(let t=this.index;t<o;t++){let n=this.top.children[t];if(n.matchesMark(e[a])&&!this.isLocked(n.dom)){i=t;break}}if(i>-1)i>this.index&&(this.changed=!0,this.destroyBetween(this.index,i)),this.top=this.top.children[this.index];else{let r=gA.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==fA&&a.dom==a.contentDOM&&(a.dirty=dA),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 _A){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!=fA&&kA(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=dA,u.updateChildren(r,a+1),u.dirty=lA),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)||!kA(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let o=_A.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=_A.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 mA(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 gA;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof yA)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((wk||Sk)&&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 bA(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 MA(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 gA)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 NA(e,t){return e.type.side-t.type.side}function PA(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(NA);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 FA(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 IA(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 LA(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 RA(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(ck(n)){for(c=o;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&U.isSelectable(e)&&i.parent&&!(e.isInline&&eae(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;l=new U(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=JA(e,u,s,n)}return l}function zA(e){return e.editable?e.hasFocus():XA(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function BA(e,t=!1){let n=e.state.selection;if(KA(e,n),zA(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&Sk){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&ik(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset)){e.input.mouseDown.delayedSelectionSync=!0,e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)tae(e);else{let{anchor:r,head:i}=n,a,o;VA&&!(n instanceof tO)&&(n.$from.parent.inlineContent||(a=HA(e,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=HA(e,n.to))),e.docView.setSelection(r,i,e,t),VA&&(a&&WA(a),o&&WA(o)),n.visible?e.dom.classList.remove(`ProseMirror-hideselection`):(e.dom.classList.add(`ProseMirror-hideselection`),`onselectionchange`in document&&GA(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}var VA=wk||Sk&&Ck<63;function HA(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(wk&&i&&i.contentEditable==`false`)return UA(i);if((!i||i.contentEditable==`false`)&&(!a||a.contentEditable==`false`)){if(i)return UA(i);if(a)return UA(a)}}function UA(e){return e.contentEditable=`true`,wk&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function WA(e){e.contentEditable=`false`,e.wasDraggable&&=(e.draggable=!0,null)}function GA(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(()=>{(!zA(e)||e.state.selection.visible)&&e.dom.classList.remove(`ProseMirror-hideselection`)},20))})}function tae(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r=n.nodeName==`IMG`;r?t.collapse(n.parentNode,ek(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&vk&&yk<=11&&(n.disabled=!0,n.disabled=!1)}function KA(e,t){if(t instanceof U){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(qA(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else qA(e)}function qA(e){e.lastSelectedViewDesc&&=(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),void 0)}function JA(e,t,n,r){return e.someProp(`createSelectionBetween`,r=>r(e,t,n))||tO.between(t,n,r)}function YA(e){return e.editable&&!e.hasFocus()?!1:XA(e)}function XA(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 nae(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return ik(t.node,t.offset,n.anchorNode,n.anchorOffset)}function ZA(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&&ZD.findFrom(a,t)}function QA(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function $A(e,t,n){let r=e.state.selection;if(r instanceof tO){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 QA(e,new tO(r.$anchor,a))}else if(!r.empty)return!1;else if(e.endOfTextblock(t>0?`forward`:`backward`)){let n=ZA(e.state,t);return n&&n instanceof U?QA(e,n):!1}else if(!(Ek&&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?U.isSelectable(i)?QA(e,new U(t<0?e.state.doc.resolve(n.pos-i.nodeSize):n)):kk?QA(e,new tO(e.state.doc.resolve(t<0?o:o+i.nodeSize))):!1:!1}}else if(r instanceof U&&r.node.isInline)return QA(e,new tO(t>0?r.$to:r.$from));else{let n=ZA(e.state,t);return n?QA(e,n):!1}}function ej(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function tj(e,t){let n=e.pmViewDesc;return n&&n.size==0&&(t<0||e.nextSibling||e.nodeName!=`BR`)}function nj(e,t){return t<0?rae(e):iae(e)}function rae(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,a,o=!1;for(bk&&n.nodeType==1&&r<ej(n)&&tj(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let e=n.childNodes[r-1];if(tj(e,-1))i=n,a=--r;else if(e.nodeType==3)n=e,r=n.nodeValue.length;else break}}else if(rj(n))break;else{let t=n.previousSibling;for(;t&&tj(t,-1);)i=n.parentNode,a=ek(t),t=t.previousSibling;if(t)n=t,r=ej(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}o?ij(e,n,r):i&&ij(e,i,a)}function iae(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i=ej(n),a,o;for(;;)if(r<i){if(n.nodeType!=1)break;let e=n.childNodes[r];if(tj(e,1))a=n,o=++r;else break}else if(rj(n))break;else{let t=n.nextSibling;for(;t&&tj(t,1);)a=t.parentNode,o=ek(t)+1,t=t.nextSibling;if(t)n=t,r=0,i=ej(n);else{if(n=n.parentNode,n==e.dom)break;r=i=0}}a&&ij(e,a,o)}function rj(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function aae(e,t){for(;e&&t==e.childNodes.length&&!sk(e);)t=ek(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 oae(e,t){for(;e&&!t&&!sk(e);)t=ek(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 ij(e,t,n){if(t.nodeType!=3){let e,r;(r=aae(t,n))?(t=r,n=0):(e=oae(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(ck(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&&BA(e)},50)}function aj(e,t){let n=e.state.doc.resolve(t);if(!(Sk||Dk)&&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 oj(e,t,n){let r=e.state.selection;if(r instanceof tO&&!r.empty||n.indexOf(`s`)>-1||Ek&&n.indexOf(`m`)>-1)return!1;let{$from:i,$to:a}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?`up`:`down`)){let n=ZA(e.state,t);if(n&&n instanceof U)return QA(e,n)}if(!i.parent.inlineContent){let n=t<0?i:a,o=r instanceof iO?ZD.near(n,t):ZD.findFrom(n,t);return o?QA(e,o):!1}return!1}function sj(e,t){if(!(e.state.selection instanceof tO))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 cj(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function sae(e){if(!wk||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;cj(e,n,`true`),setTimeout(()=>cj(e,n,`false`),20)}return!1}function cae(e){let t=``;return e.ctrlKey&&(t+=`c`),e.metaKey&&(t+=`m`),e.altKey&&(t+=`a`),e.shiftKey&&(t+=`s`),t}function lae(e,t){let n=t.keyCode,r=cae(t);if(n==8||Ek&&n==72&&r==`c`)return sj(e,-1)||nj(e,-1);if(n==46&&!t.shiftKey||Ek&&n==68&&r==`c`)return sj(e,1)||nj(e,1);if(n==13||n==27)return!0;if(n==37||Ek&&n==66&&r==`c`){let t=n==37?aj(e,e.state.selection.from)==`ltr`?-1:1:-1;return $A(e,t,r)||nj(e,t)}else if(n==39||Ek&&n==70&&r==`c`){let t=n==39?aj(e,e.state.selection.from)==`ltr`?1:-1:1;return $A(e,t,r)||nj(e,t)}else if(n==38||Ek&&n==80&&r==`c`)return oj(e,-1,r)||nj(e,-1);else if(n==40||Ek&&n==78&&r==`c`)return sae(e)||oj(e,1,r)||nj(e,1);else if(r==(Ek?`m`:`c`)&&(n==66||n==73||n==89||n==90))return!0;return!1}function lj(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`)||IE.fromSchema(e.state.schema),s=_j(),c=s.createElement(`div`);c.appendChild(o.serializeFragment(r,{document:s}));let l=c.firstChild,u,d=0;for(;l&&l.nodeType==1&&(u=gj[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,` 73 74`),slice:t}}function uj(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 H(V.from(e.state.schema.text(t.replace(/\r\n?/g,` 75`))),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=IE.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=mae(n),kk&&hae(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`)||CE.fromSchema(e.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||u),context:i,ruleFromNode(e){return e.nodeName==`BR`&&!e.nextSibling&&e.parentNode&&!uae.test(e.parentNode.nodeName)?{ignore:!0}:null}}),u)s=gae(hj(s,+u[1],+u[2]),u[4]);else if(s=H.maxOpen(dae(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=hj(s,e,t)}return e.someProp(`transformPasted`,t=>{s=t(s,e,c)}),s}var uae=/^(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 dae(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&&fj(t,i,e,a[a.length-1],0))a[a.length-1]=n;else{a.length&&(a[a.length-1]=pj(a[a.length-1],i.length));let n=dj(e,t);a.push(n),r=r.matchType(n.type),i=t}}),a)return V.from(a)}return e}function dj(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,V.from(e));return e}function fj(e,t,n,r,i){if(i<e.length&&i<t.length&&e[i]==t[i]){let a=fj(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(V.from(dj(n,e,i+1))))}}function pj(e,t){if(t==0)return e;let n=e.content.replaceChild(e.childCount-1,pj(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(V.empty,!0);return e.copy(n.append(r))}function mj(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=mj(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(V.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,o.copy(s))}function hj(e,t,n){return t<e.openStart&&(e=new H(mj(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new H(mj(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}var gj={thead:[`table`],tbody:[`table`],tfoot:[`table`],caption:[`table`],colgroup:[`table`],col:[`table`,`colgroup`],tr:[`table`,`tbody`],td:[`table`,`tbody`,`tr`],th:[`table`,`tbody`,`tr`]},fae=null;function _j(){return fae||=document.implementation.createHTMLDocument(`title`)}var vj=null;function pae(e){let t=window.trustedTypes;return t?(vj||=t.defaultPolicy||t.createPolicy(`ProseMirrorClipboard`,{createHTML:e=>e}),vj.createHTML(e)):e}function mae(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=_j().createElement(`div`),r=/<([a-z][^>\s]+)/i.exec(e),i;if((i=r&&gj[r[1].toLowerCase()])&&(e=i.map(e=>`<`+e+`>`).join(``)+e+i.map(e=>`</`+e+`>`).reverse().join(``)),n.innerHTML=pae(e),i)for(let e=0;e<i.length;e++)n=n.querySelector(i[e])||n;return n}function hae(e){let t=e.querySelectorAll(Sk?`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 gae(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=V.from(t.create(r[e+1],i)),a++,o++}return new H(i,a,o)}var yj={},bj={},_ae={touchstart:!0,touchmove:!0},vae=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 yae(e){for(let t in yj){let n=yj[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{xae(e,t)&&!Cj(e,t)&&(e.editable||!(t.type in bj))&&n(e,t)},_ae[t]?{passive:!0}:void 0)}wk&&e.dom.addEventListener(`input`,()=>null),Sj(e)}function xj(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function bae(e){e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function Sj(e){e.someProp(`handleDOMEvents`,t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>Cj(e,t))})}function Cj(e,t){return e.someProp(`handleDOMEvents`,n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function xae(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 Sae(e,t){!Cj(e,t)&&yj[t.type]&&(e.editable||!(t.type in bj))&&yj[t.type](e,t)}bj.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!kj(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(Ok&&Sk&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),Tk&&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,lk(13,`Enter`))),e.input.lastIOSEnter=0)},200)}else e.someProp(`handleKeyDown`,t=>t(e,n))||lae(e,n)?n.preventDefault():xj(e,`key`)},bj.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)},bj.keypress=(e,t)=>{let n=t;if(kj(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||Ek&&n.metaKey)return;if(e.someProp(`handleKeyPress`,t=>t(e,n))){n.preventDefault();return}let r=e.state.selection;if(!(r instanceof tO)||!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 wj(e){return{left:e.clientX,top:e.clientY}}function Cae(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function Tj(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 Ej(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 wae(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&U.isSelectable(r)?(Ej(e,new U(n),`pointer`),!0):!1}function Tae(e,t){if(t==-1)return!1;let n=e.state.selection,r,i;n instanceof U&&(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(U.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:(Ej(e,U.create(e.state.doc,i),`pointer`),!0)}function Eae(e,t,n,r,i){return Tj(e,`handleClickOn`,t,n,r)||e.someProp(`handleClick`,n=>n(e,t,r))||(i?Tae(e,n):wae(e,n))}function Dae(e,t,n,r){return Tj(e,`handleDoubleClickOn`,t,n,r)||e.someProp(`handleDoubleClick`,n=>n(e,t,r))}function Oae(e,t,n,r){return Tj(e,`handleTripleClickOn`,t,n,r)||e.someProp(`handleTripleClick`,n=>n(e,t,r))||kae(e,n,r)}function kae(e,t,n){if(n.button!=0)return!1;let r=e.state.doc;if(t==-1)return r.inlineContent?(Ej(e,tO.create(r,0,r.content.size),`pointer`),!0):!1;let i=r.resolve(t);for(let t=i.depth+1;t>0;t--){let n=t>i.depth?i.nodeAfter:i.node(t),a=i.before(t);if(n.inlineContent)Ej(e,tO.create(r,a+1,a+1+n.content.size),`pointer`);else if(U.isSelectable(n))Ej(e,U.create(r,a),`pointer`);else continue;return!0}}function Dj(e){return Mj(e)}var Oj=Ek?`metaKey`:`ctrlKey`;yj.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=Dj(e),i=Date.now(),a=`singleClick`;i-e.input.lastClick.time<500&&Cae(n,e.input.lastClick)&&!n[Oj]&&e.input.lastClick.button==n.button&&(e.input.lastClick.type==`singleClick`?a=`doubleClick`:e.input.lastClick.type==`doubleClick`&&(a=`tripleClick`)),e.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:a,button:n.button};let o=e.posAtCoords(wj(n));o&&(a==`singleClick`?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new Aae(e,o,n,!!r)):(a==`doubleClick`?Dae:Oae)(e,o.pos,o.inside,n)?n.preventDefault():xj(e,`pointer`))};var Aae=class{constructor(e,t,n,r){this.view=e,this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[Oj],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 U&&c.from<=a&&c.to>a)&&(this.mightDrag={node:i,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&bk&&!this.target.hasAttribute(`contentEditable`))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute(`contentEditable`,`false`)},20),this.view.domObserver.start()),e.root.addEventListener(`mouseup`,this.up=this.up.bind(this)),e.root.addEventListener(`mousemove`,this.move=this.move.bind(this)),xj(e,`pointer`)}done(){this.view.root.removeEventListener(`mouseup`,this.up),this.view.root.removeEventListener(`mousemove`,this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute(`draggable`),this.mightDrag.setUneditable&&this.target.removeAttribute(`contentEditable`),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>BA(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(wj(e))),this.updateAllowDefault(e),this.allowDefault||!t?xj(this.view,`pointer`):Eae(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||wk&&this.mightDrag&&!this.mightDrag.node.isAtom||Sk&&!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)?(Ej(this.view,ZD.near(this.view.state.doc.resolve(t.pos)),`pointer`),e.preventDefault()):xj(this.view,`pointer`)}move(e){this.updateAllowDefault(e),xj(this.view,`pointer`),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}};yj.touchstart=e=>{e.input.lastTouch=Date.now(),Dj(e),xj(e,`pointer`)},yj.touchmove=e=>{e.input.lastTouch=Date.now(),xj(e,`pointer`)},yj.contextmenu=e=>Dj(e);function kj(e,t){return e.composing?!0:wk&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}var jae=Ok?5e3:-1;bj.compositionstart=bj.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof tO&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>e.type.spec.inclusive===!1)||Sk&&Dk&&Mae(e)))e.markCursor=e.state.storedMarks||n.marks(),Mj(e,!0),e.markCursor=null;else if(Mj(e,!t.selection.empty),bk&&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}Aj(e,jae)};function Mae(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`}bj.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,Aj(e,20))};function Aj(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>Mj(e),t))}function jj(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Pae());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function Nae(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=Qie(t.focusNode,t.focusOffset),r=$ie(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 Pae(){let e=document.createEvent(`Event`);return e.initEvent(`event`,!0,!0),e.timeStamp}function Mj(e,t=!1){if(!(Ok&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),jj(e),t||e.docView&&e.docView.dirty){let n=RA(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 Fae(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 Nj=vk&&yk<15||Tk&&Ak<604;yj.copy=bj.cut=(e,t)=>{let n=t,r=e.state.selection,i=n.type==`cut`;if(r.empty)return;let a=Nj?null:n.clipboardData,{dom:o,text:s}=lj(e,r.content());a?(n.preventDefault(),a.clearData(),a.setData(`text/html`,o.innerHTML),a.setData(`text/plain`,s)):Fae(e,o),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta(`uiEvent`,`cut`))};function Iae(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function Lae(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?Pj(e,r.value,null,i,t):Pj(e,r.textContent,r.innerHTML,i,t)},50)}function Pj(e,t,n,r,i){let a=uj(e,t,n,r,e.state.selection.$from);if(e.someProp(`handlePaste`,t=>t(e,i,a||H.empty)))return!0;if(!a)return!1;let o=Iae(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 Fj(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,` `):``}bj.paste=(e,t)=>{let n=t;if(e.composing&&!Ok)return;let r=Nj?null:n.clipboardData,i=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&Pj(e,Fj(r),r.getData(`text/html`),i,n)?n.preventDefault():Lae(e,n)};var Ij=class{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}},Rae=Ek?`altKey`:`ctrlKey`;function Lj(e,t){let n;return e.someProp(`dragCopies`,e=>{n||=e(t)}),n==null?!t[Rae]:!n}yj.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(wj(n)),o;if(!(a&&a.pos>=i.from&&a.pos<=(i instanceof U?i.to-1:i.to))){if(r&&r.mightDrag)o=U.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=U.create(e.state.doc,t.posBefore))}}let{dom:s,text:c,slice:l}=lj(e,(o||e.state.selection).content());(!n.dataTransfer.files.length||!Sk||Ck>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Nj?`Text`:`text/html`,s.innerHTML),n.dataTransfer.effectAllowed=`copyMove`,Nj||n.dataTransfer.setData(`text/plain`,c),e.dragging=new Ij(l,Lj(e,n),o)},yj.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},bj.dragover=bj.dragenter=(e,t)=>t.preventDefault(),bj.drop=(e,t)=>{try{zae(e,t,e.dragging)}finally{e.dragging=null}};function zae(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(wj(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=uj(e,Fj(t.dataTransfer),Nj?null:t.dataTransfer.getData(`text/html`),!1,i);let o=!!(n&&Lj(e,t));if(e.someProp(`handleDrop`,n=>n(e,t,a||H.empty,o))){t.preventDefault();return}if(!a)return;t.preventDefault();let s=a?FD(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&&U.isSelectable(a.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(a.content.firstChild))c.setSelection(new U(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(JA(e,f,c.doc.resolve(t)))}e.focus(),e.dispatch(c.setMeta(`uiEvent`,`drop`))}yj.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())&&BA(e)},20))},yj.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)},yj.beforeinput=(e,t)=>{if(Sk&&Ok&&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,lk(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 bj)yj[e]=bj[e];function Rj(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 zj=class e{constructor(e,t){this.toDOM=e,this.spec=t||Wj,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 Hj(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&&Rj(this.spec,t.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},Bj=class e{constructor(e,t){this.attrs=e,this.spec=t||Wj}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 Hj(i,a,this)}valid(e,t){return t.from<t.to}eq(t){return this==t||t instanceof e&&Rj(this.attrs,t.attrs)&&Rj(this.spec,t.spec)}static is(t){return t.type instanceof e}destroy(){}},Vj=class e{constructor(e,t){this.attrs=e,this.spec=t||Wj}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 Hj(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&&Rj(this.attrs,t.attrs)&&Rj(this.spec,t.spec)}destroy(){}},Hj=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 zj(n,r))}static inline(t,n,r,i){return new e(t,n,new Bj(r,i))}static node(t,n,r,i){return new e(t,n,new Vj(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Bj}get widget(){return this.type instanceof zj}},Uj=[],Wj={},Gj=class e{constructor(e,t){this.local=e.length?e:Uj,this.children=t.length?t:Uj}static create(e,t){return t.length?$j(t,e,0,Wj):Kj}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==Kj||e.maps.length==0?this:this.mapInner(e,t,0,0,n||Wj)}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?Jj(this.children,o||[],t,n,r,i,a):o?new e(o.sort(eM),Uj):Kj}add(t,n){return n.length?this==Kj?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=Zj(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,$j(s,e,o+1,Wj)),a+=3}});let o=Yj(a?Qj(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(eM):this.local,i||this.children)}remove(e){return e.length==0||this==Kj?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==Kj?(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):Kj}forChild(t,n){if(this==Kj)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 Bj){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(eM),Uj);return r?new qj([t,r]):t}return r||Kj}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 tM(this.localsInner(e))}localsInner(e){if(this==Kj)return Uj;if(e.inlineContent||!this.local.some(Bj.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof Bj||t.push(this.local[e]);return t}forEachSet(e){e(this)}};Gj.empty=new Gj([],[]),Gj.removeOverlap=tM;var Kj=Gj.empty,qj=class e{constructor(e){this.members=e}map(t,n){let r=this.members.map(e=>e.map(t,n,Wj));return e.from(r)}forChild(t,n){if(n.isLeaf)return Gj.empty;let r=[];for(let i=0;i<this.members.length;i++){let a=this.members[i].forChild(t,n);a!=Kj&&(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?tM(n?t:t.sort(eM)):Uj}static from(t){switch(t.length){case 0:return Kj;case 1:return t[0];default:return new e(t.every(e=>e instanceof Gj)?t:t.reduce((e,t)=>e.concat(t instanceof Gj?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}};function Jj(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==Kj?(s[t+1]=-2,c=!0):(s[t]=u,s[t+1]=d,s[t+2]=r)}else c=!0}if(c){let c=$j(Xj(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 Gj(t.sort(eM),s)}function Yj(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 Hj(i.from+t,i.to+t,i.type))}return n}function Xj(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 Zj(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 Qj(e){let t=[];for(let n=0;n<e.length;n++)e[n]!=null&&t.push(e[n]);return t}function $j(e,t,n,r){let i=[],a=!1;t.forEach((t,o)=>{let s=Zj(e,t,o+n);if(s){a=!0;let e=$j(s,t,n+o+1,r);e!=Kj&&i.push(o,o+t.nodeSize,e)}});let o=Yj(a?Qj(e):e,-n).sort(eM);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 Gj(o,i):Kj}function eM(e,t){return e.from-t.from||e.to-t.to}function tM(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),nM(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),nM(t,i,r.copy(a.from,r.to)));break}}}return t}function nM(e,t,n){for(;t<e.length&&eM(n,e[t])>0;)t++;e.splice(t,0,n)}function rM(e){let t=[];return e.someProp(`decorations`,n=>{let r=n(e.state);r&&r!=Kj&&t.push(r)}),e.cursorWrapper&&t.push(Gj.create(e.state.doc,[e.cursorWrapper.deco])),qj.from(t)}var iM={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},aM=vk&&yk<=11,oM=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}},sM=class{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new oM,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]);vk&&yk<=11&&t.some(e=>e.type==`childList`&&e.removedNodes.length||e.type==`characterData`&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():wk&&e.composing&&t.some(e=>e.type==`childList`&&e.target.nodeName==`TR`)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),aM&&(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,iM)),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(YA(this.view)){if(this.suppressingSelectionUpdates)return BA(this.view);if(vk&&yk<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&ik(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=tk(n))t.add(n);for(let r=e.anchorNode;r;r=tk(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)&&YA(e)&&!this.ignoreSelectionChange(n),i=-1,a=-1,o=!1,s=[];if(e.editable)for(let e=0;e<t.length;e++){let n=this.registerMutation(t[e],s);n&&(i=i<0?n.from:Math.min(n.from,i),a=a<0?n.to:Math.max(n.to,a),n.typeOver&&(o=!0))}if(s.some(e=>e.nodeName==`BR`)&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let e of s)if(e.nodeName==`BR`&&e.parentNode){let t=e.nextSibling;for(;t&&t.nodeType==1;){if(t.contentEditable==`false`){e.parentNode.removeChild(e);break}t=t.firstChild}}}else if(bk&&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||pM(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&&ck(n)&&(c=RA(e))&&c.eq(ZD.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,BA(e),this.currentSelection.set(n),e.scrollToSelection()):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,a),uM(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,mM(e,s)),this.handleDOMChange(i,a,o,s),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||BA(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(vk&&yk<=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?ek(r)+1:0,o=n.localPosFromDOM(e.target,a,-1),s=i&&i.parentNode==e.target?ek(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}}},cM=new WeakMap,lM=!1;function uM(e){if(!cM.has(e)&&(cM.set(e,null),[`normal`,`nowrap`,`pre-line`].indexOf(getComputedStyle(e.dom).whiteSpace)!==-1)){if(e.requiresGeckoHackNode=bk,lM)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.`),lM=!0}}function dM(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,a=t.endOffset,o=e.domAtPos(e.state.selection.anchor);return ik(o.node,o.offset,i,a)&&([n,r,i,a]=[i,a,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}}function fM(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return dM(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?dM(e,n):null}function pM(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 mM(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 hM(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}],ck(c)||l.push({node:c.focusNode,offset:c.focusOffset})),Sk&&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`)||CE.fromSchema(e.state.schema),p=d.resolve(o),m=null,h=f.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:a,preserveWhitespace:p.parent.type.whitespace==`pre`?`full`:!0,findPositions:l,ruleFromNode:gM,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 gM(e){let t=e.pmViewDesc;if(t)return t.parseRule();if(e.nodeName==`BR`&&e.parentNode){if(wk&&/^(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||wk&&/^(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 _M=/^(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 vM(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=RA(e,t);if(n&&!e.state.selection.eq(n)){if(Sk&&Ok&&e.input.lastKeyCode===13&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp(`handleKeyDown`,t=>t(e,lk(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=hM(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=CM(d.content,l.doc.content,l.from,f,p);if(m&&e.input.domChangeCount++,(Tk&&e.input.lastIOSEnter>Date.now()-225||Ok)&&i.some(e=>e.nodeType==1&&!_M.test(e.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp(`handleKeyDown`,t=>t(e,lk(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(!m)if(r&&c instanceof tO&&!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=yM(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 tO&&(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)),vk&&yk<=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((Tk&&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,lk(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&xM(u,m.start,m.endA,h,g)&&e.someProp(`handleKeyDown`,t=>t(e,lk(8,`Backspace`)))){Ok&&Sk&&e.domObserver.suppressSelectionUpdates();return}Sk&&m.endB==m.start&&(e.input.lastChromeDelete=Date.now()),Ok&&!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,lk(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=yM(e,n.doc,l.sel);t&&!(Sk&&e.composing&&t.empty&&(m.start!=m.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==y||t.head==n.mapping.map(b)-1)||vk&&t.empty&&t.head==y)&&n.setSelection(t)}return a&&n.setMeta(`composition`,a),n.scrollIntoView()},S;if(v)if(h.pos==g.pos){vk&&yk<=11&&h.parentOffset==0&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>BA(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=bM(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 yM(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:JA(e,t.resolve(n.anchor),t.resolve(n.head))}function bM(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(V.from(l).eq(e))return{mark:s,type:o}}function xM(e,t,n,r,i){if(n-t<=i.pos-r.pos||SM(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(SM(a,!0,!0));return!o.parent.isTextblock||o.pos>n||SM(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function SM(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 CM(e,t,n,r,i){let a=e.findDiffStart(t,n);if(a==null)return null;let{a:o,b:s}=e.findDiffEnd(t,n+e.size,n+t.size);if(i==`end`){let e=Math.max(0,a-Math.min(o,s));r-=o+e-a}if(o<a&&e.size<t.size){let e=r<=a&&r>=o?a-r:0;a-=e,a&&a<t.size&&wM(t.textBetween(a-1,a+1))&&(a+=e?1:-1),s=a+(s-o),o=a}else if(s<a){let t=r<=a&&r>=s?a-r:0;a-=t,a&&a<e.size&&wM(e.textBetween(a-1,a+1))&&(a+=t?1:-1),o=a+(o-s),s=a}return{start:a,endA:o,endB:s}}function wM(e){if(e.length!=2)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}var TM=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 vae,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(MM),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=OM(this),DM(this),this.nodeViews=AM(this),this.docView=vA(this.state.doc,EM(this),rM(this),this.dom,this),this.domObserver=new sM(this,(e,t,n,r)=>vM(this,e,t,n,r)),this.domObserver.start(),yae(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&&Sj(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(MM),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&&(jj(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=AM(this);jM(e,this.nodeViews)&&(this.nodeViews=e,r=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&Sj(this),this.editable=OM(this),DM(this);let o=rM(this),s=EM(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&&Fk(this);if(i){this.domObserver.stop();let t=l&&(vk||Sk)&&!this.composing&&!n.selection.empty&&!e.selection.empty&&kM(n.selection,e.selection);if(l){let n=Sk?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Nae(this)),(r||!this.docView.update(e.doc,s,o,this))&&(this.docView.updateOuterDeco(s),this.docView.destroy(),this.docView=vA(e.doc,s,o,this.dom,this)),n&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(t=!0)}t||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&nae(this))?BA(this,t):(KA(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&&Lk(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 U){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Pk(this,t.getBoundingClientRect(),e)}else Pk(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 Ij(e.slice,e.move,r<0?void 0:U.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(vk){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&&Bk(this.dom),BA(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 Jk(this,e)}coordsAtPos(e,t=1){return Qk(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 cA(this,t||this.state,e)}pasteHTML(e,t){return Pj(this,``,e,!1,t||new ClipboardEvent(`paste`))}pasteText(e,t){return Pj(this,e,null,!0,t||new ClipboardEvent(`paste`))}serializeForClipboard(e){return lj(this,e)}destroy(){this.docView&&(bae(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],rM(this),this),this.dom.textContent=``):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Xie())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Sae(this,e)}domSelectionRange(){let e=this.domSelection();return e?wk&&this.root.nodeType===11&&uk(this.dom.ownerDocument)==this.dom&&fM(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};TM.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};function EM(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`,[Hj.node(0,e.state.doc.content.size,t)]}function DM(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:Hj.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function OM(e){return!e.someProp(`editable`,t=>t(e.state)===!1)}function kM(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 AM(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 jM(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 MM(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 NM={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:`'`},PM={48:`)`,49:`!`,50:`@`,51:`#`,52:`$`,53:`%`,54:`^`,55:`&`,56:`*`,57:`(`,59:`:`,61:`+`,173:`_`,186:`:`,187:`+`,188:`<`,189:`_`,190:`>`,191:`?`,192:`~`,219:`{`,220:`|`,221:`}`,222:`"`},FM=typeof navigator<`u`&&/Mac/.test(navigator.platform),IM=typeof navigator<`u`&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),LM=0;LM<10;LM++)NM[48+LM]=NM[96+LM]=String(LM);for(var LM=1;LM<=24;LM++)NM[LM+111]=`F`+LM;for(var LM=65;LM<=90;LM++)NM[LM]=String.fromCharCode(LM+32),PM[LM]=String.fromCharCode(LM);for(var RM in NM)PM.hasOwnProperty(RM)||(PM[RM]=NM[RM]);function zM(e){var t=!(FM&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||IM&&e.shiftKey&&e.key&&e.key.length==1||e.key==`Unidentified`)&&e.key||(e.shiftKey?PM:NM)[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 BM=typeof navigator<`u`&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),VM=typeof navigator<`u`&&/Win/.test(navigator.platform);function HM(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))BM?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 UM(e){let t=Object.create(null);for(let n in e)t[HM(n)]=e[n];return t}function WM(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 GM(e){return new vO({props:{handleKeyDown:KM(e)}})}function KM(e){let t=UM(e);return function(e,n){let r=zM(n),i,a=t[WM(r,n)];if(a&&a(e.state,e.dispatch,e))return!0;if(r.length==1&&r!=` `){if(n.shiftKey){let i=t[WM(r,n,!1)];if(i&&i(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(VM&&n.ctrlKey&&n.altKey)&&(i=NM[n.keyCode])&&i!=r){let r=t[WM(i,n)];if(r&&r(e.state,e.dispatch,e))return!0}}return!1}}var qM=Object.defineProperty,JM=(e,t)=>{for(var n in t)qM(e,n,{get:t[n],enumerable:!0})};function YM(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 XM=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:YM({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}},ZM={};JM(ZM,{blur:()=>QM,clearContent:()=>$M,clearNodes:()=>eN,command:()=>tN,createParagraphNear:()=>nN,cut:()=>rN,deleteCurrentNode:()=>iN,deleteNode:()=>oN,deleteRange:()=>sN,deleteSelection:()=>cN,enter:()=>lN,exitCode:()=>uN,extendMarkRange:()=>_N,first:()=>vN,focus:()=>TN,forEach:()=>EN,insertContent:()=>DN,insertContentAt:()=>NN,joinBackward:()=>IN,joinDown:()=>FN,joinForward:()=>LN,joinItemBackward:()=>RN,joinItemForward:()=>zN,joinTextblockBackward:()=>BN,joinTextblockForward:()=>VN,joinUp:()=>PN,keyboardShortcut:()=>WN,lift:()=>KN,liftEmptyBlock:()=>qN,liftListItem:()=>JN,newlineInCode:()=>YN,resetAttributes:()=>QN,scrollIntoView:()=>$N,selectAll:()=>eP,selectNodeBackward:()=>tP,selectNodeForward:()=>nP,selectParentNode:()=>rP,selectTextblockEnd:()=>iP,selectTextblockStart:()=>aP,setContent:()=>sP,setMark:()=>aF,setMeta:()=>oF,setNode:()=>sF,setNodeSelection:()=>cF,setTextDirection:()=>lF,setTextSelection:()=>uF,sinkListItem:()=>dF,splitBlock:()=>pF,splitListItem:()=>mF,toggleList:()=>vF,toggleMark:()=>yF,toggleNode:()=>bF,toggleWrap:()=>xF,undoInputRule:()=>SF,unsetAllMarks:()=>CF,unsetMark:()=>wF,unsetTextDirection:()=>TF,updateAttributes:()=>EF,wrapIn:()=>DF,wrapInList:()=>OF});var QM=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),$M=(e=!0)=>({commands:t})=>t.setContent(``,{emitUpdate:e}),eN=()=>({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=hD(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},tN=e=>t=>e(t),nN=()=>({state:e,dispatch:t})=>VO(e,t),rN=(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 tO(r.doc.resolve(Math.max(o-1,0)))),!0},iN=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;let i=e.selection.$anchor;for(let n=i.depth;n>0;--n)if(i.node(n).type===r.type){if(t){let t=i.before(n),r=i.after(n);e.delete(t,r).scrollIntoView()}return!0}return!1};function aN(e,t){if(typeof e==`string`){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var oN=e=>({tr:t,state:n,dispatch:r})=>{let i=aN(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},sN=e=>({tr:t,dispatch:n})=>{let{from:r,to:i}=e;return n&&t.delete(r,i),!0},cN=()=>({state:e,dispatch:t})=>SO(e,t),lN=()=>({commands:e})=>e.keyboardShortcut(`Enter`),uN=()=>({state:e,dispatch:t})=>BO(e,t);function dN(e){return Object.prototype.toString.call(e)===`[object RegExp]`}function fN(e,t,n={strict:!0}){let r=Object.keys(t);return r.length?r.every(r=>n.strict?t[r]===e[r]:dN(t[r])?t[r].test(e[r]):t[r]===e[r]):!0}function pN(e,t,n={}){return e.find(e=>e.type===t&&fN(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function mN(e,t,n={}){return!!pN(e,t,n)}function hN(e,t,n){if(!e||!t)return;let r=e.parent.childAfter(e.parentOffset);if((!r.node||!r.node.marks.some(e=>e.type===t))&&(r=e.parent.childBefore(e.parentOffset)),!r.node||!r.node.marks.some(e=>e.type===t))return;if(!n){let e=r.node.marks.find(e=>e.type===t);e&&(n=e.attrs)}if(!pN([...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&&mN([...e.parent.child(i-1).marks],t,n);)--i,a-=e.parent.child(i).nodeSize;for(;o<e.parent.childCount&&mN([...e.parent.child(o).marks],t,n);)s+=e.parent.child(o).nodeSize,o+=1;return{from:a,to:s}}function gN(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 _N=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=gN(e,r.schema),{doc:o,selection:s}=n,{$from:c,from:l,to:u}=s;if(i){let e=hN(c,a,t);if(e&&e.from<=l&&e.to>=u){let t=tO.create(o,e.from,e.to);n.setSelection(t)}}return!0},vN=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 yN(e){return e instanceof tO}function bN(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function xN(e,t=null){if(!t)return null;let n=ZD.atStart(e),r=ZD.atEnd(e);if(t===`start`||t===!0)return n;if(t===`end`)return r;let i=n.from,a=r.to;return t===`all`?tO.create(e,bN(0,i,a),bN(e.content.size,i,a)):tO.create(e,bN(t,i,a),bN(t,i,a))}function SN(){return navigator.platform===`Android`||/android/i.test(navigator.userAgent)}function CN(){return[`iPad Simulator`,`iPhone Simulator`,`iPod Simulator`,`iPad`,`iPhone`,`iPod`].includes(navigator.platform)||navigator.userAgent.includes(`Mac`)&&`ontouchend`in document}function wN(){return typeof navigator<`u`?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var TN=(e=null,t={})=>({editor:n,view:r,tr:i,dispatch:a})=>{t={scrollIntoView:!0,...t};let o=()=>{(CN()||SN())&&r.dom.focus(),wN()&&!CN()&&!SN()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),t?.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&e===null||e===!1)return!0}catch{return!1}if(a&&e===null&&!yN(n.state.selection))return o(),!0;let s=xN(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},EN=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),DN=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),ON=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&&ON(r)}return e};function kN(e){if(typeof window>`u`)throw Error(`[tiptap error]: there is no window object available, so this function cannot be used`);let t=`<body>${e}</body>`,n=new window.DOMParser().parseFromString(t,`text/html`).body;return ON(n)}function AN(e,t,n){if(e instanceof sE||e instanceof V)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 V.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),AN(``,t,n)}if(i){if(n.errorOnInvalidContent){let r=!1,i=``,a=new bE({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?CE.fromSchema(a).parseSlice(kN(e),n.parseOptions):CE.fromSchema(a).parse(kN(e),n.parseOptions),n.errorOnInvalidContent&&r)throw Error(`[tiptap error]: Invalid HTML content`,{cause:Error(`Invalid element found: ${i}`)})}let r=CE.fromSchema(t);return n.slice?r.parseSlice(kN(e),n.parseOptions).content:r.parse(kN(e),n.parseOptions)}return AN(``,t,n)}function jN(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof cD||i instanceof lD))return;let a=e.mapping.maps[r],o=0;a.forEach((e,t,n,r)=>{o===0&&(o=r)}),e.setSelection(ZD.near(e.doc.resolve(o),n))}var MN=e=>!(`type`in e),NN=(e,t,n)=>({tr:r,dispatch:i,editor:a})=>{if(i){n={parseOptions:a.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let i,o=e=>{a.emit(`contentError`,{editor:a,error:e,disableCollaboration:()=>{`collaboration`in a.storage&&typeof a.storage.collaboration==`object`&&a.storage.collaboration&&(a.storage.collaboration.isDisabled=!0)}})},s={preserveWhitespace:`full`,...n.parseOptions};if(!n.errorOnInvalidContent&&!a.options.enableContentCheck&&a.options.emitContentError)try{AN(t,a.schema,{parseOptions:s,errorOnInvalidContent:!0})}catch(e){o(e)}try{i=AN(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((MN(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 V){let e=``;t.forEach(t=>{t.text&&(e+=t.text)}),f=e}else f=typeof t==`object`&&t&&t.text?t.text:t;r.insertText(f,c,l)}else{f=i;let e=r.doc.resolve(c),t=e.node(),n=e.parentOffset===0,a=t.isText||t.isTextblock,o=t.content.size>0;n&&a&&o&&d&&(c=Math.max(0,c-1)),r.replaceWith(c,l,f)}n.updateSelection&&jN(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},PN=()=>({state:e,dispatch:t})=>FO(e,t),FN=()=>({state:e,dispatch:t})=>IO(e,t),IN=()=>({state:e,dispatch:t})=>wO(e,t),LN=()=>({state:e,dispatch:t})=>MO(e,t),RN=()=>({state:e,dispatch:t,tr:n})=>{try{let r=MD(e.doc,e.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},zN=()=>({state:e,dispatch:t,tr:n})=>{try{let r=MD(e.doc,e.selection.$from.pos,1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},BN=()=>({state:e,dispatch:t})=>TO(e,t),VN=()=>({state:e,dispatch:t})=>EO(e,t);function HN(){return typeof navigator<`u`?/Mac/.test(navigator.platform):!1}function UN(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))CN()||HN()?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 WN=e=>({editor:t,view:n,tr:r,dispatch:i})=>{let a=UN(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 GN(e,t,n={}){let{from:r,to:i,empty:a}=e.selection,o=t?aN(t,e.schema):null,s=[];e.doc.nodesBetween(r,i,(e,t)=>{if(e.isText)return;let n=Math.max(r,t),a=Math.min(i,t+e.nodeSize);s.push({node:e,from:n,to:a})});let c=i-r,l=s.filter(e=>o?o.name===e.node.type.name:!0).filter(e=>fN(e.node.attrs,n,{strict:!1}));return a?!!l.length:l.reduce((e,t)=>e+t.to-t.from,0)>=c}var KN=(e,t={})=>({state:n,dispatch:r})=>GN(n,aN(e,n.schema),t)?LO(n,r):!1,qN=()=>({state:e,dispatch:t})=>HO(e,t),JN=e=>({state:t,dispatch:n})=>Kie(aN(e,t.schema))(t,n),YN=()=>({state:e,dispatch:t})=>RO(e,t);function XN(e,t){return t.nodes[e]?`node`:t.marks[e]?`mark`:null}function ZN(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 QN=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=XN(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=aN(e,r.schema)),s===`mark`&&(o=gN(e,r.schema));let c=!1;return n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{a&&a===e.type&&(c=!0,i&&n.setNodeMarkup(r,void 0,ZN(e.attrs,t))),o&&e.marks.length&&e.marks.forEach(a=>{o===a.type&&(c=!0,i&&n.addMark(r,r+e.nodeSize,o.create(ZN(a.attrs,t))))})})}),c},$N=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),eP=()=>({tr:e,dispatch:t})=>{if(t){let t=new iO(e.doc);e.setSelection(t)}return!0},tP=()=>({state:e,dispatch:t})=>kO(e,t),nP=()=>({state:e,dispatch:t})=>NO(e,t),rP=()=>({state:e,dispatch:t})=>Rie(e,t),iP=()=>({state:e,dispatch:t})=>JO(e,t),aP=()=>({state:e,dispatch:t})=>qO(e,t);function oP(e,t,n={},r={}){return AN(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var sP=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:a,dispatch:o,commands:s})=>{let{doc:c}=a;if(r.preserveWhitespace!==`full`){let s=oP(e,i.schema,r,{errorOnInvalidContent:t??i.options.enableContentCheck});return o&&a.replaceWith(0,c.content.size,s).setMeta(`preventUpdate`,!n),!0}return o&&a.setMeta(`preventUpdate`,!n),s.insertContentAt({from:0,to:c.content.size},e,{parseOptions:r,errorOnInvalidContent:t??i.options.enableContentCheck})};function cP(e,t){let n=gN(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 lP(e,t){let n=new YD(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function uP(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 dP(e,t,n){let r=[];return e.nodesBetween(t.from,t.to,(e,t)=>{n(e)&&r.push({node:e,pos:t})}),r}function fP(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 pP(e){return t=>fP(t.$from,e)}function W(e,t,n){return e.config[t]===void 0&&e.parent?W(e.parent,t,n):typeof e.config[t]==`function`?e.config[t].bind({...n,parent:e.parent?W(e.parent,t,n):null}):e.config[t]}function mP(e){return e.map(e=>{let t=W(e,`addExtensions`,{name:e.name,options:e.options,storage:e.storage});return t?[e,...mP(t())]:e}).flat(10)}function hP(e,t){let n=IE.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement(`div`);return r.appendChild(n),r.innerHTML}function gP(e){return typeof e==`function`}function _P(e,t=void 0,...n){return gP(e)?t?e.bind(t)(...n):e(...n):e}function vP(e={}){return Object.keys(e).length===0&&e.constructor===Object}function yP(e){return{baseExtensions:e.filter(e=>e.type===`extension`),nodeExtensions:e.filter(e=>e.type===`node`),markExtensions:e.filter(e=>e.type===`mark`)}}function bP(e){let t=[],{nodeExtensions:n,markExtensions:r}=yP(e),i=[...n,...r],a={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(e=>e.name!==`text`).map(e=>e.name),s=r.map(e=>e.name),c=[...o,...s];return e.forEach(e=>{let n=W(e,`addGlobalAttributes`,{name:e.name,options:e.options,storage:e.storage,extensions:i});n&&n().forEach(e=>{let n;n=Array.isArray(e.types)?e.types:e.types===`*`?c:e.types===`nodes`?o:e.types===`marks`?s:[],n.forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...a,...r}})})})})}),i.forEach(e=>{let n=W(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 xP(e){let t=[],n=``,r=!1,i=!1,a=0,o=e.length;for(let s=0;s<o;s+=1){let o=e[s];if(o===`'`&&!i){r=!r,n+=o;continue}if(o===`"`&&!r){i=!i,n+=o;continue}if(!r&&!i){if(o===`(`){a+=1,n+=o;continue}if(o===`)`&&a>0){--a,n+=o;continue}if(o===`;`&&a===0){t.push(n),n=``;continue}}n+=o}return n&&t.push(n),t}function SP(e){let t=[],n=xP(e||``),r=n.length;for(let e=0;e<r;e+=1){let r=n[e],i=r.indexOf(`:`);if(i===-1)continue;let a=r.slice(0,i).trim(),o=r.slice(i+1).trim();a&&o&&t.push([a,o])}return t}function CP(...e){return e.filter(e=>!!e).reduce((e,t)=>{let n={...e};return Object.entries(t).forEach(([e,t])=>{if(!n[e]){n[e]=t;return}if(e===`class`){let r=t?String(t).split(` `):[],i=n[e]?n[e].split(` `):[],a=r.filter(e=>!i.includes(e));n[e]=[...i,...a].join(` `)}else if(e===`style`){let r=new Map([...SP(n[e]),...SP(t)]);n[e]=Array.from(r.entries()).map(([e,t])=>`${e}: ${t}`).join(`; `)}else n[e]=t}),n},{})}function wP(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)=>CP(e,t),{})}function TP(e){return typeof e==`string`?e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e===`true`?!0:e===`false`?!1:e:e}function EP(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):TP(n.getAttribute(t.name));return r==null?e:{...e,[t.name]:r}},{});return{...r,...i}}}}function DP(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>e===`attrs`&&vP(t)?!1:t!=null))}function OP(e){let t={};return!e?.attribute?.isRequired&&`default`in(e?.attribute||{})&&(t.default=e.attribute.default),e?.attribute?.validate!==void 0&&(t.validate=e.attribute.validate),[e.name,t]}function kP(e,t){let n=bP(e),{nodeExtensions:r,markExtensions:i}=yP(e);return new bE({topNode:r.find(e=>W(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=DP({...e.reduce((e,t)=>{let n=W(t,`extendNodeSchema`,a);return{...e,...n?n(r):{}}},{}),content:_P(W(r,`content`,a)),marks:_P(W(r,`marks`,a)),group:_P(W(r,`group`,a)),inline:_P(W(r,`inline`,a)),atom:_P(W(r,`atom`,a)),selectable:_P(W(r,`selectable`,a)),draggable:_P(W(r,`draggable`,a)),code:_P(W(r,`code`,a)),whitespace:_P(W(r,`whitespace`,a)),linebreakReplacement:_P(W(r,`linebreakReplacement`,a)),defining:_P(W(r,`defining`,a)),isolating:_P(W(r,`isolating`,a)),attrs:Object.fromEntries(i.map(OP))}),s=_P(W(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>EP(e,i)));let c=W(r,`renderHTML`,a);c&&(o.toDOM=e=>c({node:e,HTMLAttributes:wP(e,i)}));let l=W(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=DP({...e.reduce((e,t)=>{let n=W(t,`extendMarkSchema`,a);return{...e,...n?n(r):{}}},{}),inclusive:_P(W(r,`inclusive`,a)),excludes:_P(W(r,`excludes`,a)),group:_P(W(r,`group`,a)),spanning:_P(W(r,`spanning`,a)),code:_P(W(r,`code`,a)),attrs:Object.fromEntries(i.map(OP))}),s=_P(W(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>EP(e,i)));let c=W(r,`renderHTML`,a);return c&&(o.toDOM=e=>c({mark:e,HTMLAttributes:wP(e,i)})),[r.name,o]}))})}function AP(e){let t=e.filter((t,n)=>e.indexOf(t)!==n);return Array.from(new Set(t))}function jP(e){return e.sort((e,t)=>{let n=W(e,`priority`)||100,r=W(t,`priority`)||100;return n>r?-1:+(n<r)})}function MP(e){let t=jP(mP(e)),n=AP(t.map(e=>e.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(e=>`'${e}'`).join(`, `)}]. This can lead to issues.`),t}function NP(e,t,n){let{from:r,to:i}=t,{blockSeparator:a=` 76 77`,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 PP(e,t){return NP(e,{from:0,to:e.content.size},t)}function FP(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function IP(e,t){let n=aN(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 LP(e,t){let n=XN(typeof t==`string`?t:t.name,e.schema);return n===`node`?IP(e,t):n===`mark`?cP(e,t):{}}function RP(e,t=JSON.stringify){let n={};return e.filter(e=>{let r=t(e);return Object.prototype.hasOwnProperty.call(n,r)?!1:n[r]=!0})}function zP(e){let t=RP(e);return t.length===1?t:t.filter((e,n)=>!t.filter((e,t)=>t!==n).some(t=>e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to))}function BP(e){let{mapping:t,steps:n}=e,r=[];return t.maps.forEach((e,i)=>{let a=[];if(e.ranges.length)e.forEach((e,t)=>{a.push({from:e,to:t})});else{let{from:e,to:t}=n[i];if(e===void 0||t===void 0)return;a.push({from:e,to:t})}a.forEach(({from:e,to:n})=>{let a=t.slice(i).map(e,-1),o=t.slice(i).map(n),s=t.invert().map(a,-1),c=t.invert().map(o);r.push({oldRange:{from:s,to:c},newRange:{from:a,to:o}})})}),zP(r)}function VP(e,t,n){let r=[];return e===t?n.resolve(e).marks().forEach(t=>{let i=hN(n.resolve(e),t.type);i&&r.push({mark:t,...i})}):n.nodesBetween(e,t,(e,t)=>{!e||e?.nodeSize===void 0||r.push(...e.marks.map(n=>({from:t,to:t+e.nodeSize,mark:n})))}),r}var HP=(e,t,n,r=20)=>{let i=e.doc.resolve(n),a=r,o=null;for(;a>0&&o===null;){let e=i.node(a);e?.type.name===t?o=e:--a}return[o,a]};function UP(e,t){return t.nodes[e]||t.marks[e]||null}function WP(e,t,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{let r=e.find(e=>e.type===t&&e.name===n);return r?r.attribute.keepOnSplit:!1}))}var GP=(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 KP(e,t,n={}){let{empty:r,ranges:i}=e.selection,a=t?gN(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>a?a.name===e.type.name:!0).find(e=>fN(e.attrs,n,{strict:!1}));let o=0,s=[];if(i.forEach(({$from:t,$to:n})=>{let r=t.pos,i=n.pos;e.doc.nodesBetween(r,i,(e,t)=>{if(a&&e.inlineContent&&!e.type.allowsMarkType(a))return!1;if(!e.isText&&!e.marks.length)return;let n=Math.max(r,t),c=Math.min(i,t+e.nodeSize),l=c-n;o+=l,s.push(...e.marks.map(e=>({mark:e,from:n,to:c})))})}),o===0)return!1;let c=s.filter(e=>a?a.name===e.mark.type.name:!0).filter(e=>fN(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),l=s.filter(e=>a?e.mark.type!==a&&e.mark.type.excludes(a):!0).reduce((e,t)=>
77e+t.to-t.from,0);return(c>0?c+l:c)>=o}function qP(e,t,n={}){if(!t)return GN(e,null,n)||KP(e,null,n);let r=XN(t,e.schema);return r===`node`?GN(e,t,n):r===`mark`?KP(e,t,n):!1}var JP=(e,t)=>{let{$from:n,$to:r,$anchor:i}=e.selection;if(t){let n=pP(e=>e.type.name===t)(e.selection);if(!n)return!1;let r=e.doc.resolve(n.pos+1);return i.pos+1===r.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},YP=e=>{let{$from:t,$to:n}=e.selection;return!(t.parentOffset>0||t.pos!==n.pos)};function XP(e,t){return Array.isArray(t)?t.some(t=>(typeof t==`string`?t:t.name)===e.name):t}function ZP(e,t){let{nodeExtensions:n}=yP(t),r=n.find(t=>t.name===e);if(!r)return!1;let i=_P(W(r,`group`,{name:r.name,options:r.options,storage:r.storage}));return typeof i==`string`?i.split(` `).includes(`list`):!1}function QP(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){if(n){if(e.type.name===`hardBreak`)return!0;if(e.isText)return!/\S/.test(e.text??``)}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(e.content.childCount===0)return!0;if(t){let r=!0;return e.content.forEach(e=>{r!==!1&&(QP(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}function $P(e){return e instanceof U}function eF({selection:e,pos:t,nodeSize:n,selectedOnTextSelection:r=!1}){let{from:i,to:a}=e;return!!(i<=t&&a>=t+n||r&&yN(e)&&i>t&&a<t+n)}var tF=class e{constructor(e){this.position=e}static fromJSON(t){return new e(t.position)}toJSON(){return{position:this.position}}};function nF(e,t){let n=t.mapping.mapResult(e.position);return{position:new tF(n.pos),mapResult:n}}function rF(e){return new tF(e)}function iF(e,t,n){let{selection:r}=t,i=null;if(yN(r)&&(i=r.$cursor),i){let t=e.storedMarks??i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(t)||!t.some(e=>e.type.excludes(n)))}let{ranges:a}=r;return a.some(({$from:t,$to:r})=>{let i=t.depth===0?e.doc.inlineContent&&e.doc.type.allowsMarkType(n):!1;return e.doc.nodesBetween(t.pos,r.pos,(e,t,r)=>{if(i)return!1;if(e.isInline){let t=!r||r.type.allowsMarkType(n),a=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));i=t&&a}return!i}),i})}var aF=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=n,{empty:o,ranges:s}=a,c=gN(e,r.schema);if(i)if(o){let e=cP(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 iF(r,n,c)},oF=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),sF=(e,t={})=>({state:n,dispatch:r,chain:i})=>{let a=aN(e,n.schema),o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),a.isTextblock?i().command(({commands:e})=>YO(a,{...o,...t})(n)?!0:e.clearNodes()).command(({state:e})=>YO(a,{...o,...t})(e,r)).run():(console.warn(`[tiptap warn]: Currently "setNode()" only supports text block nodes.`),!1)},cF=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,r=bN(e,0,n.content.size),i=U.create(n,r);t.setSelection(i)}return!0},lF=(e,t)=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=r,o,s;return typeof t==`number`?(o=t,s=t):t&&`from`in t&&`to`in t?(o=t.from,s=t.to):(o=a.from,s=a.to),i&&n.doc.nodesBetween(o,s,(t,r)=>{t.isText||n.setNodeMarkup(r,void 0,{...t.attrs,dir:e})}),!0},uF=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,{from:r,to:i}=typeof e==`number`?{from:e,to:e}:e,a=tO.atStart(n).from,o=tO.atEnd(n).to,s=bN(r,a,o),c=bN(i,a,o),l=tO.create(n,s,c);t.setSelection(l)}return!0},dF=e=>({state:t,dispatch:n})=>Yie(aN(e,t.schema))(t,n);function fF(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 pF=({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=WP(l,s.node().type.name,s.node().attrs);if(a instanceof U&&a.node.isBlock)return!s.parentOffset||!DD(o,s.pos)?!1:(r&&(e&&fF(n,i.extensionManager.splittableMarks),t.split(s.pos).scrollIntoView()),!0);if(!s.parent.isBlock)return!1;
vendor: 23,087 bytes, lines 77-78
77let d=c.parentOffset===c.parent.content.size,f=s.depth===0?void 0:uP(s.node(-1).contentMatchAt(s.indexAfter(-1))),p=d&&f?[{type:f,attrs:u}]:void 0,m=DD(t.doc,t.mapping.map(s.pos),1,p);if(!p&&!m&&DD(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 tO&&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&&fF(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return m},mF=(e,t={})=>({tr:n,state:r,dispatch:i,editor:a})=>{let o=aN(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=V.empty,r=s.index(-1)?1:s.index(-2)?2:3;for(let t=s.depth-r;t>=s.depth-3;--t)e=V.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={...WP(d,s.node().type.name,s.node().attrs),...t},c=o.contentMatch.defaultType?.createAndFill(a)||void 0;e=e.append(V.from(o.createAndFill(null,c)||void 0));let l=s.before(s.depth-(r-1));n.replace(l,s.after(-i),new H(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(tO.near(n.doc.resolve(u))),n.scrollIntoView()}return!0}let f=c.pos===s.end()?u.contentMatchAt(0).defaultType:null,p={...WP(d,u.type.name,u.attrs),...t},m={...WP(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(!DD(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},hF=(e,t)=>{let n=pP(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&&kD(e.doc,n.pos)&&e.join(n.pos),!0},gF=(e,t)=>{let n=pP(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&&kD(e.doc,r)&&e.join(r),!0};function _F(e){let t=e.doc,n=t.firstChild;if(!n)return null;let r=t.resolve(1),i=t.resolve(n.nodeSize-1);return tO.between(r,i)}var vF=(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=aN(e,o.schema),m=aN(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=pP(e=>ZP(e.type.name,d))(h),S=h.from===0&&h.to===o.doc.content.size,C=o.doc.content.content,w=C.length===1?C[0]:null,T=S&&w&&ZP(w.type.name,d)?{node:w,pos:0,depth:0}:null,E=x??T,D=!!x&&y.depth>=1&&y.depth-x.depth<=1,O=!!T;if((D||O)&&E){if(E.node.type===p)return S&&O?c().command(({tr:e,dispatch:t})=>{let n=_F(e);return n?(e.setSelection(n),t&&t(e),!0):!1}).liftListItem(m).run():l.liftListItem(m);if(ZP(E.node.type.name,d)&&p.validContent(E.node.content))return c().command(()=>(a.setNodeMarkup(E.pos,p),!0)).command(()=>hF(a,p)).command(()=>gF(a,p)).run()}return!n||!b||!s?c().command(()=>u().wrapInList(p,r)?!0:l.clearNodes()).wrapInList(p,r).command(()=>hF(a,p)).command(()=>gF(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(()=>hF(a,p)).command(()=>gF(a,p)).run()},yF=(e,t={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:a=!1}=n,o=gN(e,r.schema);return KP(r,o,t)?i.unsetMark(o,{extendEmptyMarkRange:a}):i.setMark(o,t)},bF=(e,t,n={})=>({state:r,commands:i})=>{let a=aN(e,r.schema),o=aN(t,r.schema),s=GN(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})},xF=(e,t={})=>({state:n,commands:r})=>{let i=aN(e,n.schema);return GN(n,i,t)?r.lift(i):r.wrapIn(i,t)},SF=()=>({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},CF=()=>({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},wF=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{extendEmptyMarkRange:a=!1}=t,{selection:o}=n,s=gN(e,r.schema),{$from:c,empty:l,ranges:u}=o;if(!i)return!0;if(l&&a){let{from:e,to:t}=o,r=hN(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},TF=e=>({tr:t,state:n,dispatch:r})=>{let{selection:i}=n,a,o;return typeof e==`number`?(a=e,o=e):e&&`from`in e&&`to`in e?(a=e.from,o=e.to):(a=i.from,o=i.to),r&&t.doc.nodesBetween(a,o,(e,n)=>{if(e.isText)return;let r={...e.attrs};delete r.dir,t.setNodeMarkup(n,void 0,r)}),!0},EF=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=XN(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=aN(e,r.schema)),s===`mark`&&(o=gN(e,r.schema));let c=!1;return n.selection.ranges.forEach(e=>{let s=e.$from.pos,l=e.$to.pos,u,d,f,p;n.selection.empty?r.doc.nodesBetween(s,l,(e,t)=>{a&&a===e.type&&(c=!0,f=Math.max(t,s),p=Math.min(t+e.nodeSize,l),u=t,d=e)}):r.doc.nodesBetween(s,l,(e,r)=>{r<s&&a&&a===e.type&&(c=!0,f=Math.max(r,s),p=Math.min(r+e.nodeSize,l),u=r,d=e),r>=s&&r<=l&&(a&&a===e.type&&(c=!0,i&&n.setNodeMarkup(r,void 0,{...e.attrs,...t})),o&&e.marks.length&&e.marks.forEach(a=>{if(o===a.type&&(c=!0,i)){let i=Math.max(r,s),c=Math.min(r+e.nodeSize,l);n.addMark(i,c,o.create({...a.attrs,...t}))}}))}),d&&(u!==void 0&&i&&n.setNodeMarkup(u,void 0,{...d.attrs,...t}),o&&d.marks.length&&d.marks.forEach(e=>{o===e.type&&i&&n.addMark(f,p,o.create({...e.attrs,...t}))}))}),c},DF=(e,t={})=>({state:n,dispatch:r})=>Vie(aN(e,n.schema),t)(n,r),OF=(e,t={})=>({state:n,dispatch:r})=>Uie(aN(e,n.schema),t)(n,r),kF=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={}}},AF=class{constructor(e){this.find=e.find,this.handler=e.handler,this.undoable=e.undoable??!0}},jF=(e,t)=>{if(dN(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 MF(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=GP(c)+i;return a.forEach(e=>{if(l)return;let a=jF(u,e.find);if(!a)return;let c=s.state.tr,d=YM({state:s.state,transaction:c}),f={from:n-(a[0].length-i.length),to:r},{commands:p,chain:m,can:h}=new XM({editor:t,state:d});e.handler({state:d,range:f,match:a,commands:p,chain:m,can:h})===null||!c.steps.length||(e.undoable&&c.setMeta(o,{transform:c,from:n,to:r,text:i}),s.dispatch(c),l=!0)}),l}function NF(e){let{editor:t,rules:n}=e,r=new vO({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:hP(V.from(e),a.schema);let{from:i}=s;MF({editor:t,from:i,to:i+e.length,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:i}},props:{handleTextInput(e,i,a,o){return MF({editor:t,from:i,to:a,text:o,rules:n,plugin:r})},handleDOMEvents:{compositionend:e=>(setTimeout(()=>{let{$cursor:i}=e.state.selection;i&&MF({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?MF({editor:t,from:a.pos,to:a.pos,text:` 78`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function PF(e){return Object.prototype.toString.call(e).slice(8,-1)}function FF(e){return PF(e)===`Object`?e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype:!1}function IF(e,t){let n={...e};return FF(e)&&FF(t)&&Object.keys(t).forEach(r=>{FF(t[r])&&FF(e[r])?n[r]=IF(e[r],t[r]):n[r]=t[r]}),n}var LF=class{constructor(e={}){this.type=`extendable`,this.parent=null,this.child=null,this.name=``,this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{..._P(W(this,`addOptions`,{name:this.name}))||{}}}get storage(){return{..._P(W(this,`addStorage`,{name:this.name,options:this.options}))||{}}}configure(e={}){let t=this.extend({...this.config,addOptions:()=>IF(this.options,e)});return t.name=this.name,t.parent=this.parent,this.child=null,t}extend(e={}){let t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name=`name`in e?e.name:t.parent.name,t}},RF=class e extends LF{constructor(){super(...arguments),this.type=`mark`}static create(t={}){return new e(typeof t==`function`?t():t)}static handleExit({editor:e,mark:t}){let{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){let i=r.marks();if(!i.find(e=>e?.type.name===t.name))return!1;let a=i.find(e=>e?.type.name===t.name);return a&&n.removeStoredMark(a),n.insertText(` `,r.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}};function zF(e){return typeof e==`number`}var BF=class{constructor(e){this.find=e.find,this.handler=e.handler}},VF=(e,t,n)=>{if(dN(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 HF(e){let{editor:t,state:n,from:r,to:i,rule:a,pasteEvent:o,dropEvent:s}=e,{commands:c,chain:l,can:u}=new XM({editor:t,state:n}),d=[];return n.doc.nodesBetween(r,i,(e,t)=>{if(e.type?.spec?.code||!(e.isText||e.isTextblock||e.isInline))return;let f=e.content?.size??e.nodeSize??0,p=Math.max(r,t),m=Math.min(i,t+f);p>=m||VF(e.isText?e.text||``:e.textBetween(p-t,m-t,void 0,``),a.find,o).forEach(e=>{if(e.index===void 0)return;let t=p+e.index+1,r=t+e[0].length,i={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},f=a.handler({state:n,range:i,match:e,commands:c,chain:l,can:u,pasteEvent:o,dropEvent:s});d.push(f)})}),d.every(e=>e!==null)}var UF=null,WF=e=>{var t;let n=new ClipboardEvent(`paste`,{clipboardData:new DataTransfer});return(t=n.clipboardData)==null||t.setData(`text/html`,e),n};function GF(e){let{editor:t,rules:n}=e,r=null,i=!1,a=!1,o=typeof ClipboardEvent<`u`?new ClipboardEvent(`paste`):null,s;try{s=typeof DragEvent<`u`?new DragEvent(`drop`):null}catch{s=null}let c=({state:e,from:n,to:r,rule:i,pasteEvt:a})=>{let c=e.tr;if(!(!HF({editor:t,state:YM({state:e,transaction:c}),from:Math.max(n-1,0),to:r.b-1,rule:i,pasteEvent:a,dropEvent:s})||!c.steps.length)){try{s=typeof DragEvent<`u`?new DragEvent(`drop`):null}catch{s=null}return o=typeof ClipboardEvent<`u`?new ClipboardEvent(`paste`):null,c}};return n.map(e=>new vO({view(e){let n=n=>{r=e.dom.parentElement?.contains(n.target)?e.dom.parentElement:null,r&&(UF=t)},i=()=>{UF&&=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=UF;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:hP(V.from(t),r.schema);let{from:n}=d,i=n+t.length,a=WF(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(!(!zF(p)||!m||p===m.b))return c({rule:e,state:r,from:p,to:m,pasteEvt:o})}}))}var KF=class{constructor(e,t){this.splittableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=MP(e),this.schema=kP(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{let n=W(t,`addCommands`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:UP(t.name,this.schema)});return n?{...e,...n()}:e},{})}get plugins(){let{editor:e}=this;return jP([...this.extensions].reverse()).flatMap(t=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:UP(t.name,this.schema)},r=[],i=W(t,`addKeyboardShortcuts`,n),a={};if(t.type===`mark`&&W(t,`exitable`,n)&&(a.ArrowRight=()=>RF.handleExit({editor:e,mark:t})),i){let t=Object.fromEntries(Object.entries(i()).map(([t,n])=>[t,()=>n({editor:e})]));a={...a,...t}}let o=GM(a);r.push(o);let s=W(t,`addInputRules`,n);if(XP(t,e.options.enableInputRules)&&s){let t=s();if(t&&t.length){let n=NF({editor:e,rules:t}),i=Array.isArray(n)?n:[n];r.push(...i)}}let c=W(t,`addPasteRules`,n);if(XP(t,e.options.enablePasteRules)&&c){let t=c();if(t&&t.length){let n=GF({editor:e,rules:t});r.push(...n)}}let l=W(t,`addProseMirrorPlugins`,n);if(l){let e=l();r.push(...e)}return r})}get attributes(){return bP(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=yP(this.extensions);return Object.fromEntries(t.filter(e=>!!W(e,`addNodeView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=W(t,`addNodeView`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:aN(t.name,this.schema)});if(!r)return[];let i=r();return i?[t.name,(r,a,o,s,c)=>i({node:r,view:a,getPos:o,decorations:s,innerDecorations:c,editor:e,extension:t,HTMLAttributes:wP(r,n)})]:[]}))}dispatchTransaction(e){let{editor:t}=this;return jP([...this.extensions].reverse()).reduceRight((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:UP(n.name,this.schema)},i=W(n,`dispatchTransaction`,r);return i?t=>{i.call(r,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){let{editor:t}=this;return jP([...this.extensions]).reduce((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:UP(n.name,this.schema)},i=W(n,`transformPastedHTML`,r);return i?(t,n)=>{let a=e(t,n);return i.call(r,a)}:e},e||(e=>e))}get markViews(){let{editor:e}=this,{markExtensions:t}=yP(this.extensions);return Object.fromEntries(t.filter(e=>!!W(e,`addMarkView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=W(t,`addMarkView`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:gN(t.name,this.schema)});return r?[t.name,(i,a,o)=>{let s=wP(i,n);return r()({mark:i,view:a,inline:o,editor:e,extension:t,HTMLAttributes:s,updateAttributes:t=>{DI(i,e,t)}})}]:[]}))}destroy(){this.extensions.forEach(e=>{let t=e;for(;t.parent;){let e=t.parent;e.child===t&&(e.child=null),t=e}}),this.extensions=[],this.baseExtensions=[],this.schema=null,this.editor=null}setupExtensions(){let e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(e=>[e.name,e.storage])),e.forEach(e=>{let t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:UP(e.name,this.schema)};e.type===`mark`&&(_P(W(e,`keepOnSplit`,t))??!0)&&this.splittableMarks.push(e.name);let n=W(e,`onBeforeCreate`,t),r=W(e,`onCreate`,t),i=W(e,`onUpdate`,t),a=W(e,`onSelectionUpdate`,t),o=W(e,`onTransaction`,t),s=W(e,`onFocus`,t),c=W(e,`onBlur`,t),l=W(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)})}};KF.resolve=MP,KF.sort=jP,KF.flatten=mP,JM({},{ClipboardTextSerializer:()=>JF,Commands:()=>YF,Delete:()=>XF,Drop:()=>ZF,Editable:()=>QF,FocusEvents:()=>eI,Keymap:()=>tI,Paste:()=>nI,Tabindex:()=>rI,TextDirection:()=>iI,focusEventsPluginKey:()=>$F});var qF=class e extends LF{constructor(){super(...arguments),this.type=`extension`}static create(t={}){return new e(typeof t==`function`?t():t)}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}},JF=qF.create({name:`clipboardTextSerializer`,addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new vO({key:new xO(`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=FP(n);return NP(r,{from:o,to:s},{...this.options.blockSeparator===void 0?{}:{blockSeparator:this.options.blockSeparator},textSerializers:c})}}})]}}),YF=qF.create({name:`commands`,addCommands(){return{...ZM}}}),XF=qF.create({name:`delete`,onUpdate({transaction:e,appendedTransactions:t}){let n=()=>{var n;if(((n=this.editor.options.coreExtensionOptions?.delete)?.filterTransaction)?.call(n,e)??e.getMeta(`y-sync$`))return;let r=lP(e.before,[e,...t]);BP(r).forEach(t=>{r.mapping.mapResult(t.oldRange.from).deletedAfter&&r.mapping.mapResult(t.oldRange.to).deletedBefore&&r.before.nodesBetween(t.oldRange.from,t.oldRange.to,(n,i)=>{let a=i+n.nodeSize-2,o=t.oldRange.from<=i&&a<=t.oldRange.to;this.editor.emit(`delete`,{type:`node`,node:n,from:i,to:a,newFrom:r.mapping.map(i),newTo:r.mapping.map(a),deletedRange:t.oldRange,newRange:t.newRange,partial:!o,editor:this.editor,transaction:e,combinedTransform:r})})});let i=r.mapping;r.steps.forEach((t,n)=>{if(t instanceof aD){let a=i.slice(n).map(t.from,-1),o=i.slice(n).map(t.to),s=i.invert().map(a,-1),c=i.invert().map(o),l=a>0?r.doc.nodeAt(a-1)?.marks.some(e=>e.eq(t.mark)):!1,u=r.doc.nodeAt(o)?.marks.some(e=>e.eq(t.mark));this.editor.emit(`delete`,{type:`mark`,mark:t.mark,from:t.from,to:t.to,deletedRange:{from:s,to:c},newRange:{from:a,to:o},partial:!!(u||l),editor:this.editor,transaction:e,combinedTransform:r})}})};this.editor.options.coreExtensionOptions?.delete?.async??!0?setTimeout(n,0):n()}}),ZF=qF.create({name:`drop`,addProseMirrorPlugins(){return[new vO({key:new xO(`tiptapDrop`),props:{handleDrop:(e,t,n,r)=>{this.editor.emit(`drop`,{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),QF=qF.create({name:`editable`,addProseMirrorPlugins(){return[new vO({key:new xO(`editable`),props:{editable:()=>this.editor.options.editable}})]}}),$F=new xO(`focusEvents`),eI=qF.create({name:`focusEvents`,addProseMirrorPlugins(){let{editor:e}=this;return[new vO({key:$F,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}}}})]}}),tI=qF.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:ZD.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 CN()||HN()?i:r},addProseMirrorPlugins(){return[new vO({key:new xO(`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=ZD.atStart(t.doc).from,l=ZD.atEnd(t.doc).to;if(a||!(o===c&&s===l)||!QP(n.doc))return;let u=n.tr,d=YM({state:n,transaction:u}),{commands:f}=new XM({editor:this.editor,state:d});if(f.clearNodes(),u.steps.length)return u}})]}}),nI=qF.create({name:`paste`,addProseMirrorPlugins(){return[new vO({key:new xO(`tiptapPaste`),props:{handlePaste:(e,t,n)=>{this.editor.emit(`paste`,{editor:this.editor,event:t,slice:n})}}})]}}),rI=qF.create({name:`tabindex`,addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new vO({key:new xO(`tabindex`),props:{attributes:()=>!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:this.options.value??`0`}}})]}}),iI=qF.create({name:`textDirection`,addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:e}=yP(this.extensions);return[{types:e.filter(e=>e.name!==`text`).map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{let t=e.getAttribute(`dir`);return t&&(t===`ltr`||t===`rtl`||t===`auto`)?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new vO({key:new xO(`textDirection`),props:{attributes:()=>{let e=this.options.direction;return e?{dir:e}:{}}}})]}}),aI=class e{constructor(e,t,n=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=r}
78get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){return this.actualDepth??this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,n=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can\u2019t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+ +!this.node.isText}get parent(){if(this.depth===0)return null;let t=this.resolvedPos.start(this.resolvedPos.depth-1);return new e(this.resolvedPos.doc.resolve(t),this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new e(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new e(t,this.editor)}get children(){let t=[];return this.node.content.forEach((n,r)=>{let i=n.isBlock&&!n.isTextblock,a=n.isAtom&&!n.isText,o=n.isInline,s=this.pos+r+ +!a;if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;let c=this.resolvedPos.doc.resolve(s);if(!i&&!o&&c.depth<=this.depth)return;let l=new e(c,this.editor,i,i||o?n:null);i&&(l.actualDepth=this.depth+1),t.push(l)}),t}get firstChild(){return this.children[0]||null}get lastChild(){let e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,r=this.parent;for(;r&&!n;){if(r.node.type.name===e)if(Object.keys(t).length>0){let e=r.node.attrs,n=Object.keys(t);for(let r=0;r<n.length;r+=1){let i=n[r];if(e[i]!==t[i])break}}else n=r;r=r.parent}return n}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},n=!1){let r=[];if(!this.children||this.children.length===0)return r;let i=Object.keys(t);return this.children.forEach(a=>{n&&r.length>0||(a.node.type.name===e&&i.every(e=>t[e]===a.node.attrs[e])&&r.push(a),!(n&&r.length>0)&&(r=r.concat(a.querySelectorAll(e,t,n))))}),r}setAttribute(e){let{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},oI=`.ProseMirror { 79 position: relative; 80} 81 82.ProseMirror { 83 word-wrap: break-word; 84 white-space: pre-wrap; 85 white-space: break-spaces; 86 -webkit-font-variant-ligatures: none; 87 font-variant-ligatures: none; 88 font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */ 89} 90 91.ProseMirror [contenteditable="false"] { 92 white-space: normal; 93} 94 95.ProseMirror [contenteditable="false"] [contenteditable="true"] { 96 white-space: pre-wrap; 97} 98 99.ProseMirror pre { 100 white-space: pre-wrap; 101} 102 103img.ProseMirror-separator { 104 display: inline !important; 105 border: none !important; 106 margin: 0 !important; 107 width: 0 !important; 108 height: 0 !important; 109} 110 111.ProseMirror-gapcursor { 112 display: none; 113 pointer-events: none; 114 position: absolute; 115 margin: 0; 116} 117 118.ProseMirror-gapcursor:after { 119 content: ""; 120 display: block; 121 position: absolute; 122 top: -2px; 123 width: 20px; 124 border-top: 1px solid black; 125 animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite; 126} 127 128@keyframes ProseMirror-cursor-blink { 129 to { 130 visibility: hidden; 131 } 132} 133 134.ProseMirror-hideselection *::selection { 135 background: transparent; 136} 137 138.ProseMirror-hideselection *::-moz-selection { 139 background: transparent; 140} 141 142.ProseMirror-hideselection * { 143 caret-color: transparent; 144} 145 146.ProseMirror-focused .ProseMirror-gapcursor { 147 display: block; 148}`;function sI(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 cI=class extends kF{constructor(e={}){super(),this.css=null,this.className=`tiptap`,this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<`u`?document.createElement(`div`):null,content:``,injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:nF,createMappablePosition:rF},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on(`beforeCreate`,this.options.onBeforeCreate),this.emit
148(`beforeCreate`,{editor:this}),this.on(`mount`,this.options.onMount),this.on(`unmount`,this.options.onUnmount),this.on(`contentError`,this.options.onContentError),this.on(`create`,this.options.onCreate),this.on(`update`,this.options.onUpdate),this.on(`selectionUpdate`,this.options.onSelectionUpdate),this.on(`transaction`,this.options.onTransaction),this.on(`focus`,this.options.onFocus),this.on(`blur`,this.options.onBlur),this.on(`destroy`,this.options.onDestroy),this.on(`drop`,({event:e,slice:t,moved:n})=>this.options.onDrop(e,t,n)),this.on(`paste`,({event:e,slice:t})=>this.options.onPaste(e,t)),this.on(`delete`,this.options.onDelete);let t=this.createDoc(),n=xN(t,this.options.autofocus);this.editorState=gO.create({doc:t,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if(typeof document>`u`)throw Error(`[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.`);this.createView(e),this.emit(`mount`,{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit(`create`,{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){let e=this.editorView.dom;e?.editor&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove==`function`?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn(`Failed to remove CSS element:`,e)}this.css=null,this.emit(`unmount`,{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<`u`&&(this.css=sI(oI,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit(`update`,{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if(t===`state`)return this.editorState;if(t in e)return Reflect.get(e,t);throw Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){let n=gP(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?[QF,JF.configure({blockSeparator:this.options.coreExtensionOptions?.clipboardTextSerializer?.blockSeparator}),YF,eI,tI,rI.configure({value:this.options.coreExtensionOptions?.tabindex?.value}),ZF,nI,XF,iI.configure({direction:this.options.textDirection})].filter(e=>typeof this.options.enableCoreExtensions==`object`?this.options.enableCoreExtensions[e.name]!==!1:!0):[],...this.options.extensions].filter(e=>[`extension`,`node`,`mark`].includes(e?.type));this.extensionManager=new KF(e,this)}createCommandManager(){this.commandManager=new XM({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=oP(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;
148this.emit(`contentError`,{editor:this,error:t,disableCollaboration:()=>{`collaboration`in this.storage&&typeof this.storage.collaboration==`object`&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(e=>e.name!==`collaboration`),this.createExtensionManager()}}),e=oP(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){let{editorProps:t,enableExtensionDispatchTransaction:n}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,a=t.transformPastedHTML,o=this.extensionManager.transformPastedHTML(a);this.editorView=new TM(e,{...t,attributes:{role:`textbox`,...t?.attributes},dispatchTransaction:i,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});let s=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(s),this.prependClass(),this.injectCSS();let c=this.view.dom;c.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;let t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(e=>this.capturedTransaction?.step(e));return}let{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),i=n.includes(e),a=this.state;if(this.emit(`beforeTransaction`,{editor:this,transaction:e,nextState:t}),!i)return;this.view.updateState(t),this.emit(`transaction`,{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit(`selectionUpdate`,{editor:this,transaction:e});let o=n.findLast(e=>e.getMeta(`focus`)||e.getMeta(`blur`)),s=o?.getMeta(`focus`),c=o?.getMeta(`blur`);s&&this.emit(`focus`,{editor:this,event:s.event,transaction:o}),c&&this.emit(`blur`,{editor:this,event:c.event,transaction:o}),!(e.getMeta(`preventUpdate`)||!n.some(e=>e.docChanged)||a.doc.eq(t.doc))&&this.emit(`update`,{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return LP(this.state,e)}isActive(e,t){let n=typeof e==`string`?e:null,r=typeof e==`string`?t:e;return qP(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return hP(this.state.doc.content,this.schema)}getText(e){let{blockSeparator:t=` 149 150`,textSerializers:n={}}=e||{};return PP(this.state.doc,{blockSeparator:t,textSerializers:{...FP(this.schema),...n}})}get isEmpty(){return QP(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit(`destroy`),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){return this.editorView?.isDestroyed??!0}$node(e,t){return this.$doc?.querySelector(e,t)||null}$nodes(e,t){return this.$doc?.querySelectorAll(e,t)||null}$pos(e){let t=this.state.doc.resolve(e),n=e>0&&t.nodeAfter&&!t.nodeAfter.isText?t.nodeAfter:null;return new aI(t,this,!1,n)}get $doc(){return this.$pos(0)}};function lI(e){return new AF({find:e.find,handler:({state:t,range:n,match:r})=>{let i=_P(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(VP(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>c).length)return null;l<n.to&&a.delete(l,n.to),c>n.from&&a.delete(n.from+r,c);let u=n.from+r+o.length;a.addMark(n.from+r,u,e.type.create(i||{})),a.removeStoredMark(e.type)}},undoable:e.undoable})}function uI(e){return new AF({find:e.find,handler:({state:t,range:n,match:r})=>{let i=_P(e.getAttributes,void 0,r)||{},{tr:a}=t,o=n.from,s=n.to,c=e.type.create(i);if(r[1]){let e=o+r[0].lastIndexOf(r[1]);e>s?e=s:s=e+r[1].length;let t=r[0][r[0].length-1];a.insertText(t,o+r[0].length-1),a.replaceWith(e,s,c)}else if(r[0]){let t=e.type.isInline?o:o-1;a.insert(t,e.type.create(i)).delete(a.mapping.map(o),a.mapping.map(s))}a.scrollIntoView()},undoable:e.undoable})}function dI(e){return new AF({find:e.find,handler:({state:t,range:n,match:r})=>{let i=t.doc.resolve(n.from),a=_P(e.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,a)},undoable:e.undoable})}function fI(e){return new AF({find:e.find,handler:({state:t,range:n,match:r})=>{let i=e.replace,a=n.from,o=n.to;if(r[1]){let e=r[0].lastIndexOf(r[1]);i+=r[0].slice(e+r[1].length),a+=e;let t=a-o;t>0&&(i=r[0].slice(e-t,e)+i,a=o)}t.tr.insertText(i,a,o)},undoable:e.undoable})}function pI(e){return new AF({find:e.find,handler:({state:t,range:n,match:r,chain:i})=>{let a=_P(e.getAttributes,void 0,r)||{},o=t.tr.delete(n.from,n.to),s=o.doc.resolve(n.from).blockRange(),c=s&&_D(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=>
150i.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&&kD(o.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,l))&&o.join(n.from-1)},undoable:e.undoable})}var mI=e=>`touches`in e,hI=class{constructor(e){this.directions=[`bottom-left`,`bottom-right`,`top-left`,`top-right`],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:``,wrapper:``,handle:``,resizing:``},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=e=>{if(!this.isResizing||!this.activeHandle)return;let t=e.clientX-this.startX,n=e.clientY-this.startY;this.handleResize(t,n)},this.handleTouchMove=e=>{if(!this.isResizing||!this.activeHandle)return;let t=e.touches[0];if(!t)return;let n=t.clientX-this.startX,r=t.clientY-this.startY;this.handleResize(n,r)},this.handleMouseUp=()=>{if(!this.isResizing)return;let e=this.element.offsetWidth,t=this.element.offsetHeight;this.onCommit(e,t),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState=`false`,this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener(`mousemove`,this.handleMouseMove),document.removeEventListener(`mouseup`,this.handleMouseUp),document.removeEventListener(`keydown`,this.handleKeyDown),document.removeEventListener(`keyup`,this.handleKeyUp)},this.handleKeyDown=e=>{e.key===`Shift`&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=e=>{e.key===`Shift`&&(this.isShiftKeyPressed=!1)},this.node=e.node,this.editor=e.editor,this.element=e.element,this.contentElement=e.contentElement,this.getPos=e.getPos,this.onResize=e.onResize,this.onCommit=e.onCommit,this.onUpdate=e.onUpdate,e.options?.min&&(this.minSize={...this.minSize,...e.options.min}),e.options?.max&&(this.maxSize=e.options.max),e?.options?.directions&&(this.directions=e.options.directions),e.options?.preserveAspectRatio&&(this.preserveAspectRatio=e.options.preserveAspectRatio),e.options?.className&&(this.classNames={container:e.options.className.container||``,wrapper:e.options.className.wrapper||``,handle:e.options.className.handle||``,resizing:e.options.className.resizing||``}),e.options?.createCustomHandle&&(this.createCustomHandle=e.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on(`update`,this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){return this.contentElement??null}handleEditorUpdate(){let e=this.editor.isEditable;e!==this.lastEditableState&&(this.lastEditableState=e,e?e&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(e,t,n){return e.type===this.node.type?(this.node=e,this.onUpdate?this.onUpdate(e,t,n):!0):!1}destroy(){this.isResizing&&(this.container.dataset.resizeState=`false`,this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener(`mousemove`,this.handleMouseMove),document.removeEventListener(`mouseup`,this.handleMouseUp),document.removeEventListener(`keydown`,this.handleKeyDown),document.removeEventListener(`keyup`,this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off(`update`,this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){let e=document.createElement(`div`);return e.dataset.resizeContainer=``,e.dataset.node=this.node.type.name,e.style.display=this.node.type.isInline?`inline-flex`:`flex`,this.classNames.container&&(e.className=this.classNames.container),e.appendChild(this.wrapper),e}createWrapper(){let e=document.createElement(`div`);return e.style.position=`relative`,e.style.display=`block`,e.dataset.resizeWrapper=``,this.classNames.wrapper&&(e.className=this.classNames.wrapper),e.appendChild(this.element),e}createHandle(e){let t=document.createElement(`div`);return t.dataset.resizeHandle=e,t.style.position=`absolute`,this.classNames.handle&&(t.className=this.classNames.handle),t}positionHandle(e,t){let n=t.includes(`top`),r=t.includes(`bottom`),i=t.includes(`left`),a=t.includes(`right`);
150n&&(e.style.top=`0`),r&&(e.style.bottom=`0`),i&&(e.style.left=`0`),a&&(e.style.right=`0`),(t===`top`||t===`bottom`)&&(e.style.left=`0`,e.style.right=`0`),(t===`left`||t===`right`)&&(e.style.top=`0`,e.style.bottom=`0`)}attachHandles(){this.directions.forEach(e=>{let t;t=this.createCustomHandle?this.createCustomHandle(e):this.createHandle(e),t instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${e}") did not return an HTMLElement. Falling back to default handle.`),t=this.createHandle(e)),this.createCustomHandle||this.positionHandle(t,e),t.addEventListener(`mousedown`,t=>this.handleResizeStart(t,e)),t.addEventListener(`touchstart`,t=>this.handleResizeStart(t,e)),this.handleMap.set(e,t),this.wrapper.appendChild(t)})}removeHandles(){this.handleMap.forEach(e=>e.remove()),this.handleMap.clear()}applyInitialSize(){let e=this.node.attrs.width,t=this.node.attrs.height;e?(this.element.style.width=`${e}px`,this.initialWidth=e):this.initialWidth=this.element.offsetWidth,t?(this.element.style.height=`${t}px`,this.initialHeight=t):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(e,t){e.preventDefault(),e.stopPropagation(),this.isResizing=!0,this.activeHandle=t,mI(e)?(this.startX=e.touches[0].clientX,this.startY=e.touches[0].clientY):(this.startX=e.clientX,this.startY=e.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState=`true`,this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener(`mousemove`,this.handleMouseMove),document.addEventListener(`touchmove`,this.handleTouchMove),document.addEventListener(`mouseup`,this.handleMouseUp),document.addEventListener(`keydown`,this.handleKeyDown),document.addEventListener(`keyup`,this.handleKeyUp)}handleResize(e,t){if(!this.activeHandle)return;let n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:i}=this.calculateNewDimensions(this.activeHandle,e,t),a=this.applyConstraints(r,i,n);this.element.style.width=`${a.width}px`,this.element.style.height=`${a.height}px`,this.onResize&&this.onResize(a.width,a.height)}calculateNewDimensions(e,t,n){let r=this.startWidth,i=this.startHeight,a=e.includes(`right`),o=e.includes(`left`),s=e.includes(`bottom`),c=e.includes(`top`);return a?r=this.startWidth+t:o&&(r=this.startWidth-t),s?i=this.startHeight+n:c&&(i=this.startHeight-n),(e===`right`||e===`left`)&&(r=this.startWidth+(a?t:-t)),(e===`top`||e===`bottom`)&&(i=this.startHeight+(s?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,i,e):{width:r,height:i}}applyConstraints(e,t,n){if(!n){let n=Math.max(this.minSize.width,e),r=Math.max(this.minSize.height,t);return this.maxSize?.width&&(n=Math.min(this.maxSize.width,n)),this.maxSize?.height&&(r=Math.min(this.maxSize.height,r)),{width:n,height:r}}let r=e,i=t;return r<this.minSize.width&&(r=this.minSize.width,i=r/this.aspectRatio),i<this.minSize.height&&(i=this.minSize.height,r=i*this.aspectRatio),this.maxSize?.width&&r>this.maxSize.width&&(r=this.maxSize.width,i=r/this.aspectRatio),this.maxSize?.height&&i>this.maxSize.height&&(i=this.maxSize.height,r=i*this.aspectRatio),{width:r,height:i}}applyAspectRatio(e,t,n){return n===`left`||n===`right`?{width:e,height:e/this.aspectRatio}:n===`top`||n===`bottom`?{width:t*this.aspectRatio,height:t}:{width:e,height:e/this.aspectRatio}}};function gI(e,t){let{selection:n}=e,{$from:r}=n;if(n instanceof U){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 _I(e,t){let n=e.getAttribute(`style`);if(!n)return null;let r=n.split(`;`).map(e=>e.trim()).filter(Boolean),i=t.toLowerCase();for(let e=r.length-1;e>=0;--e){let t=r[e],n=t.indexOf(`:`);if(n!==-1&&t.slice(0,n).trim().toLowerCase()===i)return t.slice(n+1).trim()}return null}JM({},{createAtomBlockMarkdownSpec:()=>bI,createBlockMarkdownSpec:()=>xI,createInlineMarkdownSpec:()=>wI,parseAttributes:()=>vI,parseIndentedBlocks:()=>TI,renderNestedMarkdownContent:()=>EI,serializeAttributes:()=>yI});function vI(e){if(!e?.trim())return{};let t={},n=[],r=e.replace(/["']([^"']*)["']/g,e=>(n.push(e),`__QUOTED_${n.length-1}
150__`)),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);i&&(t.class=i.map(e=>e.trim().slice(1)).join(` `));let a=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);a&&(t.id=a[1]),Array.from(r.matchAll(/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g)).forEach(([,e,r])=>{let i=n[parseInt(r.match(/__QUOTED_(\d+)__/)?.[1]||`0`,10)];i&&(t[e]=i.slice(1,-1))});let o=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,``).replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,``).replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,``).trim();return o&&o.split(/\s+/).filter(Boolean).forEach(e=>{e.match(/^[a-zA-Z][\w-]*$/)&&(t[e]=!0)}),t}function yI(e){if(!e||Object.keys(e).length===0)return``;let t=[];return e.class&&String(e.class).split(/\s+/).filter(Boolean).forEach(e=>t.push(`.${e}`)),e.id&&t.push(`#${e.id}`),Object.entries(e).forEach(([e,n])=>{e===`class`||e===`id`||(n===!0?t.push(e):n!==!1&&n!=null&&t.push(`${e}="${String(n)}"`))}),t.join(` `)}function bI(e){let{nodeName:t,name:n,parseAttributes:r=vI,serializeAttributes:i=yI,defaultAttributes:a={},requiredAttributes:o=[],allowedAttributes:s}=e,c=n||t,l=e=>{if(!s)return e;let t={};return s.forEach(n=>{n in e&&(t[n]=e[n])}),t};return{parseMarkdown:(e,n)=>{let r={...a,...e.attributes};return n.createNode(t,r,[])},markdownTokenizer:{name:t,level:`block`,start(e){let t=RegExp(`^:::${c}(?:\\s|$)`,`m`),n=e.match(t)?.index;return n===void 0?-1:n},tokenize(e,n,i){let a=RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),s=e.match(a);if(!s)return;let l=r(s[1]||``);if(!o.find(e=>!(e in l)))return{type:t,raw:s[0],attributes:l}}},renderMarkdown:e=>{let t=i(l(e.attrs||{}));return`:::${c}${t?` {${t}}`:``} :::`}}}function xI(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=vI,serializeAttributes:a=yI,defaultAttributes:o={},content:s=`block`,allowedAttributes:c}=e,l=n||t,u=e=>{if(!c)return e;let t={};return c.forEach(n=>{n in e&&(t[n]=e[n])}),t};return{parseMarkdown:(e,n)=>{let i;if(r){let t=r(e);i=typeof t==`string`?[{type:`text`,text:t}]:t}else i=s===`block`?n.parseChildren(e.tokens||[]):n.parseInline(e.tokens||[]);let a={...o,...e.attributes};return n.createNode(t,a,i)},markdownTokenizer:{name:t,level:`block`,start(e){let t=RegExp(`^:::${l}`,`m`),n=e.match(t)?.index;return n===void 0?-1:n},tokenize(e,n,r){let a=RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),o=e.match(a);if(!o)return;let[c,u=``]=o,d=i(u),f=1,p=c.length,m=``,h=/^:::([\w-]*)(\s.*)?/gm,g=e.slice(p);for(h.lastIndex=0;;){let n=h.exec(g);if(n===null)break;let i=n.index,a=n[1];if(!n[2]?.endsWith(`:::`)){if(a)f+=1;else if(--f,f===0){let a=g.slice(0,i);m=a.trim();let o=e.slice(0,p+i+n[0].length),c=[];if(m)if(s===`block`)for(c=r.blockTokens(a),c.forEach(e=>{e.text&&(!e.tokens||e.tokens.length===0)&&(e.tokens=r.inlineTokens(e.text))});c.length>0;){let e=c[c.length-1];if(e.type===`paragraph`&&(!e.text||e.text.trim()===``))c.pop();else break}else c=r.inlineTokens(m);return{type:t,raw:o,attributes:d,content:m,tokens:c}}}}}},renderMarkdown:(e,t)=>{let n=a(u(e.attrs||{}));return`:::${l}${n?` {${n}}`:``} 151 152${t.renderChildren(e.content||[],` 153 154`)} 155 156:::`}}}function SI(e){if(!e.trim())return{};let t={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g,r=n.exec(e);for(;r!==null;){let[,i,a,o]=r;t[i]=a||o,r=n.exec(e)}return t}function CI(e){return Object.entries(e).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(` `)}function wI(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=SI,serializeAttributes:a=CI,defaultAttributes:o={},selfClosing:s=!1,allowedAttributes:c}=e,l=n||t,u=e=>{if(!c)return e;let t={};return c.forEach(n=>{let r=typeof n==`string`?n:n.name,i=typeof n==`string`?void 0:n.skipIfDefault;if(r in e){let n=e[r];if(i!==void 0&&n===i)return;t[r]=n}}),t},d=l.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);return{parseMarkdown:(e,n)=>{let i={...o,...e.attributes};if(s)return n.createNode(t,i);let a=r?r(e):e.content||``;return a?n.createNode(t,i,[n.createTextNode(a)]):n.createNode(t,i,[])},markdownTokenizer:{name:t,level:`inline`,start(e){let t=RegExp(s?`\\[${d}\\s*[^\\]]*\\]`:`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),n=e.match(t)?.index;return n===void 0?-1:n},tokenize(e,n,r){let a=RegExp(s?`^\\[${d}\\s*([^\\]]*)\\]`:`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),o=e.match(a);if(!o)return;let c=``,l=``;if(s){let[,e]=o;l=e}else{let[,e,t]=o;l=e,c=t||``}let u=i(l.trim());return{type:t,raw:o[0],content:c.trim(),attributes:u}}},renderMarkdown:e=>{let t=``;r?t=r(e):e.content&&e.content.length>0&&(t=e.content.filter(e=>e.type===`text`).map(e=>e.text).join(``));let n=a(u(e.attrs||{})),i=n?` ${n}`:``;return s?`[${l}${i}]`:`[${l}${i}]${t}[/${l}]`}}}function TI(e,t,n){let r=e.split(` 157`),i=[],a=``,o=0,s=t.baseIndentSize||2;for(;o<r.length;){let e=r[o],c=e.match(t.itemPattern);if(!c){if(i.length>0)break;if(e.trim()===``){o+=1,a=`${a}${e} 158`;continue}else return}let l=t.extractItemData(c),{indentLevel:u,mainContent:d}=l;a=`${a}${e} 159`;let f=[d];for(o+=1;o<r.length;){let e=r[o];if(e.trim()===``){let t=r.slice(o+1).findIndex(e=>e.trim()!==``);if(t===-1)break;if((r[o+1+t].match(/^(\s*)/)?.[1]?.length||0)>u){f.push(e),a=`${a}${e} 160`,o+=1;continue}else break}if((e.match(/^(\s*)/)?.[1]?.length||0)>u)f.push(e),a=`${a}${e} 161`,o+=1;else break}let p,m=f.slice(1);if(m.length>0){let e=m.map(e=>e.slice(u+s)).join(` 162`);e.trim()&&(p=t.customNestedParser?t.customNestedParser(e):n.blockTokens(e))}let h=t.createToken(l,p);i.push(h)}if(i.length!==0)return{items:i,raw:a}}function EI(e,t,n,r){if(!e||!Array.isArray(e.content))return``;let i=typeof n==`function`?n(r):n,[a,...o]=e.content,s=`${i}${t.renderChildren([a])}`;return o&&o.length>0&&o.forEach((e,n)=>{let r=t.renderChild?.call(t,e,n+1)??t.renderChildren([e]);if(r!=null){let n=r.split(` 163`).map(e=>e?t.indent(e):t.indent(``)).join(` 164`);s+=e.type===`paragraph`?` 165 166${n}`:` 167${n}`}}),s}function DI(e,t,n={}){let{state:r}=t,{doc:i,tr:a}=r,o=e;i.descendants((t,r)=>{let i=a.mapping.map(r),s=a.mapping.map(r)+t.nodeSize,c=null;
167if(t.marks.forEach(e=>{if(e!==o)return!1;c=e}),!c)return;let l=!1;if(Object.keys(n).forEach(e=>{n[e]!==c.attrs[e]&&(l=!0)}),l){let t=e.type.create({...e.attrs,...n});a.removeMark(i,s,e.type),a.addMark(i,s,t)}}),a.docChanged&&t.view.dispatch(a)}var OI=class e extends LF{constructor(){super(...arguments),this.type=`node`}static create(t={}){return new e(typeof t==`function`?t():t)}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}},kI=class{constructor(e,t,n){this.isDragging=!1,this.component=e,this.editor=t.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=t.extension,this.node=t.node,this.decorations=t.decorations,this.innerDecorations=t.innerDecorations,this.view=t.view,this.HTMLAttributes=t.HTMLAttributes,this.getPos=t.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(e){var t;let{view:n}=this.editor,r=e.target,i=r.nodeType===3?r.parentElement?.closest(`[data-drag-handle]`):r.closest(`[data-drag-handle]`);if(!this.dom||this.contentDOM?.contains(r)||!i)return;let a=0,o=0;if(this.dom!==i){let t=this.dom.getBoundingClientRect(),n=i.getBoundingClientRect(),r=e.offsetX??e.nativeEvent?.offsetX,s=e.offsetY??e.nativeEvent?.offsetY;a=n.x-t.x+r,o=n.y-t.y+s}let s=this.dom.cloneNode(!0);try{let e=this.dom.getBoundingClientRect();s.style.width=`${Math.round(e.width)}px`,s.style.height=`${Math.round(e.height)}px`,s.style.boxSizing=`border-box`,s.style.pointerEvents=`none`}catch{}let c=null;try{c=document.createElement(`div`),c.style.position=`absolute`,c.style.top=`-9999px`,c.style.left=`-9999px`,c.style.pointerEvents=`none`,c.appendChild(s),document.body.appendChild(c),(t=e.dataTransfer)==null||t.setDragImage(s,a,o)}finally{c&&setTimeout(()=>{try{c?.remove()}catch{}},0)}let l=this.getPos();if(typeof l!=`number`)return;let u=U.create(n.state.doc,l),d=n.state.tr.setSelection(u);n.dispatch(d)}stopEvent(e){if(!this.dom)return!1;if(typeof this.options.stopEvent==`function`)return this.options.stopEvent({event:e});let t=e.target;if(!(this.dom.contains(t)&&!this.contentDOM?.contains(t)))return!1;let n=e.type.startsWith(`drag`),r=e.type===`dragover`||e.type===`dragenter`,i=e.type===`drop`;if(([`INPUT`,`BUTTON`,`SELECT`,`TEXTAREA`].includes(t.tagName)||t.isContentEditable)&&!i&&!n)return!0;let{isEditable:a}=this.editor,{isDragging:o}=this,s=!!this.node.type.spec.draggable,c=U.isSelectable(this.node),l=e.type===`copy`,u=e.type===`paste`,d=e.type===`cut`,f=e.type===`mousedown`;if(!s&&c&&n&&e.target===this.dom&&e.preventDefault(),s&&n&&!o&&e.target===this.dom)return e.preventDefault(),!1;if(s&&a&&!o&&f){let e=t.closest(`[data-drag-handle]`);e&&(this.dom===e||this.dom.contains(e))&&(this.isDragging=!0,document.addEventListener(`dragend`,()=>{this.isDragging=!1},{once:!0}),document.addEventListener(`drop`,()=>{this.isDragging=!1},{once:!0}),document.addEventListener(`mouseup`,()=>{this.isDragging=!1},{once:!0}))}return!(o||r||i||l||u||d||f&&c)}ignoreMutation(e){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation==`function`?this.options.ignoreMutation({mutation:e}):this.node.isLeaf||this.node.isAtom?!0:e.type===`selection`||this.dom.contains(e.target)&&e.type===`childList`&&(CN()||SN())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].every(e=>e.isContentEditable)?!1:this.contentDOM===e.target&&e.type===`attributes`?!0:!this.contentDOM.contains(e.target)}updateAttributes(e){this.editor.commands.command(({tr:t})=>{let n=this.getPos();
167return typeof n==`number`?(t.setNodeMarkup(n,void 0,{...this.node.attrs,...e}),!0):!1})}deleteNode(){let e=this.getPos();if(typeof e!=`number`)return;let t=e+this.node.nodeSize;this.editor.commands.deleteRange({from:e,to:t})}};function AI(e){return new BF({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:i})=>{let a=_P(e.getAttributes,void 0,r,i);if(a===!1||a===null)return null;let{tr:o}=t,s=r[r.length-1],c=r[0],l=n.to;if(s){let i=c.search(/\S/),u=n.from+c.indexOf(s),d=u+s.length;if(VP(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>u).length)return null;d<n.to&&o.delete(d,n.to),u>n.from&&o.delete(n.from+i,u),l=n.from+i+s.length,o.addMark(n.from+i,l,e.type.create(a||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(e.type)}}})}var{getOwnPropertyNames:jI,getOwnPropertySymbols:MI}=Object,{hasOwnProperty:NI}=Object.prototype;function PI(e,t){return function(n,r,i){return e(n,r,i)&&t(n,r,i)}}function FI(e){return function(t,n,r){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r);let{cache:i}=r,a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);let s=e(t,n,r);return i.delete(t),i.delete(n),s}}function II(e){return e?.[Symbol.toStringTag]}function LI(e){return jI(e).concat(MI(e))}var RI=Object.hasOwn||((e,t)=>NI.call(e,t));function zI(e,t){return e===t||!e&&!t&&e!==e&&t!==t}var BI=`__v`,VI=`__o`,HI=`_owner`,{getOwnPropertyDescriptor:UI,keys:WI}=Object;function GI(e,t){return e.byteLength===t.byteLength&&eL(new Uint8Array(e),new Uint8Array(t))}function KI(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function qI(e,t){return e.byteLength===t.byteLength&&eL(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function JI(e,t){return zI(e.getTime(),t.getTime())}function YI(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function XI(e,t){return e===t}function ZI(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.entries(),o,s,c=0;for(;(o=a.next())&&!o.done;){let r=t.entries(),a=!1,l=0;for(;(s=r.next())&&!s.done;){if(i[l]){l++;continue}let r=o.value,u=s.value;if(n.equals(r[0],u[0],c,l,e,t,n)&&n.equals(r[1],u[1],r[0],u[0],e,t,n)){a=i[l]=!0;break}l++}if(!a)return!1;c++}return!0}var Bae=zI;function Vae(e,t,n){let r=WI(e),i=r.length;if(WI(t).length!==i)return!1;for(;i-- >0;)if(!tL(e,t,n,r[i]))return!1;return!0}function QI(e,t,n){let r=LI(e),i=r.length;if(LI(t).length!==i)return!1;let a,o,s;for(;i-- >0;)if(a=r[i],!tL(e,t,n,a)||(o=UI(e,a),s=UI(t,a),(o||s)&&(!o||!s||o.configurable!==s.configurable||o.enumerable!==s.enumerable||o.writable!==s.writable)))return!1;return!0}function Hae(e,t){return zI(e.valueOf(),t.valueOf())}function Uae(e,t){return e.source===t.source&&e.flags===t.flags}function $I(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.values(),o,s;for(;(o=a.next())&&!o.done;){let r=t.values(),a=!1,c=0;for(;(s=r.next())&&!s.done;){if(!i[c]&&n.equals(o.value,s.value,o.value,s.value,e,t,n)){a=i[c]=!0;break}c++}if(!a)return!1}return!0}function eL(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function Wae(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function tL(e,t,n,r){return(r===HI||r===VI||r===BI)&&(e.$$typeof||t.$$typeof)?!0:RI(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}var Gae=`[object ArrayBuffer]`,Kae=`[object Arguments]`,qae=`[object Boolean]`,Jae=`[object DataView]`,Yae=`[object Date]`,Xae=`[object Error]`,Zae=`[object Map]`,Qae=`[object Number]`,$ae=`[object Object]`,eoe=`[object RegExp]`,toe=`[object Set]`,noe=`[object String]`,roe={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array
167]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},ioe=`[object URL]`,aoe=Object.prototype.toString;function ooe({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:s,areObjectsEqual:c,arePrimitiveWrappersEqual:l,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:p,unknownTagComparators:m}){return function(h,g,_){if(h===g)return!0;if(h==null||g==null)return!1;let v=typeof h;if(v!==typeof g)return!1;if(v!==`object`)return v===`number`?s(h,g,_):v===`function`?a(h,g,_):!1;let y=h.constructor;if(y!==g.constructor)return!1;if(y===Object)return c(h,g,_);if(Array.isArray(h))return t(h,g,_);if(y===Date)return r(h,g,_);if(y===RegExp)return u(h,g,_);if(y===Map)return o(h,g,_);if(y===Set)return d(h,g,_);let b=aoe.call(h);if(b===Yae)return r(h,g,_);if(b===eoe)return u(h,g,_);if(b===Zae)return o(h,g,_);if(b===toe)return d(h,g,_);if(b===$ae)return typeof h.then!=`function`&&typeof g.then!=`function`&&c(h,g,_);if(b===ioe)return p(h,g,_);if(b===Xae)return i(h,g,_);if(b===Kae)return c(h,g,_);if(roe[b])return f(h,g,_);if(b===Gae)return e(h,g,_);if(b===Jae)return n(h,g,_);if(b===qae||b===Qae||b===noe)return l(h,g,_);if(m){let e=m[b];if(!e){let t=II(h);t&&(e=m[t])}if(e)return e(h,g,_)}return!1}}function soe({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:GI,areArraysEqual:n?QI:KI,areDataViewsEqual:qI,areDatesEqual:JI,areErrorsEqual:YI,areFunctionsEqual:XI,areMapsEqual:n?PI(ZI,QI):ZI,areNumbersEqual:Bae,areObjectsEqual:n?QI:Vae,arePrimitiveWrappersEqual:Hae,areRegExpsEqual:Uae,areSetsEqual:n?PI($I,QI):$I,areTypedArraysEqual:n?PI(eL,QI):eL,areUrlsEqual:Wae,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){let e=FI(r.areArraysEqual),t=FI(r.areMapsEqual),n=FI(r.areObjectsEqual),i=FI(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:i})}return r}function coe(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function loe({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(a,o){let{cache:s=e?new WeakMap:void 0,meta:c}=n();return t(a,o,{cache:s,equals:r,meta:c,strict:i})};if(e)return function(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};let a={cache:void 0,equals:r,meta:void 0,strict:i};return function(e,n){return t(e,n,a)}}var uoe=nL();nL({strict:!0}),nL({circular:!0}),nL({circular:!0,strict:!0}),nL({createInternalComparator:()=>zI}),nL({strict:!0,createInternalComparator:()=>zI}),nL({circular:!0,createInternalComparator:()=>zI}),nL({circular:!0,createInternalComparator:()=>zI,strict:!0});function nL(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,a=ooe(soe(e));return loe({circular:t,comparator:a,createState:r,equals:n?n(a):coe(a),strict:i})}var doe=o((e=>{var t=u(),n=Vl();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}})),foe=o(((e,t)=>{t.exports=doe()}))(),poe=(...e)=>t=>{e.forEach(e=>{typeof e==`function`?e(t):e&&(e.current=t)})},moe=({contentComponent:e})=>{let t=(0,Hl.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getServerSnapshot);return(0,M.jsx)(M.Fragment,{children:Object.values(t)})};function hoe(){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]:ya.createPortal(r.reactElement,r.element,n)}
167,e.forEach(e=>e())},removeRenderer(n){let r={...t};delete r[n],t=r,e.forEach(e=>e())}}}var goe=class extends _.Component{constructor(e){super(e),this.editorContentRef=_.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){let e=this.props.editor;if(e&&!e.isDestroyed&&e.view.dom?.parentNode){if(e.contentComponent)return;let t=this.editorContentRef.current;t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t}),e.contentComponent=hoe(),e.createNodeViews(),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){let e=this.props.editor;if(e){e.isEditorContentInitialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),e.contentComponent=null;try{if(!e.view.dom?.parentNode)return;let t=document.createElement(`div`);t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t})}catch{}}}render(){let{editor:e,innerRef:t,...n}=this.props;return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`div`,{ref:poe(t,this.editorContentRef),...n}),e?.contentComponent&&(0,M.jsx)(moe,{contentComponent:e.contentComponent})]})}},_oe=(0,_.forwardRef)((e,t)=>{let n=_.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return _.createElement(goe,{key:n,innerRef:t,...e})}),rL=_.memo(_oe),voe=typeof window<`u`?_.useLayoutEffect:_.useEffect,yoe=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 iL(e){let[t]=(0,_.useState)(()=>new yoe(e.editor)),n=(0,foe.useSyncExternalStoreWithSelector)(t.subscribe,t.getSnapshot,t.getServerSnapshot,e.selector,e.equalityFn??uoe);return voe(()=>t.watch(e.editor),[e.editor,t]),(0,_.useDebugValue)(n),n}var aL=!1,oL=typeof window>`u`,boe=oL||!!(typeof window<`u`&&window.next),xoe=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(){let e=this.options.current.immediatelyRender,t=e??!0;return oL?(t&&aL&&console.warn("SSR detected. `immediatelyRender` has been set to false to avoid hydration mismatches"),t=!1):boe&&e===void 0&&(t=!1,aL&&console.warn("Next.js detected. `immediatelyRender` defaults to false to avoid hydration mismatches. Pass `immediatelyRender: true` explicitly if you are rendering the editor only on the client.")),t?this.createEditor():null}createEditor(){return new cI({...this.options.current,onBeforeCreate:(...e)=>{var t;return(t=this.options.current).onBeforeCreate?.call(t,...e)},onBlur:(...e)=>{var t;return(t=this.options.current).onBlur?.call(t,...e)},onCreate:(...e)=>{var t;return(t=this.options.current).onCreate?.call(t,...e)},onDestroy:(...e)=>{var t;return(t=this.options.current).onDestroy?.call(t,...e)},onFocus:(...e)=>{var t;return(t=this.options.current).onFocus?.call(t,...e)},onSelectionUpdate:(...e)=>{var t;return(t=this.options.current).onSelectionUpdate?.call(t,...e)},onTransaction:(...e)=>{var t;return(t=this.options.current).onTransaction?.call(t,...e)},onUpdate:(...e)=>{var t;return(t=this.options.current).onUpdate?.call(t,...e)},onContentError:(...e)=>{var t;return(t=this.options.current).onContentError?.call(t,...e)},onDrop:(...e)=>{var t;return(t=this.options.current).onDrop?.call(t,...e)},onPaste:(...e)=>{var t;return(t=this.options.current).onPaste?.call(t,...e)},onDelete:(...e)=>{var t;return(t=this.options.current).onDelete?.call(t,...e)}})}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(n=>[`onCreate`,`onBeforeCreate`,`onDestroy`,`onUpdate`,`onTransaction`,`onFocus`,`onBlur`,`onSelectionUpdate`,`onContentError`,`onDrop`,`onPaste`].includes(n)?!0:n===`extensions`&&e.extensions&&t.extensions?e.extensions.length===t.extensions.length?e.extensions.every((e,n)=>e===t.extensions?.[n]):!1:e[n]===t[n])}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&t.length===0?e.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){
167if(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 Soe(e={},t=[]){let n=(0,_.useRef)(e);n.current=e;let[r]=(0,_.useState)(()=>new xoe(n)),i=(0,Hl.useSyncExternalStore)(r.subscribe,r.getEditor,r.getServerSnapshot);return(0,_.useDebugValue)(i),(0,_.useEffect)(r.onRender(t)),iL({editor:i,selector:({transactionNumber:t})=>e.shouldRerenderOnTransaction===!1||e.shouldRerenderOnTransaction===void 0?null:e.immediatelyRender&&t===0?0:t+1}),i}var sL=(0,_.createContext)({editor:null});sL.Consumer;var Coe=()=>(0,_.useContext)(sL),cL=(0,_.createContext)({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),woe=()=>(0,_.useContext)(cL),Toe=_.forwardRef((e,t)=>{let{onDragStart:n}=woe();return(0,M.jsx)(e.as||`div`,{...e,ref:t,"data-node-view-wrapper":``,onDragStart:n,style:{whiteSpace:`normal`,...e.style}})});function lL(e){return!!(typeof e==`function`&&e.prototype&&e.prototype.isReactComponent)}function uL(e){return!!(typeof e==`object`&&e.$$typeof&&(e.$$typeof.toString()===`Symbol(react.forward_ref)`||e.$$typeof.description===`react.forward_ref`))}function Eoe(e){return!!(typeof e==`object`&&e.$$typeof&&(e.$$typeof.toString()===`Symbol(react.memo)`||e.$$typeof.description===`react.memo`))}function Doe(e){if(lL(e)||uL(e))return!0;if(Eoe(e)){let t=e.type;if(t)return lL(t)||uL(t)}return!1}function Ooe(){try{if(_.version)return parseInt(_.version.split(`.`)[0],10)>=19}catch{}return!1}var koe=class{constructor(e,{editor:t,props:n={},as:r=`div`,className:i=``}){this.ref=null,this.destroyed=!1,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=e,this.editor=t,this.props=n,this.element=document.createElement(r),this.element.classList.add(`react-renderer`),i&&this.element.classList.add(...i.split(` `)),this.editor.isEditorContentInitialized?(0,ya.flushSync)(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var e;if(this.destroyed)return;let t=this.component,n=this.props,r=this.editor,i=Ooe(),a=Doe(t),o={...n};o.ref&&!(i||a)&&delete o.ref,!o.ref&&(i||a)&&(o.ref=e=>{this.ref=e}),this.reactElement=(0,M.jsx)(t,{...o}),(e=r?.contentComponent)==null||e.setRenderer(this.id,this)}updateProps(e={}){if(this.destroyed)return;let t=!1,n=Object.keys(e);for(let r=0;r<n.length;r+=1){let i=n[r];if(e[i]!==this.props[i]){t=!0;break}}t&&(this.props={...this.props,...e},this.render())}destroy(){var e;this.destroyed=!0,(e=this.editor?.contentComponent)==null||e.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(e){Object.keys(e).forEach(t=>{this.element.setAttribute(t,e[t])})}};_.createContext({markViewContentRef:()=>{}});var Aoe=class extends kI{constructor(e,t,n){if(super(e,t,n),this.selectionRafId=null,this.handlePositionUpdate=()=>{let e=this.getPos();typeof e!=`number`||e===this.currentPos||(this.currentPos=e,this.renderer.updateProps({getPos:()=>this.getPos()}),typeof this.options.attrs==`function`&&this.updateElementAttributes())},this.cachedExtensionWithSyncedStorage=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?`span`:`div`),this.contentDOMElement.dataset.nodeViewContentReact=``,this.contentDOMElement.dataset.nodeViewWrapper=``,this.contentDOMElement.style.whiteSpace=`inherit`;let e=this.dom.querySelector(`[data-node-view-content]`);if(!e)return;e.appendChild(this.contentDOMElement)}this.options.trackNodeViewPosition&&this.editor.on(`update`,this.handlePositionUpdate)}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){let e=this.editor,t=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(t,{get(n,r,i){return r===`storage`?e.storage[t.name]??{}:Reflect.get(n,r,i)}})}return this.cachedExtensionWithSyncedStorage}mount(){let e={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(e={})=>this.updateAttributes(e),deleteNode:()=>this.deleteNode(),ref:(0,_.createRef)()};if(!this.component.displayName){let e=e=>e.charAt(0).toUpperCase()+e.substring(1);this.component.displayName=e(this.extension.name)}let t={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:e=>{e&&this.contentDOMElement&&e.firstChild!==this.contentDOMElement&&(e.hasAttribute(`data-node-view-wrapper`)&&e.removeAttribute(`data-node-view-wrapper`),e.a
167ppendChild(this.contentDOMElement))}},n=this.component,r=(0,_.memo)(e=>(0,M.jsx)(cL.Provider,{value:t,children:(0,_.createElement)(n,e)}));r.displayName=`ReactNodeView`;let i=this.node.isInline?`span`:`div`;this.options.as&&(i=this.options.as);let{className:a=``}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new koe(r,{editor:this.editor,props:e,as:i,className:`node-${this.node.type.name} ${a}`.trim()}),this.editor.on(`selectionUpdate`,this.handleSelectionUpdate),this.updateElementAttributes(),this.currentPos=this.getPos()}get dom(){if(this.renderer.element.firstElementChild&&!this.renderer.element.firstElementChild?.hasAttribute(`data-node-view-wrapper`))throw Error(`Please use the NodeViewWrapper component for your node view.`);return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){this.selectionRafId&&=(cancelAnimationFrame(this.selectionRafId),null),this.selectionRafId=requestAnimationFrame(()=>{this.selectionRafId=null;let e=this.currentPos;if(typeof e==`number`)if(eF({selection:this.editor.state.selection,pos:e,nodeSize:this.node.nodeSize,selectedOnTextSelection:this.options.selectedOnTextSelection})){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}})}update(e,t,n){let r=e=>{this.renderer.updateProps(e),typeof this.options.attrs==`function`&&this.updateElementAttributes()};if(e.type!==this.node.type)return!1;if(typeof this.options.update==`function`){let i=this.node,a=this.decorations,o=this.innerDecorations;return this.node=e,this.decorations=t,this.innerDecorations=n,this.currentPos=this.getPos(),this.options.update({oldNode:i,oldDecorations:a,newNode:e,newDecorations:t,oldInnerDecorations:o,innerDecorations:n,updateProps:()=>r({node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage})})}if(e===this.node)return this.node=e,this.decorations=t,this.innerDecorations=n,!0;let i=this.getPos();this.node=e,this.decorations=t,this.innerDecorations=n,this.currentPos=i;let a={node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage};return this.options.trackNodeViewPosition&&(a.getPos=()=>this.getPos()),r(a),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add(`ProseMirror-selectednode`)}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove(`ProseMirror-selectednode`)}destroy(){this.renderer.destroy(),this.editor.off(`selectionUpdate`,this.handleSelectionUpdate),this.options.trackNodeViewPosition&&this.editor.off(`update`,this.handlePositionUpdate),this.contentDOMElement=null,this.selectionRafId&&=(cancelAnimationFrame(this.selectionRafId),null)}updateElementAttributes(){if(this.options.attrs){let e={};if(typeof this.options.attrs==`function`){let t=this.editor.extensionManager.attributes,n=wP(this.node,t);e=this.options.attrs({node:this.node,HTMLAttributes:n})}else e=this.options.attrs;this.renderer.updateAttributes(e)}}};function joe(e,t){return n=>n.editor.contentComponent?new Aoe(e,n,t):{}}var dL=(0,_.createContext)({get editor(){throw Error(`useTiptap must be used within a <Tiptap> provider`)}});dL.displayName=`TiptapContext`;var Moe=()=>(0,_.useContext)(dL);function fL({editor:e,instance:t,children:n}){let r=e??t;if(!r)throw Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");let i=(0,_.useMemo)(()=>({editor:r}),[r]),a=(0,_.useMemo)(()=>({editor:r}),[r]);return(0,M.jsx)(sL.Provider,{value:a,children:(0,M.jsx)(dL.Provider,{value:i,children:n})})}fL.displayName=`Tiptap`;function pL({...e}){let{editor:t}=Moe();return(0,M.jsx)(rL,{editor:t,...e})}pL.displayName=`Tiptap.Content`,Object.assign(fL,{Content:pL});var mL=class{constructor(e,t,n){this.step=e,this.inverted=t,this.origin=n}};function Noe(e,t,n){for(let t=e.length-1;t>=0;t--)n.step(e[t].inverted);for(let e=0;e<t.length;e++)n.step(t[e]);let r=[];for(let t=0,i=e.length;t<e.length;t++){let a=e[t].step.map(n.mapping.slice(i));i--,a&&!n.maybeStep(a).failed&&(n.mapping.setMirror(i,n.steps.length-1),r.push(new mL(a,a.invert(n.docs[n.docs.length-1]),e[t].origin)))}return r}var hL=class{constructor(e,t){this.version=e,this.unconfirmed=t}};function Poe(e){let t=[];for(let n=0;n<e.steps.length;n++)t.push(new mL(e.steps[n],e.steps[n].invert(e.docs[n]),e));return t}var gL=new xO(`collab`);function Foe(e={}){let t={version:e.version||0,clientID:e.clientID==null?Math.floor(Math.random()*4294967295):e.clientID};return new vO({key:gL,state:{init:()=>
167new hL(t.version,[]),apply(e,t){return e.getMeta(gL)||(e.docChanged?new hL(t.version,t.unconfirmed.concat(Poe(e))):t)}},config:t,historyPreserveItems:!0})}function Ioe(e,t,n,r={}){let i=gL.getState(e),a=i.version+t.length,o=gL.get(e).spec.config.clientID,s=0;for(;s<n.length&&n[s]==o;)++s;let c=i.unconfirmed.slice(s);if(t=s?t.slice(s):t,!t.length)return e.tr.setMeta(gL,new hL(a,c));let l=c.length,u=e.tr;if(l)c=Noe(c,t,u);else{for(let e=0;e<t.length;e++)u.step(t[e]);c=[]}let d=new hL(a,c);return r&&r.mapSelectionBackward&&e.selection instanceof tO&&(u.setSelection(tO.between(u.doc.resolve(u.mapping.map(e.selection.anchor,-1)),u.doc.resolve(u.mapping.map(e.selection.head,-1)),-1)),u.updated&=-2),u.setMeta(`rebased`,l).setMeta(`addToHistory`,!1).setMeta(gL,d)}function _L(e){let t=gL.getState(e);return t.unconfirmed.length==0?null:{version:t.version,steps:t.unconfirmed.map(e=>e.step),clientID:gL.get(e).spec.config.clientID,get origins(){return this._origins||=t.unconfirmed.map(e=>e.origin)}}}function vL(e){return gL.getState(e).version}var Loe=1e3,Roe=1e3;function zoe(e,t,n){let r=n?.debug?console.debug:()=>{},i=Ni(),a=Hoe(e,t),o=(0,_.useMemo)(()=>{let{loading:r,...o}=a;return r||!o.initialContent?null:Boe(i,t,e,o,n)},[i,t,a.loading,a.initialContent]),s=Ii(e.submitSnapshot).withOptimisticUpdate((n,r)=>{n.getQuery(e.getSnapshot,{id:t})?.content||n.setQuery(e.getSnapshot,{id:t},{version:r.version,content:r.content}),n.getQuery(e.latestVersion,{id:t})===null&&n.setQuery(e.latestVersion,{id:t},r.version)}),c=(0,_.useCallback)(async e=>{r(`Creating new document`,{id:t}),await s({id:t,version:1,content:JSON.stringify(e)})},[i,t]);return a.loading?{extension:null,isLoading:!0,initialContent:null,create:c}:a.initialContent?{extension:o,isLoading:!1,initialContent:a.initialContent}:{extension:null,isLoading:!1,initialContent:null,create:c}}function Boe(e,t,n,r,i){let a=i?.debug?console.debug:()=>{},o,s=(r,a)=>{o&&clearTimeout(o),o=setTimeout(()=>{e.mutation(n.submitSnapshot,{id:t,version:r,content:a}).catch(i?.onSyncError)},i?.snapshotDebounceMs??Roe)},c=!1,l,u;async function d(a){let f=u?.localQueryResult();if(f!==void 0){if(f&&f>vL(a.state)&&(clearTimeout(o),o=void 0),c){if(!l){let e=()=>{},t=()=>{},n=new Promise((n,r)=>{e=n,t=r});l={resolve:e,reject:t,promise:n}}return l.promise}c=!0;try{if(await Voe(a,e,n,t,f,r,i?.debug)){let e=vL(a.state),t=JSON.stringify(a.state.doc.toJSON());if(_L(a.state))throw Error(`Synced but still have sendable steps`);s(e,t)}}catch(e){if(i?.onSyncError)i.onSyncError(e);else throw e}finally{if(c=!1,l){let{resolve:e,reject:t}=l;l=void 0,d(a).then(e,t)}}}}let f,p;return qF.create({name:`convex-sync`,onDestroy(){a(`destroying`),f?.(),p&&=(window.removeEventListener?.(`beforeunload`,p),void 0)},onCreate(){if(r.restoredSteps?.length){a(`Restoring local steps`,r.restoredSteps);let e=this.editor.state.tr;for(let t of r.restoredSteps)e.step(tD.fromJSON(this.editor.schema,t));this.editor.view.dispatch(e)}if(u=e.watchQuery(n.latestVersion,{id:t}),f=u.onUpdate(()=>{d(this.editor)}),d(this.editor),i?.warnOnUnsyncedClose!==!1&&typeof window<`u`&&typeof window.addEventListener==`function`){let e=this.editor;p=t=>{_L(e.state)&&(t.preventDefault(),t.returnValue=``)},window.addEventListener(`beforeunload`,p)}},onUpdate(){d(this.editor)},addProseMirrorPlugins(){return a(`Adding collab plugin`,{version:r.initialVersion}),[Foe({version:r.initialVersion})]}})}async function Voe(e,t,n,r,i,a,o){let s=o?console.debug:()=>{};if(i===null)if(a.initialVersion<=1)s(`Syncing new document`,{id:r}),await t.mutation(n.submitSnapshot,{id:r,version:a.initialVersion,content:JSON.stringify(a.initialContent)});else throw Error(`Syncing a document that doesn't exist server-side`);let c=vL(e.state);if(i!==null&&i>c){s(`Updating to server version`,{id:r,version:c,serverVersion:i});let a=await t.query(n.getSteps,{id:r,version:c});yL(e,a.steps.map(t=>tD.fromJSON(e.schema,JSON.parse(t))),a.clientIds)}let l=!1;for(;;){let i=_L(e.state);if(!i)break;let a=i.steps.slice(0,Loe).map(e=>JSON.stringify(e.toJSON()));s(`Sending steps`,{steps:a,version:i.version});let o=await t.mutation(n.submitSteps,{id:r,steps:a,version:i.version,clientId:i.clientID});if(o.status===`synced`){l=!0,yL(e,a.map(t=>tD.fromJSON(e.schema,JSON.parse(t))),a.map(()=>i.clientID)),s(`Synced`,{steps:a,version:c,newVersion:vL(e.state)});continue}o.status===`needs-rebase`&&(yL(e,o.steps.map(t=>tD.fromJSON(e.schema,JSON.parse(t))),o.clientIds),s(`Rebased`,{steps:a,newVersion:vL(e.state)}))}return l}function yL(e,t,n){e.view.dispatch(Ioe(e.state,t,n,{mapSelectionBackward:!0}))}function Hoe(e,t,n){let r=(0,_.useRef)({id:t}),i=(0,_.useMemo)(()=>Uoe(t,n),[t,n]),a=Fi(e.getSnapshot,r.current.snapshot&&r.current.id===t?`skip`:{id:t}),o=(0,_.useMemo)(()=>a&&a.content!==null&&{initialContent:JSON.parse(a.content),initialVersion:a.version},[a]);(o||r.current.id!==t)&&(r.current={id:t,snapshot:o||void 0});let s=r.current.snapshot||i;return s?{loading:!1,...s}:!i&&a?.content===null?{loading:!1,initialContent:null}:{loading:!0}}function Uoe(e,t){if(typeof window>`u`)return;let n=`${t??`convex-sync`}-${e}`,r=sessionStorage.getItem(n);if(r){let{content:e,version:t,steps:n}=JSON.parse(r);return{initialContent:e,initialVersion:Number(t),restoredSteps:n??[]}}}function Woe({noteId:e,filedIn:t}){let n=Fi(B.projects.queries.listOwned,{}),r=Fi(B.areas.queries.listOwned,{}),i=Fi(B.resources.queries.listOwned,{}),a=Ii(B.notes.mutations.setFiledIn),o=Li(B.notes.filingSuggestion.suggest),[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(`idle`),d=[...n??[],...r??[],...i??[]],f=t===void 0?void 0:d.find(e=>e._id===t)?.name,p=t=>{!t||l!==`idle`||(u(`loading`),o({noteId:e}).then(e=>{c(e),u(`done`)}).catch(()=>u(`done`)))},m=t=>{a({id:e,filedIn:t})},h=[{label:`Projects`,items:n},{label:`Areas`,items:r},{label:`Resources`,items:i}],g=d.length>0;return(0,M.jsxs)(HS,{onOpenChange:p,children:[(0,M.jsx)(US,{asChild:!0,children:(0,M.jsxs)(z,{variant:`ghost`,size:`sm`,"aria-label":f?`Filed in ${f}`:`File note`,children:[f?(0,M.jsx)(qx,{className:`size-4`}):(0,M.jsx)(Gx,{className:`size-4`}),(0,M.jsx)(`span`,{className:`max-w-28 truncate`,children:f??`File`})]})}),(0,M.jsxs)(WS,{align:`end`,className:`w-64`,children:[l===`loading`?(0,M.jsxs)(qS,{className:`flex items-center gap-2 font-normal text-muted-foreground`,children:[(0,M.jsx)(NS,{className:`size-3.5`}),` XO is thinkingâ¦`]}):s!==null&&s.containerId!==t?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(KS,{onSelect:()=>m(s.containerId),children:[(0,M.jsx)(NS,{className:`size-4`}),(0,M.jsxs)(`span`,{className:`flex flex-col`,children:[(0,M.jsx)(`span`,{children:s.name}),s.reason?(0,M.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:s.reason}):null]})]}),(0,M.jsx)(JS,{})]}):null,!g&&n!==void 0&&r!==void 0&&i!==void 0?(0,M.jsx)(qS,{className:`font-normal text-muted-foreground`,children:`No projects, areas, or resources yet â create one from the sidebar first.`}):null,h.map(e=>e.items!==void 0&&e.items.length>0?(0,M.jsxs)(GS,{children:[(0,M.jsx)(qS,{children:e.label}),e.items.map(e=>(0,M.jsxs)(KS,{disabled:e._id===t,onSelect:()=>m(e._id),children:[(0,M.jsx)(qx,{className:`size-4`}),(0,M.jsx)(`span`,{className:`truncate`,children:e.name})]},e._id))]},e.label):null),t===void 0?null:(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(JS,{}),(0,M.jsxs)(KS,{onSelect:()=>void a({id:e,filedIn:null}),children:[(0,M.jsx)(BS,{className:`size-4`}),` Remove from`,` `,f??`container`]})]})]})]})}var Goe=c(o(((e,t)=>{var n=`Expected a function`,r=NaN,i=`[object Symbol]`,a=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,c=/^0o[0-7]+$/i,l=parseInt,u=typeof global==`object`&&global&&global.Object===Object&&global,d=typeof self==`object`&&self&&self.Object===Object&&self,f=u||d||Function(`return this`)(),p=Object.prototype.toString,m=Math.max,h=Math.min,g=function(){return f.Date.now()};function _(e,t,r){var i,a,o,s,c,l,u=0,d=!1,f=!1,p=!0;if(typeof e!=`function`)throw TypeError(n);t=S(t)||0,y(r)&&(d=!!r.leading,f=`maxWait`in r,o=f?m(S(r.maxWait)||0,t):o,p=`trailing`in r?!!r.trailing:p);function _(t){var n=i,r=a;return i=a=void 0,u=t,s=e.apply(r,n),s}function v(e){return u=e,c=setTimeout(C,t),d?_(e):s}function b(e){var n=e-l,r=e-u,i=t-n;return f?h(i,o-r):i}function x(e){var n=e-l,r=e-u;return l===void 0||n>=t||n<0||f&&r>=o}function C(){var e=g();if(x(e))return w(e);c=setTimeout(C,b(e))}function w(e){return c=void 0,p&&i?_(e):(i=a=void 0,s)}function T(){c!==void 0&&clearTimeout(c),u=0,i=l=a=c=void 0}function E(){return c===void 0?s:w(g())}function D(){var e=g(),n=x(e);if(i=arguments,a=this,l=e,n){if(c===void 0)return v(l);
167if(f)return c=setTimeout(C,t),_(l)}return c===void 0&&(c=setTimeout(C,t)),s}return D.cancel=T,D.flush=E,D}function v(e,t,r){var i=!0,a=!0;if(typeof e!=`function`)throw TypeError(n);return y(r)&&(i=`leading`in r?!!r.leading:i,a=`trailing`in r?!!r.trailing:a),_(e,t,{leading:i,maxWait:t,trailing:a})}function y(e){var t=typeof e;return!!e&&(t==`object`||t==`function`)}function b(e){return!!e&&typeof e==`object`}function x(e){return typeof e==`symbol`||b(e)&&p.call(e)==i}function S(e){if(typeof e==`number`)return e;if(x(e))return r;if(y(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=y(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=e.replace(a,``);var n=s.test(e);return n||c.test(e)?l(e.slice(2),n?2:8):o.test(e)?r:+e}t.exports=v}))(),1),Koe=e=>{let t=(0,_.useRef)(e);t.current=e,(0,_.useEffect)(()=>()=>{t.current()},[])},qoe={leading:!1,trailing:!0};function bL(e,t=250,n=[],r=qoe){let i=(0,_.useMemo)(()=>(0,Goe.default)(e,t,r),n);return Koe(()=>{i.cancel()}),i}function xL(){let[e,t]=(0,_.useState)({width:0,height:0,offsetTop:0,offsetLeft:0,scale:0}),n=bL(()=>{if(typeof window>`u`)return;let e=window.visualViewport;if(!e)return;let{width:n=0,height:r=0,offsetTop:i=0,offsetLeft:a=0,scale:o=0}=e;t(e=>n===e.width&&r===e.height&&i===e.offsetTop&&a===e.offsetLeft&&o===e.scale?e:{width:n,height:r,offsetTop:i,offsetLeft:a,scale:o})},200);return(0,_.useEffect)(()=>{let e=window.visualViewport;if(e)return e.addEventListener(`resize`,n),n(),()=>{e.removeEventListener(`resize`,n)}},[n]),e}var SL={x:0,y:0,width:0,height:0,top:0,right:0,bottom:0,left:0},CL=typeof window>`u`,Joe=!CL&&typeof ResizeObserver<`u`,wL=()=>!CL;function Yoe({element:e,enabled:t=!0,throttleMs:n=100,useResizeObserver:r=!0}={}){let[i,a]=(0,_.useState)(SL),o=(0,_.useCallback)(()=>!t||!wL()?null:e?typeof e==`string`?document.querySelector(e):`current`in e?e.current:e:document.body,[e,t]),s=bL(()=>{if(!t||!wL())return;let e=o();if(!e){a(SL);return}let n=e.getBoundingClientRect();a({x:n.x,y:n.y,width:n.width,height:n.height,top:n.top,right:n.right,bottom:n.bottom,left:n.left})},n,[t,o],{leading:!0,trailing:!0});return(0,_.useEffect)(()=>{if(!t||!wL()){a(SL);return}let e=o();if(!e)return;s();let n=[];if(r&&Joe){let t=new ResizeObserver(()=>{window.requestAnimationFrame(s)});t.observe(e),n.push(()=>t.disconnect())}let i=()=>s();return window.addEventListener(`scroll`,i,!0),window.addEventListener(`resize`,i,!0),n.push(()=>{window.removeEventListener(`scroll`,i),window.removeEventListener(`resize`,i)}),()=>{n.forEach(e=>e()),a(SL)}},[t,o,s,r]),i}function Xoe(e={}){return Yoe({...e,element:wL()?document.body:null})}function Zoe({editor:e,overlayHeight:t=0}){let{height:n}=xL(),r=Xoe({enabled:!0,throttleMs:100,useResizeObserver:!0});return(0,_.useEffect)(()=>{(()=>{if(!e)return;let{state:i,view:a}=e;if(!a.hasFocus())return;let{from:o}=i.selection,s=a.coordsAtPos(o);if(n<r.height&&s&&n-s.top<t){let e=Math.max(n/2,t),r=window.scrollY,i=s.top+r-e;window.scrollTo({top:Math.max(0,i),behavior:`smooth`})}})()},[e,t,n,r.height]),r}function Qoe(e){let t=e.initialTitle,n=e.noteId,r=e.initialTitle,i=null,a=null,o=!1,s=e.debounceMs??600;function c(){i!==null&&(clearTimeout(i),i=null)}function l(){o||(c(),i=setTimeout(()=>{d()},s))}async function u(){if(t===r)return;let i=t.trim()===``?`Untitled`:t,a=t;await e.onSetTitle({id:n,title:i}),r=a}async function d(){for(c();a!==null;)await a;let e=u();a=e.then(()=>void 0,()=>void 0);try{await e}finally{a=null}}async function f(){o||(o=!0,await d())}return{setTitle:e=>{t=e,l()},flush:d,dispose:f}}function $oe(e){let t=Ii(B.notes.mutations.setTitle),[n]=(0,_.useState)(()=>Qoe({noteId:e.noteId,initialTitle:e.initialTitle,onSetTitle:e=>t(e).then(()=>void 0)}));return(0,_.useEffect)(()=>()=>{n.dispose()},[n]),{setTitle:n.setTitle,flush:n.flush}}var TL=[`input:not([inert]):not([inert] *)`,`select:not([inert]):not([inert] *)`,`textarea:not([inert]):not([inert] *)`,`a[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(`,`),EL=typeof Element>`u`,DL=EL?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,OL=!EL&&Element.prototype.getRootNode?function(e){return e?.getRootNode?.call(e)}:function(e){return e?.ownerDocument},kL=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]`):kL(e.parentNode))},ese=function(e){var t=e?.getAttribute?.call(e,`contenteditable`);return t===``||t===`true`},tse=function(e,t,n){if(kL(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(TL));return t&&DL.call(e,TL)&&r.unshift(e),r=r.filter(n),r},AL=function(e,t,n){for(var r=[],i=Array.from(e);i.length;){var a=i.shift();if(!kL(a,!1))if(a.tagName===`SLOT`){var o=a.assignedElements(),s=AL(o.length?o:a.children,!0,n);
167n.flatten?r.push.apply(r,s):r.push({scopeParent:a,candidates:s})}else{DL.call(a,TL)&&n.filter(a)&&(t||!e.includes(a))&&r.push(a);var c=a.shadowRoot||typeof n.getShadowRoot==`function`&&n.getShadowRoot(a),l=!kL(c,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(a));if(c&&l){var u=AL(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},jL=function(e){return!isNaN(parseInt(e.getAttribute(`tabindex`),10))},ML=function(e){if(!e)throw Error(`No node provided`);return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||ese(e))&&!jL(e)?0:e.tabIndex},nse=function(e,t){var n=ML(e);return n<0&&t&&!jL(e)?0:n},rse=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},NL=function(e){return e.tagName===`INPUT`},ise=function(e){return NL(e)&&e.type===`hidden`},ase=function(e){return e.tagName===`DETAILS`&&Array.prototype.slice.apply(e.children).some(function(e){return e.tagName===`SUMMARY`})},ose=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]},sse=function(e){if(!e.name)return!0;var t=e.form||OL(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=ose(r,e.form);return!i||i===e},cse=function(e){return NL(e)&&e.type===`radio`},lse=function(e){return cse(e)&&!sse(e)},use=function(e){var t=e&&OL(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=OL(n),n=t?.host,r=!!((s=n)!=null&&(c=s.ownerDocument)!=null&&c.contains(n))}}return r},PL=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return n===0&&r===0},dse=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});if(getComputedStyle(e).visibility===`hidden`)return!0;var i=DL.call(e,`details>summary:first-of-type`)?e.parentElement:e;if(DL.call(i,`details:not([open]) *`))return!0;if(!n||n===`full`||n===`full-native`||n===`legacy-full`){if(typeof r==`function`){for(var a=e;e;){var o=e.parentElement,s=OL(e);if(o&&!o.shadowRoot&&r(o)===!0)return PL(e);e=e.assignedSlot?e.assignedSlot:!o&&s!==e.ownerDocument?s.host:o}e=a}if(use(e))return!e.getClientRects().length;if(n!==`legacy-full`)return!0}else if(n===`non-zero-area`)return PL(e);return!1},fse=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 DL.call(t,`fieldset[disabled] *`)?!0:!r.contains(e)}return!0}t=t.parentElement}return!1},pse=function(e,t){return!(t.disabled||ise(t)||dse(t,e)||ase(t)||fse(t))},FL=function(e,t){return!(lse(t)||ML(t)<0||!pse(e,t))},mse=function(e){var t=parseInt(e.getAttribute(`tabindex`),10);return!!(isNaN(t)||t>=0)},IL=function(e){var t=[],n=[];return e.forEach(function(e,r){var i=!!e.scopeParent,a=i?e.scopeParent:e,o=nse(a,i),s=i?IL(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(rse).reduce(function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e},[]).concat(t)},LL=function(e,t){return t||={},IL(t.getShadowRoot?AL([e],t.includeContainer,{filter:FL.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:mse}):tse(e,t.includeContainer,FL.bind(null,t)))};function hse(){let e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function gse(){let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(e=>{let{brand:t,version:n}=e;return t+`/`+n}).join(` `):navigator.userAgent}function RL(){return/apple/i.test(navigator.vendor)}function _se(){return hse().toLowerCase().startsWith(`mac`)&&!navigator.maxTouchPoints}function vse(){return gse().includes(`jsdom/`)}var zL=`data-floating-ui-focusable`,yse=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`;function BL(e){let t=e.activeElement;for(;((n=t)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;t=t.shadowRoot.activeElement}return t}function VL(e,t){if(!e||!t)return!1;let n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;
167if(n&&bd(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function HL(e){return`composedPath`in e?e.composedPath()[0]:e.target}function UL(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 bse(e){return e.matches(`html,body`)}function WL(e){return e?.ownerDocument||document}function xse(e){return yd(e)&&e.matches(yse)}function Sse(e){if(!e||vse())return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function Cse(e){return e?e.hasAttribute(zL)?e:e.querySelector(`[`+zL+`]`)||e:null}function GL(e,t,n){return n===void 0&&(n=!0),e.filter(e=>e.parentId===t&&(!n||e.context?.open)).flatMap(t=>[t,...GL(e,t.id,n)])}function wse(e){return`nativeEvent`in e}function KL(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}var qL=typeof document<`u`?_.useLayoutEffect:function(){},Tse={..._};function JL(e){let t=_.useRef(e);return qL(()=>{t.current=e}),t}var Ese=Tse.useInsertionEffect||(e=>e());function YL(e){let t=_.useRef(()=>{});return Ese(()=>{t.current=e}),_.useCallback(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}var XL=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver==`function`&&ResizeObserver.toString().includes(`[native code]`)?`full`:`none`});function ZL(e,t){let n=LL(e,XL()),r=n.length;if(r===0)return;let i=BL(WL(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function Dse(e){return ZL(WL(e).body,1)||e}function Ose(e){return ZL(WL(e).body,-1)||e}function QL(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!VL(n,r)}function kse(e){LL(e,XL()).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function $L(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 eR(e){let t=_.useRef(void 0),n=_.useCallback(t=>{let n=e.map(e=>{if(e!=null){if(typeof e==`function`){let n=e,r=n(t);return typeof r==`function`?r:()=>{n(null)}}return e.current=t,()=>{e.current=null}}});return()=>{n.forEach(e=>e?.())}},e);return _.useMemo(()=>e.every(e=>e==null)?null:e=>{t.current&&=(t.current(),void 0),e!=null&&(t.current=n(e))},e)}var Ase=`data-floating-ui-focusable`,tR=`active`,nR=`selected`,jse=`ArrowLeft`,Mse=`ArrowRight`,Nse=`ArrowUp`,Pse=`ArrowDown`,Fse=[jse,Mse],Ise=[Nse,Pse];[...Fse,...Ise];var Lse={..._},rR=!1,Rse=0,iR=()=>`floating-ui-`+Math.random().toString(36).slice(2,6)+ Rse++;function zse(){let[e,t]=_.useState(()=>rR?iR():void 0);return qL(()=>{e??t(iR())},[]),_.useEffect(()=>{rR=!0},[]),e}var aR=Lse.useId||zse;function Bse(){let e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var r;(r=e.get(t))==null||r.delete(n)}}}var Vse=_.createContext(null),Hse=_.createContext(null),oR=()=>_.useContext(Vse)?.id||null,sR=()=>_.useContext(Hse);function cR(e){return`data-floating-ui-`+e}function lR(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}var uR=cR(`safe-polygon`);function dR(e,t,n){if(n&&!KL(n))return 0;if(typeof e==`number`)return e;if(typeof e==`function`){let n=e();
167return typeof n==`number`?n:n?.[t]}return e?.[t]}function fR(e){return typeof e==`function`?e():e}function Use(e,t){t===void 0&&(t={});let{open:n,onOpenChange:r,dataRef:i,events:a,elements:o}=e,{enabled:s=!0,delay:c=0,handleClose:l=null,mouseOnly:u=!1,restMs:d=0,move:f=!0}=t,p=sR(),m=oR(),h=JL(l),g=JL(c),v=JL(n),y=JL(d),b=_.useRef(),x=_.useRef(-1),S=_.useRef(),C=_.useRef(-1),w=_.useRef(!0),T=_.useRef(!1),E=_.useRef(()=>{}),D=_.useRef(!1),O=YL(()=>{let e=i.current.openEvent?.type;return e?.includes(`mouse`)&&e!==`mousedown`});_.useEffect(()=>{if(!s)return;function e(e){let{open:t}=e;t||(lR(x),lR(C),w.current=!0,D.current=!1)}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[s,a]),_.useEffect(()=>{if(!s||!h.current||!n)return;function e(e){O()&&r(!1,e,`hover`)}let t=WL(o.floating).documentElement;return t.addEventListener(`mouseleave`,e),()=>{t.removeEventListener(`mouseleave`,e)}},[o.floating,n,r,s,h,O]);let ee=_.useCallback(function(e,t,n){t===void 0&&(t=!0),n===void 0&&(n=`hover`);let i=dR(g.current,`close`,b.current);i&&!S.current?(lR(x),x.current=window.setTimeout(()=>r(!1,e,n),i)):t&&(lR(x),r(!1,e,n))},[g,r]),k=YL(()=>{E.current(),S.current=void 0}),te=YL(()=>{if(T.current){let e=WL(o.floating).body;e.style.pointerEvents=``,e.removeAttribute(uR),T.current=!1}}),ne=YL(()=>i.current.openEvent?[`click`,`mousedown`].includes(i.current.openEvent.type):!1);_.useEffect(()=>{if(!s)return;function e(e){if(lR(x),w.current=!1,u&&!KL(b.current)||fR(y.current)>0&&!dR(g.current,`open`))return;let t=dR(g.current,`open`,b.current);t?x.current=window.setTimeout(()=>{v.current||r(!0,e,`hover`)},t):n||r(!0,e,`hover`)}function t(e){if(ne()){te();return}E.current();let t=WL(o.floating);if(lR(C),D.current=!1,h.current&&i.current.floatingContext){n||lR(x),S.current=h.current({...i.current.floatingContext,tree:p,x:e.clientX,y:e.clientY,onClose(){te(),k(),ne()||ee(e,!0,`safe-polygon`)}});let r=S.current;t.addEventListener(`mousemove`,r),E.current=()=>{t.removeEventListener(`mousemove`,r)};return}(b.current!==`touch`||!VL(o.floating,e.relatedTarget))&&ee(e)}function a(e){ne()||i.current.floatingContext&&(h.current==null||h.current({...i.current.floatingContext,tree:p,x:e.clientX,y:e.clientY,onClose(){te(),k(),ne()||ee(e)}})(e))}function c(){lR(x)}function l(e){ne()||ee(e,!1)}if(vd(o.domReference)){let r=o.domReference,i=o.floating;return n&&r.addEventListener(`mouseleave`,a),f&&r.addEventListener(`mousemove`,e,{once:!0}),r.addEventListener(`mouseenter`,e),r.addEventListener(`mouseleave`,t),i&&(i.addEventListener(`mouseleave`,a),i.addEventListener(`mouseenter`,c),i.addEventListener(`mouseleave`,l)),()=>{n&&r.removeEventListener(`mouseleave`,a),f&&r.removeEventListener(`mousemove`,e),r.removeEventListener(`mouseenter`,e),r.removeEventListener(`mouseleave`,t),i&&(i.removeEventListener(`mouseleave`,a),i.removeEventListener(`mouseenter`,c),i.removeEventListener(`mouseleave`,l))}}},[o,s,e,u,f,ee,k,te,r,n,v,p,g,h,i,ne,y]),qL(()=>{var e;if(s&&n&&(e=h.current)!=null&&(e=e.__options)!=null&&e.blockPointerEvents&&O()){T.current=!0;let e=o.floating;if(vd(o.domReference)&&e){var t;let n=WL(o.floating).body;n.setAttribute(uR,``);let r=o.domReference,i=p==null||(t=p.nodesRef.current.find(e=>e.id===m))==null||(t=t.context)==null?void 0:t.elements.floating;return i&&(i.style.pointerEvents=``),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,e.style.pointerEvents=`auto`,()=>{n.style.pointerEvents=``,r.style.pointerEvents=``,e.style.pointerEvents=``}}}},[s,n,m,o,p,h,O]),qL(()=>{n||(b.current=void 0,D.current=!1,k(),te())},[n,k,te]),_.useEffect(()=>()=>{k(),lR(x),lR(C),te()},[s,o.domReference,k,te]);let re=_.useMemo(()=>{function e(e){b.current=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e;function i(){!w.current&&!v.current&&r(!0,t,`hover`)}u&&!KL(b.current)||n||fR(y.current)===0||D.current&&e.movementX**2+e.movementY**2<2||(lR(C),b.current===`touch`?i():(D.current=!0,C.current=window.setTimeout(i,fR(y.current))))}}},[u,r,n,v,y]);return _.useMemo(()=>s?{reference:re}:{},[s,re])}var pR=()=>{},Wse=_.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:pR,setState:pR,isInstantPhase:!1});function Gse(e){let{children:t,delay:n,timeoutMs:r=0}=e,[i,a]=_.useReducer((e,t)=>
167({...e,...t}),{delay:n,timeoutMs:r,initialDelay:n,currentId:null,isInstantPhase:!1}),o=_.useRef(null),s=_.useCallback(e=>{a({currentId:e})},[]);return qL(()=>{i.currentId?o.current===null?o.current=i.currentId:i.isInstantPhase||a({isInstantPhase:!0}):(i.isInstantPhase&&a({isInstantPhase:!1}),o.current=null)},[i.currentId,i.isInstantPhase]),(0,M.jsx)(Wse.Provider,{value:_.useMemo(()=>({...i,setState:a,setCurrentId:s}),[i,s]),children:t})}var Kse={border:0,clip:`rect(0 0 0 0)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`fixed`,whiteSpace:`nowrap`,width:`1px`,top:0,left:0},mR=_.forwardRef(function(e,t){let[n,r]=_.useState();qL(()=>{RL()&&r(`button`)},[]);let i={ref:t,tabIndex:0,role:n,"aria-hidden":n?void 0:!0,[cR(`focus-guard`)]:``,style:Kse};return(0,M.jsx)(`span`,{...e,...i})}),qse={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},hR=_.createContext(null),gR=cR(`portal`);function Jse(e){e===void 0&&(e={});let{id:t,root:n}=e,r=aR(),i=Xse(),[a,o]=_.useState(null),s=_.useRef(null);return qL(()=>()=>{a?.remove(),queueMicrotask(()=>{s.current=null})},[a]),qL(()=>{if(!r||s.current)return;let e=t?document.getElementById(t):null;if(!e)return;let n=document.createElement(`div`);n.id=r,n.setAttribute(gR,``),e.appendChild(n),s.current=n,o(n)},[t,r]),qL(()=>{if(n===null||!r||s.current)return;let e=n||i?.portalNode;e&&!_d(e)&&(e=e.current),e||=document.body;let a=null;t&&(a=document.createElement(`div`),a.id=t,e.appendChild(a));let c=document.createElement(`div`);c.id=r,c.setAttribute(gR,``),e=a||e,e.appendChild(c),s.current=c,o(c)},[t,n,r,i]),a}function Yse(e){let{children:t,id:n,root:r,preserveTabOrder:i=!0}=e,a=Jse({id:n,root:r}),[o,s]=_.useState(null),c=_.useRef(null),l=_.useRef(null),u=_.useRef(null),d=_.useRef(null),f=o?.modal,p=o?.open,m=!!o&&!o.modal&&o.open&&i&&!!(r||a);return _.useEffect(()=>{if(!a||!i||f)return;function e(e){a&&QL(e)&&(e.type===`focusin`?$L:kse)(a)}return a.addEventListener(`focusin`,e,!0),a.addEventListener(`focusout`,e,!0),()=>{a.removeEventListener(`focusin`,e,!0),a.removeEventListener(`focusout`,e,!0)}},[a,i,f]),_.useEffect(()=>{a&&(p||$L(a))},[p,a]),(0,M.jsxs)(hR.Provider,{value:_.useMemo(()=>({preserveTabOrder:i,beforeOutsideRef:c,afterOutsideRef:l,beforeInsideRef:u,afterInsideRef:d,portalNode:a,setFocusManagerState:s}),[i,a]),children:[m&&a&&(0,M.jsx)(mR,{"data-type":`outside`,ref:c,onFocus:e=>{if(QL(e,a)){var t;(t=u.current)==null||t.focus()}else Ose(o?o.domReference:null)?.focus()}}),m&&a&&(0,M.jsx)(`span`,{"aria-owns":a.id,style:qse}),a&&ya.createPortal(t,a),m&&a&&(0,M.jsx)(mR,{"data-type":`outside`,ref:l,onFocus:e=>{if(QL(e,a)){var t;(t=d.current)==null||t.focus()}else Dse(o?o.domReference:null)?.focus(),o!=null&&o.closeOnFocusOut&&o?.onOpenChange(!1,e.nativeEvent,`focus-out`)}})]})}var Xse=()=>_.useContext(hR),Zse={pointerdown:`onPointerDown`,mousedown:`onMouseDown`,click:`onClick`},Qse={pointerdown:`onPointerDownCapture`,mousedown:`onMouseDownCapture`,click:`onClickCapture`},_R=e=>({escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0});function $se(e,t){t===void 0&&(t={});let{open:n,onOpenChange:r,elements:i,dataRef:a}=e,{enabled:o=!0,escapeKey:s=!0,outsidePress:c=!0,outsidePressEvent:l=`pointerdown`,referencePress:u=!1,referencePressEvent:d=`pointerdown`,ancestorScroll:f=!1,bubbles:p,capture:m}=t,h=sR(),g=YL(typeof c==`function`?c:()=>!1),v=typeof c==`function`?g:c,y=_.useRef(!1),{escapeKey:b,outsidePress:x}=_R(p),{escapeKey:S,outsidePress:C}=_R(m),w=_.useRef(!1),T=YL(e=>{if(!n||!o||!s||e.key!==`Escape`||w.current)return;let t=a.current.floatingContext?.nodeId,i=h?GL(h.nodesRef.current,t):[];if(!b&&(e.stopPropagation(),i.length>0)){let e=!0;if(i.forEach(t=>{var n;if((n=t.context)!=null&&n.open&&!t.context.dataRef.current.__escapeKeyBubbles){e=!1;return}}),!e)return}r(!1,wse(e)?e.nativeEvent:e,`escape-key`)}),E=YL(e=>{var t;let n=()=>{var t;T(e),(t=HL(e))==null||t.removeEventListener(`keydown`,n)};(t=HL(e))==null||t.addEventListener(`keydown`,n)}),D=YL(e=>{let t=a.current.insideReactTree;a.current.insideReactTree=!1;let n=y.current;if(y.current=!1,l===`click`&&n||t||typeof v==`function`&&!v(e))return;let o=HL(e),s=`[`+cR(`inert`)+`]`,c=WL(i.floating).querySelectorAll(s),u=vd(o)?o:null;for(;u&&!jd(u);){let e=Pd(u);if(jd(e)||!vd(e))break;u=e}if(c.length&&vd(o)&&!bse(o)&&!VL(o,i.floating)&&Array.from(c).every(e=>!VL(u,e)))return;if(yd(o)&&k){let t=jd(o),n=Md(o),r=/auto|scroll/,i=t||r.test(n.overflowX),a=t||r.test(n.overflowY),s=i&&o.clientWidth>0&&o.scrollWidth>o.clientWidth,c=a&&o.clientHeight>0&&o.scrollHeight>o.clientHeight,l=n.direction===`rtl`,u=c&&(l?e.offsetX<=o.offsetWidth-o.clientWidth:e.offsetX>o.clientWidth),d=s&&e.offsetY>o.clientHeight;if(u||d)return}let d=a.current.floatingContext?.nodeId,f=h&&GL(h.nodesRef.current,d).some(t=>UL(e,t.context?.elements.floating));if(UL(e,i.floating)||UL(e,i.domReference)||f)return;let p=h?GL(h.nodesRef.current,d):[];if(p.length>0){let e=!0;
167if(p.forEach(t=>{var n;if((n=t.context)!=null&&n.open&&!t.context.dataRef.current.__outsidePressBubbles){e=!1;return}}),!e)return}r(!1,e,`outside-press`)}),O=YL(e=>{var t;let n=()=>{var t;D(e),(t=HL(e))==null||t.removeEventListener(l,n)};(t=HL(e))==null||t.addEventListener(l,n)});_.useEffect(()=>{if(!n||!o)return;a.current.__escapeKeyBubbles=b,a.current.__outsidePressBubbles=x;let e=-1;function t(e){r(!1,e,`ancestor-scroll`)}function c(){window.clearTimeout(e),w.current=!0}function u(){e=window.setTimeout(()=>{w.current=!1},Ad()?5:0)}let d=WL(i.floating);s&&(d.addEventListener(`keydown`,S?E:T,S),d.addEventListener(`compositionstart`,c),d.addEventListener(`compositionend`,u)),v&&d.addEventListener(l,C?O:D,C);let p=[];return f&&(vd(i.domReference)&&(p=Id(i.domReference)),vd(i.floating)&&(p=p.concat(Id(i.floating))),!vd(i.reference)&&i.reference&&i.reference.contextElement&&(p=p.concat(Id(i.reference.contextElement)))),p=p.filter(e=>e!==d.defaultView?.visualViewport),p.forEach(e=>{e.addEventListener(`scroll`,t,{passive:!0})}),()=>{s&&(d.removeEventListener(`keydown`,S?E:T,S),d.removeEventListener(`compositionstart`,c),d.removeEventListener(`compositionend`,u)),v&&d.removeEventListener(l,C?O:D,C),p.forEach(e=>{e.removeEventListener(`scroll`,t)}),window.clearTimeout(e)}},[a,i,s,v,l,n,r,f,o,b,x,T,S,E,D,C,O]),_.useEffect(()=>{a.current.insideReactTree=!1},[a,v,l]);let ee=_.useMemo(()=>({onKeyDown:T,...u&&{[Zse[d]]:e=>{r(!1,e.nativeEvent,`reference-press`)},...d!==`click`&&{onClick(e){r(!1,e.nativeEvent,`reference-press`)}}}}),[T,r,u,d]),k=_.useMemo(()=>{function e(e){e.button===0&&(y.current=!0)}return{onKeyDown:T,onMouseDown:e,onMouseUp:e,[Qse[l]]:()=>{a.current.insideReactTree=!0}}},[T,l,a]);return _.useMemo(()=>o?{reference:ee,floating:k}:{},[o,ee,k])}function ece(e){let{open:t=!1,onOpenChange:n,elements:r}=e,i=aR(),a=_.useRef({}),[o]=_.useState(()=>Bse()),s=oR()!=null,[c,l]=_.useState(r.reference),u=YL((e,t,r)=>{a.current.openEvent=e?t:void 0,o.emit(`openchange`,{open:e,event:t,reason:r,nested:s}),n?.(e,t,r)}),d=_.useMemo(()=>({setPositionReference:l}),[]),f=_.useMemo(()=>({reference:c||r.reference||null,floating:r.floating||null,domReference:r.reference}),[c,r.reference,r.floating]);return _.useMemo(()=>({dataRef:a,open:t,onOpenChange:u,elements:f,events:o,floatingId:i,refs:d}),[t,u,f,o,i,d])}function tce(e){e===void 0&&(e={});let{nodeId:t}=e,n=ece({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,i=r.elements,[a,o]=_.useState(null),[s,c]=_.useState(null),l=i?.domReference||a,u=_.useRef(null),d=sR();qL(()=>{l&&(u.current=l)},[l]);let f=Of({...e,elements:{...i,...s&&{reference:s}}}),p=_.useCallback(e=>{let t=vd(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;c(t),f.refs.setReference(t)},[f.refs]),m=_.useCallback(e=>{(vd(e)||e===null)&&(u.current=e,o(e)),(vd(f.refs.reference.current)||f.refs.reference.current===null||e!==null&&!vd(e))&&f.refs.setReference(e)},[f.refs]),h=_.useMemo(()=>({...f.refs,setReference:m,setPositionReference:p,domReference:u}),[f.refs,m,p]),g=_.useMemo(()=>({...f.elements,domReference:l}),[f.elements,l]),v=_.useMemo(()=>({...f,...r,refs:h,elements:g,nodeId:t}),[f,h,g,t,r]);return qL(()=>{r.dataRef.current.floatingContext=v;let e=d?.nodesRef.current.find(e=>e.id===t);e&&(e.context=v)}),_.useMemo(()=>({...f,context:v,refs:h,elements:g}),[f,h,g,v])}function vR(){return _se()&&RL()}function nce(e,t){t===void 0&&(t={});let{open:n,onOpenChange:r,events:i,dataRef:a,elements:o}=e,{enabled:s=!0,visibleOnly:c=!0}=t,l=_.useRef(!1),u=_.useRef(-1),d=_.useRef(!0);_.useEffect(()=>{if(!s)return;let e=hd(o.domReference);function t(){!n&&yd(o.domReference)&&o.domReference===BL(WL(o.domReference))&&(l.current=!0)}function r(){d.current=!0}function i(){d.current=!1}return e.addEventListener(`blur`,t),vR()&&(e.addEventListener(`keydown`,r,!0),e.addEventListener(`pointerdown`,i,!0)),()=>{e.removeEventListener(`blur`,t),vR()&&(e.removeEventListener(`keydown`,r,!0),e.removeEventListener(`pointerdown`,i,!0))}},[o.domReference,n,s]),_.useEffect(()=>{if(!s)return;function e(e){let{reason:t}=e;(t===`reference-press`||t===`escape-key`)&&(l.current=!0)}return i.on(`openchange`,e),()=>{i.off(`openchange`,e)}},[i,s]),_.useEffect(()=>()=>{lR(u)},[]);let f=_.useMemo(()=>({onMouseLeave(){l.current=!1},onFocus(e){if(l.current)return;let t=HL(e.nativeEvent);if(c&&vd(t)){if(vR()&&!e.relatedTarget){if(!d.current&&!xse(t))return}else if(!Sse(t))return}r(!0,e.nativeEvent,`focus`)},onBlur(e){l.current=!1;let t=e.relatedTarget,n=e.nativeEvent,i=vd(t)&&t.hasAttribute(cR(`focus-guard`))&&t.getAttribute(`data-type`)===`outside`;u.current=window.setTimeout(()=>{let e=BL(o.domReference?o.domReference.ownerDocument:document);!t&&e===o.domReference||VL(a.current.floatingContext?.refs.floating.current,e)||VL(o.domReference,e)||i||r(!1,n,`focus`)})}}),[a,o.domReference,r,c]);return _.useMemo(()=>s?{reference:f}:{},[s,f])}function yR(e,t,n){let r=new Map,i=n===`item`,a=e;if(i&&e){let{[tR]:t,[nR]:n,...r}=e;a=r}return{...n===`floating`&&{tabIndex:-1,[Ase]:``},...a,...t.map(t=>{let r=t?t[n]:null;return typeof r==`function`?e?r(e):null:r}).concat(e).reduce((e,t)=>
167(t&&Object.entries(t).forEach(t=>{let[n,a]=t;if(!(i&&[tR,nR].includes(n)))if(n.indexOf(`on`)===0){if(r.has(n)||r.set(n,[]),typeof a==`function`){var o;(o=r.get(n))==null||o.push(a),e[n]=function(){var e=[...arguments];return r.get(n)?.map(t=>t(...e)).find(e=>e!==void 0)}}}else e[n]=a}),e),{})}}function rce(e){e===void 0&&(e=[]);let t=e.map(e=>e?.reference),n=e.map(e=>e?.floating),r=e.map(e=>e?.item),i=_.useCallback(t=>yR(t,e,`reference`),t),a=_.useCallback(t=>yR(t,e,`floating`),n),o=_.useCallback(t=>yR(t,e,`item`),r);return _.useMemo(()=>({getReferenceProps:i,getFloatingProps:a,getItemProps:o}),[i,a,o])}var ice=new Map([[`select`,`listbox`],[`combobox`,`listbox`],[`label`,!1]]);function ace(e,t){t===void 0&&(t={});let{open:n,elements:r,floatingId:i}=e,{enabled:a=!0,role:o=`dialog`}=t,s=aR(),c=r.domReference?.id||s,l=_.useMemo(()=>Cse(r.floating)?.id||i,[r.floating,i]),u=ice.get(o)??o,d=oR()!=null,f=_.useMemo(()=>u===`tooltip`||o===`label`?{[`aria-`+(o===`label`?`labelledby`:`describedby`)]:n?l:void 0}:{"aria-expanded":n?`true`:`false`,"aria-haspopup":u===`alertdialog`?`dialog`:u,"aria-controls":n?l:void 0,...u===`listbox`&&{role:`combobox`},...u===`menu`&&{id:c},...u===`menu`&&d&&{role:`menuitem`},...o===`select`&&{"aria-autocomplete":`none`},...o===`combobox`&&{"aria-autocomplete":`list`}},[u,l,d,n,c,o]),p=_.useMemo(()=>{let e={id:l,...u&&{role:u}};return u===`tooltip`||o===`label`?e:{...e,...u===`menu`&&{"aria-labelledby":c}}},[u,l,c,o]),m=_.useCallback(e=>{let{active:t,selected:n}=e,r={role:`option`,...t&&{id:l+`-fui-option`}};switch(o){case`select`:case`combobox`:return{...r,"aria-selected":n}}return{}},[l,o]);return _.useMemo(()=>a?{reference:f,floating:p,item:m}:{},[a,f,p,m])}function oce({initialOpen:e=!1,placement:t=`top`,open:n,onOpenChange:r,delay:i=600,closeDelay:a=0}={}){let[o,s]=(0,_.useState)(e),c=n??o,l=r??s,u=tce({placement:t,open:c,onOpenChange:l,whileElementsMounted:mf,middleware:[Af(4),Nf({crossAxis:t.includes(`-`),fallbackAxisSideDirection:`start`,padding:4}),jf({padding:4})]}),d=u.context,f=rce([Use(d,{mouseOnly:!0,move:!1,restMs:i,enabled:n==null,delay:{close:a}}),nce(d,{enabled:n==null}),$se(d),ace(d,{role:`tooltip`})]);return(0,_.useMemo)(()=>({open:c,setOpen:l,...f,...u}),[c,l,f,u])}var bR=(0,_.createContext)(null);function xR(){let e=(0,_.useContext)(bR);if(e==null)throw Error(`Tooltip components must be wrapped in <TooltipProvider />`);return e}function SR({children:e,...t}){let n=oce(t);return t.useDelayGroup?(0,M.jsx)(Gse,{delay:{open:t.delay??0,close:t.closeDelay??0},timeoutMs:t.timeout,children:(0,M.jsx)(bR.Provider,{value:n,children:e})}):(0,M.jsx)(bR.Provider,{value:n,children:e})}var CR=(0,_.forwardRef)(function({children:e,asChild:t=!1,...n},r){let i=xR(),a=(0,_.isValidElement)(e)?parseInt(_.version,10)>=19?e.props.ref:e.ref:void 0,o=eR([i.refs.setReference,r,a]);if(t&&(0,_.isValidElement)(e)){let t={"data-tooltip-state":i.open?`open`:`closed`};return(0,_.cloneElement)(e,i.getReferenceProps({ref:o,...n,...typeof e.props==`object`?e.props:{},...t}))}return(0,M.jsx)(`button`,{ref:o,"data-tooltip-state":i.open?`open`:`closed`,...i.getReferenceProps(n),children:e})}),wR=(0,_.forwardRef)(function({style:e,children:t,portal:n=!0,portalProps:r={},...i},a){let o=xR(),s=eR([o.refs.setFloating,a]);if(!o.open)return null;let c=(0,M.jsx)(`div`,{ref:s,style:{...o.floatingStyles,...e},...o.getFloatingProps(i),className:`tiptap-tooltip`,children:t});return n?(0,M.jsx)(Yse,{...r,children:c}):c});SR.displayName=`Tooltip`,CR.displayName=`TooltipTrigger`,wR.displayName=`TooltipContent`;var TR,ER;if(typeof WeakMap<`u`){let e=new WeakMap;TR=t=>e.get(t),ER=(t,n)=>(e.set(t,n),n)}else{let e=[],t=0;TR=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},ER=(n,r)=>(t==10&&(t=0),e[t++]=n,e[t++]=r)}var DR=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){let n=this.map[t];if(n!=e)continue;let r=t%this.width,i=t/this.width|0,a=r+1,o=i+1;for(let e=1;a<this.width&&this.map[t+e]==n;e++)a++;for(let e=1;o<this.height&&this.map[t+this.width*e]==n;e++)o++;return{left:r,top:i,right:a,bottom:o}}throw RangeError(`No cell with offset ${e}
167 found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){let{left:r,right:i,top:a,bottom:o}=this.findCell(e);return t==`horiz`?(n<0?r==0:i==this.width)?null:this.map[a*this.width+(n<0?r-1:i)]:(n<0?a==0:o==this.height)?null:this.map[r+this.width*(n<0?a-1:o)]}rectBetween(e,t){let{left:n,right:r,top:i,bottom:a}=this.findCell(e),{left:o,right:s,top:c,bottom:l}=this.findCell(t);return{left:Math.min(n,o),top:Math.min(i,c),right:Math.max(r,s),bottom:Math.max(a,l)}}cellsInRect(e){let t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let i=e.left;i<e.right;i++){let a=r*this.width+i,o=this.map[a];n[o]||(n[o]=!0,!(i==e.left&&i&&this.map[a-1]==o||r==e.top&&r&&this.map[a-this.width]==o)&&t.push(o))}return t}positionAt(e,t,n){for(let r=0,i=0;;r++){let a=i+n.child(r).nodeSize;if(r==e){let n=t+e*this.width,r=(e+1)*this.width;for(;n<r&&this.map[n]<i;)n++;return n==r?a-1:this.map[n]}i=a}}static get(e){return TR(e)||ER(e,sce(e))}};function sce(e){if(e.type.spec.tableRole!=`table`)throw RangeError(`Not a table node: `+e.type.name);let t=cce(e),n=e.childCount,r=[],i=0,a=null,o=[];for(let e=0,i=t*n;e<i;e++)r[e]=0;for(let s=0,c=0;s<n;s++){let l=e.child(s);c++;for(let e=0;;e++){for(;i<r.length&&r[i]!=0;)i++;if(e==l.childCount)break;let u=l.child(e),{colspan:d,rowspan:f,colwidth:p}=u.attrs;for(let e=0;e<f;e++){if(e+s>=n){(a||=[]).push({type:`overlong_rowspan`,pos:c,n:f-e});break}let l=i+e*t;for(let e=0;e<d;e++){r[l+e]==0?r[l+e]=c:(a||=[]).push({type:`collision`,row:s,pos:c,n:d-e});let n=p&&p[e];if(n){let r=(l+e)%t*2,i=o[r];i==null||i!=n&&o[r+1]==1?(o[r]=n,o[r+1]=1):i==n&&o[r+1]++}}}i+=d,c+=u.nodeSize}let u=(s+1)*t,d=0;for(;i<u;)r[i++]==0&&d++;d&&(a||=[]).push({type:`missing`,row:s,n:d}),c++}(t===0||n===0)&&(a||=[]).push({type:`zero_sized`});let s=new DR(t,n,r,a),c=!1;for(let e=0;!c&&e<o.length;e+=2)o[e]!=null&&o[e+1]<n&&(c=!0);return c&&lce(s,o,e),s}function cce(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){let i=e.child(r),a=0;if(n)for(let t=0;t<r;t++){let n=e.child(t);for(let e=0;e<n.childCount;e++){let i=n.child(e);t+i.attrs.rowspan>r&&(a+=i.attrs.colspan)}}for(let e=0;e<i.childCount;e++){let t=i.child(e);a+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}t==-1?t=a:t!=a&&(t=Math.max(t,a))}return t}function lce(e,t,n){e.problems||=[];let r={};for(let i=0;i<e.map.length;i++){let a=e.map[i];if(r[a])continue;r[a]=!0;let o=n.nodeAt(a);if(!o)throw RangeError(`No cell with offset ${a} found`);let s=null,c=o.attrs;for(let n=0;n<c.colspan;n++){let r=t[(i+n)%e.width*2];r!=null&&(!c.colwidth||c.colwidth[n]!=r)&&((s||=uce(c))[n]=r)}s&&e.problems.unshift({type:`colwidth mismatch`,pos:a,colwidth:s})}}function uce(e){if(e.colwidth)return e.colwidth.slice();let t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function OR(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(let n in e.nodes){let r=e.nodes[n],i=r.spec.tableRole;i&&(t[i]=r)}}return t}new xO(`selectingCells`);function dce(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole==`row`)return e.node(0).resolve(e.before(t+1));return null}function kR(e){let t=e.selection.$head;for(let e=t.depth;e>0;e--)if(t.node(e).type.spec.tableRole==`row`)return!0;return!1}function fce(e){let t=e.selection;if(`$anchorCell`in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if(`node`in t&&t.node&&t.node.type.spec.tableRole==`cell`)return t.$anchor;let n=dce(t.$head)||pce(t.$head);if(n)return n;throw RangeError(`No cell found around position ${t.head}`)}function pce(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n-t.nodeSize)}}function AR(e){return e.parent.type.spec.tableRole==`row`&&!!e.nodeAfter}function jR(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function MR(e,t,n){let r=e.node(-1),i=DR.get(r),a=e.start(-1),o=i.nextCell(e.pos-a,t,n);return o==null?null:e.node(0).resolve(a+o)}function NR(e,t,n=1){let r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(e=>e>0)||(r.colwidth=null)),r}var PR=class e extends ZD{constructor(e,t=e){let n=e.node(-1),r=DR.get(n),i=e.start(-1),a=r.rectBetween(e.pos-i,t.pos-i),o=e.node(0),s=r.cellsInRect(a).filter(e=>e!=t.pos-i);s.unshift(t.pos-i);let c=s.map(e=>{let t=n.nodeAt(e);if(!t)throw RangeError(`No cell with offset ${e}
167 found`);let r=i+e+1;return new QD(o.resolve(r),o.resolve(r+t.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(t,n){let r=t.resolve(n.map(this.$anchorCell.pos)),i=t.resolve(n.map(this.$headCell.pos));if(AR(r)&&AR(i)&&jR(r,i)){let t=this.$anchorCell.node(-1)!=r.node(-1);return t&&this.isRowSelection()?e.rowSelection(r,i):t&&this.isColSelection()?e.colSelection(r,i):new e(r,i)}return tO.between(r,i)}content(){let e=this.$anchorCell.node(-1),t=DR.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),i={},a=[];for(let n=r.top;n<r.bottom;n++){let o=[];for(let a=n*t.width+r.left,s=r.left;s<r.right;s++,a++){let n=t.map[a];if(i[n])continue;i[n]=!0;let s=t.findCell(n),c=e.nodeAt(n);if(!c)throw RangeError(`No cell with offset ${n} found`);let l=r.left-s.left,u=s.right-r.right;if(l>0||u>0){let e=c.attrs;if(l>0&&(e=NR(e,0,l)),u>0&&(e=NR(e,e.colspan-u,u)),s.left<r.left){if(c=c.type.createAndFill(e),!c)throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else c=c.type.create(e,c.content)}if(s.top<r.top||s.bottom>r.bottom){let e={...c.attrs,rowspan:Math.min(s.bottom,r.bottom)-Math.max(s.top,r.top)};c=s.top<r.top?c.type.createAndFill(e):c.type.create(e,c.content)}o.push(c)}a.push(e.child(n).copy(V.from(o)))}let o=this.isColSelection()&&this.isRowSelection()?e:a;return new H(V.from(o),1,1)}replace(e,t=H.empty){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);e.replace(s.map(a.pos),s.map(o.pos),i?H.empty:t)}let i=ZD.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new H(V.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),n=DR.get(t),r=this.$anchorCell.start(-1),i=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let n=0;n<i.length;n++)e(t.nodeAt(i[n]),r+i[n])}isColSelection(){let e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;let n=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){let r=t.node(-1),i=DR.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.top<=s.top?(o.top>0&&(t=c.resolve(a+i.map[o.left])),s.bottom<i.height&&(n=c.resolve(a+i.map[i.width*(i.height-1)+s.right-1]))):(s.top>0&&(n=c.resolve(a+i.map[s.left])),o.bottom<i.height&&(t=c.resolve(a+i.map[i.width*(i.height-1)+o.right-1]))),new e(t,n)}isRowSelection(){let e=this.$anchorCell.node(-1),t=DR.get(e),n=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-n),i=t.colCount(this.$headCell.pos-n);if(Math.min(r,i)>0)return!1;let a=r+this.$anchorCell.nodeAfter.attrs.colspan,o=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(a,o)==t.width}eq(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){let r=t.node(-1),i=DR.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.left<=s.left?(o.left>0&&(t=c.resolve(a+i.map[o.top*i.width])),s.right<i.width&&(n=c.resolve(a+i.map[i.width*(s.top+1)-1]))):(s.left>0&&(n=c.resolve(a+i.map[s.top*i.width])),o.right<i.width&&(t=c.resolve(a+i.map[i.width*(o.top+1)-1]))),new e(t,n)}toJSON(){return{type:`cell`,anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new e(t.resolve(n),t.resolve(r))}getBookmark(){return new mce(this.$anchorCell.pos,this.$headCell.pos)}};PR.prototype.visible=!1,ZD.jsonID(`cell`,PR);var mce=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){let t=e.resolve(this.anchor),n=e.resolve(this.head);return t.parent.type.spec.tableRole==`row`&&n.parent.type.spec.tableRole==`row`&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&jR(t,n)?new PR(t,n):ZD.near(n,1)}};new xO(`fix-tables`);function FR(e){let t=e.selection,n=fce(e),r=n.node(-1),i=n.start(-1),a=DR.get(r);return{...t instanceof PR?a.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):a.findCell(n.pos-i),tableStart:i,map:a,table:r}}function hce(e){return function(t,n){if(!kR(t))return!1;if(n){let r=OR(t.schema),i=FR(t),a=t.tr,o=i.map.cellsInRect(e==`column`?{left:i.left,top:0,right:i.right,bottom:i.map.height}:e==`row`?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),s=o.map(e=>i.table.nodeAt(e));for(let e=0;e<o.length;e++)s[e].type==r.header_cell&&a.setNodeMarkup(i.tableStart+o[e],r.cell,s[e].attrs);if(a.steps.length===0)for(let e=0;e<o.length;e++)a.setNodeMarkup(i.tableStart+o[e],r.header_cell,s[e].attrs);n(a)}return!0}}
167function IR(e,t,n){let r=t.map.cellsInRect({left:0,top:0,right:e==`row`?t.map.width:1,bottom:e==`column`?t.map.height:1});for(let e=0;e<r.length;e++){let i=t.table.nodeAt(r[e]);if(i&&i.type!==n.header_cell)return!1}return!0}function LR(e,t){return t||={useDeprecatedLogic:!1},t.useDeprecatedLogic?hce(e):function(t,n){if(!kR(t))return!1;if(n){let r=OR(t.schema),i=FR(t),a=t.tr,o=IR(`row`,i,r),s=IR(`column`,i,r),c=(e===`column`?o:e===`row`&&s)?1:0,l=e==`column`?{left:0,top:c,right:1,bottom:i.map.height}:e==`row`?{left:c,top:0,right:i.map.width,bottom:1}:i,u=e==`column`?s?r.cell:r.header_cell:e==`row`?o?r.cell:r.header_cell:r.cell;i.map.cellsInRect(l).forEach(e=>{let t=e+i.tableStart,n=a.doc.nodeAt(t);n&&a.setNodeMarkup(t,u,n.attrs)}),n(a)}return!0}}LR(`row`,{useDeprecatedLogic:!0}),LR(`column`,{useDeprecatedLogic:!0}),LR(`cell`,{useDeprecatedLogic:!0});function RR(e,t){let n=e.selection;if(!(n instanceof PR))return!1;if(t){let r=e.tr,i=OR(e.schema).cell.createAndFill().content;n.forEachCell((e,t)=>{e.content.eq(i)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new H(i,0,0))}),r.docChanged&&t(r)}return!0}KM({ArrowLeft:BR(`horiz`,-1),ArrowRight:BR(`horiz`,1),ArrowUp:BR(`vert`,-1),ArrowDown:BR(`vert`,1),"Shift-ArrowLeft":VR(`horiz`,-1),"Shift-ArrowRight":VR(`horiz`,1),"Shift-ArrowUp":VR(`vert`,-1),"Shift-ArrowDown":VR(`vert`,1),Backspace:RR,"Mod-Backspace":RR,Delete:RR,"Mod-Delete":RR});function zR(e,t,n){return n.eq(e.selection)?!1:(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function BR(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection;if(a instanceof PR)return zR(n,r,ZD.near(a.$headCell,t));if(e!=`horiz`&&!a.empty)return!1;let o=HR(i,e,t);if(o==null)return!1;if(e==`horiz`)return zR(n,r,ZD.near(n.doc.resolve(a.head+t),t));{let i=n.doc.resolve(o),a=MR(i,e,t),s;return s=a?ZD.near(a,1):t<0?ZD.near(n.doc.resolve(i.before(-1)),-1):ZD.near(n.doc.resolve(i.after(-1)),1),zR(n,r,s)}}}function VR(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection,o;if(a instanceof PR)o=a;else{let r=HR(i,e,t);if(r==null)return!1;o=new PR(n.doc.resolve(r))}let s=MR(o.$headCell,e,t);return s?zR(n,r,new PR(o.$anchorCell,s)):!1}}function HR(e,t,n){if(!(e.state.selection instanceof tO))return null;let{$head:r}=e.state.selection;for(let i=r.depth-1;i>=0;i--){let a=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:a.childCount))return null;if(a.type.spec.tableRole==`cell`||a.type.spec.tableRole==`header_cell`){let a=r.before(i),o=t==`vert`?n>0?`down`:`up`:n>0?`right`:`left`;return e.endOfTextblock(o)?a:null}}return null}new xO(`tableColumnResizing`);var gce=5*1024*1024,_ce={mod:`â`,command:`â`,meta:`â`,ctrl:`â`,control:`â`,alt:`â¥`,option:`â¥`,shift:`â§`,backspace:`Del`,delete:`â¦`,enter:`â`,escape:`â`,capslock:`âª`};function UR(...e){return e.filter(Boolean).join(` `)}function vce(){return typeof navigator<`u`&&navigator.platform.toLowerCase().includes(`mac`)}var yce=(e,t,n=!0)=>t?_ce[e.toLowerCase()]||(n?e.toUpperCase():e):n?e.charAt(0).toUpperCase()+e.slice(1):e,WR=e=>{let{shortcutKeys:t,delimiter:n=`+`,capitalize:r=!0}=e;return t?t.split(n).map(e=>e.trim()).map(e=>yce(e,vce(),r)):[]},GR=(e,t)=>t?.schema?t.schema.spec.marks.get(e)!==void 0:!1,KR=(e,t)=>t?.schema?t.schema.spec.nodes.get(e)!==void 0:!1;function bce(e){let{state:t,view:n}=e,{doc:r,selection:i}=t,a=ZD.findFrom(i.$to,1,!0);if(a)return n.dispatch(t.tr.setSelection(a).scrollIntoView()),!0;let o=t.schema.nodes.paragraph;if(!o)return console.warn(`No paragraph node type found in schema.`),!1;let s=r.content.size,c=o.create(),l=t.tr.insert(s,c),u=l.doc.resolve(s+1);return l=l.setSelection(tO.near(u)).scrollIntoView(),n.dispatch(l),!0}function qR(e){return typeof e==`number`&&e>=0}function JR(e,t){if(!e)return!1;let n=Array.isArray(t)?t:[t],r=n.some(t=>e.extensionManager.extensions.some(e=>e.name===t));return r||console.warn(`None of the extensions [${n.join(`, `)}] were found in the editor schema. Ensure they are included in the editor configuration.`),r}function xce(e,t){try{return e.state.doc.nodeAt(t)||(console.warn(`No node found at position ${t}`),null)}catch(e){return console.error(`Error getting node at position ${t}:`,e),null}}function YR(e){let{editor:t,node:n,nodePos:r}=e;if(!t||!t.state?.doc)return null;let i=n!=null,a=qR(r);if(!i&&!a)return null;if(i){let e=-1,r=null;if(t.state.doc.descendants((t,i)=>t===n?(e=i,r=t,!1):!0),e!==-1&&r!==null)return{pos:e,node:r}}if(a){let e=xce(t,r);
167if(e)return{pos:r,node:e}}return null}function XR(e,t=[],n=!1){if(!e||!e.state.selection)return!1;let{selection:r}=e.state;if(r.empty)return!1;if(r instanceof U){let e=r.node;return e?t.includes(e.type.name):!1}if(n){let{$from:e}=r;for(let n=e.depth;n>0;n--){let r=e.node(n);if(t.includes(r.type.name))return!0}}return!1}function ZR(e,t=[]){if(!e||t.length===0)return!1;let{state:n}=e,{selection:r}=n,i=new Set(t);if(r instanceof U){let e=r.node?.type?.name;return!!e&&i.has(e)}if(r instanceof tO||r instanceof iO){let e=!0;return n.doc.nodesBetween(r.from,r.to,t=>t.isTextblock&&!i.has(t.type.name)?(e=!1,!1):e),e}return!1}var Sce=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function Cce(e,t){let n=[`http`,`https`,`ftp`,`ftps`,`mailto`,`tel`,`callto`,`sms`,`cid`,`xmpp`];return t&&t.forEach(e=>{let t=typeof e==`string`?e:e.scheme;t&&n.push(t)}),!e||e.replace(Sce,``).match(RegExp(`^(?:(?:${n.join(`|`)}):|[^a-z]|[a-z0-9+.\-]+(?:[^a-z+.\-:]|$))`,`i`))}function wce(e,t,n){try{let r=new URL(e,t);if(Cce(r.href,n))return r.href}catch{}return`#`}function QR(e){let{doc:t}=e.state,{from:n,to:r}=e.state.selection,i=[],a=new Set;return t.nodesBetween(n,r,(e,t)=>{if(e.isBlock)return a.has(t)||(a.add(t),i.push(e)),!1}),i}var Tce=({shortcuts:e})=>e.length===0?null:(0,M.jsx)(`div`,{children:e.map((e,t)=>(0,M.jsxs)(_.Fragment,{children:[t>0&&(0,M.jsx)(`kbd`,{children:`+`}),(0,M.jsx)(`kbd`,{children:e})]},t))}),$R=(0,_.forwardRef)(({className:e,children:t,tooltip:n,showTooltip:r=!0,shortcutKeys:i,variant:a,size:o,...s},c)=>{let l=(0,_.useMemo)(()=>WR({shortcutKeys:i}),[i]);return!n||!r?(0,M.jsx)(`button`,{"data-slot":`tiptap-button`,className:UR(`tiptap-button`,e),ref:c,"data-style":a,"data-size":o,...s,children:t}):(0,M.jsxs)(SR,{delay:200,children:[(0,M.jsx)(CR,{"data-slot":`tiptap-button`,className:UR(`tiptap-button`,e),ref:c,"data-style":a,"data-size":o,...s,children:t}),(0,M.jsxs)(wR,{children:[n,(0,M.jsx)(Tce,{shortcuts:l})]})]})});$R.displayName=`Button`;var ez=(0,_.memo)(({className:e,...t})=>(0,M.jsx)(`svg`,{width:`24`,height:`24`,className:e,viewBox:`0 0 24 24`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,...t,children:(0,M.jsx)(`path`,{d:`M18.7071 6.70711C19.0976 6.31658 19.0976 5.68342 18.7071 5.29289C18.3166 4.90237 17.6834 4.90237 17.2929 5.29289L12 10.5858L6.70711 5.29289C6.31658 4.90237 5.68342 4.90237 5.29289 5.29289C4.90237 5.68342 4.90237 6.31658 5.29289 6.70711L10.5858 12L5.29289 17.2929C4.90237 17.6834 4.90237 18.3166 5.29289 18.7071C5.68342 19.0976 6.31658 19.0976 6.70711 18.7071L12 13.4142L17.2929 18.7071C17.6834 19.0976 18.3166 19.0976 18.7071 18.7071C19.0976 18.3166 19.0976 17.6834 18.7071 17.2929L13.4142 12L18.7071 6.70711Z`,fill:`currentColor`})}));ez.displayName=`CloseIcon`;function Ece(e){let[t,n]=(0,_.useState)([]),r=async t=>{if(t.size>e.maxSize){let t=Error(`File size exceeds maximum allowed (${e.maxSize/1024/1024}MB)`);return e.onError?.(t),null}let r=new AbortController,i=crypto.randomUUID(),a={id:i,file:t,progress:0,status:`uploading`,abortController:r};n(e=>[...e,a]);try{if(!e.upload)throw Error(`Upload function is not defined`);let a=await e.upload(t,e=>{n(t=>t.map(t=>t.id===i?{...t,progress:e.progress}:t))},r.signal);if(!a)throw Error(`Upload failed: No URL returned`);return r.signal.aborted?null:(n(e=>e.map(e=>e.id===i?{...e,status:`success`,url:a,progress:100}:e)),e.onSuccess?.(a),a)}catch(t){return r.signal.aborted||(n(e=>e.map(e=>e.id===i?{...e,status:`error`,progress:0}:e)),e.onError?.(t instanceof Error?t:Error(`Upload failed`))),null}};return{fileItems:t,uploadFiles:async t=>{if(!t||t.length===0)return e.onError?.(Error(`No files to upload`)),[];if(e.limit&&t.length>e.limit)return e.onError?.(Error(`Maximum ${e.limit} file${e.limit===1?``:`s`} allowed`)),[];let n=t.map(e=>r(e));return(await Promise.all(n)).filter(e=>e!==null)},removeFileItem:e=>{n(t=>{let n=t.find(t=>t.id===e);return n?.abortController&&n.abortController.abort(),n?.url&&URL.revokeObjectURL(n.url),t.filter(t=>t.id!==e)})},clearAllFiles:()=>{t.forEach(e=>{e.abortController&&e.abortController.abort(),e.url&&URL.revokeObjectURL(e.url)}),n([])}}}var tz=()=>(0,M.jsxs)(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,className:`tiptap-image-upload-icon`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,M.jsx)(`path`,{d:`M11.1953 4.41771C10.3478 4.08499 9.435
16778 3.94949 8.5282 4.02147C7.62062 4.09345 6.74133 4.37102 5.95691 4.83316C5.1725 5.2953 4.50354 5.92989 4.00071 6.68886C3.49788 7.44783 3.17436 8.31128 3.05465 9.2138C2.93495 10.1163 3.0222 11.0343 3.3098 11.8981C3.5974 12.7619 4.07781 13.5489 4.71463 14.1995C5.10094 14.5942 5.09414 15.2274 4.69945 15.6137C4.30476 16 3.67163 15.9932 3.28532 15.5985C2.43622 14.731 1.79568 13.6816 1.41221 12.5299C1.02875 11.3781 0.91241 10.1542 1.07201 8.95084C1.23162 7.74748 1.66298 6.59621 2.33343 5.58425C3.00387 4.57229 3.89581 3.72617 4.9417 3.10998C5.98758 2.4938 7.15998 2.1237 8.37008 2.02773C9.58018 1.93176 10.7963 2.11243 11.9262 2.55605C13.0561 2.99968 14.0703 3.69462 14.8919 4.58825C15.5423 5.29573 16.0585 6.11304 16.4177 7.00002H17.4999C18.6799 6.99991 19.8288 7.37933 20.7766 8.08222C21.7245 8.78515 22.4212 9.7743 22.7637 10.9036C23.1062 12.0328 23.0765 13.2423 22.6788 14.3534C22.2812 15.4644 21.5367 16.4181 20.5554 17.0736C20.0962 17.3803 19.4752 17.2567 19.1684 16.7975C18.8617 16.3382 18.9853 15.7172 19.4445 15.4105C20.069 14.9934 20.5427 14.3865 20.7958 13.6794C21.0488 12.9724 21.0678 12.2027 20.8498 11.4841C20.6318 10.7655 20.1885 10.136 19.5853 9.6887C18.9821 9.24138 18.251 8.99993 17.5001 9.00002H15.71C15.2679 9.00002 14.8783 8.70973 14.7518 8.28611C14.4913 7.41374 14.0357 6.61208 13.4195 5.94186C12.8034 5.27164 12.0427 4.75043 11.1953 4.41771Z`,fill:`currentColor`}),(0,M.jsx)(`path`,{d:`M11 14.4142V21C11 21.5523 11.4477 22 12 22C12.5523 22 13 21.5523 13 21V14.4142L15.2929 16.7071C15.6834 17.0976 16.3166 17.0976 16.7071 16.7071C17.0976 16.3166 17.0976 15.6834 16.7071 15.2929L12.7078 11.2936C12.7054 11.2912 12.703 11.2888 12.7005 11.2864C12.5208 11.1099 12.2746 11.0008 12.003 11L12 11L11.997 11C11.8625 11.0004 11.7343 11.0273 11.6172 11.0759C11.502 11.1236 11.3938 11.1937 11.2995 11.2864C11.297 11.2888 11.2946 11.2912 11.2922 11.2936L7.29289 15.2929C6.90237 15.6834 6.90237 16.3166 7.29289 16.7071C7.68342 17.0976 8.31658 17.0976 8.70711 16.7071L11 14.4142Z`,fill:`currentColor`})]}),Dce=()=>(0,M.jsx)(`svg`,{width:`43`,height:`57`,viewBox:`0 0 43 57`,fill:`currentColor`,className:`tiptap-image-upload-dropzone-rect-primary`,xmlns:`http://www.w3.org/2000/svg`,children:(0,M.jsx)(`path`,{d:`M0.75 10.75C0.75 5.64137 4.89137 1.5 10 1.5H32.3431C33.2051 1.5 34.0317 1.84241 34.6412 2.4519L40.2981 8.10876C40.9076 8.71825 41.25 9.5449 41.25 10.4069V46.75C41.25 51.8586 37.1086 56 32 56H10C4.89137 56 0.75 51.8586 0.75 46.75V10.75Z`,fill:`currentColor`,fillOpacity:`0.11`,stroke:`currentColor`,strokeWidth:`1.5`})}),Oce=()=>(0,M.jsx)(`svg`,{width:`10`,height:`10`,className:`tiptap-image-upload-dropzone-rect-secondary`,viewBox:`0 0 10 10`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,children:(0,M.jsx)(`path`,{d:`M0 0.75H0.343146C1.40401 0.75 2.42143 1.17143 3.17157 1.92157L8.82843 7.57843C9.57857 8.32857 10 9.34599 10 10.4069V10.75H4C1.79086 10.75 0 8.95914 0 6.75V0.75Z`,fill:`currentColor`})}),kce=({onFile:e,children:t})=>{let[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)(!1);return(0,M.jsx)(`div`,{className:`tiptap-image-upload-drag-area ${i?`drag-active`:``} ${n?`drag-over`:``}`,onDragEnter:e=>{e.preventDefault(),e.stopPropagation(),a(!0)},onDragLeave:e=>{e.preventDefault(),e.stopPropagation(),e.currentTarget.contains(e.relatedTarget)||(a(!1),r(!1))},onDragOver:e=>{e.preventDefault(),e.stopPropagation(),r(!0)},onDrop:t=>{t.preventDefault(),t.stopPropagation(),a(!1),r(!1);let n=Array.from(t.dataTransfer.files);n.length>0&&e(n)},children:t})},Ace=({fileItem:e,onRemove:t})=>(0,M.jsxs)(`div`,{className:`tiptap-image-upload-preview`,children:[e.status===`uploading`&&(0,M.jsx)(`div`,{className:`tiptap-image-upload-progress`,style:{width:`${e.progress}%`}}),(0,M.jsxs)(`div`,{className:`tiptap-image-upload-preview-content`,children:[(0,M.jsxs)(`div`,{className:`tiptap-image-upload-file-info`,children:[(0,M.jsx)(`div`,{className:`tiptap-image-upload-file-icon`,children:(0,M.jsx)(tz,{})}),(0,M.jsxs)(`div`,{className:`tiptap-image-upload-details`,children:[(0,M.jsx)(`span`,{className:`tiptap-image-upload-text`,children:e.file.name}),(0,M.jsx)(`span`,{className:`tiptap-image-upload-subtext`,children:(e=>{if(e===0)return`0 Bytes`;let t=1024,n=[`Bytes`,`KB`,`MB`,`GB`],r=Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/t**+r).toFixed(2))} ${n[r]}`})(e.file.size)})]})]}),(0,M.jsxs)(`div`,{className:`tiptap-image-upload-actions`,children:[e.status===`uploading`&&(0,M.jsxs)(`span`,{className:`tiptap-image-upload-progress-text`,children:[e.progress,`%`]}),(0,M.jsx)($R,{type:`button`,variant:`ghost`,onClick:e=>{e.stopPropagation(),t()},children:(0,M.jsx)(ez,{className:`tiptap-button-icon`})})]})]})]}),jce=({maxSize:e,limit:t})=>(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`div`,{className:`tiptap-image-upload-dropzone`,children:[(0,M.jsx)(Dce,{}),(0,M.jsx)(Oce,{}),(0,M.jsx)(`div`,{className:`tiptap-image-upload-icon-container`,children:(0,M.jsx)(tz,{})})]}),(0,M.jsxs)(`div`,{className:`tiptap-image-upload-content`,children:[(0,M.jsxs)(`span`,{className:`tiptap-image-upload-text`,children:[(0,M.jsx)(`em`,{children:`Click to upload`}),` or drag and drop`]}),(0,M.jsxs)(`span`,{className:`tiptap-image-upload-subtext`,children:[`Maximum `,t,` file`,t===1?``:`s`,`, `,e/1024/1024,`MB each.`]})]})]}),Mce=e=>{let{accept:t,limit:n,maxSize:r}=e.node.attrs,i=(0,_.useRef)(null),a=e.extension,{fileItems:o,uploadFiles:s,removeFileItem:c,clearAllFiles:l}=Ece({maxSize:r,limit:n,accept:t,upload:a.options.upload,onSuccess:a.options.onSuccess,onError:a.options.onError}),u=async t=>{let n=await s(t);if(n.length>0){let r=e.getPos();if(qR(r)){let i=n.map((e,n)=>{let r=t[n]?.name.replace(/\.[^/.]+$/,``)||`unknown`;return{type:a.options.type,attrs:{...a.options,src:e,alt:r,title:r}}});e.editor.chain().focus().deleteRange({from:r,to:r+e.node.nodeSize}).insertContentAt(r,i).run(),bce(e.editor)}}},d=e=>{let t=e.target.files;if(!t||t.length===0){a.options.onError?.(Error(`No file selected`));return}u(Array.from(t))},f=()=>{i.current&&o.length===0&&(i.current.value=``,i.current.click())},p=o.length>0;return(0,M.jsxs)(Toe,{className:`tiptap-image-upload`,tabIndex:0,onClick:f,children:[!p&&(0,M.jsx)(kce,{onFile:u,children:(0,M.jsx)(jce,{maxSize:r,limit:n})}),p&&(0,M.jsxs)(`div`,{className:`tiptap-image-upload-previews`,children:[o.length>1&&(0,M.jsxs)(`div`,{className:`tiptap-image-upload-header`,children:[(0,M.jsxs)(`span`,{children:[`Uploading `,o.length,` files`]}),(0,M.jsx)($R,{type:`button`,variant:`ghost`,onClick:e=>{e.stopPropagation(),l()},children:`Clear All`})]}),o.map(e=>(0,M.jsx)(Ace,{fileItem:e,onRemove:()=>c(e.id)},e.id))]}),(0,M.jsx)(`input`,{ref:i,name:`file`,accept:t,type:`file`,multiple:n>1,onChange:d,onClick:e=>e.stopPropagation()})]})},Nce=OI.create({name:`imageUpload`,group:`block`,draggable:!0,selectable:!0,atom:!0,addOptions(){return{type:`image`,accept:`image/*`,limit:1,maxSize:0,upload:void 0,onError:void 0,onSuccess:void 0,HTMLAttributes:{}}},addAttributes(){return{accept:{default:this.options.accept},limit:{default:this.options.limit},maxSize:{default:this.options.maxSize}}},parseHTML(){return[{tag:`div[data-type="image-upload"]`}]},renderHTML({HTMLAttributes:e}){return[`div`,CP({"data-type":`image-upload`},e)]},addNodeView(){return joe(Mce)},addCommands(){return{setImageUploadNode:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addKeyboardShortcuts(){return{Enter:({editor:e})=>{let{selection:t}=e.state,{nodeAfter:n}=t.$from;if(n&&n.type.name===`imageUpload`&&e.isActive(`imageUpload`)){let n=e.view.nodeDOM(t.$from.pos);if(n&&n instanceof HTMLElement){let e=n.firstChild;if(e&&e instanceof HTMLElement)return e.click(),!0}}return!1}}}}),nz=OI.create({name:`horizontalRule`,addOptions(){return{HTMLAttributes:{},nextNodeType:`paragraph`}},group:`block`,parseHTML(){return[{tag:`hr`}]},renderHTML({HTMLAttributes:e}){return[`hr`,CP(this.options.HTMLAttributes,e)]},markdownTokenName:`hr`,parseMarkdown:(e,t)=>t.createNode(`horizontalRule`),renderMarkdown:()=>`---`,addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!gI(t,t.schema.nodes[this.name]))return!1;let{selection:n}=t,{$to:r}=n,i=e();return $P(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:e,tr:t,dispatch:n})=>{if(n){let{$to:n}=t.selection,r=n.end();if(n.nodeAfter)n.nodeAfter.isTextblock?t.setSelection(tO.create(t.doc,n.pos+1)):n.nodeAfter.isBlock?t.setSelection(U.create(t.doc,n.pos)):t.setSelection(tO.create(t.doc,n.pos));else{let i=(e.schema.nodes[this.options.nextNodeType]||n.parent.type.contentMatch.defaultType)?.create();
167i&&(t.insert(r,i),t.setSelection(tO.create(t.doc,r+1)))}t.scrollIntoView()}return!0}).run()}}},addInputRules(){return[uI({find:/^(?:---|â-|___\s|\*\*\*\s)$/,type:this.type})]}}),Pce=nz,Fce=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,Ice=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,Lce=RF.create({name:`highlight`,addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:e=>e.getAttribute(`data-color`)||_I(e,`background-color`)||e.style.backgroundColor,renderHTML:e=>e.color?{"data-color":e.color,style:`background-color: ${e.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:`mark`}]},renderHTML({HTMLAttributes:e}){return[`mark`,CP(this.options.HTMLAttributes,e),0]},renderMarkdown:(e,t)=>`==${t.renderChildren(e)}==`,parseMarkdown:(e,t)=>t.applyMark(`highlight`,t.parseInline(e.tokens||[])),markdownTokenizer:{name:`highlight`,level:`inline`,start:e=>e.indexOf(`==`),tokenize(e,t,n){let r=/^(==)([^=]+)(==)/.exec(e);if(r){let e=r[2].trim(),t=n.inlineTokens(e);return{type:`highlight`,raw:r[0],text:e,tokens:t}}}},addCommands(){return{setHighlight:e=>({commands:t})=>t.setMark(this.name,e),toggleHighlight:e=>({commands:t})=>t.toggleMark(this.name,e),unsetHighlight:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[lI({find:Fce,type:this.type})]},addPasteRules(){return[AI({find:Ice,type:this.type})]}}),Rce=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,zce=OI.create({name:`image`,addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?`inline`:`block`},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?`img[src]`:`img[src]:not([src^="data:"])`}]},renderHTML({HTMLAttributes:e}){return[`img`,CP(this.options.HTMLAttributes,e)]},parseMarkdown:(e,t)=>t.createNode(`image`,{src:e.href,title:e.title,alt:e.text}),renderMarkdown:e=>{let t=e.attrs?.src??``,n=e.attrs?.alt??``,r=e.attrs?.title??``;return r?``:``},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>`u`)return null;let{directions:e,minWidth:t,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:i,getPos:a,HTMLAttributes:o,editor:s})=>{let c=document.createElement(`img`);Object.entries(o).forEach(([e,t])=>
167{if(t!=null)switch(e){case`width`:case`height`:break;default:c.setAttribute(e,t);break}}),c.src=o.src;let l=new hI({element:c,editor:s,node:i,getPos:a,onResize:(e,t)=>{c.style.width=`${e}px`,c.style.height=`${t}px`},onCommit:(e,t)=>{let n=a();n!==void 0&&this.editor.chain().setNodeSelection(n).updateAttributes(this.name,{width:e,height:t}).run()},onUpdate:(e,t,n)=>e.type===i.type,options:{directions:e,min:{width:t,height:n},preserveAspectRatio:r===!0}}),u=l.dom;return u.style.visibility=`hidden`,u.style.pointerEvents=`none`,c.onload=()=>{u.style.visibility=``,u.style.pointerEvents=``},l}},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[uI({find:Rce,type:this.type,getAttributes:e=>{let[,,t,n,r]=e;return{src:n,alt:t,title:r}}})]}}),Bce=Object.defineProperty,Vce=(e,t)=>{for(var n in t)Bce(e,n,{get:t[n],enumerable:!0})},Hce=`listItem`,rz=`textStyle`,iz=/^\s*([-+*])\s$/,az=OI.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`,CP(this.options.HTMLAttributes,e),0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>e.type!==`list`||e.ordered?[]:{type:`bulletList`,content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,` 168`):``,markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Hce,this.editor.getAttributes(rz)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=pI({find:iz,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=pI({find:iz,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(rz),editor:this.editor})),[e]}});function Uce(e){let t=e.tokens?.[0];return!!(e.text&&e.tokens?.length===1&&t?.type===`list`&&t.ordered&&t.raw===e.text)}function Wce(e,t){return t.tokenizeInline?t.parseInline(t.tokenizeInline(e)):t.parseInline([{type:`text`,raw:e,text:e}])}var oz=OI.create({name:`listItem`,addOptions(){return{HTMLAttributes:{},bulletListTypeName:`bulletList`,orderedListTypeName:`orderedList`}},content:`paragraph block*`,defining:!0,parseHTML(){return[{tag:`li`}]},renderHTML({HTMLAttributes:e}){return[`li`,CP(this.options.HTMLAttributes,e),0]},markdownTokenName:`list_item`,parseMarkdown:(e,t)=>{if(e.type!==`list_item`)return[];let n=t.parseBlockChildren??t.parseChildren,r=[];if(e.tokens&&e.tokens.length>0){if(Uce(e))return{type:`listItem`,content:[{type:`paragraph`,content:Wce(e.text||``,t)}]};if(e.tokens.some(e=>e.type===`paragraph`))r=n(e.tokens);else{let i=e.tokens[0];if(i&&i.type===`text`&&i.tokens&&i.tokens.length>0){if(r=[{type:`paragraph`,content:t.parseInline(i.tokens)}],e.tokens.length>1){let t=n(e.tokens.slice(1));r.push(...t)}}else r=n(e.tokens)}}return r.length===0&&(r=[{type:`paragraph`,content:[]}]),{type:`listItem`,content:r}},renderMarkdown:(e,t,n)=>EI(e,t,e=>e.parentType===`bulletList`?`- `:e.parentType===`orderedList`?`${(e.meta?.parentAttrs?.start||1)+e.index}. `:`- `,n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});Vce({},{findListItemPos:()=>sz,getNextListDepth:()=>cz,handleBackspace:()=>fz,handleDelete:()=>hz,hasListBefore:()=>lz,hasListItemAfter:()=>Gce,hasListItemBefore:()=>uz,listItemHasSubList:()=>dz,nextListIsDeeper:()=>pz,nextListIsHigher:()=>mz});var sz=(e,t)=>{let{$from:n}=t.selection,r=aN(e,t.schema),i=null,a=n.depth,o=n.pos,s=null;for(;a>0&&s===null;)i=n.node(a),i.type===r?s=a:(--a,--o);return s===null?null:{$pos:t.doc.resolve(o),depth:s}},cz=(e,t)=>
vendor: 9,527 bytes, lines 168-176
168{let n=sz(e,t);if(!n)return!1;let[,r]=HP(t,e,n.$pos.pos+4);return r},lz=(e,t,n)=>{let{$anchor:r}=e.selection,i=Math.max(0,r.pos-2),a=e.doc.resolve(i).node();return!(!a||!n.includes(a.type.name))},uz=(e,t)=>{let{$anchor:n}=t.selection,r=t.doc.resolve(n.pos-2);return!(r.index()===0||r.nodeBefore?.type.name!==e)},dz=(e,t,n)=>{if(!n)return!1;let r=aN(e,t.schema),i=!1;return n.descendants(e=>{e.type===r&&(i=!0)}),i},fz=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!GN(e.state,t)&&lz(e.state,t,n)){let{$anchor:n}=e.state.selection,r=e.state.doc.resolve(n.before()-1),i=[];r.node().descendants((e,n)=>{e.type.name===t&&i.push({node:e,pos:n})});let a=i.at(-1);if(!a)return!1;let o=e.state.doc.resolve(r.start()+a.pos+1);return e.chain().cut({from:n.start()-1,to:n.end()+1},o.end()).joinForward().run()}if(!GN(e.state,t)||!YP(e.state))return!1;let r=sz(t,e.state);if(!r)return!1;let i=e.state.doc.resolve(r.$pos.pos-2).node(r.depth),a=dz(t,e.state,i);return uz(t,e.state)&&!a?e.commands.joinItemBackward():e.chain().liftListItem(t).run()},pz=(e,t)=>{let n=cz(e,t),r=sz(e,t);return!r||!n?!1:n>r.depth},mz=(e,t)=>{let n=cz(e,t),r=sz(e,t);return!r||!n?!1:n<r.depth},hz=(e,t)=>{if(!GN(e.state,t)||!JP(e.state,t))return!1;let{selection:n}=e.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:pz(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():mz(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward()},Gce=(e,t)=>{let{$anchor:n}=t.selection,r=t.doc.resolve(n.pos-n.parentOffset-2);return!(r.index()===r.parent.childCount-1||r.nodeAfter?.type.name!==e)},gz=qF.create({name:`listKeymap`,addOptions(){return{listTypes:[{itemName:`listItem`,wrapperNames:[`bulletList`,`orderedList`]},{itemName:`taskItem`,wrapperNames:[`taskList`]}]}},addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&hz(e,n)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&hz(e,n)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&fz(e,n,r)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&fz(e,n,r)&&(t=!0)}),t}}}}),_z=/^(\s*)(\d+)\.\s+(.*)$/,Kce=/^\s/;function qce(e){let t=e.trimStart();return/^[-+*]\s+/.test(t)||/^\d+\.\s+/.test(t)||/^>\s?/.test(t)||/^```/.test(t)||/^~~~/.test(t)}function Jce(e){let t=[],n=[],r=!1;return e.forEach(e=>{if(r){n.push(e);return}if(e.trim()===``){r=!0,n.push(e);return}if(t.length>0&&qce(e)){r=!0,n.push(e);return}t.push(e)}),{paragraphLines:t,blockLines:n}}function vz(e){let t=[],n=0,r=0;for(;n<e.length;){let i=e[n],a=i.match(_z);if(!a)break;let[,o,s,c]=a,l=o.length,u=[c],d=n+1,f=[i],p=!1;for(;d<e.length;){let t=e[d];if(t.match(_z))break;if(t.trim()===``)f.push(t),u.push(``),p=!0,d+=1;else if(t.match(Kce))f.push(t),u.push(t.slice(l+2)),d+=1;else{if(p)break;f.push(t),u.push(t),d+=1}}t.push({indent:l,number:parseInt(s,10),content:u.join(` 169`).trim(),contentLines:u,raw:f.join(` 170`)}),r=d,n=d}return[t,r]}function yz(e,t,n){let r=[],i=0;for(;i<e.length;){let a=e[i];if(a.indent===t){let{paragraphLines:o,blockLines:s}=Jce(a.contentLines),c=o.join(` 171`).trim(),l=[];c&&l.push({type:`paragraph`,raw:c,tokens:n.inlineTokens(c)});let u=s.join(` 172`).trim();if(u){let e=n.blockTokens(u);l.push(...e)}let d=i+1,f=[];for(;d<e.length&&e[d].indent>t;)f.push(e[d]),d+=1;if(f.length>0){let e=yz(f,Math.min(...f.map(e=>e.indent)),n);l.push({type:`list`,ordered:!0,start:f[0].number,items:e,raw:f.map(e=>e.raw).join(` 173`)})}r.push({type:`list_item`,raw:a.raw,tokens:l}),i=d}else i+=1}return r}function bz(e,t){return e.map(e=>{if(e.type!==`list_item`)return t.parseChildren([e])[0];let n=[];return e.tokens&&e.tokens.length>0&&e.tokens.forEach(e=>{if(e.type===`paragraph`||e.type===`list`||e.type===`blockquote`||e.type===`code`)n.push(...t.parseChildren([e]));else if(e.type===`text`&&e.tokens){let r=t.parseChildren([e]);n.push({type:`paragraph`,content:r})}else{let r=t.parseChildren([e]);r.length>0&&n.push(...r)}}),{type:`listItem`,content:n}})}var xz=`listItem`,Sz=`textStyle`,Cz=/^(\d+)\.\s$/,wz=OI.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`,CP(this.options.HTMLAttributes,n),0]:[`ol`,CP(this.options.HTMLAttributes,e),0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>{if(e.type!==`list`||!e.ordered)return[];let n=e.start||1,r=e.items?bz(e.items,t):[];return n===1?{type:`orderedList`,content:r}:{type:`orderedList`,attrs:{start:n},content:r}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,` 174`):``,markdownTokenizer:{name:`orderedList`,level:`block`,start:e=>{let t=e.match(/^(\s*)(\d+)\.\s+/)?.index;return t===void 0?-1:t},tokenize:(e,t,n)=>{let r=e.split(` 175`),[i,a]=vz(r);if(i.length===0)return;let o=yz(i,0,n);if(o.length!==0)return{type:`list`,ordered:!0,start:i[0]?.number||1,items:o,raw:r.slice(0,a).join(` 176`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(xz,this.editor.getAttributes(Sz)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=pI({find:Cz,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=pI({find:Cz,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Sz)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[e]}}),Tz=/^\s*(\[([( |x])?\])\s$/,Ez=OI.create({name:`taskItem`,addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:`taskList`,a11y:void 0}},content(){return this.options.nested?`paragraph block*`:`paragraph+`},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{let t=e.getAttribute(`data-checked`);return t===``||t===`true`},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return[`li`,CP(this.options.HTMLAttributes,t,{"data-type":this.name}),[`label`,[`input`,{type:`checkbox`,checked:e.attrs.checked?`checked`:null}],[`span`]],[`div`,0]]},parseMarkdown:(e,t)=>{let n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode(`paragraph`,{},t.parseInline(e.tokens))):e.text?n.push(t.createNode(`paragraph`,{},[t.createNode(`text`,{text:e.text})])):n.push(t.createNode(`paragraph`,{},[])),e.nestedTokens&&e.nestedTokens.length>0){let r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode(`taskItem`,{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>EI(e,t,`- [${e.attrs?.checked?`x`:` `}] `),addKeyboardShortcuts(){let e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{let i=document.createElement(`li`),a=document.createElement(`label`),o=document.createElement(`span`),s=document.createElement(`input`),c=document.createElement(`div`),l=e=>{var t;s.ariaLabel=((t=this.options.a11y)?.checkboxLabel)?.call(t,e,s.checked)||`Task item checkbox for ${e.textContent||`empty task item`}`};l(e),a.contentEditable=`false`,s.type=`checkbox`,s.addEventListener(`mousedown`,e=>e.preventDefault()),s.addEventListener(`change`,t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){s.checked=!s.checked;return}let{checked:i}=t.target;r.isEditable&&typeof n==`function`&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{let t=n();if(typeof t!=`number`)return!1;let r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...r?.attrs,checked:i}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,i)||(s.checked=!s.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{i.setAttribute(e,t)}),i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,a.append(s,o),i.append(a,c),Object.entries(t).forEach(([e,t])=>{i.setAttribute(e,t)});let u=new Set(Object.keys(t));return{dom:i,contentDOM:c,update:e=>{if(e.type!==this.type)return!1;i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,l(e);let t=r.extensionManager.attributes,n=wP(e,t),a=new Set(Object.keys(n)),o=this.options.HTMLAttributes;return u.forEach(e=>{a.has(e)||(e in o?i.setAttribute(e,o[e]):i.removeAttribute(e))}),Object.entries(n).forEach(([e,t])=>{t==null?e in o?i.setAttribute(e,o[e]):i.removeAttribute(e):i.setAttribute(e,t)}),u=a,!0}}}}
176,addInputRules(){return[pI({find:Tz,type:this.type,getAttributes:e=>({checked:e[e.length-1]===`x`})})]}}),Dz=OI.create({name:`taskList`,addOptions(){return{itemTypeName:`taskItem`,HTMLAttributes:{}}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return[`ul`,CP(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode(`taskList`,{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,` 177`):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){let t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;return t===void 0?-1:t},tokenize(e,t,n){let r=e=>{let t=TI(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);return t?[{type:`taskList`,raw:t.raw,items:t.items}]:n.blockTokens(e)},i=TI(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:`taskList`,raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});qF.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(az.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(oz.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(gz.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(wz.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(Ez.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(Dz.configure(this.options.taskList)),e}});var Oz=RF.create({name:`subscript`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`sub`},{style:`vertical-align`,getAttrs(e){return e===`sub`?null:!1}}]},renderHTML({HTMLAttributes:e}){return[`sub`,CP(this.options.HTMLAttributes,e),0]},addCommands(){return{setSubscript:()=>({commands:e})=>e.setMark(this.name),toggleSubscript:()=>({commands:e})=>e.toggleMark(this.name),unsetSubscript:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),kz=RF.create({name:`superscript`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`sup`},{style:`vertical-align`,getAttrs(e){return e===`super`?null:!1}}]},renderHTML({HTMLAttributes:e}){return[`sup`,CP(this.options.HTMLAttributes,e),0]},addCommands(){return{setSuperscript:()=>({commands:e})=>e.setMark(this.name),toggleSuperscript:()=>({commands:e})=>e.toggleMark(this.name),unsetSuperscript:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),Az=qF.create({name:`textAlign`,addOptions(){return{types:[],alignments:[`left`,`center`,`right`,`justify`],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:e=>{let t=e.style.textAlign;return this.options.alignments.includes(t)?t:this.options.defaultAlignment},renderHTML:e=>e.textAlign?{style:`text-align: ${e.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:e=>({commands:t})=>this.options.alignments.includes(e)?this.options.types.map(n=>t.updateAttributes(n,{textAlign:e})).some(e=>e):!1,unsetTextAlign:()=>({commands:e})=>this.options.types.map(t=>e.resetAttributes(t,`textAlign`)).some(e=>e),toggleTextAlign:e=>({editor:t,commands:n})=>this.options.alignments.includes(e)?t.isActive({textAlign:e})?n.unsetTextAlign():n.setTextAlign(e):!1}}
177,addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign(`left`),"Mod-Shift-e":()=>this.editor.commands.setTextAlign(`center`),"Mod-Shift-r":()=>this.editor.commands.setTextAlign(`right`),"Mod-Shift-j":()=>this.editor.commands.setTextAlign(`justify`)}}}),jz=e=>fI({find:/--$/,replace:e??`â`}),Mz=e=>fI({find:/\.\.\.$/,replace:e??`â¦`}),Nz=e=>fI({find:/(?:^|[\s{[(<'"\u2018\u201C])(")$/,replace:e??`â`}),Pz=e=>fI({find:/"$/,replace:e??`â`}),Fz=e=>fI({find:/(?:^|[\s{[(<'"\u2018\u201C])(')$/,replace:e??`â`}),Iz=e=>fI({find:/'$/,replace:e??`â`}),Lz=e=>fI({find:/<-$/,replace:e??`â`}),Rz=e=>fI({find:/->$/,replace:e??`â`}),zz=e=>fI({find:/\(c\)$/,replace:e??`©`}),Bz=e=>fI({find:/\(tm\)$/,replace:e??`â¢`}),Vz=e=>fI({find:/\(sm\)$/,replace:e??`â `}),Hz=e=>fI({find:/\(r\)$/,replace:e??`®`}),Uz=e=>fI({find:/(?:^|\s)(1\/2)\s$/,replace:e??`½`}),Wz=e=>fI({find:/\+\/-$/,replace:e??`±`}),Gz=e=>fI({find:/!=$/,replace:e??`â `}),Kz=e=>fI({find:/<<$/,replace:e??`«`}),qz=e=>fI({find:/>>$/,replace:e??`»`}),Jz=e=>fI({find:/\d+\s?([*x])\s?\d+$/,replace:e??`Ã`}),Yz=e=>fI({find:/\^2$/,replace:e??`²`}),Xz=e=>fI({find:/\^3$/,replace:e??`³`}),Zz=e=>fI({find:/(?:^|\s)(1\/4)\s$/,replace:e??`¼`}),Qz=e=>fI({find:/(?:^|\s)(3\/4)\s$/,replace:e??`¾`}),$z=qF.create({name:`typography`,addOptions(){return{closeDoubleQuote:`â`,closeSingleQuote:`â`,copyright:`©`,ellipsis:`â¦`,emDash:`â`,laquo:`«`,leftArrow:`â`,multiplication:`Ã`,notEqual:`â `,oneHalf:`½`,oneQuarter:`¼`,openDoubleQuote:`â`,openSingleQuote:`â`,plusMinus:`±`,raquo:`»`,registeredTrademark:`®`,rightArrow:`â`,servicemark:`â `,superscriptThree:`³`,superscriptTwo:`²`,threeQuarters:`¾`,trademark:`â¢`}},addInputRules(){let e=[];this.options.emDash!==!1&&e.push(jz(this.options.emDash)),this.options.ellipsis!==!1&&e.push(Mz(this.options.ellipsis));let t=this.editor.options.textDirection===`rtl`;if(this.options.doubleQuotes?.rtl){let{open:t,close:n}=this.options.doubleQuotes.rtl;e.push(Nz(t)),e.push(Pz(n))}else t?(e.push(Nz(`â`)),e.push(Pz(`â`))):(this.options.openDoubleQuote!==!1&&e.push(Nz(this.options.openDoubleQuote)),this.options.closeDoubleQuote!==!1&&e.push(Pz(this.options.closeDoubleQuote)));if(this.options.singleQuotes?.rtl){let{open:t,close:n}=this.options.singleQuotes.rtl;e.push(Fz(t)),e.push(Iz(n))}else t?(e.push(Fz(`â`)),e.push(Iz(`â`))):(this.options.openSingleQuote!==!1&&e.push(Fz(this.options.openSingleQuote)),this.options.closeSingleQuote!==!1&&e.push(Iz(this.options.closeSingleQuote)));return this.options.leftArrow!==!1&&e.push(Lz(this.options.leftArrow)),this.options.rightArrow!==!1&&e.push(Rz(this.options.rightArrow)),this.options.copyright!==!1&&e.push(zz(this.options.copyright)),this.options.trademark!==!1&&e.push(Bz(this.options.trademark)),this.options.servicemark!==!1&&e.push(Vz(this.options.servicemark)),this.options.registeredTrademark!==!1&&e.push(Hz(this.options.registeredTrademark)),this.options.oneHalf!==!1&&e.push(Uz(this.options.oneHalf)),this.options.plusMinus!==!1&&e.push(Wz(this.options.plusMinus)),this.options.notEqual!==!1&&e.push(Gz(this.options.notEqual)),this.options.laquo!==!1&&e.push(Kz(this.options.laquo)),this.options.raquo!==!1&&e.push(qz(this.options.raquo)),this.options.multiplication!==!1&&e.push(Jz(this.options.multiplication)),this.options.superscriptTwo!==!1&&e.push(Yz(this.options.superscriptTwo)),this.options.superscriptThree!==!1&&e.push(Xz(this.options.superscriptThree)),this.options.oneQuarter!==!1&&e.push(Zz(this.options.oneQuarter)),this.options.threeQuarters!==!1&&e.push(Qz(this.options.threeQuarters)),e}}),eB=RF.create({name:`underline`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`u`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`underline`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`u`,CP(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||`underline`,t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:`underline`,level:`inline`,start(e){return e.indexOf(`++`)},tokenize(e,t,n){let r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;let i=r[2].trim();return{type:`underline`,raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),tB=(e,t)=>{if(e===`slot`)return 0;if(e instanceof Function)return e(t);let{children:n,...r}=t??{};if(e===`svg`)throw Error(`SVG elements are not supported in the JSX syntax, use the array syntax instead`);return[e,r,n]},nB=/^\s*>\s$/,rB=OI.create({name:`blockquote`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,group:`block`,defining:!0,parseHTML(){return[{tag:`blockquote`}]},renderHTML({HTMLAttributes:e}){return tB(`blockquote`,{...CP(this.options.HTMLAttributes,e),children:tB(`slot`,{})})},parseMarkdown:(e,t)=>{let n=t.parseBlockChildren??t.parseChildren;return t.createNode(`blockquote`,void 0,n(e.tokens||[]))},renderMarkdown:(e,t)=>{if(!e.content)return``;let n=[];return e.content.forEach((e,r)=>{let i=(t.renderChild?.call(t,e,r)??t.renderChildren([e])).split(` 178`).map(e=>e.trim()===``?`>`:`> ${e}`);n.push(i.join(` 179`))}),n.join(` 180> 181`)},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}}
vendor: 8,825 bytes, lines 181-202
181,addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[pI({find:nB,type:this.type})]}}),iB=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,aB=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,oB=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,sB=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,cB=RF.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 tB(`strong`,{...CP(this.options.HTMLAttributes,e),children:tB(`slot`,{})})},markdownTokenName:`strong`,parseMarkdown:(e,t)=>t.applyMark(`bold`,t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:`<strong>`,close:`</strong>`}},renderMarkdown:(e,t)=>`**${t.renderChildren(e)}**`,addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[lI({find:iB,type:this.type}),lI({find:oB,type:this.type})]},addPasteRules(){return[AI({find:aB,type:this.type}),AI({find:sB,type:this.type})]}}),lB=/(^|[^`])`([^`]+)`(?!`)$/,uB=/(^|[^`])`([^`]+)`(?!`)/g,dB=RF.create({name:`code`,addOptions(){return{HTMLAttributes:{}}},excludes:`_`,code:!0,exitable:!0,parseHTML(){return[{tag:`code`}]},renderHTML({HTMLAttributes:e}){return[`code`,CP(this.options.HTMLAttributes,e),0]},markdownTokenName:`codespan`,parseMarkdown:(e,t)=>t.applyMark(`code`,[{type:`text`,text:e.text||``}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:``,addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[lI({find:lB,type:this.type})]},addPasteRules(){return[AI({find:uB,type:this.type})]}}),fB=4,pB=/^```([a-z]+)?[\s\n]$/,mB=/^~~~([a-z]+)?[\s\n]$/,hB=OI.create({name:`codeBlock`,addOptions(){return{languageClassPrefix:`language-`,exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:fB,HTMLAttributes:{}}},content:`text*`,marks:``,group:`block`,code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{let{languageClassPrefix:t}=this.options;return t&&[...e.firstElementChild?.classList||[]].filter(e=>e.startsWith(t)).map(e=>e.replace(t,``))[0]||null},rendered:!1}}},parseHTML(){return[{tag:`pre`,preserveWhitespace:`full`}]},renderHTML({node:e,HTMLAttributes:t}){return[`pre`,CP(this.options.HTMLAttributes,t),[`code`,{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:`code`,parseMarkdown:(e,t)=>e.raw?.startsWith("```")===!1&&e.raw?.startsWith(`~~~`)===!1&&e.codeBlockStyle!==`indented`?[]:t.createNode(`codeBlock`,{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[]),renderMarkdown:(e,t)=>{let n=``,r=e.attrs?.language||``;return n=e.content?[`\`\`\`${r}`,t.renderChildren(e.content),"```"].join(` 182`):`\`\`\`${r} 183 184\`\`\``,n},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,`paragraph`,e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:e,$anchor:t}=this.editor.state.selection,n=t.pos===1;return!e||t.parent.type.name!==this.name?!1:n||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??fB,{state:n}=e,{selection:r}=n,{$from:i,empty:a}=r;if(i.parent.type!==this.type)return!1;let o=` `.repeat(t);return a?e.commands.insertContent(o):e.commands.command(({tr:e})=>{let{from:t,to:i}=r,a=n.doc.textBetween(t,i,` 185`,` 186`).split(` 187`).map(e=>o+e).join(` 188`);return e.replaceWith(t,i,n.schema.text(a)),!0})},"Shift-Tab":({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??fB,{state:n}=e,{selection:r}=n,{$from:i,empty:a}=r;return i.parent.type===this.type?a?e.commands.command(({tr:e})=>{let{pos:r}=i,a=i.start(),o=i.end(),s=n.doc.textBetween(a,o,` 189`,` 190`).split(` 191`),c=0,l=0,u=r-a;for(let e=0;e<s.length;e+=1){if(l+s[e].length>=u){c=e;break}l+=s[e].length+1}let d=s[c].match(/^ */)?.[0]||``,f=Math.min(d.length,t);if(f===0)return!0;let p=a;for(let e=0;e<c;e+=1)p+=s[e].length+1;return e.delete(p,p+f),r-p<=f&&e.setSelection(tO.create(e.doc,p)),!0}):e.commands.command(({tr:e})=>{let{from:i,to:a}=r,o=n.doc.textBetween(i,a,` 192`,` 193`).split(` 194`).map(e=>{let n=e.match(/^ */)?.[0]||``,r=Math.min(n.length,t);return e.slice(r)}).join(` 195`);return e.replaceWith(i,a,n.schema.text(o)),!0}):!1},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;let{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;let a=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(` 196 197`);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(ZD.near(r.resolve(o))),!0)):e.commands.exitCode()}}},addInputRules(){return[dI({find:pB,type:this.type,getAttributes:e=>({language:e[1]})}),dI({find:mB,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new vO({key:new xO(`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,` 198`));return a.replaceSelectionWith(this.type.create({language:i},s)),a.selection.$from.parent.type!==this.type&&a.setSelection(tO.near(a.doc.resolve(Math.max(0,a.selection.from-2)))),a.setMeta(`paste`,!0),e.dispatch(a),!0}}})]}}),gB=OI.create({name:`doc`,topNode:!0,content:`block+`,renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,` 199 200`):``}),_B=OI.create({name:`hardBreak`,markdownTokenName:`br`,addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:`inline`,selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:`br`}]},renderHTML({HTMLAttributes:e}){return[`br`,CP(this.options.HTMLAttributes,e)]},renderText(){return` 201`},renderMarkdown:()=>` 202`,parseMarkdown:()=>({type:`hardBreak`}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{let{selection:e,storedMarks:i}=n;if(e.$from.parent.type.spec.isolating)return!1;let{keepMarks:a}=this.options,{splittableMarks:o}=r.extensionManager,s=i||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{if(t&&s&&a){let t=s.filter(e=>o.includes(e.type.name));e.ensureMarks(t)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),vB=OI.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]}`,CP(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode(`heading`,{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{let n=e.attrs?.level?parseInt(e.attrs.level,10):1,r=`#`.repeat(n);return e.content?`${r} ${t.renderChildren(e.content)}`:``},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,`paragraph`,e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>dI({find:RegExp(`^(#{${Math.min(...this.options.levels)},${e}}
202)\\s$`),type:this.type,getAttributes:{level:e}}))}}),yB=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,bB=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,xB=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,SB=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,CB=RF.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`,CP(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:`em`,parseMarkdown:(e,t)=>t.applyMark(`italic`,t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:`<em>`,close:`</em>`}},renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}}
202,addInputRules(){return[lI({find:yB,type:this.type}),lI({find:xB,type:this.type})]},addPasteRules(){return[AI({find:bB,type:this.type}),AI({find:SB,type:this.type})]}}),wB=`aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yac
202hts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2`,TB=`ελ1Ï 2бг1ел3деÑи4еÑ2каÑолик6ом3мкд2он1Ñква6онлайн5Ñг3ÑÑÑ2Ñ2ÑайÑ3Ñб3ÑкÑ3Òаз3Õ°Õ¡Õµ3×שר××5×§××3Ø§Ø¨ÙØ¸Ø¨Ù5را٠ÙÙ5ÙØ§Ø±Ø¯Ù4Ø¨ØØ±ÙÙ5جزائر5Ø³Ø¹ÙØ¯ÙØ©6عÙÙØ§Ù5٠غرب5٠ارات5ÛØ±Ø§Ù5بارت2زار4ÙØªÙ3ھارت5تÙÙØ³4Ø³ÙØ¯Ø§Ù3Ø±ÙØ©5Ø´Ø¨ÙØ©4عراÙ2ب2٠اÙ4ÙÙØ³Ø·ÙÙ6ÙØ·Ø±3ÙØ§Ø«ÙÙÙÙ6ÙÙ 3٠صر2ÙÙØ³Ùا5ÙØ±ÙتاÙÙØ§7ÙØ¹4Ù٠راÙ5پاکستاÙ7ÚØ§Ø±Øª4à¤à¥à¤®3नà¥à¤3à¤à¤¾à¤°à¤¤0मà¥3à¥à¤¤5सà¤à¤à¤ न5বাà¦à¦²à¦¾5à¦à¦¾à¦°à¦¤2ৰত4à¨à¨¾à¨°à¨¤4àªàª¾àª°àª¤4à¬à¬¾à¬°à¬¤4à®à®¨à¯à®¤à®¿à®¯à®¾6லà®à¯à®à¯6à®à®¿à®à¯à®à®ªà¯à®ªà¯à®°à¯11à°à°¾à°°à°¤à±5à²à²¾à²°à²¤4à´à´¾à´°à´¤à´5à¶½à¶à¶à·4à¸à¸à¸¡3à¹à¸à¸¢3ລາວ3áá2ã¿ããª3ã¢ãã¾ã³4ã¯ã©ã¦ã4ã°ã¼ã°ã«4ã³ã 2ã¹ãã¢3ã»ã¼ã«3ãã¡ãã·ã§ã³6ãã¤ã³ã4ä¸ç2ä¸ä¿¡1å½1å1æç½3äºé©¬é3ä¼ä¸2ä½å±±2ä¿¡æ¯2å¥åº·2å «å¦2å ¬å¸1ç2å°æ¹¾1ç£2åå1åº1æ 2åé0大é åº5å¨çº¿2大æ¿2天主æ3娱ä¹2å®¶é»2广ä¸2å¾®å2æ å2æç±ä½ 3ææº2æè2æ¿å¡1åº2æ°å å¡2é»2æ¶å°2æ¸ç±2æºæ2淡马é¡3游æ2æ¾³é2ç¹ç2ç§»å¨2ç»ç»æºæ4ç½å1åº1ç«1ç»2èé2è°·æ2è´ç©2é販2éå¢2é»è¨çç§4é£å©æµ¦3é£å2é¤å 2馿 ¼éæ3港2ë·ë·1ì»´2ì¼ì±2íêµ2`,EB=`numeric`,DB=`ascii`,OB=`alpha`,kB=`asciinumeric`,AB=`alphanumeric`,jB=`domain`,MB=`emoji`,NB=`scheme`,PB=`slashscheme`,FB=`whitespace`;function IB(e,t){return e in t||(t[e]=[]),t[e]}function LB(e,t,n){t[EB]&&(t[kB]=!0,t[AB]=!0),t[DB]&&(t[kB]=!0,t[OB]=!0),t[kB]&&(t[AB]=!0),t[OB]&&(t[AB]=!0),t[AB]&&(t[jB]=!0),t[MB]&&(t[jB]=!0);for(let r in t){let t=IB(r,n);t.indexOf(e)<0&&t.push(e)}}function RB(e,t){let n={};for(let r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}function zB(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}zB.groups={},zB.prototype={accepts(){return!!this.t},go(e){let t=this,n=t.j[e];if(n)return n;for(let n=0;n<t.jr.length;n++){let r=t.jr[n][0],i=t.jr[n][1];if(i&&r.test(e))return i}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let i=0;i<e.length;i++)this.tt(e[i],t,n,r)},tr(e,t,n,r){r||=zB.groups;let i;return t&&t.j?i=t:(i=new zB(t),n&&r&&LB(t,n,r)),this.jr.push([e,i]),i},ts(e,t,n,r){let i=this,a=e.length;if(!a)return i;for(let t=0;t<a-1;t++)i=i.tt(e[t]);return i.tt(e[a-1],t,n,r)},tt(e,t,n,r){r||=zB.groups;let i=this;if(t&&t.j)return i.j[e]=t,t;let a=t,o,s=i.go(e);return s?(o=new zB,Object.assign(o.j,s.j),o.jr.push.apply(o.jr,s.jr),o.jd=s.jd,o.t=s.t):o=new zB,a&&(r&&(o.t&&typeof o.t==`string`?LB(a,Object.assign(RB(o.t,r),n),r):n&&LB(a,n,r)),o.t=a),i.j[e]=o,o}};var BB=(e,t,n,r,i)=>e.ta(t,n,r,i),VB=(e,t,n,r,i)=>e.tr(t,n,r,i),HB=(e,t,n,r,i)=>e.ts(t,n,r,i),G=(e,t,n,r,i)=>e.tt(t,n,r,i),UB=`WORD`,WB=`UWORD`,GB=`ASCIINUMERICAL`,KB=`ALPHANUMERICAL`,qB=`LOCALHOST`,JB=`TLD`,YB=`UTLD`,XB=`SCHEME`,ZB=`SLASH_SCHEME`,QB=`NUM`,$B=`WS`,eV=`NL`,tV=`OPENBRACE`,nV=`CLOSEBRACE`,rV=`OPENBRACKET`,iV=`CLOSEBRACKET`,aV=`OPENPAREN`,oV=`CLOSEPAREN`,sV=`OPENANGLEBRACKET`,cV=`CLOSEANGLEBRACKET`,lV=`FULLWIDTHLEFTPAREN`,uV=`FULLWIDTHRIGHTPAREN`,dV=`LEFTCORNERBRACKET`,fV=`RIGHTCORNERBRACKET`,pV=`LEFTWHITECORNERBRACKET`,mV=`RIGHTWHITECORNERBRACKET`,hV=`FULLWIDTHLESSTHAN`,gV=`FULLWIDTHGREATERTHAN`,_V=`AMPERSAND`,vV=`APOSTROPHE`,yV=`ASTERISK`,bV=`AT`,xV=`BACKSLASH`,SV=`BACKTICK`,CV=`CARET`,wV=`COLON`,TV=`COMMA`,EV=`DOLLAR`,DV=`DOT`,OV=`EQUALS`,kV=`EXCLAMATION`,AV=`HYPHEN`,jV=`PERCENT`,MV=`PIPE`,NV=`PLUS`,PV=`POUND`,FV=`QUERY`,IV=`QUOTE`,LV=`FULLWIDTHMIDDLEDOT`,RV=`SEMI`,zV=`SLASH`,BV=`TILDE`,VV=`UNDERSCORE`,HV=`EMOJI`,UV=`SYM`,WV=Object.freeze({__proto__:null,ALPHANUMERICAL:KB,AMPERSAND:_V,APOSTROPHE:vV,ASCIINUMERICAL:GB,ASTERISK:yV,AT:bV,BACKSLASH:xV,BACKTICK:SV,CARET:CV,CLOSEANGLEBRACKET:cV,CLOSEBRACE:nV,CLOSEBRACKET:iV,CLOSEPAREN:oV,COLON:wV,COMMA:TV,DOLLAR:EV,DOT:DV,EMOJI:HV,EQUALS:OV,EXCLAMATION:kV,FULLWIDTHGREATERTHAN:gV,FULLWIDTHLEFTPAREN:lV,FULLWIDTHLESSTHAN:hV,FULLWIDTHMIDDLEDOT:LV,FULLWIDTHRIGHTPAREN:uV,HYPHEN:AV,LEFTCORNERBRACKET:dV,LEFTWHITECORNERBRACKET:pV,LOCALHOST:qB,NL:eV,NUM:QB,OPENANGLEBRACKET:sV,OPENBRACE:tV,OPENBRACKET:rV,OPENPAREN:aV,PERCENT:jV,PIPE:MV,PLUS:NV,POUND:PV,QUERY:FV,QUOTE:IV,RIGHTCORNERBRACKET:fV,RIGHTWHITECORNERBRACKET:mV,SCHEME:XB,SEMI:RV,SLASH:zV,SLASH_SCHEME:ZB,SYM:UV,TILDE:BV,TLD:JB,UNDERSCORE:VV,UTLD:YB,UWORD:WB,WORD:UB,WS:$B}),GV=/[a-z]/,KV=/\p{L}/u,qV=/\p{Emoji}/u,JV=/\d/,YV=/\s/,XV=`\r`,ZV=` 203`,QV=`ï¸`,$V=`â`,eH=``,tH=null,nH=null;function rH(e=[]){let t={};zB.groups=t;let n=new zB;tH??=sH(wB),nH??=sH(TB),G(n,`'`,vV),G(n,`{`,tV),G(n,`}`,nV),G(n,`[`,rV),G(n,`]`,iV),G(n,`(`,aV),G(n,`)`,oV),G(n,`<`,sV),G(n,`>`,cV),G(n,`ï¼`,lV),G(n,`ï¼`,uV),G(n,`ã`,dV),G(n,`ã`,fV),G(n,`ã`,pV),G(n,`ã`,mV),G(n,`ï¼`,hV),G(n,`ï¼`,gV),G(n,`&`,_V),G(n,`*`,yV),G(n,`@`,bV),G(n,"`",SV),G(n,`^`,CV),G(n,`:`,wV),G(n,`,`,TV),G(n,`$`,EV),G(n,`.`,DV),G(n,`=`,OV),G(n,`!`,kV),G(n,`-`,AV),G(n,`%`,jV),G(n,`|`,MV),G(n,`+`,NV),G(n,`#`,PV),G(n,`?`,FV),G(n,`"`,IV),G(n,`/`,zV),G(n,`;`,RV),G(n,`~`,BV),G(n,`_`,VV),G(n,`\\`,xV),G(n,`ã»`,LV);let r=VB(n,JV,QB,{[EB]:!0});VB(r,JV,r);let i=VB(r,GV,GB,{[kB]:!0}),a=VB(r,KV,KB,{[AB]:!0}),o=VB(n,GV,UB,{[DB]:!0});VB(o,JV,i),VB(o,GV,o),VB(i,JV,i),VB(i,GV,i);let s=VB(n,KV,WB,{[OB]:!0});VB(s,GV),VB(s,JV,a),VB(s,KV,s),VB(a,JV,a),VB(a,GV),VB(a,KV,a);let c=G(n,ZV,eV,{[FB]:!0}),l=G(n,XV,$B,{[FB]:!0}),u=VB(n,YV,$B,{[FB]:!0});G(n,eH,u),G(l,ZV,c),G(l,eH,u),VB(l,YV,u),G(u,XV),G(u,ZV),VB(u,YV,u),G(u,eH,u);let d=VB(n,qV,HV,{[MB]:!0});G(d,`#`),VB(d,qV,d),G(d,QV,d);let f=G(d,$V);G(f,`#`),VB(f,qV,d);
vendor: 34,802 bytes, lines 203-206
203let p=[[GV,o],[JV,i]],m=[[GV,null],[KV,s],[JV,a]];for(let e=0;e<tH.length;e++)oH(n,tH[e],JB,UB,p);for(let e=0;e<nH.length;e++)oH(n,nH[e],YB,WB,m);LB(JB,{tld:!0,ascii:!0},t),LB(YB,{utld:!0,alpha:!0},t),oH(n,`file`,XB,UB,p),oH(n,`mailto`,XB,UB,p),oH(n,`http`,ZB,UB,p),oH(n,`https`,ZB,UB,p),oH(n,`ftp`,ZB,UB,p),oH(n,`ftps`,ZB,UB,p),LB(XB,{scheme:!0,ascii:!0},t),LB(ZB,{slashscheme:!0,ascii:!0},t),e=e.sort((e,t)=>e[0]>t[0]?1:-1);for(let t=0;t<e.length;t++){let r=e[t][0],i=e[t][1]?{[NB]:!0}:{[PB]:!0};r.indexOf(`-`)>=0?i[jB]=!0:GV.test(r)?JV.test(r)?i[kB]=!0:i[DB]=!0:i[EB]=!0,HB(n,r,r,i)}return HB(n,`localhost`,qB,{ascii:!0}),n.jd=new zB(UV),{start:n,tokens:Object.assign({groups:t},WV)}}function iH(e,t){let n=aH(t.replace(/[A-Z]/g,e=>e.toLowerCase())),r=n.length,i=[],a=0,o=0;for(;o<r;){let s=e,c=null,l=0,u=null,d=-1,f=-1;for(;o<r&&(c=s.go(n[o]));)s=c,s.accepts()?(d=0,f=0,u=s):d>=0&&(d+=n[o].length,f++),l+=n[o].length,a+=n[o].length,o++;a-=d,o-=f,l-=d,i.push({t:u.t,v:t.slice(a-l,a),s:a-l,e:a})}return i}function aH(e){let t=[],n=e.length,r=0;for(;r<n;){let i=e.charCodeAt(r),a,o=i<55296||i>56319||r+1===n||(a=e.charCodeAt(r+1))<56320||a>57343?e[r]:e.slice(r,r+2);t.push(o),r+=o.length}return t}function oH(e,t,n,r,i){let a,o=t.length;for(let n=0;n<o-1;n++){let o=t[n];e.j[o]?a=e.j[o]:(a=new zB(r),a.jr=i.slice(),e.j[o]=a),e=a}return a=new zB(n),a.jr=i.slice(),e.j[t[o-1]]=a,a}function sH(e){let t=[],n=[],r=0;for(;r<e.length;){let i=0;for(;`0123456789`.indexOf(e[r+i])>=0;)i++;if(i>0){t.push(n.join(``));for(let t=parseInt(e.substring(r,r+i),10);t>0;t--)n.pop();r+=i}else n.push(e[r]),r++}return t}var cH={defaultProtocol:`http`,events:null,format:uH,formatHref:uH,nl2br:!1,tagName:`a`,target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function lH(e,t=null){let n=Object.assign({},cH);e&&(n=Object.assign(n,e instanceof lH?e.o:e));let r=n.ignoreTags,i=[];for(let e=0;e<r.length;e++)i.push(r[e].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=i}lH.prototype={o:cH,ignoreTags:[],defaultRender(e){return e},check(e){return this.get(`validate`,e.toString(),e)},get(e,t,n){let r=t!=null,i=this.o[e];return i&&(typeof i==`object`?(i=n.t in i?i[n.t]:cH[e],typeof i==`function`&&r&&(i=i(t,n))):typeof i==`function`&&r&&(i=i(t,n.t,n)),i)},getObj(e,t,n){let r=this.o[e];return typeof r==`function`&&t!=null&&(r=r(t,n.t,n)),r},render(e){let t=e.render(this);return(this.get(`render`,null,e)||this.defaultRender)(t,e.t,e)}};function uH(e){return e}function dH(e,t){this.t=`token`,this.v=e,this.tk=t}dH.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){let t=this.toString(),n=e.get(`truncate`,t,this),r=e.get(`format`,t,this);return n&&r.length>n?r.substring(0,n)+`â¦`:r},toFormattedHref(e){return e.get(`formatHref`,this.toHref(e.get(`defaultProtocol`)),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=cH.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get(`validate`,this.toString(),this)},render(e){let t=this,n=this.toHref(e.get(`defaultProtocol`)),r=e.get(`formatHref`,n,this),i=e.get(`tagName`,n,t),a=this.toFormattedString(e),o={},s=e.get(`className`,n,t),c=e.get(`target`,n,t),l=e.get(`rel`,n,t),u=e.getObj(`attributes`,n,t),d=e.getObj(`events`,n,t);return o.href=r,s&&(o.class=s),c&&(o.target=c),l&&(o.rel=l),u&&Object.assign(o,u),{tagName:i,attributes:o,content:a,eventListeners:d}}};function fH(e,t){class n extends dH{constructor(t,n){super(t,n),this.t=e}}for(let e in t)n.prototype[e]=t[e];return n.t=e,n}var pH=fH(`email`,{isLink:!0,toHref(){return`mailto:`+this.toString()}}),mH=fH(`text`),hH=fH(`nl`),gH=fH(`url`,{isLink:!0,toHref(e=cH.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){let e=this.tk;return e.length>=2&&e[0].t!==qB&&e[1].t===wV}}),_H=e=>new zB(e);function vH({groups:e}){let t=e.domain.concat([_V,yV,bV,xV,SV,CV,EV,OV,AV,QB,jV,MV,NV,PV,zV,UV,BV,VV]),n=[vV,wV,TV,DV,kV,jV,FV,IV,RV,sV,cV,tV,nV,iV,rV,aV,oV,lV,uV,dV,fV,pV,mV,hV,gV],r=[_V,vV,yV,xV,SV,CV,EV,OV,AV,tV,nV,jV,MV,NV,PV,FV,zV,UV,BV,VV],i=_H(),a=G(i,BV);BB(a,r,a),BB(a,e.domain,a);let o=_H(),s=_H(),c=_H();BB(i,e.domain,o),BB(i,e.scheme,s),BB(i,e.slashscheme,c),BB(o,r,a),BB(o,e.domain,o);let l=G(o,bV);G(a,bV,l),G(s,bV,l),G(c,bV,l);let u=G(a,DV);BB(u,r,a),BB(u,e.domain,a);let d=_H();BB(l,e.domain,d),BB(d,e.domain,d);let f=G(d,DV);BB(f,e.domain,d);let p=_H(pH);BB(f,e.tld,p),BB(f,e.utld,p),G(l,qB,p);let m=G(d,AV);G(m,AV,m),BB(m,e.domain,d),BB(p,e.domain,d),G(p,DV,f),G(p,AV,m);let h=G(o,AV),g=G(o,DV);G(h,AV,h),BB(h,e.domain,o),BB(g,r,a),BB(g,e.domain,o);let _=_H(gH);BB(g,e.tld,_),BB(g,e.utld,_),BB(_,e.domain,o),BB(_,r,a),G(_,DV,g),G(_,AV,h),G(_,bV,l);let v=G(_,wV),y=_H(gH);BB(v,e.numeric,y);let b=_H(gH),x=_H();BB(b,t,b),BB(b,n,x),BB(x,t,b),BB(x,n,x),G(_,zV,b),G(y,zV,b);let S=G(s,wV),C=G(G(G(c,wV),zV),zV);BB(s,e.domain,o),G(s,DV,g),G(s,AV,h),BB(c,e.domain,o),G(c,DV,g),G(c,AV,h),BB(S,e.domain,b),G(S,zV,b),G(S,FV,b),BB(C,e.domain,b),BB(C,t,b),G(C,zV,b);let w=[[tV,nV],[rV,iV],[aV,oV],[sV,cV],[lV,uV],[dV,fV],[pV,mV],[hV,gV]];for(let e=0;e<w.length;e++){let[r,i]=w[e],a=G(b,r);G(x,r,a);let o=_H(gH);BB(a,t,o);let s=_H();BB(a,n,s),G(a,i,b),BB(o,t,o),BB(o,n,s),BB(s,t,o),BB(s,n,s),G(o,i,b),G(s,i,b)}return G(i,qB,_),G(i,eV,hH),{start:i,tokens:WV}}function yH(e,t,n){let r=n.length,i=0,a=[],o=[];for(;i<r;){let s=e,c=null,l=null,u=0,d=null,f=-1;for(;i<r&&!(c=s.go(n[i].t));)o.push(n[i++]);for(;i<r&&(l=c||s.go(n[i].t));)c=null,s=l,s.accepts()?(f=0,d=s):f>=0&&f++,i++,u++;if(f<0)i-=u,i<r&&(o.push(n[i]),i++);else{o.length>0&&(a.push(bH(mH,t,o)),o=[]),i-=f,u-=f;let e=d.t,r=n.slice(i-u,i);a.push(bH(e,t,r))}}return o.length>0&&a.push(bH(mH,t,o)),a}function bH(e,t,n){let r=n[0].s,i=n[n.length-1].e;return new e(t.slice(r,i),n)}var xH=typeof console<`u`&&console&&console.warn||(()=>{}),SH=`until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`,CH={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function wH(){return zB.groups={},CH.scanner=null,CH.parser=null,CH.tokenQueue=[],CH.pluginQueue=[],CH.customSchemes=[],CH.initialized=!1,CH}function TH(e,t=!1){if(CH.initialized&&xH(`linkifyjs: already initialized - will not register custom scheme "${e}" ${SH}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw Error(`linkifyjs: incorrect scheme format. 2041. Must only contain digits, lowercase ASCII letters or "-" 2052. Cannot start or end with "-" 2063. "-" cannot repeat`);CH.customSchemes.push([e,t])}function EH(){CH.scanner=rH(CH.customSchemes);for(let e=0;e<CH.tokenQueue.length;e++)CH.tokenQueue[e][1]({scanner:CH.scanner});CH.parser=vH(CH.scanner.tokens);for(let e=0;e<CH.pluginQueue.length;e++)CH.pluginQueue[e][1]({scanner:CH.scanner,parser:CH.parser});return CH.initialized=!0,CH}function DH(e){return CH.initialized||EH(),yH(CH.parser.start,e,iH(CH.scanner.start,e))}DH.scan=iH;function OH(e,t=null,n=null){if(t&&typeof t==`object`){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}let r=new lH(n),i=DH(e),a=[];for(let e=0;e<i.length;e++){let n=i[e];n.isLink&&(!t||n.t===t)&&r.check(n)&&a.push(n.toFormattedObject(r))}return a}var kH=`[\0- \xA0áá â-\u2029âã]`,AH=new RegExp(kH),jH=RegExp(`${kH}$`),MH=new RegExp(kH,`g`);function NH(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?[`()`,`[]`].includes(e[0].value+e[2].value):!1}function PH(e){return new vO({key:new xO(`autolink`),appendTransaction:(t,n,r)=>{let i=t.some(e=>e.docChanged)&&!n.doc.eq(r.doc),a=t.some(e=>e.getMeta(`preventAutolink`));if(!i||a)return;let{tr:o}=r;if(BP(lP(n.doc,[...t])).forEach(({newRange:t})=>{let n=dP(r.doc,t,e=>e.isTextblock),i,a;if(n.length>1)i=n[0],a=r.doc.textBetween(i.pos,i.pos+i.node.nodeSize,void 0,` `);else if(n.length){let e=r.doc.textBetween(t.from,t.to,` `,` `);if(!jH.test(e))return;i=n[0],a=r.doc.textBetween(i.pos,t.to,void 0,` `)}if(i&&a){let t=a.split(AH).filter(Boolean);if(t.length<=0)return!1;let n=t[t.length-1],s=i.pos+a.lastIndexOf(n);if(!n)return!1;let c=DH(n).map(t=>t.toObject(e.defaultProtocol));if(!NH(c))return!1;c.filter(e=>e.isLink).map(e=>({...e,from:s+e.start+1,to:s+e.end+1})).filter(e=>r.schema.marks.code?!r.doc.rangeHasMark(e.from,e.to,r.schema.marks.code):!0).filter(t=>e.validate(t.value)).filter(t=>e.shouldAutoLink(t.value)).forEach(t=>{VP(t.from,t.to,r.doc).some(t=>t.mark.type===e.type)||o.addMark(t.from,t.to,e.type.create({href:t.href}))})}}),o.steps.length)return o}})}function FH(e){return new vO({key:new xO(`handleClickLink`),props:{handleClick:(t,n,r)=>{if(r.button!==0||!t.editable)return!1;let i=null;if(r.target instanceof HTMLAnchorElement)i=r.target;else{let t=r.target;if(!t)return!1;let n=e.editor.view.dom;i=t.closest(`a`),i&&!n.contains(i)&&(i=null)}if(!i)return!1;let a=!1;if(e.enableClickSelection&&(a=e.editor.commands.extendMarkRange(e.type.name)),e.openOnClick){let n=LP(t.state,e.type.name),r=i.href??n.href,o=i.target??n.target;r&&(window.open(r,o),a=!0)}return a}}})}function IH(e){return new vO({key:new xO(`handlePasteLink`),props:{handlePaste:(t,n,r)=>{let{shouldAutoLink:i}=e,{state:a}=t,{selection:o}=a,{empty:s}=o;if(s)return!1;let c=``;r.content.forEach(e=>{c+=e.textContent});let l=OH(c,{defaultProtocol:e.defaultProtocol}).find(e=>e.isLink&&e.value===c);return!c||!l||i!==void 0&&!i(l.value)?!1:e.editor.commands.setMark(e.type,{href:l.href})}}})}function LH(e,t){let n=[`http`,`https`,`ftp`,`ftps`,`mailto`,`tel`,`callto`,`sms`,`cid`,`xmpp`];return t&&t.forEach(e=>{let t=typeof e==`string`?e:e.scheme;t&&n.push(t)}),!e||e.replace(MH,``).match(RegExp(`^(?:(?:${n.join(`|`)}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,`i`))}var RH=RF.create({name:`link`,priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{if(typeof e==`string`){TH(e);return}TH(e.scheme,e.optionalSlashes)})},onDestroy(){wH()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer nofollow`,class:null},isAllowedUri:(e,t)=>!!LH(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{let t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes(`@`))return!0;let r=(e.includes(`@`)?e.split(`@`).pop():e).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){return{href:{default:null,parseHTML(e){return e.getAttribute(`href`)}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:`a[href]`,getAttrs:e=>{let t=e.getAttribute(`href`);return!t||!this.options.isAllowedUri(t,{defaultValidate:e=>!!LH(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!LH(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?[`a`,CP(this.options.HTMLAttributes,e),0]:[`a`,CP(this.options.HTMLAttributes,{...e,href:``}),0]},markdownTokenName:`link`,parseMarkdown:(e,t)=>t.applyMark(`link`,t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{let n=e.attrs?.href??``,r=e.attrs?.title??``,i=t.renderChildren(e);return r?`[${i}](${n} "${r}")`:`[${i}](${n})`},addCommands(){return{setLink:e=>({chain:t})=>{let{href:n}=e;return this.options.isAllowedUri(n,{defaultValidate:e=>!!LH(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta(`preventAutolink`,!0).run():!1},toggleLink:e=>({chain:t})=>{let{href:n}=e||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:e=>!!LH(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()}},addPasteRules(){return[AI({find:e=>{let t=[];if(e){let{protocols:n,defaultProtocol:r}=this.options,i=OH(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!LH(e,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(e=>{this.options.shouldAutoLink(e.value)&&t.push({text:e.value,data:{href:e.href},index:e.start})})}return t},type:this.type,getAttributes:e=>({href:e.data?.href})})]},addProseMirrorPlugins(){let e=[],{protocols:t,defaultProtocol:n}=this.options;return this.options.autolink&&e.push(PH({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!LH(e,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),e.push(FH({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick===`whenNotEditable`?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(IH({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}}),zH=` `,BH=`\xA0`,VH=OI.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,CP(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(n.length===1&&n[0].type===`image`)return t.parseChildren([n[0]]);let r=t.parseInline(n);return n.length===1&&n[0].type===`text`&&(n[0].raw===zH||n[0].text===zH||n[0].raw===BH||n[0].text===BH)&&r.length===1&&r[0].type===`text`&&(r[0].text===zH||r[0].text===BH)?t.createNode(`paragraph`,void 0,[]):t.createNode(`paragraph`,void 0,r)},renderMarkdown:(e,t,n)=>{if(!e)return``;let r=Array.isArray(e.content)?e.content:[];if(r.length===0){let e=Array.isArray(n?.previousNode?.content)?n.previousNode.content:[];return n?.previousNode?.type===`paragraph`&&e.length===0?zH:``}return t.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),HH=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,UH=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,WH=RF.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`,CP(this.options.HTMLAttributes,e),0]},markdownTokenName:`del`,parseMarkdown:(e,t)=>t.applyMark(`strike`,t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[lI({find:HH,type:this.type})]},addPasteRules(){return[AI({find:UH,type:this.type})]}}),GH=OI.create({name:`text`,group:`inline`,parseMarkdown:e=>({type:`text`,text:e.text||``}),renderMarkdown:e=>e.text||``});function KH(e={}){return new vO({view(t){return new qH(t,e)}})}var qH=class{constructor(e,t){this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=t.width??1,this.color=t.color===!1?void 0:t.color||`black`,this.class=t.class,this.handlers=[`dragover`,`dragend`,`drop`,`dragleave`].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,r=this.editorView.dom,i=r.getBoundingClientRect(),a=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(t){let t=e.nodeBefore,r=e.nodeAfter;if(t||r){let e=this.editorView.nodeDOM(this.cursorPos-(t?t.nodeSize:0));if(e){let i=e.getBoundingClientRect(),a=t?i.bottom:i.top;t&&r&&(a=(a+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*o;n={left:i.left,right:i.right,top:a-s,bottom:a+s}}}}if(!n){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*a;n={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let s=this.editorView.dom.offsetParent;this.element||(this.element=s.appendChild(document.createElement(`div`)),this.class&&(this.element.className=this.class),this.element.style.cssText=`position: absolute; z-index: 50; pointer-events: none;`,this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle(`prosemirror-dropcursor-block`,t),this.element.classList.toggle(`prosemirror-dropcursor-inline`,!t);let c,l;if(!s||s==document.body&&getComputedStyle(s).position==`static`)c=-pageXOffset,l=-pageYOffset;else{let e=s.getBoundingClientRect(),t=e.width/s.offsetWidth,n=e.height/s.offsetHeight;c=e.left-s.scrollLeft*t,l=e.top-s.scrollTop*n}this.element.style.left=(n.left-c)/a+`px`,this.element.style.top=(n.top-l)/o+`px`,this.element.style.width=(n.right-n.left)/a+`px`,this.element.style.height=(n.bottom-n.top)/o+`px`}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i=typeof r==`function`?r(this.editorView,t,e):r;if(t&&!i){let e=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let t=FD(this.editorView.state.doc,e,this.editorView.dragging.slice);t!=null&&(e=t)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}},JH=class e extends ZD{constructor(e){super(e,e)}map(t,n){let r=t.resolve(n.map(this.head));return e.valid(r)?new e(r):ZD.near(r)}content(){return H.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 YH(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!ZH(e)||!QH(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&&!U.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}}};JH.prototype.visible=!1,JH.findFrom=JH.findGapCursorFrom,ZD.jsonID(`gapcursor`,JH);var YH=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 JH.valid(t)?new JH(t):ZD.near(t)}};function XH(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function ZH(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||XH(e.type))return!0;if(e.inlineContent)return!1}}return!0}function QH(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||XH(e.type))return!0;if(e.inlineContent)return!1}}return!0}function $H(){return new vO({props:{decorations:iU,createSelectionBetween(e,t,n){return t.pos==n.pos&&JH.valid(n)?new JH(n):null},handleClick:nU,handleKeyDown:eU,handleDOMEvents:{beforeinput:rU}}})}var eU=KM({ArrowLeft:tU(`horiz`,-1),ArrowRight:tU(`horiz`,1),ArrowUp:tU(`vert`,-1),ArrowDown:tU(`vert`,1)});function tU(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 tO){if(!i.endOfTextblock(n)||o.depth==0)return!1;s=!1,o=e.doc.resolve(t>0?o.after():o.before())}let c=JH.findGapCursorFrom(o,t,s);return c?(r&&r(e.tr.setSelection(new JH(c))),!0):!1}}function nU(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!JH.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&U.isSelectable(e.state.doc.nodeAt(i.inside))?!1:(e.dispatch(e.state.tr.setSelection(new JH(r))),!0)}function rU(e,t){if(t.inputType!=`insertCompositionText`||!(e.state.selection instanceof JH))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=V.empty;for(let e=r.length-1;e>=0;e--)i=V.from(r[e].createAndFill(null,i));let a=e.state.tr.replace(n.pos,n.pos,new H(i,0,0));return a.setSelection(tO.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function iU(e){if(!(e.selection instanceof JH))return null;let t=document.createElement(`div`);return t.className=`ProseMirror-gapcursor`,Gj.create(e.doc,[Hj.widget(e.selection.head,t,{key:`gapcursor`})])}var aU=200,oU=function(){};oU.prototype.append=function(e){return e.length?(e=oU.from(e),!this.length&&e||e.length<aU&&this.leafAppend(e)||this.length<aU&&e.leafPrepend(this)||this.appendInner(e)):this},oU.prototype.prepend=function(e){return e.length?oU.from(e).append(this):this},oU.prototype.appendInner=function(e){return new cU(this,e)},oU.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?oU.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},oU.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},oU.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)},oU.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},oU.from=function(e){return e instanceof oU?e:e&&e.length?new sU(e):oU.empty};var sU=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<=aU)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=aU)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}(oU);oU.empty=new sU([]);var cU=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}(oU),lU=500,uU=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 fU(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 fU(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 fU(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>mU&&(s=dU(s,l),o-=l),new e(s.append(a),o)}remapping(e,t){let n=new $E;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 fU(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 fU(i,o,l))}else r.push(new fU(i))},i);let l=[];for(let e=n;e<o;e++)l.push(new fU(a.maps[e]));let u=new e(this.items.slice(0,i).append(l).append(r),s);return u.emptyItemCount()>lU&&(u=u.compress(this.items.length-r.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,i=[],a=0;return this.items.forEach((e,o)=>{if(o>=t)i.push(e),e.selection&&a++;else if(e.step){let t=e.step.map(n.slice(r)),o=t&&t.getMap();if(r--,o&&n.appendMap(o,r),t){let s=e.selection&&e.selection.map(n.slice(r));s&&a++;let c=new fU(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(oU.from(i.reverse()),a)}};uU.empty=new uU(oU.empty,0);function dU(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&t--==0)return n=r,!1}),e.slice(n)}var fU=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)}}},pU=class{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}},mU=20;function hU(e,t,n,r){let i=n.getMeta(CU),a;if(i)return i.historyState;n.getMeta(wU)&&(e=new pU(e.done,e.undone,null,0,-1));let o=n.getMeta(`appendedTransaction`);if(n.steps.length==0)return e;if(o&&o.getMeta(CU))return o.getMeta(CU).redo?new pU(e.done.addTransform(n,void 0,r,SU(t)),e.undone,_U(n.mapping.maps),e.prevTime,e.prevComposition):new pU(e.done,e.undone.addTransform(n,void 0,r,SU(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||!gU(n,e.prevRanges)),s=o?vU(e.prevRanges,n.mapping):_U(n.mapping.maps);return new pU(e.done.addTransform(n,a?t.selection.getBookmark():void 0,r,SU(t)),uU.empty,s,n.time,i??e.prevComposition)}else if(a=n.getMeta(`rebased`))return new pU(e.done.rebased(n,a),e.undone.rebased(n,a),vU(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);else return new pU(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),vU(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function gU(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 _U(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 vU(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 yU(e,t,n){let r=SU(t),i=CU.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 pU(n?s:a.remaining,n?a.remaining:s,null,0,-1);return a.transform.setSelection(o).setMeta(CU,{redo:n,historyState:c})}var bU=!1,xU=null;function SU(e){let t=e.plugins;if(xU!=t){bU=!1,xU=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){bU=!0;break}}return bU}var CU=new xO(`history`),wU=new xO(`closeHistory`);function TU(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new vO({key:CU,state:{init(){return new pU(uU.empty,uU.empty,null,0,-1)},apply(t,n,r){return hU(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r=n==`historyUndo`?DU:n==`historyRedo`?OU:null;return!r||!e.editable?!1:(t.preventDefault(),r(e.state,e.dispatch))}}}})}function EU(e,t){return(n,r)=>{let i=CU.getState(n);if(!i||(e?i.undone:i.done).eventCount==0)return!1;if(r){let a=yU(i,n,e);a&&r(t?a.scrollIntoView():a)}return!0}}var DU=EU(!1,!0),OU=EU(!0,!0);qF.create({name:`characterCount`,addOptions(){return{limit:null,autoTrim:!0,mode:`textSize`,textCounter:e=>e.length,wordCounter:e=>e.split(` `).filter(e=>e!==``).length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{let t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)===`textSize`){let e=t.textBetween(0,t.content.size,void 0,` `);return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size,` `,` `);return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new vO({key:new xO(`characterCount`),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit,a=this.options.autoTrim;if(i==null||i===0||a===!1){e=!0;return}let o=this.storage.characters({node:r.doc});if(o>i){let t=o-i;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let n=r.tr.deleteRange(0,t);return e=!0,n}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||n===0||n==null)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta(`paste`))return!1;let a=e.selection.$head.pos,o=a-(i-n),s=a;return e.deleteRange(o,s),!(this.storage.characters({node:e.doc})>n)}})]}});var kU=qF.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[KH(this.options)]}});qF.create({name:`focus`,addOptions(){return{className:`has-focus`,mode:`all`}},addProseMirrorPlugins(){return[new vO({key:new xO(`focus`),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,a=[];if(!n||!r)return Gj.create(e,[]);let o=0;this.options.mode===`deepest`&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;o+=1}});let s=0;return e.descendants((e,t)=>{if(e.isText||!(i>=t&&i<=t+e.nodeSize-1))return!1;if(s+=1,this.options.mode===`deepest`&&o-s>0||this.options.mode===`shallowest`&&s>1)return this.options.mode===`deepest`;a.push(Hj.node(t,t+e.nodeSize,{class:this.options.className}))}),Gj.create(e,a)}}})]}});var AU=qF.create({name:`gapCursor`,addProseMirrorPlugins(){return[$H()]},extendNodeSchema(e){return{allowGapCursor:_P(W(e,`allowGapCursor`,{name:e.name,options:e.options,storage:e.storage}))??null}}}),jU=`placeholder`;function MU(e){return e.replace(/\s+/g,`-`).replace(/[^a-zA-Z0-9-]/g,``).replace(/^[0-9-]+/,``).replace(/^-+/,``).toLowerCase()}qF.create({name:`placeholder`,addOptions(){return{emptyEditorClass:`is-editor-empty`,emptyNodeClass:`is-empty`,dataAttribute:jU,placeholder:`Write something â¦`,showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){let e=this.options.dataAttribute?`data-${MU(this.options.dataAttribute)}`:`data-${jU}`;return[new vO({key:new xO(`placeholder`),props:{decorations:({doc:t,selection:n})=>{let r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=n,a=[];if(!r)return null;let o=this.editor.isEmpty;
206return t.descendants((t,n)=>{let r=i>=n&&i<=n+t.nodeSize,s=!t.isLeaf&&QP(t);if(!t.type.isTextblock)return this.options.includeChildren;if((r||!this.options.showOnlyCurrent)&&s){let i=[this.options.emptyNodeClass];o&&i.push(this.options.emptyEditorClass);let s=Hj.node(n,n+t.nodeSize,{class:i.join(` `),[e]:typeof this.options.placeholder==`function`?this.options.placeholder({editor:this.editor,node:t,pos:n,hasAnchor:r}):this.options.placeholder});a.push(s)}return this.options.includeChildren}),Gj.create(t,a)}}})]}});var NU=qF.create({name:`selection`,addOptions(){return{className:`selection`}},addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new vO({key:new xO(`selection`),props:{decorations(n){return n.selection.empty||e.isFocused||!e.isEditable||$P(n.selection)||e.view.dragging?null:Gj.create(n.doc,[Hj.inline(n.selection.from,n.selection.to,{class:t.className})])}}})]}});function PU({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var FU=qF.create({name:`trailingNode`,addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){let e=new xO(this.name),t=this.options.node||this.editor.schema.topNodeType.contentMatch.defaultType?.name||`paragraph`,n=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(t).includes(e.name));return[new vO({key:e,appendTransaction:(n,r,i)=>{let{doc:a,tr:o,schema:s}=i,c=e.getState(i),l=a.content.size,u=s.nodes[t];if(!n.some(e=>e.getMeta(`skipTrailingNode`))&&c)return o.insert(l,u.create())},state:{init:(e,t)=>{let r=t.tr.doc.lastChild;return!PU({node:r,types:n})},apply:(e,t)=>{if(!e.docChanged||e.getMeta(`__uniqueIDTransaction`))return t;let r=e.doc.lastChild;return!PU({node:r,types:n})}}})]}}),IU=qF.create({name:`undoRedo`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>DU(e,t),redo:()=>({state:e,dispatch:t})=>OU(e,t)}},addProseMirrorPlugins(){return[TU(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()}}}),LU=qF.create({name:`starterKit`,addExtensions(){let e=[];return this.options.bold!==!1&&e.push(cB.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(rB.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(az.configure(this.options.bulletList)),this.options.code!==!1&&e.push(dB.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(hB.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(gB.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(kU.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(AU.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(_B.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(vB.configure(this.options.heading)),this.options.undoRedo!==!1&&e.push(IU.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&e.push(nz.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(CB.configure(this.options.italic)),this.options.listItem!==!1&&e.push(oz.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(gz.configure(this.options?.listKeymap)),this.options.link!==!1&&e.push(RH.configure(this.options?.link)),this.options.orderedList!==!1&&e.push(wz.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(VH.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(WH.configure(this.options.strike)),this.options.text!==!1&&e.push(GH.configure(this.options.text)),this.options.underline!==!1&&e.push(eB.configure(this.options?.underline)),this.options.trailingNode!==!1&&e.push(FU.configure(this.options?.trailingNode)),e}}),RU=Pce.extend({renderHTML(){return[`div`,{"data-type":`horizontalRule`},[`hr`]]}}),zU=OI.create({name:`imageUpload`,group:`block`,atom:!0,draggable:!0,selectable:!0,addAttributes(){return{accept:{default:`image/*`},limit:{default:1},maxSize:{default:0}}},parseHTML(){return[{tag:`div[data-type="image-upload"]`}]},renderHTML(){return[`div`,{"data-type":`image-upload`}]}});function BU(e){return[LU.configure({horizontalRule:!1,link:{openOnClick:!1,enableClickSelection:!0}
206}),e?.horizontalRule??RU,Az.configure({types:[`heading`,`paragraph`]}),Dz,Ez.configure({nested:!0}),Lce.configure({multicolor:!0}),zce,$z,kz,Oz,eB,NU,e?.imageUpload??zU]}BU();var VU=BU({imageUpload:Nce.configure({accept:`image/*`,maxSize:gce,limit:3,upload:async()=>{throw Error(`Image upload is coming soon.`)},onError:e=>console.warn(`Image upload disabled:`,e.message)})});function HU({orientation:e=`horizontal`,size:t,style:n={},...r}){let i={...n,...e===`horizontal`&&!t&&{flex:1},...t&&{width:e===`vertical`?`1px`:t,height:e===`horizontal`?`1px`:t}};return(0,M.jsx)(`div`,{...r,style:i})}function UU({decorative:e,orientation:t=`vertical`,className:n,...r}){let i=e?{role:`none`}:{"aria-orientation":t===`vertical`?t:void 0,role:`separator`};return(0,M.jsx)(`div`,{className:UR(`tiptap-separator`,n),"data-orientation":t,...i,...r})}function WU({editor:e,containerRef:t,query:n,items:r,onSelect:i,onClose:a,orientation:o=`vertical`,autoSelectFirstItem:s=!0}){let[c,l]=(0,_.useState)(s?0:-1);return(0,_.useEffect)(()=>{let n=e=>{if(!r.length)return!1;let t=()=>l(e=>e===-1?0:(e+1)%r.length),n=()=>l(e=>e===-1?r.length-1:(e-1+r.length)%r.length);switch(e.key){case`ArrowUp`:return o===`horizontal`?!1:(e.preventDefault(),n(),!0);case`ArrowDown`:return o===`horizontal`?!1:(e.preventDefault(),t(),!0);case`ArrowLeft`:return o===`vertical`?!1:(e.preventDefault(),n(),!0);case`ArrowRight`:return o===`vertical`?!1:(e.preventDefault(),t(),!0);case`Tab`:return e.preventDefault(),e.shiftKey?n():t(),!0;case`Home`:return e.preventDefault(),l(0),!0;case`End`:return e.preventDefault(),l(r.length-1),!0;case`Enter`:return e.isComposing?!1:(e.preventDefault(),c!==-1&&r[c]&&i?.(r[c]),!0);case`Escape`:return e.preventDefault(),a?.(),!0;default:return!1}},s=null;if(e?s=e.view.dom:t?.current&&(s=t.current),s)return s.addEventListener(`keydown`,n,!0),()=>{s?.removeEventListener(`keydown`,n,!0)}},[e,t,r,c,i,a,o]),(0,_.useEffect)(()=>{n&&l(s?0:-1)},[n,s]),{selectedIndex:r.length?c:void 0,setSelectedIndex:l}}var GU=(e,t)=>{typeof e==`function`?e(t):e&&typeof e==`object`&&`current`in e&&(e.current=t)},KU=(e,t)=>{let n=(0,_.useRef)(null);return(0,_.useCallback)(r=>{e&&`current`in e&&(e.current=r),n.current&&GU(n.current,null),n.current=t,t&&GU(t,r)},[e,t])},qU=e=>{let[t,n]=(0,_.useState)([]),r=(0,_.useCallback)(()=>e.current?Array.from(e.current.querySelectorAll(`button:not([disabled]), [role="button"]:not([disabled]), [tabindex="0"]:not([disabled])`)):[],[e]);(0,_.useEffect)(()=>{let t=e.current;if(!t)return;let i=()=>n(r());i();let a=new MutationObserver(i);return a.observe(t,{childList:!0,subtree:!0}),()=>a.disconnect()},[r,e]);let{selectedIndex:i}=WU({containerRef:e,items:t,orientation:`horizontal`,onSelect:e=>e.click(),autoSelectFirstItem:!1});(0,_.useEffect)(()=>{let t=e.current;if(!t)return;let n=e=>{let n=e.target;t.contains(n)&&n.setAttribute(`data-focus-visible`,`true`)},r=e=>{let n=e.target;t.contains(n)&&n.removeAttribute(`data-focus-visible`)};return t.addEventListener(`focus`,n,!0),t.addEventListener(`blur`,r,!0),()=>{t.removeEventListener(`focus`,n,!0),t.removeEventListener(`blur`,r,!0)}},[e]),(0,_.useEffect)(()=>{i!==void 0&&t[i]&&t[i].focus()},[i,t])},JU=(0,_.forwardRef)(({children:e,className:t,variant:n=`fixed`,...r},i)=>{let a=(0,_.useRef)(null),o=KU(a,i);return qU(a),(0,M.jsx)(`div`,{ref:o,role:`toolbar`,"aria-label":`toolbar`,"data-variant":n,className:UR(`tiptap-toolbar`,t),...r,children:e})});JU.displayName=`Toolbar`;var YU=(0,_.forwardRef)(({children:e,className:t,...n},r)=>(0,M.jsx)(`div`,{ref:r,role:`group`,className:UR(`tiptap-toolbar-group`,t),...n,children:e}));YU.displayName=`ToolbarGroup`;var XU=(0,_.forwardRef)(({...e},t)=>(0,M.jsx)(UU,{ref:t,orientation:`vertical`,decorative:!0,...e}));XU.displayName=`ToolbarSeparator`;var ZU=(0,_.memo)(({className:e,...t})=>(0,M.jsx)(`svg`,{width:`24`,height:`24`,className:e,viewBox:`0 0 24 24`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,...t,children:(0,M.jsx)(`path`,{d:`M12.7071 5.70711C13.0976 5.31658 13.0976 4.68342 12.7071 4.29289C12.3166 3.90237 11.6834 3.90237 11.2929 4.29289L4.29289 11.2929C3.90237 11.6834 3.90237 12.3166 4.29289 12.7071L11.2929 19.7071C11.6834 20.0976 12.3166 20.0976 12.7071 19.7071C13.0976 19.3166 13.0976 18.6834 12.7071 18.2929L7.41421 13L19 13C19.5523 13 20 12.5523 20 12C20 11.4477 19.5523 11 19 11L7.41421 11L12.7071 5.70711Z`,fill:`currentColor`})}));ZU.displayName=`ArrowLeftIcon`;var QU=(0,_.memo)(({className:e,...t})=>(0,M.jsx)(`svg`,{width:`24`,height:`24`,className:e,viewBox:`0 0 24 24`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,...t,children:(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M14.7072 4.70711C15.0977 4.31658 15.0977 3.68342 14.7072 3.29289C14.316
2067 2.90237 13.6835 2.90237 13.293 3.29289L8.69294 7.89286L8.68594 7.9C8.13626 8.46079 7.82837 9.21474 7.82837 10C7.82837 10.2306 7.85491 10.4584 7.90631 10.6795L2.29289 16.2929C2.10536 16.4804 2 16.7348 2 17V20C2 20.5523 2.44772 21 3 21H12C12.2652 21 12.5196 20.8946 12.7071 20.7071L15.3205 18.0937C15.5416 18.1452 15.7695 18.1717 16.0001 18.1717C16.7853 18.1717 17.5393 17.8639 18.1001 17.3142L22.7072 12.7071C23.0977 12.3166 23.0977 11.6834 22.7072 11.2929C22.3167 10.9024 21.6835 10.9024 21.293 11.2929L16.6971 15.8887C16.5105 16.0702 16.2605 16.1717 16.0001 16.1717C15.7397 16.1717 15.4897 16.0702 15.303 15.8887L10.1113 10.697C9.92992 10.5104 9.82837 10.2604 9.82837 10C9.82837 9.73963 9.92992 9.48958 10.1113 9.30297L14.7072 4.70711ZM13.5858 17L9.00004 12.4142L4 17.4142V19H11.5858L13.5858 17Z`,fill:`currentColor`})}));QU.displayName=`HighlighterIcon`;var $U=(0,_.memo)(({className:e,...t})=>(0,M.jsxs)(`svg`,{width:`24`,height:`24`,className:e,viewBox:`0 0 24 24`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,...t,children:[(0,M.jsx)(`path`,{d:`M16.9958 1.06669C15.4226 1.05302 13.907 1.65779 12.7753 2.75074L12.765 2.76086L11.045 4.47086C10.6534 4.86024 10.6515 5.49341 11.0409 5.88507C11.4303 6.27673 12.0634 6.27858 12.4551 5.88919L14.1697 4.18456C14.9236 3.45893 15.9319 3.05752 16.9784 3.06662C18.0272 3.07573 19.0304 3.49641 19.772 4.23804C20.5137 4.97967 20.9344 5.98292 20.9435 7.03171C20.9526 8.07776 20.5515 9.08563 19.8265 9.83941L16.833 12.8329C16.4274 13.2386 15.9393 13.5524 15.4019 13.7529C14.8645 13.9533 14.2903 14.0359 13.7181 13.9949C13.146 13.9539 12.5894 13.7904 12.0861 13.5154C11.5827 13.2404 11.1444 12.8604 10.8008 12.401C10.47 11.9588 9.84333 11.8685 9.40108 12.1993C8.95883 12.5301 8.86849 13.1568 9.1993 13.599C9.71464 14.288 10.3721 14.858 11.1272 15.2705C11.8822 15.683 12.7171 15.9283 13.5753 15.9898C14.4334 16.0513 15.2948 15.9274 16.1009 15.6267C16.907 15.326 17.639 14.8555 18.2473 14.247L21.2472 11.2471L21.2593 11.2347C22.3523 10.1031 22.9571 8.58751 22.9434 7.01433C22.9297 5.44115 22.2987 3.93628 21.1863 2.82383C20.0738 1.71138 18.5689 1.08036 16.9958 1.06669Z`,fill:`currentColor`}),(0,M.jsx)(`path`,{d:`M10.4247 8.0102C9.56657 7.94874 8.70522 8.07256 7.89911 8.37326C7.09305 8.67395 6.36096 9.14458 5.75272 9.753L2.75285 12.7529L2.74067 12.7653C1.64772 13.8969 1.04295 15.4125 1.05662 16.9857C1.07029 18.5589 1.70131 20.0637 2.81376 21.1762C3.9262 22.2886 5.43108 22.9196 7.00426 22.9333C8.57744 22.947 10.0931 22.3422 11.2247 21.2493L11.2371 21.2371L12.9471 19.5271C13.3376 19.1366 13.3376 18.5034 12.9471 18.1129C12.5565 17.7223 11.9234 17.7223 11.5328 18.1129L9.82932 19.8164C9.07555 20.5414 8.06768 20.9425 7.02164 20.9334C5.97285 20.9243 4.9696 20.5036 4.22797 19.762C3.48634 19.0203 3.06566 18.0171 3.05655 16.9683C3.04746 15.9222 3.44851 14.9144 4.17355 14.1606L7.16719 11.167C7.5727 10.7613 8.06071 10.4476 8.59811 10.2471C9.13552 10.0467 9.70976 9.96412 10.2819 10.0051C10.854 10.0461 11.4106 10.2096 11.9139 10.4846C12.4173 10.7596 12.8556 11.1397 13.1992 11.599C13.53 12.0412 14.1567 12.1316 14.5989 11.8007C15.0412 11.4699 15.1315 10.8433 14.8007 10.401C14.2854 9.71205 13.6279 9.14198 12.8729 8.72948C12.1178 8.31697 11.2829 8.07166 10.4247 8.0102Z`,fill:`currentColor`})]}));$U.displayName=`LinkIcon`;var eW=(0,_.memo)(({className:e,...t})=>(0,M.jsx)(`svg`,{width:`24`,height:`24`,className:e,viewBox:`0 0 24 24`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,...t,children:(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M5.29289 8.29289C5.68342 7.90237 6.31658 7.90237 6.70711 8.29289L12 13.5858L17.2929 8.29289C17.6834 7.90237 18.3166 7.90237 18.7071 8.29289C19.0976 8.68342 19.0976 9.31658 18.7071 9.70711L12.7071 15.7071C12.3166 16.0976 11.6834 16.0976 11.2929 15.7071L5.29289 9.70711C4.90237 9.31658 4.90237 8.68342 5.29289 8.29289Z`,fill:`currentColor`})}));eW.displayName=`ChevronDownIcon`;function tW(e){let t=e.storage.pages;return!t||!(`activeEditor`in t)?null:t.activeEditor??null}function nW(e){let{editor:t}=Coe(),n=e??t,[r,i]=(0,_.useState)(null);return(0,_.useEffect)(()=>{if(!n){i(null);return}let e=()=>i(tW(n));return e(),n.on(`update`,e),n.on(`selectionUpdate`,e),()=>{n.off(`update`,e),n.off(`selectionUpdate`,e)}},[n]),(0,_.useEffect)(()=>
206{if(!r)return;let e=()=>i(null);return r.on(`destroy`,e),()=>{r.off(`destroy`,e)}},[r]),iL({editor:r??n,selector(e){return e.editor?{editor:e.editor,editorState:e.editor.state,canCommand:e.editor.can}:{editor:null,editorState:void 0,canCommand:void 0}}})??{editor:null}}var rW=(0,_.forwardRef)(({variant:e,size:t=`default`,appearance:n=`default`,trimText:r=!1,className:i,children:a,...o},s)=>(0,M.jsx)(`div`,{ref:s,className:`tiptap-badge ${i||``}`,"data-style":e,"data-size":t,"data-appearance":n,"data-text-trim":r?`on`:`off`,...o,children:a}));rW.displayName=`Badge`;function iW({level:e,shortcutKeys:t=pW[e]}){return(0,M.jsx)(rW,{children:WR({shortcutKeys:t})})}var aW=(0,_.forwardRef)(({editor:e,level:t,text:n,hideWhenUnavailable:r=!1,onToggled:i,showShortcut:a=!1,onClick:o,children:s,...c},l)=>{let{editor:u}=nW(e),{isVisible:d,canToggle:f,isActive:p,handleToggle:m,label:h,Icon:g,shortcutKeys:v}=vW({editor:u,level:t,hideWhenUnavailable:r,onToggled:i}),y=(0,_.useCallback)(e=>{o?.(e),!e.defaultPrevented&&m()},[m,o]);return d?(0,M.jsx)($R,{type:`button`,variant:`ghost`,"data-active-state":p?`on`:`off`,role:`button`,tabIndex:-1,disabled:!f,"data-disabled":!f,"aria-label":h,"aria-pressed":p,tooltip:h,onClick:y,...c,ref:l,children:s??(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(g,{className:`tiptap-button-icon`}),n&&(0,M.jsx)(`span`,{className:`tiptap-button-text`,children:n}),a&&(0,M.jsx)(iW,{level:t,shortcutKeys:v})]})}):null});aW.displayName=`HeadingButton`;var oW=(0,_.memo)(({className:e,...t})=>(0,M.jsxs)(`svg`,{width:`24`,height:`24`,className:e,viewBox:`0 0 24 24`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,...t,children:[(0,M.jsx)(`path`,{d:`M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z`,fill:`currentColor`}),(0,M.jsx)(`path`,{d:`M21.0001 10C21.0001 9.63121 20.7971 9.29235 20.472 9.11833C20.1468 8.94431 19.7523 8.96338 19.4454 9.16795L16.4454 11.168C15.9859 11.4743 15.8617 12.0952 16.1681 12.5547C16.4744 13.0142 17.0953 13.1384 17.5548 12.8321L19.0001 11.8685V18C19.0001 18.5523 19.4478 19 20.0001 19C20.5524 19 21.0001 18.5523 21.0001 18V10Z`,fill:`currentColor`})]}));oW.displayName=`HeadingOneIcon`;var sW=(0,_.memo)(({className:e,...t})=>(0,M.jsxs)(`svg`,{width:`24`,height:`24`,className:e,viewBox:`0 0 24 24`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,...t,children:[(0,M.jsx)(`path`,{d:`M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z`,fill:`currentColor`}),(0,M.jsx)(`path`,{d:`M22.0001 12C22.0001 10.7611 21.1663 9.79297 20.0663 9.42632C18.9547 9.05578 17.6171 9.28724 16.4001 10.2C15.9582 10.5314 15.8687 11.1582 16.2001 11.6C16.5314 12.0418 17.1582 12.1314 17.6001 11.8C18.383 11.2128 19.0455 11.1942 19.4338 11.3237C19.8339 11.457 20.0001 11.7389 20.0001 12C20.0001 12.4839 19.8554 12.7379 19.6537 12.9481C19.4275 13.1837 19.1378 13.363 18.7055 13.6307C18.6313 13.6767 18.553 13.7252 18.4701 13.777C17.9572 14.0975 17.3128 14.5261 16.8163 15.2087C16.3007 15.9177 16.0001 16.8183 16.0001 18C16.0001 18.5523 16.4478 19 17.0001 19H21.0001C21.5523 19 22.0001 18.5523 22.0001 18C22.0001 17.4477 21.5523 17 21.0001 17H18.131C18.21 16.742 18.3176 16.5448 18.4338 16.385C18.6873 16.0364 19.0429 15.7775 19.5301 15.473C19.5898 15.4357 19.6536 15.3966 19.7205 15.3556C20.139 15.0992 20.6783 14.7687 21.0964 14.3332C21.6447 13.7621 22.0001 13.0161 22.0001 12Z`,fill:`currentColor`})]}));sW.displayName=`HeadingTwoIcon`;var cW=(0,_.memo)(({className:e,...t})=>(0,M.jsxs)(`svg`,{width:`24`,height:`24`,className:e,viewBox:`0 0 24 24`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,...t,children:[(0,M.jsx)(`path`,{d:`M4 5C4.55228 5 5 5.44772 5 6V11H11V6C11 5.44772 11.4477 5 12 5C12.5523 5 13 5.44772 13 6V18C13 18.5523 12.5523 19 12 19C11.4477 19 11 18.5523 11 18V13H5V18C5 18.5523 4.55228 19 4 19C3.44772 19 3 18.5523 3 18V6C3 5.44772 3.44772 5 4 5Z`,fill:`currentColor`}),(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M19.4608 11.2169C19.1135 11.0531 18.5876 11.0204 18.0069 11.3619C17.5309 11.642
20616.918 11.4831 16.638 11.007C16.358 10.531 16.5169 9.91809 16.9929 9.63807C18.1123 8.97962 19.3364 8.94691 20.314 9.40808C21.2839 9.86558 21.9999 10.818 21.9999 12C21.9999 12.7957 21.6838 13.5587 21.1212 14.1213C20.5586 14.6839 19.7956 15 18.9999 15C18.4476 15 17.9999 14.5523 17.9999 14C17.9999 13.4477 18.4476 13 18.9999 13C19.2651 13 19.5195 12.8947 19.707 12.7071C19.8946 12.5196 19.9999 12.2652 19.9999 12C19.9999 11.6821 19.8159 11.3844 19.4608 11.2169Z`,fill:`currentColor`}),(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M18.0001 14C18.0001 13.4477 18.4478 13 19.0001 13C19.7957 13 20.5588 13.3161 21.1214 13.8787C21.684 14.4413 22.0001 15.2043 22.0001 16C22.0001 17.2853 21.2767 18.3971 20.1604 18.8994C19.0257 19.41 17.642 19.2315 16.4001 18.3C15.9582 17.9686 15.8687 17.3418 16.2001 16.9C16.5314 16.4582 17.1582 16.3686 17.6001 16.7C18.3581 17.2685 18.9744 17.24 19.3397 17.0756C19.7234 16.9029 20.0001 16.5147 20.0001 16C20.0001 15.7348 19.8947 15.4804 19.7072 15.2929C19.5196 15.1054 19.2653 15 19.0001 15C18.4478 15 18.0001 14.5523 18.0001 14Z`,fill:`currentColor`})]}));cW.displayName=`HeadingThreeIcon`;var lW=(0,_.memo)(({className:e,...t})=>(0,M.jsxs)(`svg`,{width:`24`,height:`24`,className:e,viewBox:`0 0 24 24`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,...t,children:[(0,M.jsx)(`path`,{d:`M4 5C4.55228 5 5 5.44772 5 6V11H11V6C11 5.44772 11.4477 5 12 5C12.5523 5 13 5.44772 13 6V18C13 18.5523 12.5523 19 12 19C11.4477 19 11 18.5523 11 18V13H5V18C5 18.5523 4.55228 19 4 19C3.44772 19 3 18.5523 3 18V6C3 5.44772 3.44772 5 4 5Z`,fill:`currentColor`}),(0,M.jsx)(`path`,{d:`M17 9C17.5523 9 18 9.44772 18 10V13H20V10C20 9.44772 20.4477 9 21 9C21.5523 9 22 9.44772 22 10V18C22 18.5523 21.5523 19 21 19C20.4477 19 20 18.5523 20 18V15H17C16.4477 15 16 14.5523 16 14V10C16 9.44772 16.4477 9 17 9Z`,fill:`currentColor`})]}));lW.displayName=`HeadingFourIcon`;var uW=(0,_.memo)(({className:e,...t})=>(0,M.jsxs)(`svg`,{width:`24`,height:`24`,className:e,viewBox:`0 0 24 24`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,...t,children:[(0,M.jsx)(`path`,{d:`M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z`,fill:`currentColor`}),(0,M.jsx)(`path`,{d:`M16 10C16 9.44772 16.4477 9 17 9H21C21.5523 9 22 9.44772 22 10C22 10.5523 21.5523 11 21 11H18V12H18.3C20.2754 12 22 13.4739 22 15.5C22 17.5261 20.2754 19 18.3 19C17.6457 19 17.0925 18.8643 16.5528 18.5944C16.0588 18.3474 15.8586 17.7468 16.1055 17.2528C16.3525 16.7588 16.9532 16.5586 17.4472 16.8056C17.7074 16.9357 17.9542 17 18.3 17C19.3246 17 20 16.2739 20 15.5C20 14.7261 19.3246 14 18.3 14H17C16.4477 14 16 13.5523 16 13L16 12.9928V10Z`,fill:`currentColor`})]}));uW.displayName=`HeadingFiveIcon`;var dW=(0,_.memo)(({className:e,...t})=>(0,M.jsxs)(`svg`,{width:`24`,height:`24`,className:e,viewBox:`0 0 24 24`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,...t,children:[(0,M.jsx)(`path`,{d:`M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z`,fill:`currentColor`}),(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M20.7071 9.29289C21.0976 9.68342 21.0976 10.3166 20.7071 10.7071C19.8392 11.575 19.2179 12.2949 18.7889 13.0073C18.8587 13.0025 18.929 13 19 13C20.6569 13 22 14.3431 22 16C22 17.6569 20.6569 19 19 19C17.3431 19 16 17.6569 16 16C16 14.6007 16.2837 13.4368 16.8676 12.3419C17.4384 11.2717 18.2728 10.3129 19.2929 9.29289C19.6834 8.90237 20.3166 8.90237 20.7071 9.29289ZM19 17C18.4477 17 18 16.5523 18 16C18 15.4477 18.4477 15 19 15C19.5523 15 20 15.4477 20 16C20 16.5523 19.5523 17 19 17Z`,fill:`currentColor`})]}));dW.displayName=`HeadingSixIcon`;var fW={1:oW,2:sW,3:cW,4:lW,5:uW,6:dW},pW={1:`ctrl+alt+1`,2:`ctrl+alt+2`,3:`ctrl+alt+3`,4:`ctrl+alt+4`,5:`ctrl+alt+5`,6:`ctrl+alt+6`};function mW(e,t,n=!0){return!e||!e.isEditable||!KR(`heading`,e)||XR(e,[`image`])?!1:n?ZR(e,[`paragraph`,`heading`,`bulletList`,`orderedList`,`taskList`,`blockquote`,`codeBlock`])?t?e.can().setNode(`heading`,{level:t})||e.can().clearNodes():e.can().setNode(`heading`)||e.can().clearNodes():!1:t?e.can().setNode(`heading`,{level:t}):e.can().setNode(`heading`)}function hW(e,t){return!e||!e.isEditable?!1:Array.isArray(t)?t.some(t=>e.isActive(`heading`,{level:t})):t?e.isActive(`heading`,{level:t}):e.isActive(`heading`)}function gW(e,t){if(!e||!e.isEditable)return!1;let n=Array.isArray(t)?t:[t],r=n.find(t=>mW(e,t));if(!r)return!1;try{let t=e.view,i=t.state,a=i.tr,o=QR(e),s=ZR(e,[`paragraph`,`heading`,`bulletList`,`orderedList`,`taskList`,`blockquote`,`codeBlock`])&&o.length===1;if((i.selection.empty||i.selection instanceof tO)&&s){let n=YR({editor:e,node:i.selection.$anchor.node(1)})?.pos;if(!qR(n))return!1;
206a=a.setSelection(U.create(i.doc,n)),t.dispatch(a),i=t.state}let c=i.selection,l=e.chain().focus();if(c instanceof U){let e=c.node.firstChild?.firstChild,t=c.node.lastChild?.lastChild,n=e?c.from+e.nodeSize:c.from+1,r=t?c.to-t.nodeSize:c.to-1,a=i.doc.resolve(n),o=i.doc.resolve(r);l=l.setTextSelection(tO.between(a,o)).clearNodes()}return(n.some(t=>e.isActive(`heading`,{level:t}))?l.setNode(`paragraph`):l.setNode(`heading`,{level:r})).run(),e.chain().focus().selectTextblockEnd().run(),!0}catch{return!1}}function _W(e){let{editor:t,level:n,hideWhenUnavailable:r}=e;return t?r?!t.isEditable||!KR(`heading`,t)?!1:t.isActive(`code`)?!0:Array.isArray(n)?n.some(e=>mW(t,e)):mW(t,n):!0:!1}function vW(e){let{editor:t,level:n,hideWhenUnavailable:r=!1,onToggled:i}=e,{editor:a}=nW(t),[o,s]=(0,_.useState)(!0),c=mW(a,n),l=hW(a,n);return(0,_.useEffect)(()=>{if(!a)return;let e=()=>{s(_W({editor:a,level:n,hideWhenUnavailable:r}))};return e(),a.on(`selectionUpdate`,e),()=>{a.off(`selectionUpdate`,e)}},[a,n,r]),{isVisible:o,isActive:l,handleToggle:(0,_.useCallback)(()=>{if(!a)return!1;let e=gW(a,n);return e&&i?.(),e},[a,n,i]),canToggle:c,label:`Heading ${n}`,shortcutKeys:pW[n],Icon:fW[n]}}var yW=(0,_.memo)(({className:e,...t})=>(0,M.jsx)(`svg`,{width:`24`,height:`24`,className:e,viewBox:`0 0 24 24`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,...t,children:(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M20.7071 5.29289C21.0976 5.68342 21.0976 6.31658 20.7071 6.70711L9.70711 17.7071C9.31658 18.0976 8.68342 18.0976 8.29289 17.7071L3.29289 12.7071C2.90237 12.3166 2.90237 11.6834 3.29289 11.2929C3.68342 10.9024 4.31658 10.9024 4.70711 11.2929L9 15.5858L19.2929 5.29289C19.6834 4.90237 20.3166 4.90237 20.7071 5.29289Z`,fill:`currentColor`})}));yW.displayName=`CheckIcon`;function bW({...e}){return(0,M.jsx)(Fh,{"data-slot":`tiptap-dropdown-menu`,...e})}function xW({...e}){return(0,M.jsx)(Ih,{"data-slot":`tiptap-dropdown-menu-trigger`,...e})}function SW({className:e,align:t=`start`,sideOffset:n=4,...r}){return(0,M.jsx)(Lh,{children:(0,M.jsx)(Rh,{"data-slot":`tiptap-dropdown-menu-content`,sideOffset:n,align:t,className:UR(`tiptap-dropdown-menu-content`,e),onCloseAutoFocus:e=>e.preventDefault(),...r})})}function CW({className:e,...t}){return(0,M.jsx)(zh,{"data-slot":`tiptap-dropdown-menu-group`,className:UR(`tiptap-dropdown-menu-group`,e),...t})}function wW({className:e,inset:t,variant:n=`default`,...r}){return(0,M.jsx)(Bh,{"data-slot":`tiptap-dropdown-menu-item`,"data-inset":t,"data-variant":n,className:UR(`tiptap-dropdown-menu-item`,e),...r})}var TW=(0,_.forwardRef)(({editor:e,levels:t=[1,2,3,4,5,6],hideWhenUnavailable:n=!1,onOpenChange:r,children:i,modal:a=!0,...o},s)=>{let{editor:c}=nW(e),[l,u]=(0,_.useState)(!1),{isVisible:d,isActive:f,canToggle:p,Icon:m}=OW({editor:c,levels:t,hideWhenUnavailable:n}),h=(0,_.useCallback)(e=>{!c||!p||(u(e),r?.(e))},[p,c,r]);return d?(0,M.jsxs)(bW,{modal:a,open:l,onOpenChange:h,children:[(0,M.jsx)(xW,{asChild:!0,children:(0,M.jsx)($R,{type:`button`,variant:`ghost`,"data-active-state":f?`on`:`off`,role:`button`,tabIndex:-1,disabled:!p,"data-disabled":!p,"aria-label":`Format text as heading`,"aria-pressed":f,tooltip:`Heading`,...o,ref:s,children:i||(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(m,{className:`tiptap-button-icon`}),(0,M.jsx)(eW,{className:`tiptap-button-dropdown-small`})]})})}),(0,M.jsx)(SW,{align:`start`,children:(0,M.jsx)(CW,{children:t.map(e=>(0,M.jsx)(wW,{asChild:!0,children:(0,M.jsx)(aW,{editor:c,level:e,text:`Heading ${e}`,showTooltip:!1})},`heading-${e}`))})})]}):null});TW.displayName=`HeadingDropdownMenu`;var EW=(0,_.memo)(({className:e,...t})=>(0,M.jsx)(`svg`,{width:`24`,height:`24`,className:e,viewBox:`0 0 24 24`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,...t,children:(0,M.jsx)(`path`,{d:`M6 3C6.55228 3 7 3.44772 7 4V11H17V4C17 3.44772 17.4477 3 18 3C18.5523 3 19 3.44772 19 4V20C19 20.5523 18.5523 21 18 21C17.4477 21 17 20.5523 17 20V13H7V20C7 20.5523 6.55228 21 6 21C5.44772 21 5 20.5523 5 20V4C5 3.44772 5.44772 3 6 3Z`,fill:`currentColor`})}));EW.displayName=`HeadingIcon`;
206function DW(e,t=[1,2,3,4,5,6]){if(!(!e||!e.isEditable))return t.find(t=>hW(e,t))}function OW(e){let{editor:t,levels:n=[1,2,3,4,5,6],hideWhenUnavailable:r=!1}=e||{},{editor:i}=nW(t),[a,o]=(0,_.useState)(!0),s=DW(i,n),c=hW(i),l=mW(i);return(0,_.useEffect)(()=>{if(!i)return;let e=()=>{o(_W({editor:i,hideWhenUnavailable:r,level:n}))};return e(),i.on(`selectionUpdate`,e),()=>{i.off(`selectionUpdate`,e)}},[i,r,n]),{isVisible:a,activeLevel:s,isActive:c,canToggle:l,levels:n,label:`Heading`,Icon:s?fW[s]:EW}}function kW({type:e,shortcutKeys:t=IW[e]}){return(0,M.jsx)(rW,{children:WR({shortcutKeys:t})})}var AW=(0,_.forwardRef)(({editor:e,type:t,text:n,hideWhenUnavailable:r=!1,onToggled:i,showShortcut:a=!1,onClick:o,children:s,...c},l)=>{let{editor:u}=nW(e),{isVisible:d,canToggle:f,isActive:p,handleToggle:m,label:h,shortcutKeys:g,Icon:v}=VW({editor:u,type:t,hideWhenUnavailable:r,onToggled:i}),y=(0,_.useCallback)(e=>{o?.(e),!e.defaultPrevented&&m()},[m,o]);return d?(0,M.jsx)($R,{type:`button`,variant:`ghost`,"data-active-state":p?`on`:`off`,role:`button`,tabIndex:-1,disabled:!f,"data-disabled":!f,"aria-label":h,"aria-pressed":p,tooltip:h,onClick:y,...c,ref:l,children:s??(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(v,{className:`tiptap-button-icon`}),n&&(0,M.jsx)(`span`,{className:`tiptap-button-text`,children:n}),a&&(0,M.jsx)(kW,{type:t,shortcutKeys:g})]})}):null});AW.displayName=`ListButton`;var jW=(0,_.memo)(({className:e,...t})=>(0,M.jsxs)(`svg`,{width:`24`,height:`24`,className:e,viewBox:`0 0 24 24`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,...t,children:[(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M7 6C7 5.44772 7.44772 5 8 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H8C7.44772 7 7 6.55228 7 6Z`,fill:`currentColor`}),(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M7 12C7 11.4477 7.44772 11 8 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H8C7.44772 13 7 12.5523 7 12Z`,fill:`currentColor`}),(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M7 18C7 17.4477 7.44772 17 8 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H8C7.44772 19 7 18.5523 7 18Z`,fill:`currentColor`}),(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M2 6C2 5.44772 2.44772 5 3 5H3.01C3.56228 5 4.01 5.44772 4.01 6C4.01 6.55228 3.56228 7 3.01 7H3C2.44772 7 2 6.55228 2 6Z`,fill:`currentColor`}),(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M2 12C2 11.4477 2.44772 11 3 11H3.01C3.56228 11 4.01 11.4477 4.01 12C4.01 12.5523 3.56228 13 3.01 13H3C2.44772 13 2 12.5523 2 12Z`,fill:`currentColor`}),(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M2 18C2 17.4477 2.44772 17 3 17H3.01C3.56228 17 4.01 17.4477 4.01 18C4.01 18.5523 3.56228 19 3.01 19H3C2.44772 19 2 18.5523 2 18Z`,fill:`currentColor`})]}));jW.displayName=`ListIcon`;var MW=(0,_.memo)(({className:e,...t})=>(0,M.jsxs)(`svg`,{width:`24`,height:`24`,className:e,viewBox:`0 0 24 24`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,...t,children:[(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M9 6C9 5.44772 9.44772 5 10 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H10C9.44772 7 9 6.55228 9 6Z`,fill:`currentColor`}),(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M9 12C9 11.4477 9.44772 11 10 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H10C9.44772 13 9 12.5523 9 12Z`,fill:`currentColor`}),(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M9 18C9 17.4477 9.44772 17 10 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H10C9.44772 19 9 18.5523 9 18Z`,fill:`currentColor`}),(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M3 6C3 5.44772 3.44772 5 4 5H5C5.55228 5 6 5.44772 6 6V10C6 10.5523 5.55228 11 5 11C4.44772 11 4 10.5523 4 10V7C3.44772 7 3 6.55228 3 6Z`,fill:`currentColor`}),(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M3 10C3 9.44772 3.44772 9 4 9H6C6.55228 9 7 9.44772 7 10C7 10.5523 6.55228 11 6 11H4C3.44772 11 3 10.5523 3 10Z`,fill:`currentColor`}),(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M5.82219 13.0431C6.54543 13.4047 6.99997 14.1319 6.99997 15C6.99997 15.5763 6.71806 16.0426 6.48747 16.35C6.31395 16.5814 6.1052 16.8044 5.91309 17H5.99997C6.55226 17 6.99997 17.4477 6.99997 18C6.99997 18.5523 6.55226 19 5.99997 19H3.99997C3.44769 19 2.99997 18.5523 2.99997 18C2.99997 17.4237 3.28189 16.9575 3.51247 16.65C3.74323 16.3424 4.03626 16.0494 4.26965 15.8161C4.27745 15.8083 4.2852 15.8006 4.29287 15.7929C4.55594 15.5298 4.75095 15.3321 4.88748 15.15C4.96287 15.0495 4.99021 14.9922 4.99911 14.9714C4.99535 14.9112 4.9803 14.882 4.9739 14.8715C4.96613 14.8588 4.95382 14.845 4.92776 14.8319C4.87723 14.8067 4.71156 14.7623 4.44719 14.8944C3.95321 15.1414 3.35254 14.9412 3.10555 14.4472C2.85856 13.9533 3.05878 13.3526 3.55276 13.1056C4.28839 12.7378 5.12272 12.6934 5.82219 13.0431Z`,fill:`currentColor`})]}));MW.displayName=`ListOrderedIcon`;var NW=(0,_.memo)(({className:e,...t})=>(0,M.jsxs)(`svg`,{width:`24`,height:`24`,className:e,viewBox:`0 0 24 24`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,...t,children:[(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M2 6C2 4.89543 2.89543 4 4 4H8C9.1045
2067 4 10 4.89543 10 6V10C10 11.1046 9.10457 12 8 12H4C2.89543 12 2 11.1046 2 10V6ZM8 6H4V10H8V6Z`,fill:`currentColor`}),(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M9.70711 14.2929C10.0976 14.6834 10.0976 15.3166 9.70711 15.7071L5.70711 19.7071C5.31658 20.0976 4.68342 20.0976 4.29289 19.7071L2.29289 17.7071C1.90237 17.3166 1.90237 16.6834 2.29289 16.2929C2.68342 15.9024 3.31658 15.9024 3.70711 16.2929L5 17.5858L8.29289 14.2929C8.68342 13.9024 9.31658 13.9024 9.70711 14.2929Z`,fill:`currentColor`}),(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12 6C12 5.44772 12.4477 5 13 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H13C12.4477 7 12 6.55228 12 6Z`,fill:`currentColor`}),(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12 12C12 11.4477 12.4477 11 13 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H13C12.4477 13 12 12.5523 12 12Z`,fill:`currentColor`}),(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12 18C12 17.4477 12.4477 17 13 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H13C12.4477 19 12 18.5523 12 18Z`,fill:`currentColor`})]}));NW.displayName=`ListTodoIcon`;var PW={bulletList:jW,orderedList:MW,taskList:NW},FW={bulletList:`Bullet List`,orderedList:`Ordered List`,taskList:`Task List`},IW={bulletList:`mod+shift+8`,orderedList:`mod+shift+7`,taskList:`mod+shift+9`};function LW(e,t,n=!0){if(!e||!e.isEditable||!KR(t,e)||XR(e,[`image`]))return!1;if(!n)switch(t){case`bulletList`:return e.can().toggleBulletList();case`orderedList`:return e.can().toggleOrderedList();case`taskList`:return e.can().toggleList(`taskList`,`taskItem`);default:return!1}if(!ZR(e,[`paragraph`,`heading`,`bulletList`,`orderedList`,`taskList`,`blockquote`,`codeBlock`]))return!1;switch(t){case`bulletList`:return e.can().toggleBulletList()||e.can().clearNodes();case`orderedList`:return e.can().toggleOrderedList()||e.can().clearNodes();case`taskList`:return e.can().toggleList(`taskList`,`taskItem`)||e.can().clearNodes();default:return!1}}function RW(e,t){if(!e||!e.isEditable)return!1;switch(t){case`bulletList`:return e.isActive(`bulletList`);case`orderedList`:return e.isActive(`orderedList`);case`taskList`:return e.isActive(`taskList`);default:return!1}}function zW(e,t){if(!e||!e.isEditable||!LW(e,t))return!1;try{let n=e.view,r=n.state,i=r.tr,a=QR(e),o=ZR(e,[`paragraph`,`heading`,`bulletList`,`orderedList`,`taskList`,`blockquote`,`codeBlock`])&&a.length===1;if((r.selection.empty||r.selection instanceof tO)&&o){let t=YR({editor:e,node:r.selection.$anchor.node(1)})?.pos;if(!qR(t))return!1;i=i.setSelection(U.create(r.doc,t)),n.dispatch(i),r=n.state}let s=r.selection,c=e.chain().focus();if(s instanceof U){let e=s.node.firstChild?.firstChild,t=s.node.lastChild?.lastChild,n=e?s.from+e.nodeSize:s.from+1,i=t?s.to-t.nodeSize:s.to-1,a=r.doc.resolve(n),o=r.doc.resolve(i);c=c.setTextSelection(tO.between(a,o)).clearNodes()}if(e.isActive(t))c.liftListItem(`listItem`).lift(`bulletList`).lift(`orderedList`).lift(`taskList`).run();else{let e={bulletList:()=>c.toggleBulletList(),orderedList:()=>c.toggleOrderedList(),taskList:()=>c.toggleList(`taskList`,`taskItem`)}[t];if(!e)return!1;e().run()}return e.chain().focus().selectTextblockEnd().run(),!0}catch{return!1}}function BW(e){let{editor:t,type:n,hideWhenUnavailable:r}=e;return t?r?!t.isEditable||!KR(n,t)?!1:t.isActive(`code`)?!0:LW(t,n):!0:!1}function VW(e){let{editor:t,type:n,hideWhenUnavailable:r=!1,onToggled:i}=e,{editor:a}=nW(t),[o,s]=(0,_.useState)(!0),c=LW(a,n),l=RW(a,n);return(0,_.useEffect)(()=>{if(!a)return;let e=()=>{s(BW({editor:a,type:n,hideWhenUnavailable:r}))};return e(),a.on(`selectionUpdate`,e),()=>{a.off(`selectionUpdate`,e)}},[a,n,r]),{isVisible:o,isActive:l,handleToggle:(0,_.useCallback)(()=>{if(!a)return!1;let e=zW(a,n);return e&&i?.(),e},[a,n,i]),canToggle:c,label:FW[n],shortcutKeys:IW[n],Icon:PW[n]}}var HW=[{label:`Bullet List`,type:`bulletList`,icon:jW},{label:`Ordered List`,type:`orderedList`,icon:MW},{label:`Task List`,type:`taskList`,icon:NW}];function UW(e,t){return!e||!e.isEditable?!1:t.some(t=>LW(e,t))}function WW(e,t){return!e||!e.isEditable?!1:t.some(t=>RW(e,t))}function GW(e){return HW.filter(t=>!t.type||e.includes(t.type))}function KW(e){let{editor:t,hideWhenUnavailable:n,listInSchema:r,canToggleAny:i}=e;return t?n?r?t.isActive(`code`)?!0:i:!1:!0:!1}function qW(e,t){if(!(!e||!e.isEditable))return t.find(t=>RW(e,t))}function JW(e){let{editor:t,types:n=[`bulletList`,`orderedList`,`taskList`],hideWhenUnavailable:r=!1}=e||{},{editor:i}=nW(t),[a,o]=(0,_.useState)(!0),s=n.some(e=>KR(e,i)),c=(0,_.useMemo)(()=>GW(n),[n]),l=UW(i,n),u=WW(i,n),d=qW(i,n),f=c.find(e=>e.type===d);return(0,_.useEffect)(()=>
206{if(!i)return;let e=()=>{o(KW({editor:i,listTypes:n,hideWhenUnavailable:r,listInSchema:s,canToggleAny:l}))};return e(),i.on(`selectionUpdate`,e),()=>{i.off(`selectionUpdate`,e)}},[l,i,r,s,n]),{isVisible:a,activeType:d,isActive:u,canToggle:l,types:n,filteredLists:c,label:`List`,Icon:f?PW[f.type]:jW}}function YW({editor:e,types:t=[`bulletList`,`orderedList`,`taskList`],hideWhenUnavailable:n=!1,onOpenChange:r,modal:i=!0,...a}){let{editor:o}=nW(e),[s,c]=(0,_.useState)(!1),{filteredLists:l,canToggle:u,isActive:d,isVisible:f,Icon:p}=JW({editor:o,types:t,hideWhenUnavailable:n}),m=(0,_.useCallback)(e=>{c(e),r?.(e)},[r]);return f?(0,M.jsxs)(bW,{modal:i,open:s,onOpenChange:m,children:[(0,M.jsx)(xW,{asChild:!0,children:(0,M.jsxs)($R,{type:`button`,variant:`ghost`,"data-active-state":d?`on`:`off`,role:`button`,tabIndex:-1,disabled:!u,"data-disabled":!u,"aria-label":`List options`,tooltip:`List`,...a,children:[(0,M.jsx)(p,{className:`tiptap-button-icon`}),(0,M.jsx)(eW,{className:`tiptap-button-dropdown-small`})]})}),(0,M.jsx)(SW,{align:`start`,children:(0,M.jsx)(CW,{children:l.map(e=>(0,M.jsx)(wW,{asChild:!0,children:(0,M.jsx)(AW,{editor:o,type:e.type,text:e.label,showTooltip:!1})},e.type))})})]}):null}function XW({shortcutKeys:e=$W}){return(0,M.jsx)(rW,{children:WR({shortcutKeys:e})})}var ZW=(0,_.forwardRef)(({editor:e,text:t,hideWhenUnavailable:n=!1,onToggled:r,showShortcut:i=!1,onClick:a,children:o,...s},c)=>{let{editor:l}=nW(e),{isVisible:u,canToggle:d,isActive:f,handleToggle:p,label:m,shortcutKeys:h,Icon:g}=rG({editor:l,hideWhenUnavailable:n,onToggled:r}),v=(0,_.useCallback)(e=>{a?.(e),!e.defaultPrevented&&p()},[p,a]);return u?(0,M.jsx)($R,{type:`button`,variant:`ghost`,"data-active-state":f?`on`:`off`,role:`button`,tabIndex:-1,disabled:!d,"data-disabled":!d,"aria-label":m,"aria-pressed":f,tooltip:`Blockquote`,onClick:v,...s,ref:c,children:o??(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(g,{className:`tiptap-button-icon`}),t&&(0,M.jsx)(`span`,{className:`tiptap-button-text`,children:t}),i&&(0,M.jsx)(XW,{shortcutKeys:h})]})}):null});ZW.displayName=`BlockquoteButton`;var QW=(0,_.memo)(({className:e,...t})=>(0,M.jsxs)(`svg`,{width:`24`,height:`24`,className:e,viewBox:`0 0 24 24`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,...t,children:[(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M8 6C8 5.44772 8.44772 5 9 5H16C16.5523 5 17 5.44772 17 6C17 6.55228 16.5523 7 16 7H9C8.44772 7 8 6.55228 8 6Z`,fill:`currentColor`}),(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M4 3C4.55228 3 5 3.44772 5 4L5 20C5 20.5523 4.55229 21 4 21C3.44772 21 3 20.5523 3 20L3 4C3 3.44772 3.44772 3 4 3Z`,fill:`currentColor`}),(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M8 12C8 11.4477 8.44772 11 9 11H20C20.5523 11 21 11.4477 21 12C21 12.5523 20.5523 13 20 13H9C8.44772 13 8 12.5523 8 12Z`,fill:`currentColor`}),(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M8 18C8 17.4477 8.44772 17 9 17H16C16.5523 17 17 17.4477 17 18C17 18.5523 16.5523 19 16 19H9C8.44772 19 8 18.5523 8 18Z`,fill:`currentColor`})]}));QW.displayName=`BlockquoteIcon`;var $W=`mod+shift+b`;function eG(e,t=!0){return!e||!e.isEditable||!KR(`blockquote`,e)||XR(e,[`image`])?!1:t?ZR(e,[`paragraph`,`heading`,`bulletList`,`orderedList`,`taskList`,`blockquote`,`codeBlock`])?e.can().toggleWrap(`blockquote`)||e.can().clearNodes():!1:e.can().toggleWrap(`blockquote`)}function tG(e){if(!e||!e.isEditable||!eG(e))return!1;try{let t=e.view,n=t.state,r=n.tr,i=QR(e),a=ZR(e,[`paragraph`,`heading`,`bulletList`,`orderedList`,`taskList`,`blockquote`,`codeBlock`])&&i.length===1;if((n.selection.empty||n.selection instanceof tO)&&a){let i=YR({editor:e,node:n.selection.$anchor.node(1)})?.pos;if(!qR(i))return!1;r=r.setSelection(U.create(n.doc,i)),t.dispatch(r),n=t.state}let o=n.selection,s=e.chain().focus();if(o instanceof U){let e=o.node.firstChild?.firstChild,t=o.node.lastChild?.lastChild,r=e?o.from+e.nodeSize:o.from+1,i=t?o.to-t.nodeSize:o.to-1,a=n.doc.resolve(r),c=n.doc.resolve(i);s=s.setTextSelection(tO.between(a,c)).clearNodes()}return(e.isActive(`blockquote`)?s.lift(`blockquote`):s.wrapIn(`blockquote`)).run(),e.chain().focus().selectTextblockEnd().run(),!0}catch{return!1}}function nG(e){let{editor:t,hideWhenUnavailable:n}=e;return t?n?!t.isEditable||!KR(`blockquote`,t)?!1:t.isActive(`code`)?!0:eG(t):!0:!1}function rG(e){let{editor:t,hideWhenUnavailable:n=!1,onToggled:r}=e||{},{editor:i}=nW(t),[a,o]=(0,_.useState)(!0),s=eG(i),c=i?.isActive(`blockquote`)||!1;return(0,_.useEffect)(()=>
206{if(!i)return;let e=()=>{o(nG({editor:i,hideWhenUnavailable:n}))};return e(),i.on(`selectionUpdate`,e),()=>{i.off(`selectionUpdate`,e)}},[i,n]),{isVisible:a,isActive:c,handleToggle:(0,_.useCallback)(()=>{if(!i)return!1;let e=tG(i);return e&&r?.(),e},[i,r]),canToggle:s,label:`Blockquote`,shortcutKeys:$W,Icon:QW}}function iG({shortcutKeys:e=sG}){return(0,M.jsx)(rW,{children:WR({shortcutKeys:e})})}var aG=(0,_.forwardRef)(({editor:e,text:t,hideWhenUnavailable:n=!1,onToggled:r,showShortcut:i=!1,onClick:a,children:o,...s},c)=>{let{editor:l}=nW(e),{isVisible:u,canToggle:d,isActive:f,handleToggle:p,label:m,shortcutKeys:h,Icon:g}=dG({editor:l,hideWhenUnavailable:n,onToggled:r}),v=(0,_.useCallback)(e=>{a?.(e),!e.defaultPrevented&&p()},[p,a]);return u?(0,M.jsx)($R,{type:`button`,variant:`ghost`,"data-active-state":f?`on`:`off`,role:`button`,disabled:!d,"data-disabled":!d,tabIndex:-1,"aria-label":m,"aria-pressed":f,tooltip:`Code Block`,onClick:v,...s,ref:c,children:o??(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(g,{className:`tiptap-button-icon`}),t&&(0,M.jsx)(`span`,{className:`tiptap-button-text`,children:t}),i&&(0,M.jsx)(iG,{shortcutKeys:h})]})}):null});aG.displayName=`CodeBlockButton`;var oG=(0,_.memo)(({className:e,...t})=>(0,M.jsxs)(`svg`,{width:`24`,height:`24`,className:e,viewBox:`0 0 24 24`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,...t,children:[(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M6.70711 2.29289C7.09763 2.68342 7.09763 3.31658 6.70711 3.70711L4.41421 6L6.70711 8.29289C7.09763 8.68342 7.09763 9.31658 6.70711 9.70711C6.31658 10.0976 5.68342 10.0976 5.29289 9.70711L2.29289 6.70711C1.90237 6.31658 1.90237 5.68342 2.29289 5.29289L5.29289 2.29289C5.68342 1.90237 6.31658 1.90237 6.70711 2.29289Z`,fill:`currentColor`}),(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M10.2929 2.29289C10.6834 1.90237 11.3166 1.90237 11.7071 2.29289L14.7071 5.29289C15.0976 5.68342 15.0976 6.31658 14.7071 6.70711L11.7071 9.70711C11.3166 10.0976 10.6834 10.0976 10.2929 9.70711C9.90237 9.31658 9.90237 8.68342 10.2929 8.29289L12.5858 6L10.2929 3.70711C9.90237 3.31658 9.90237 2.68342 10.2929 2.29289Z`,fill:`currentColor`}),(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M17 4C17 3.44772 17.4477 3 18 3H19C20.6569 3 22 4.34315 22 6V18C22 19.6569 20.6569 21 19 21H5C3.34315 21 2 19.6569 2 18V12C2 11.4477 2.44772 11 3 11C3.55228 11 4 11.4477 4 12V18C4 18.5523 4.44772 19 5 19H19C19.5523 19 20 18.5523 20 18V6C20 5.44772 19.5523 5 19 5H18C17.4477 5 17 4.55228 17 4Z`,fill:`currentColor`})]}));oG.displayName=`CodeBlockIcon`;var sG=`mod+alt+c`;function cG(e,t=!0){return!e||!e.isEditable||!KR(`codeBlock`,e)||XR(e,[`image`])?!1:t?ZR(e,[`paragraph`,`heading`,`bulletList`,`orderedList`,`taskList`,`blockquote`,`codeBlock`])?e.can().toggleNode(`codeBlock`,`paragraph`)||e.can().clearNodes():!1:e.can().toggleNode(`codeBlock`,`paragraph`)}function lG(e){if(!e||!e.isEditable||!cG(e))return!1;try{let t=e.view,n=t.state,r=n.tr,i=QR(e),a=ZR(e,[`paragraph`,`heading`,`bulletList`,`orderedList`,`taskList`,`blockquote`,`codeBlock`])&&i.length===1;if((n.selection.empty||n.selection instanceof tO)&&a){let i=YR({editor:e,node:n.selection.$anchor.node(1)})?.pos;if(!qR(i))return!1;r=r.setSelection(U.create(n.doc,i)),t.dispatch(r),n=t.state}let o=n.selection,s=e.chain().focus();if(o instanceof U){let e=o.node.firstChild?.firstChild,t=o.node.lastChild?.lastChild,r=e?o.from+e.nodeSize:o.from+1,i=t?o.to-t.nodeSize:o.to-1,a=n.doc.resolve(r),c=n.doc.resolve(i);s=s.setTextSelection(tO.between(a,c)).clearNodes()}return(e.isActive(`codeBlock`)?s.setNode(`paragraph`):s.toggleNode(`codeBlock`,`paragraph`)).run(),e.chain().focus().selectTextblockEnd().run(),!0}catch{return!1}}function uG(e){let{editor:t,hideWhenUnavailable:n}=e;return t?n?!t.isEditable||!KR(`codeBlock`,t)?!1:t.isActive(`code`)?!0:cG(t):!0:!1}function dG(e){let{editor:t,hideWhenUnavailable:n=!1,onToggled:r}=e||{},{editor:i}=nW(t),[a,o]=(0,_.useState)(!0),s=cG(i),c=i?.isActive(`codeBlock`)||!1;return(0,_.useEffect)(()=>{if(!i)return;let e=()=>{o(uG({editor:i,hideWhenUnavailable:n}))};return e(),i.on(`selectionUpdate`,e),()=>{i.off(`selectionUpdate`,e)}},[i,n]),{isVisible:a,isActive:c,handleToggle:(0,_.useCallback)(()=>
206{if(!i)return!1;let e=lG(i);return e&&r?.(),e},[i,r]),canToggle:s,label:`Code Block`,shortcutKeys:sG,Icon:oG}}function fG(e=`max`,t=768){let[n,r]=(0,_.useState)(void 0);return(0,_.useEffect)(()=>{let n=e===`min`?`(min-width: ${t}px)`:`(max-width: ${t-1}px)`,i=window.matchMedia(n),a=e=>r(e.matches);return r(i.matches),i.addEventListener(`change`,a),()=>i.removeEventListener(`change`,a)},[e,t]),!!n}var pG=(0,_.memo)(({className:e,...t})=>(0,M.jsx)(`svg`,{width:`24`,height:`24`,className:e,viewBox:`0 0 24 24`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,...t,children:(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M4.43471 4.01458C4.34773 4.06032 4.26607 4.11977 4.19292 4.19292C4.11977 4.26607 4.06032 4.34773 4.01458 4.43471C2.14611 6.40628 1 9.0693 1 12C1 18.0751 5.92487 23 12 23C14.9306 23 17.5936 21.854 19.5651 19.9856C19.6522 19.9398 19.7339 19.8803 19.8071 19.8071C19.8803 19.7339 19.9398 19.6522 19.9856 19.5651C21.854 17.5936 23 14.9306 23 12C23 5.92487 18.0751 1 12 1C9.0693 1 6.40628 2.14611 4.43471 4.01458ZM6.38231 4.9681C7.92199 3.73647 9.87499 3 12 3C16.9706 3 21 7.02944 21 12C21 14.125 20.2635 16.078 19.0319 17.6177L6.38231 4.9681ZM17.6177 19.0319C16.078 20.2635 14.125 21 12 21C7.02944 21 3 16.9706 3 12C3 9.87499 3.73647 7.92199 4.9681 6.38231L17.6177 19.0319Z`,fill:`currentColor`})}));pG.displayName=`BanIcon`;function mG({...e}){return(0,M.jsx)(sg,{...e})}function hG({...e}){return(0,M.jsx)(cg,{...e})}function gG({className:e,align:t=`center`,sideOffset:n=4,...r}){return(0,M.jsx)(Dee,{children:(0,M.jsx)(lg,{align:t,sideOffset:n,className:UR(`tiptap-popover`,e),...r})})}var _G=(0,_.forwardRef)(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,className:UR(`tiptap-card`,e),...t}));_G.displayName=`Card`;var vG=(0,_.forwardRef)(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,className:UR(`tiptap-card-header`,e),...t}));vG.displayName=`CardHeader`;var yG=(0,_.forwardRef)(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,className:UR(`tiptap-card-body`,e),...t}));yG.displayName=`CardBody`;var bG=(0,_.forwardRef)(({className:e,orientation:t=`vertical`,...n},r)=>(0,M.jsx)(`div`,{ref:r,"data-orientation":t,className:UR(`tiptap-card-item-group`,e),...n}));bG.displayName=`CardItemGroup`;var xG=(0,_.forwardRef)(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,className:UR(`tiptap-card-group-label`,e),...t}));xG.displayName=`CardGroupLabel`;var SG=(0,_.forwardRef)(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,className:UR(`tiptap-card-footer`,e),...t}));SG.displayName=`CardFooter`;function CG({shortcutKeys:e=tK}){return(0,M.jsx)(rW,{children:WR({shortcutKeys:e})})}var wG=(0,_.forwardRef)(({editor:e,highlightColor:t,text:n,hideWhenUnavailable:r=!1,mode:i=`mark`,onApplied:a,showShortcut:o=!1,onClick:s,children:c,style:l,useColorValue:u=!1,...d},f)=>{let{editor:p}=nW(e),{isVisible:m,canColorHighlight:h,isActive:g,handleColorHighlight:v,label:y,shortcutKeys:b}=lK({editor:p,highlightColor:t,useColorValue:u,label:n||`Toggle highlight (${t})`,hideWhenUnavailable:r,mode:i,onApplied:a}),x=(0,_.useCallback)(e=>{s?.(e),!e.defaultPrevented&&v()},[v,s]),S=(0,_.useMemo)(()=>({...l,"--highlight-color":t}),[t,l]);return m?(0,M.jsx)($R,{type:`button`,variant:`ghost`,"data-active-state":g?`on`:`off`,role:`button`,tabIndex:-1,disabled:!h,"data-disabled":!h,"aria-label":y,"aria-pressed":g,tooltip:y,onClick:x,style:S,...d,ref:f,children:c??(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`span`,{className:`tiptap-button-highlight`,style:{"--highlight-color":t}}),n&&(0,M.jsx)(`span`,{className:`tiptap-button-text`,children:n}),o&&(0,M.jsx)(CG,{shortcutKeys:b})]})}):null});wG.displayName=`ColorHighlightButton`;var TG=[`shift`,`alt`,`meta`,`mod`,`ctrl`,`control`];function EG(){return typeof navigator>`u`?!1:/mac/i.test(navigator.userAgent)&&!/iphone|ipad|ipod/i.test(navigator.userAgent)}var DG={esc:`escape`,return:`enter`,left:`arrowleft`,right:`arrowright`,up:`arrowup`,down:`arrowdown`,ShiftLeft:`shift`,ShiftRight:`shift`,AltLeft:`alt`,AltRight:`alt`,MetaLeft:`meta`,MetaRight:`meta`,OSLeft:`meta`,OSRight:`meta`,ControlLeft:`ctrl`,ControlRight:`ctrl`};function OG(e){return(DG[e.trim()]||e.trim()).toLowerCase().replace(/key|digit|numpad/,``)}function kG(e){return TG.includes(e)}function AG(e,t=`,`){return e.toLowerCase().split(t)}function jG(e,t=`+`,n=`>`,r=!1,i,a){let o=[],s=!1;e=e.trim(),e.includes(n)?(s=!0,o=e.toLocaleLowerCase().split(n).map(e=>OG(e))):o=e.toLocaleLowerCase().split(t).map(e=>OG(e));let c={alt:o.includes(`alt`),ctrl:o.includes(`ctrl`)||o.includes(`control`),shift:o.includes(`shift`),meta:o.includes(`meta`),mod:o.includes(`mod`),useKey:r},l=o.filter(e=>!TG.includes(e));return{...c,keys:l,description:i,isSequence:s,hotkey:e,metadata:a}}
206typeof document<`u`&&(document.addEventListener(`keydown`,e=>{e.code!==void 0&&FG([OG(e.code)])}),document.addEventListener(`keyup`,e=>{e.code!==void 0&&IG([OG(e.code)])})),typeof window<`u`&&(window.addEventListener(`blur`,()=>{MG.clear()}),window.addEventListener(`focus`,()=>{MG.clear()}),window.addEventListener(`contextmenu`,()=>{setTimeout(()=>{MG.clear()},0)})),typeof document<`u`&&document.addEventListener(`visibilitychange`,()=>{MG.clear()});var MG=new Set;function NG(e){return Array.isArray(e)}function PG(e,t=`,`){return(NG(e)?e:e.split(t)).every(e=>MG.has(e.trim().toLowerCase()))}function FG(e){let t=Array.isArray(e)?e:[e];MG.has(`meta`)&&MG.forEach(e=>{kG(e)||MG.delete(e.toLowerCase())}),t.forEach(e=>{MG.add(e.toLowerCase())})}function IG(e){e===`meta`?MG.clear():(Array.isArray(e)?e:[e]).forEach(e=>{MG.delete(e.toLowerCase())})}function LG(e,t,n){(typeof n==`function`&&n(e,t)||n===!0)&&e.preventDefault()}function RG(e,t,n){return typeof n==`function`?n(e,t):n===!0||n===void 0}var zG=[`input`,`textarea`,`select`,`searchbox`,`slider`,`spinbutton`,`menuitem`,`menuitemcheckbox`,`menuitemradio`,`option`,`radio`,`textbox`];function BG(e){return VG(e,zG)}
206function VG(e,t=!1){let{target:n,composed:r}=e,i,a;return HG(n)&&r?(i=e.composedPath()[0]&&e.composedPath()[0].tagName,a=e.composedPath()[0]&&e.composedPath()[0].role):(i=n&&n.tagName,a=n&&n.role),NG(t)?!!(i&&t?.some(e=>e.toLowerCase()===i.toLowerCase()||e===a)):!!(i&&t&&t)}function HG(e){return!!e.tagName&&!e.tagName.startsWith(`-`)&&e.tagName.includes(`-`)}function UG(e,t){return e.length===0&&t?!1:t?e.some(e=>t.includes(e))||e.includes(`*`):!0}var WG=(e,t,n=!1)=>{let{alt:r,meta:i,mod:a,shift:o,ctrl:s,keys:c,useKey:l}=t,{code:u,key:d,ctrlKey:f,metaKey:p,shiftKey:m,altKey:h}=e,g=OG(u);if(l&&c?.length===1&&c.includes(d.toLowerCase()))return!0;if(!c?.includes(g)&&![`ctrl`,`control`,`unknown`,`meta`,`alt`,`shift`,`os`].includes(g))return!1;if(!n){if(r!==h&&g!==`alt`||o!==m&&g!==`shift`)return!1;if(a){if(EG()?!p:!f)return!1}else if(i!==p&&g!==`meta`&&g!==`os`||s!==f&&g!==`ctrl`&&g!==`control`)return!1}return c&&c.length===1&&c.includes(g)?!0:c&&c.length>0?c.includes(g)?PG(c):!1:!c||c.length===0},GG=(0,_.createContext)(void 0),KG=()=>(0,_.useContext)(GG);function qG(e,t){return e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(e).length===Object.keys(t).length&&Object.keys(e).reduce((n,r)=>n&&qG(e[r],t[r]),!0):e===t}var JG=(0,_.createContext)({hotkeys:[],activeScopes:[],toggleScope:()=>{},enableScope:()=>{},disableScope:()=>{}}),YG=()=>(0,_.useContext)(JG);function XG(e){let t=(0,_.useRef)(void 0);return qG(t.current,e)||(t.current=e),t.current}var ZG=e=>{e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},QG=typeof window<`u`?_.useLayoutEffect:_.useEffect;function $G(e){if(!e)return;let{enabled:t,preventDefault:n,ignoreEventWhen:r,...i}=e;return typeof t==`function`?i:{...i,enabled:t}}function eK(e,t,n,r){let[i,a]=(0,_.useState)(null),o=(0,_.useCallback)(e=>(a(e),()=>a(null)),[]),s=(0,_.useRef)(!1),c=Array.isArray(n)?Array.isArray(r)?void 0:r:n,l=NG(e)?e.join(c?.delimiter):e,u=Array.isArray(n)?n:Array.isArray(r)?r:void 0,d=(0,_.useCallback)(t,u??[]),f=(0,_.useRef)(d);u?f.current=d:f.current=t;let p=XG($G(c)),m=(0,_.useRef)(c?.enabled);m.current=c?.enabled;let h=(0,_.useRef)(c?.preventDefault);h.current=c?.preventDefault;let g=(0,_.useRef)(c?.ignoreEventWhen);g.current=c?.ignoreEventWhen;let{activeScopes:v}=YG(),y=KG();return QG(()=>{if(m.current===!1||!UG(v,p?.scopes))return;let e=[],t,n=(n,r=!1)=>{if(!(BG(n)&&!VG(n,p?.enableOnFormTags))){if(i!==null){let e=i.getRootNode();if((e instanceof Document||e instanceof ShadowRoot)&&e.activeElement!==i&&!i.contains(e.activeElement)){ZG(n);return}}n.target?.isContentEditable&&!p?.enableOnContentEditable||AG(l,p?.delimiter).forEach(i=>{if(i.includes(p?.splitKey??`+`)&&i.includes(p?.sequenceSplitKey??`>`)){console.warn(`Hotkey ${i} contains both ${p?.splitKey??`+`} and ${p?.sequenceSplitKey??`>`} which is not supported.`);return}let a=jG(i,p?.splitKey,p?.sequenceSplitKey,p?.useKey,p?.description,p?.metadata);if(a.isSequence){t=setTimeout(()=>{e=[]},p?.sequenceTimeoutMs??1e3);let r=a.useKey?n.key:OG(n.code);if(kG(r.toLowerCase()))return;if(e.push(r),r!==a.keys?.[e.length-1]){e=[],t&&clearTimeout(t);return}e.length===a.keys?.length&&(f.current(n,a),t&&clearTimeout(t),e=[])}else if(WG(n,a,p?.ignoreModifiers)||a.keys?.includes(`*`)){if(g.current?.(n)||r&&s.current||(LG(n,a,h.current),!RG(n,a,m.current)))return;f.current(n,a),r||(s.current=!0)}})}},r=e=>{e.code!==void 0&&(FG(OG(e.code)),(p?.keydown===void 0&&p?.keyup!==!0||p?.keydown)&&n(e))},a=e=>{e.code!==void 0&&(IG(OG(e.code)),s.current=!1,p?.keyup&&n(e,!0))},o=i||c?.document||document;return o.addEventListener(`keyup`,a,c?.eventListenerOptions),o.addEventListener(`keydown`,r,c?.eventListenerOptions),y&&AG(l,p?.delimiter).forEach(e=>{y.addHotkey(jG(e,p?.splitKey,p?.sequenceSplitKey,p?.useKey,p?.description,p?.metadata))}),()=>{o.removeEventListener(`keyup`,a,c?.eventListenerOptions),o.removeEventListener(`keydown`,r,c?.eventListenerOptions),y&&AG(l,p?.delimiter).forEach(e=>{y.removeHotkey(jG(e,p?.splitKey,p?.sequenceSplitKey,p?.useKey,p?.description,p?.metadata))}),e=[],t&&clearTimeout(t)}},[i,p,v,l]),o}var tK=`mod+shift+h`,nK=[{label:`Default background`,value:`var(--tt-bg-color)`,colorValue:`#ffffff`,border:`var(--tt-bg-color-contrast)`},{label:`Gray background`,value:`var(--tt-color-highlight-gray)`,colorValue:`#f8f8f7`,border:`var(--tt-color-highlight-gray-contrast)`},{label:`Brown background`,value:`var(--tt-color-highlight-brown)`,colorValue:`#f4eeee`,border:`var(--tt-color-highlight-brown-contrast)`},{label:`Orange background`,value:`var(--tt-color-highlight-orange)`,colorValue:`#fbecdd`,border:`var(--tt-color-highlight-orange-contrast)`},{label:`Yellow background`,value:`var(--tt-color-highlight-yellow)`,colorValue:`#fef9c3`,border:`var(--tt-color-highlight-yellow-contrast)`},{label:`Green background`,value:`var(--tt-color-highlight-green)`,colorValue:`#dcfce7`,border:`var(--tt-color-highlight-green-contrast)`},{label:`Blue background`,value:`var(--tt-color-highlight-blue)`,colorValue:`#e0f2fe`,border:`var(--tt-color-highlight-blue-contrast)`},{label:`Purple background`,value:`var(--tt-color-highlight-purple)`,colorValue:`#f3e8ff`,border:`var(--tt-color-highlight-purple-contrast)`},{label:`Pink background`,value:`var(--tt-color-highlight-pink)`,colorValue:`#fcf1f6`,border:`var(--tt-color-highlight-pink-contrast)`},{label:`Red background`,value:`var(--tt-color-highlight-red)`,colorValue:`#ffe4e6`,border:`var(--tt-color-highlight-red-contrast)`}];function rK(e){let t=new Map(nK.map(e=>[e.value,e]));return e.map(e=>t.get(e)).filter(e=>!!e)}function iK(e,t=!1){return t&&nK.find(t=>t.value===e||t.colorValue===e)?.colorValue||e}function aK(e,t=`mark`){if(!e||!e.isEditable)return!1;if(t===`mark`)return!GR(`highlight`,e)||XR(e,[`image`])?!1:e.can().setMark(`highlight`);
206if(!JR(e,[`nodeBackground`]))return!1;try{return e.can().toggleNodeBackgroundColor(`test`)}catch{return!1}}function oK(e,t,n=`mark`){if(!e||!e.isEditable)return!1;if(n===`mark`)return t?e.isActive(`highlight`,{color:t}):e.isActive(`highlight`);if(!t)return!1;try{let{state:n}=e,{selection:r}=n,i=r.$anchor;for(let e=i.depth;e>=0;e--){let n=i.node(e);if(n&&n.attrs?.backgroundColor===t)return!0}return!1}catch{return!1}}function sK(e,t=`mark`){return!e||!e.isEditable||!aK(e,t)?!1:t===`mark`?e.chain().focus().unsetMark(`highlight`).run():e.chain().focus().unsetNodeBackgroundColor().run()}function cK(e){let{editor:t,hideWhenUnavailable:n,mode:r}=e;if(!t)return!1;if(!n)return!0;if(!t.isEditable)return!1;if(r===`mark`){if(!GR(`highlight`,t))return!1}else if(!JR(t,[`nodeBackground`]))return!1;return t.isActive(`code`)?!0:aK(t,r)}function lK(e){let{editor:t,label:n,highlightColor:r,hideWhenUnavailable:i=!1,mode:a=`mark`,useColorValue:o=!1,onApplied:s}=e,{editor:c}=nW(t),l=fG(),[u,d]=(0,_.useState)(!0),f=aK(c,a),p=r&&iK(r,o),m=oK(c,p,a);(0,_.useEffect)(()=>{if(!c)return;let e=()=>{d(cK({editor:c,hideWhenUnavailable:i,mode:a}))};return e(),c.on(`selectionUpdate`,e),()=>{c.off(`selectionUpdate`,e)}},[c,i,a]);let h=(0,_.useCallback)(()=>{if(!c||!f||!p||!n)return!1;if(a===`mark`){if(c.state.storedMarks){let e=c.schema.marks.highlight;e&&c.view.dispatch(c.state.tr.removeStoredMark(e))}return setTimeout(()=>{let e=c.chain().focus().toggleHighlight({color:p}).run();return e&&s?.({color:p,label:n,mode:a}),e},0),!0}else{let e=c.chain().focus().toggleNodeBackgroundColor(p).run();return e&&s?.({color:p,label:n,mode:a}),e}},[f,p,c,n,s,a]),g=(0,_.useCallback)(()=>{let e=sK(c,a);return e&&s?.({color:``,label:`Remove highlight`,mode:a}),e},[c,s,a]);return eK(tK,e=>{e.preventDefault(),h()},{enabled:u&&f,enableOnContentEditable:!l,enableOnFormTags:!0}),{isVisible:u,isActive:m,handleColorHighlight:h,handleRemoveHighlight:g,canColorHighlight:f,label:n||`Highlight`,shortcutKeys:tK,Icon:QU,mode:a}}var uK=eC(`tiptap-button-group`,{variants:{orientation:{horizontal:`tiptap-button-group-horizontal`,vertical:`tiptap-button-group-vertical`}},defaultVariants:{orientation:`horizontal`}});function dK({className:e,orientation:t,...n}){return(0,M.jsx)(`div`,{role:`group`,"data-slot":`tiptap-button-group`,"data-orientation":t,className:UR(uK({orientation:t}),e),...n})}var fK=(0,_.forwardRef)(({className:e,children:t,...n},r)=>(0,M.jsx)($R,{type:`button`,className:e,variant:`ghost`,"data-appearance":`default`,role:`button`,tabIndex:-1,"aria-label":`Highlight text`,tooltip:`Highlight`,ref:r,...n,children:t??(0,M.jsx)(QU,{className:`tiptap-button-icon`})}));fK.displayName=`ColorHighlightPopoverButton`;function pK({editor:e,colors:t=rK([`var(--tt-color-highlight-green)`,`var(--tt-color-highlight-blue)`,`var(--tt-color-highlight-red)`,`var(--tt-color-highlight-purple)`,`var(--tt-color-highlight-yellow)`]),useColorValue:n=!1}){let{handleRemoveHighlight:r}=lK({editor:e}),i=fG(),a=(0,_.useRef)(null),{selectedIndex:o}=WU({containerRef:a,items:(0,_.useMemo)(()=>[...t,{label:`Remove highlight`,value:`none`}],[t]),orientation:`both`,onSelect:e=>{if(!a.current)return!1;let t=a.current.querySelector(`[data-highlighted="true"]`);return t&&t.click(),e.value===`none`&&r(),!0},autoSelectFirstItem:!1});return(0,M.jsx)(_G,{ref:a,tabIndex:0,style:i?{boxShadow:`none`,border:0}:{},children:(0,M.jsx)(yG,{style:i?{padding:0}:{},children:(0,M.jsxs)(bG,{orientation:`horizontal`,children:[(0,M.jsx)(dK,{children:t.map((t,r)=>(0,M.jsx)(dK,{children:(0,M.jsx)(wG,{editor:e,highlightColor:n?t.colorValue:t.value,tooltip:t.label,"aria-label":`${t.label} highlight color`,tabIndex:r===o?0:-1,"data-highlighted":o===r,useColorValue:n})},t.value))}),(0,M.jsx)(UU,{}),(0,M.jsx)(dK,{children:(0,M.jsx)($R,{onClick:r,"aria-label":`Remove highlight`,tooltip:`Remove highlight`,tabIndex:o===t.length?0:-1,type:`button`,role:`menuitem`,variant:`ghost`,"data-highlighted":o===t.length,children:(0,M.jsx)(pG,{className:`tiptap-button-icon`})})})]})})})}function mK({editor:e,colors:t=rK([`var(--tt-color-highlight-green)`,`var(--tt-color-highlight-blue)`,`var(--tt-color-highlight-red)`,`var(--tt-color-highlight-purple)`,`var(--tt-color-highlight-yellow)`]),hideWhenUnavailable:n=!1,useColorValue:r=!1,onApplied:i,...a}){let{editor:o}=nW(e),[s,c]=(0,_.useState)(!1),{isVisible:l,canColorHighlight:u,isActive:d,label:f,Icon:p}=lK({editor:o,hideWhenUnavailable:n,onApplied:i});return l?(0,M.jsxs)(mG,{open:s,onOpenChange:c,children:[(0,M.jsx)(hG,{asChild:!0,children:(0,M.jsx)(fK,{disabled:!u,"data-active-state":d?`on`:`off`,"data-disabled":!u,"aria-pressed":d,"aria-label":f,tooltip:f,...a,children:(0,M.jsx)(p,{className:`tiptap-button-icon`})})}),(0,M.jsx)(gG,{"aria-label":`Highlight colors`,children:(0,M.jsx)(pK,{editor:o,colors:t,useColorValue:r})})]}):null}function hK({shortcutKeys:e=vK}){return(0,M.jsx)(rW,{children:WR({shortcutKeys:e})})}var gK=(0,_.forwardRef)(({editor:e,text:t,hideWhenUnavailable:n=!1,onInserted:r,showShortcut:i=!1,onClick:a,icon:o,children:s,...c},l)=>{let{editor:u}=nW(e),{isVisible:d,canInsert:f,handleImage:p,label:m,isActive:h,shortcutKeys:g,Icon:v}=CK({editor:u,hideWhenUnavailable:n,onInserted:r}),y=(0,_.useCallback)(e=>{a?.(e),!e.defaultPrevented&&p()},[p,a]);if(!d)return null;let b=o??v;return(0,M.jsx)($R,{type:`button`,variant:`ghost`,"data-active-state":h?`on`:`off`,role:`button`,tabIndex:-1,disabled:!f,"data-disabled":!f,"aria-label":m,"aria-pressed":h,tooltip:m,onClick:y,...c,ref:l,children:s??(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(b,{className:`tiptap-button-icon`}),t&&(0,M.jsx)(`span`,{className:`tiptap-button-text`,children:t}),i&&(0,M.jsx)(hK,{shortcutKeys:g})]})})});gK.displayName=`ImageUploadButton`;var _K=(0,_.memo)(({className:e,...t})=>(0,M.jsx)(`svg`,{width:`24`,height:`24`,className:e,viewBox:`0 0 24 24`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,...t,children:(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M20 2C20 1.44772 19.5523 1 19 1C18.4477 1 18 1.44772 18 2V4H16C15.4477 4 15 4.44772 15 5C15 5.55228 15.4477 6 16 6H18V8C18 8.55228 18.4477 9 19 9C19.5523 9 20 8.55228 20 8V6H22C22.5523 6 23 5.55228 23 5C23 4.44772 22.5523 4 22 4H20V2ZM5 4C4.73478 4 4.48043 4.10536 4.29289 4.29289C4.10536 4.48043 4 4.73478 4 5V19C4 19.2652 4.10536 19.5196 4.29289 19.7071C4.48043 19.8946 4.73478 20 5 20H5.58579L14.379 11.2068C14.9416 10.6444 15.7045 10.3284 16.5 10.3284C17.2955 10.3284 18.0584
20610.6444 18.621 11.2068L20 12.5858V12C20 11.4477 20.4477 11 21 11C21.5523 11 22 11.4477 22 12V14.998C22 14.9994 22 15.0007 22 15.002V19C22 19.7957 21.6839 20.5587 21.1213 21.1213C20.5587 21.6839 19.7957 22 19 22H6.00219C6.00073 22 5.99927 22 5.99781 22H5C4.20435 22 3.44129 21.6839 2.87868 21.1213C2.31607 20.5587 2 19.7957 2 19V5C2 4.20435 2.31607 3.44129 2.87868 2.87868C3.44129 2.31607 4.20435 2 5 2H12C12.5523 2 13 2.44772 13 3C13 3.55228 12.5523 4 12 4H5ZM8.41422 20H19C19.2652 20 19.5196 19.8946 19.7071 19.7071C19.8946 19.5196 20 19.2652 20 19V15.4142L17.207 12.6212C17.0195 12.4338 16.7651 12.3284 16.5 12.3284C16.2349 12.3284 15.9806 12.4337 15.7931 12.6211L8.41422 20ZM6.87868 6.87868C7.44129 6.31607 8.20435 6 9 6C9.79565 6 10.5587 6.31607 11.1213 6.87868C11.6839 7.44129 12 8.20435 12 9C12 9.79565 11.6839 10.5587 11.1213 11.1213C10.5587 11.6839 9.79565 12 9 12C8.20435 12 7.44129 11.6839 6.87868 11.1213C6.31607 10.5587 6 9.79565 6 9C6 8.20435 6.31607 7.44129 6.87868 6.87868ZM9 8C8.73478 8 8.48043 8.10536 8.29289 8.29289C8.10536 8.48043 8 8.73478 8 9C8 9.26522 8.10536 9.51957 8.29289 9.70711C8.48043 9.89464 8.73478 10 9 10C9.26522 10 9.51957 9.89464 9.70711 9.70711C9.89464 9.51957 10 9.26522 10 9C10 8.73478 9.89464 8.48043 9.70711 8.29289C9.51957 8.10536 9.26522 8 9 8Z`,fill:`currentColor`})}));_K.displayName=`ImagePlusIcon`;var vK=`mod+shift+i`;function yK(e){return!e||!e.isEditable||!JR(e,`imageUpload`)?!1:e.can().insertContent({type:`imageUpload`})}function bK(e){return!e||!e.isEditable?!1:e.isActive(`imageUpload`)}function xK(e){if(!e||!e.isEditable||!yK(e))return!1;try{return e.chain().focus().insertContent({type:`imageUpload`}).run()}catch{return!1}}function SK(e){let{editor:t,hideWhenUnavailable:n}=e;return!t||!t.isEditable?!1:n?JR(t,`imageUpload`)?t.isActive(`code`)?!0:yK(t):!1:!0}function CK(e){let{editor:t,hideWhenUnavailable:n=!1,onInserted:r}=e||{},{editor:i}=nW(t),a=fG(),[o,s]=(0,_.useState)(!0),c=yK(i),l=bK(i);(0,_.useEffect)(()=>{if(!i)return;let e=()=>{s(SK({editor:i,hideWhenUnavailable:n}))};return e(),i.on(`selectionUpdate`,e),()=>{i.off(`selectionUpdate`,e)}},[i,n]);let u=(0,_.useCallback)(()=>{if(!i)return!1;let e=xK(i);return e&&r?.(),e},[i,r]);return eK(vK,e=>{e.preventDefault(),u()},{enabled:o&&c,enableOnContentEditable:!a,enableOnFormTags:!0}),{isVisible:o,isActive:l,handleImage:u,canInsert:c,label:`Add image`,shortcutKeys:vK,Icon:_K}}var wK=(0,_.memo)(({className:e,...t})=>(0,M.jsx)(`svg`,{width:`24`,height:`24`,className:e,viewBox:`0 0 24 24`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,...t,children:(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M21 4C21 3.44772 20.5523 3 20 3C19.4477 3 19 3.44772 19 4V11C19 11.7956 18.6839 12.5587 18.1213 13.1213C17.5587 13.6839 16.7956 14 16 14H6.41421L9.70711 10.7071C10.0976 10.3166 10.0976 9.68342 9.70711 9.29289C9.31658 8.90237 8.68342 8.90237 8.29289 9.29289L3.29289 14.2929C2.90237 14.6834 2.90237 15.3166 3.29289 15.7071L8.29289 20.7071C8.68342 21.0976 9.31658 21.0976 9.70711 20.7071C10.0976 20.3166 10.0976 19.6834 9.70711 19.2929L6.41421 16H16C17.3261 16 18.5979 15.4732 19.5355 14.5355C20.4732 13.5979 21 12.3261 21 11V4Z`,fill:`currentColor`})}));wK.displayName=`CornerDownLeftIcon`;var TK=(0,_.memo)(({className:e,...t})=>(0,M.jsxs)(`svg`,{width:`24`,height:`24`,className:e,viewBox:`0 0 24 24`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,...t,children:[(0,M.jsx)(`path`,{d:`M14 3C14 2.44772 14.4477 2 15 2H21C21.5523 2 22 2.44772 22 3V9C22 9.55228 21.5523 10 21 10C20.4477 10 20 9.55228 20 9V5.41421L10.7071 14.7071C10.3166 15.0976 9.68342 15.0976 9.29289 14.7071C8.90237 14.3166 8.90237 13.6834 9.29289 13.2929L18.5858 4H15C14.4477 4 14 3.55228 14 3Z`,fill:`currentColor`}),(0,M.jsx)(`path`,{d:`M4.29289 7.29289C4.48043 7.10536 4.73478 7 5 7H11C11.5523 7 12 6.55228 12 6C12 5.44772 11.5523 5 11 5H5C4.20435 5 3.44129 5.31607 2.87868 5.87868C2.31607 6.44129 2 7.20435 2 8V19C2 19.7957 2.31607 20.5587 2.87868 21.1213C3.44129 21.6839 4.20435 22 5 22H16C16.7957 22 17.5587 21.6839 18.1213 21.1213C18.6839 20.5587 19 19.7957 19 19V13C19 12.4477 18.5523 12 18 12C17.4477 12 17 12.4477 17 13V19C17 19.2652 16.8946 19.5196 16.7071 19.7071C16.5196 19.8946 16.2652 20 16 20H5C4.73478 20 4.48043 19.8946 4.29289 19.7071C4.10536 19.5196 4 19.2652 4 19V8C4 7.73478 4.10536 7.48043 4.29289 7.29289Z`,fill:`currentColor`})]}));TK.displayName=`ExternalLinkIcon`;var EK=(0,_.memo)(({className:e,...t})=>(0,M.jsx)(`svg`,{width:`24`,height:`24`,className:e,viewBox:`0 0 24 24`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,...t,children:(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M7 5V4C7 3.17477 7.40255 2.43324 7.91789 1.91789C8.43324 1.40255 9.17477 1 10 1H14C14.8252 1 15.5668 1.40255 16.0821 1.91789C16.5975 2.43324 17 3.17477 17 4V5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H20V20C20 20.8252 19.5975 21.5668 19.0821 22.0821C18.5668 22.5975 17.8252 23 17 23H7C6.17477 23 5.43324 22.5975 4.91789 22.0821C4.40255 21.5668 4 20.8252 4 20V7H3C2.44772 7 2 6.55228 2 6C2 5.44772 2.44772 5 3 5H7ZM9 4C9 3.82523 9.09745 3.56676 9.33211 3.33211C9.56676 3.09745 9.82523 3 10 3H14C14.1748 3 14.4332 3.09745 14.6679 3.33211C14.9025 3.56676 15 3.82523 15 4V5H9V4ZM6 7V20C6 20.1748 6.09745 20.4332 6.33211 20.6679C6.56676 20.9025 6.82523 21 7 21H17C17.1748 21 17.4332 20.9025 17.6679 20.6679C17.9025 20.4332 18 20.1748 18 20V7H6Z`,fill:`currentColor`})}));EK.displayName=`TrashIcon`;function DK({className:e,type:t,...n}){return(0,M.jsx)(`input`,{type:t,"data-slot":`tiptap-input`,className:UR(`tiptap-input`,e),...n})}var OK=(0,_.forwardRef)(({className:e,children:t,...n},r)=>(0,M.jsx)($R,{type:`button`,className:e,variant:`ghost`,role:`button`,tabIndex:-1,"aria-label":`Link`,tooltip:`Link`,ref:r,...n,children:t||(0,M.jsx)($U,{className:`tiptap-button-icon`})}));OK.displayName=`LinkButton`;var kK=({url:e,setUrl:t,setLink:n,removeLink:r,openLink:i,isActive:a})=>{let o=fG(),s=e=>{e.key===`Enter`&&(e.preventDefault(),n())};return(0,M.jsx)(_G,{style:{...o?{boxShadow:`none`,border:0}:{}},children:(0,M.jsx)(yG,{style:{...o?{padding:0}:{}},children:(0,M.jsxs)(bG,{orientation:`horizontal`,children:[(0,M.jsx)(DK,{type:`url`,placeholder:`Paste a link...`,value:e,onCh
206ange:e=>t(e.target.value),onKeyDown:s,autoFocus:!0,autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`off`,className:`tiptap-link-input`}),(0,M.jsx)(dK,{children:(0,M.jsx)($R,{type:`button`,onClick:n,title:`Apply link`,disabled:!e&&!a,variant:`ghost`,children:(0,M.jsx)(wK,{className:`tiptap-button-icon`})})}),(0,M.jsx)(UU,{}),(0,M.jsxs)(dK,{children:[(0,M.jsx)(dK,{children:(0,M.jsx)($R,{type:`button`,onClick:i,title:`Open in new window`,disabled:!e&&!a,variant:`ghost`,children:(0,M.jsx)(TK,{className:`tiptap-button-icon`})})}),(0,M.jsx)(dK,{children:(0,M.jsx)($R,{type:`button`,onClick:r,title:`Remove link`,disabled:!e&&!a,variant:`ghost`,children:(0,M.jsx)(EK,{className:`tiptap-button-icon`})})})]})]})})})},AK=({editor:e})=>(0,M.jsx)(kK,{...LK({editor:e})}),jK=(0,_.forwardRef)(({editor:e,hideWhenUnavailable:t=!1,onSetLink:n,onOpenChange:r,autoOpenOnLinkActive:i=!0,onClick:a,children:o,...s},c)=>{let{editor:l}=nW(e),[u,d]=(0,_.useState)(!1),{isVisible:f,canSet:p,isActive:m,url:h,setUrl:g,setLink:v,removeLink:y,openLink:b,label:x,Icon:S}=LK({editor:l,hideWhenUnavailable:t,onSetLink:n}),C=(0,_.useCallback)(e=>{d(e),r?.(e)},[r]),w=(0,_.useCallback)(()=>{v(),d(!1)},[v]),T=(0,_.useCallback)(e=>{a?.(e),!e.defaultPrevented&&d(!u)},[a,u]);return(0,_.useEffect)(()=>{i&&m&&d(!0)},[i,m]),f?(0,M.jsxs)(mG,{open:u,onOpenChange:C,children:[(0,M.jsx)(hG,{asChild:!0,children:(0,M.jsx)(OK,{disabled:!p,"data-active-state":m?`on`:`off`,"data-disabled":!p,"aria-label":x,"aria-pressed":m,onClick:T,...s,ref:c,children:o??(0,M.jsx)(S,{className:`tiptap-button-icon`})})}),(0,M.jsx)(gG,{children:(0,M.jsx)(kK,{url:h,setUrl:g,setLink:w,removeLink:y,openLink:b,isActive:m})})]}):null});jK.displayName=`LinkPopover`;function MK(e){if(!e||!e.isEditable||XR(e,[`image`],!0))return!1;try{return e.can().setMark(`link`)}catch{return!1}}function NK(e){return!e||!e.isEditable?!1:e.isActive(`link`)}function PK(e){let{editor:t,hideWhenUnavailable:n}=e;if(!t||!t.isEditable)return!1;let r=GR(`link`,t);return n?r?t.isActive(`code`)?!0:MK(t):!1:!0}function FK(e){let{editor:t,onSetLink:n}=e,[r,i]=(0,_.useState)(null);(0,_.useEffect)(()=>{if(!t)return;let{href:e}=t.getAttributes(`link`);NK(t)&&r===null&&i(e||``)},[t,r]),(0,_.useEffect)(()=>{if(!t)return;let e=()=>{let{href:e}=t.getAttributes(`link`);i(e||``)};return t.on(`selectionUpdate`,e),()=>{t.off(`selectionUpdate`,e)}},[t]);let a=(0,_.useCallback)(()=>{if(!r||!t)return;let{selection:e}=t.state,a=e.empty,o=t.chain().focus();o=o.extendMarkRange(`link`).setLink({href:r}),a&&(o=o.insertContent({type:`text`,text:r})),o.run(),i(null),n?.()},[t,n,r]),o=(0,_.useCallback)(()=>{t&&(t.chain().focus().extendMarkRange(`link`).unsetLink().setMeta(`preventAutolink`,!0).run(),i(``))},[t]),s=(0,_.useCallback)((e=`_blank`,t=`noopener,noreferrer`)=>{if(!r)return;let n=wce(r,window.location.href);n!==`#`&&window.open(n,e,t)},[r]);return{url:r||``,setUrl:i,setLink:a,removeLink:o,openLink:s}}function IK(e){let{editor:t,hideWhenUnavailable:n=!1}=e,r=MK(t),i=NK(t),[a,o]=(0,_.useState)(!0);return(0,_.useEffect)(()=>{if(!t)return;let e=()=>{o(PK({editor:t,hideWhenUnavailable:n}))};return e(),t.on(`selectionUpdate`,e),()=>{t.off(`selectionUpdate`,e)}},[t,n]),{isVisible:a,canSet:r,isActive:i}}function LK(e){let{editor:t,hideWhenUnavailable:n=!1,onSetLink:r}=e||{},{editor:i}=nW(t),{isVisible:a,canSet:o,isActive:s}=IK({editor:i,hideWhenUnavailable:n});return{isVisible:a,canSet:o,isActive:s,label:`Link`,Icon:$U,...FK({editor:i,onSetLink:r})}}function RK({type:e,shortcutKeys:t=JK[e]}){return(0,M.jsx)(rW,{children:WR({shortcutKeys:t})})}var zK=(0,_.forwardRef)(({editor:e,type:t,text:n,hideWhenUnavailable:r=!1,onToggled:i,showShortcut:a=!1,onClick:o,children:s,...c},l)=>{let{editor:u}=nW(e),{isVisible:d,handleMark:f,label:p,canToggle:m,isActive:h,Icon:g,shortcutKeys:v}=eq({editor:u,type:t,hideWhenUnavailable:r,onToggled:i}),y=(0,_.useCallback)(e=>{o?.(e),!e.defaultPrevented&&f()},[f,o]);return d?(0,M.jsx)($R,{type:`button`,disabled:!m,variant:`ghost`,"data-active-state":h?`on`:`off`,"data-disabled":!m,role:`button`,tabIndex:-1,"aria-label":p,"aria-pressed":h,tooltip:p,onClick:y,...c,ref:l,children:s??(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(g,{className:`tiptap-button-icon`}),n&&(0,M.jsx)(`span`,{className:`tiptap-button-text`,children:n}),a&&(0,M.jsx)(RK,{type:t,shortcutKeys:v})]})}):null});zK.displayName=`MarkButton`;var BK=(0,_.memo)(({className:e,...t})=>(0,M.jsx)(`svg`,{width:`24`,height:`24`,className:e,viewBox:`0 0 24 24`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,...t,children:(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M6 2.5C5.17157 2.5 4.5 3.17157 4.5 4V20C4.5 20.8284 5.17157 21.5 6 21.5H15C16.4587 21.5 17.8576 20.9205 18.8891 19.8891C19.9205 18.8576 20.5 17.4587 20.5 16C20.5 14.5413 19.9205 13.1424 18.8891 12.1109C18.6781 11.9 18.4518 11.7079 18.2128 11.5359C19.041 10.5492 19.5 9.29829 19.5 8C19.5 6.54131 18.9205 5.14236 17.8891 4.11091C16.8576 3.07946 15.4587 2.5 14 2.5H6ZM14 10.5C14.663 10.5 15.2989 10.2366 15.7678 9.76777C16.2366 9.29893 16.5 8.66304 16.5 8C16.5 7.33696 16.2366 6.70107 15.7678 6.23223C15.2989 5.76339 14.663 5.5 14 5.5H7.5V10.5H14ZM7.5 18.5V13.5H15C15.663 13.5 16.2989 13.7634 16.7678 14.2322C17.2366 14.7011 17.5 15.337 17.5 16C17.5 16.663 17.2366 17.2989 16.7678 17.7678C16.2989 18.2366 15.663 18.5 15 18.5H7.5Z`,fill:`currentColor`})}));BK.displayName=`BoldIcon`;var VK=(0,_.memo)(({className:e,...t})=>(0,M.jsxs)(`svg`,{width:`24`,height:`24`,className:e,viewBox:`0 0 24 24`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,...t,children:[(0,M.jsx)(`path`,{d:`M15.4545 4.2983C15.6192 3.77115 15.3254 3.21028 14.7983 3.04554C14.2712 2.88081 13.7103 3.1746 13.5455 3.70175L8.54554 19.7017C8.38081 20.2289 8.6746 20.7898 9.20175 20.9545C9.72889 21.1192 10.2898 20.8254 10.4545 20.2983L15.4545 4.2983Z`,fill:`currentColor`}),(0,M.jsx)(`path`,{d:`M6.70711 7.29289C7.09763 7.68342 7.09763 8.31658 6.70711 8.70711L3.41421 12L6.70711 15.2929C7.09763 15.6834 7.09763 16.3166 6.70711 16.7071C6.31658 17.0976 5.68342 17.0976 5.29289 16.7071L1.29289 12.7071C0.902369 12.3166 0.902369 11.6834 1.29289 11.2929L5.29289 7.29289C5.68342 6.90237 6.31658 6.90237 6.70711 7.29289Z`,fill:`currentColor`}),(0,M.jsx)(`path`,{d:`M17.2929 7.29289C17.6834 6.90237 18.3166 6.90237 18.7071 7.29289L22.7071 11.2929C23.0976 11.6834 23.0976 12.3166 22.7071 12.7071L18.7071 16.7071C18.3166 17.0976 17.6834 17.0976 17.2929 16.7071C16.9024 16.3166 16.9
206024 15.6834 17.2929 15.2929L20.5858 12L17.2929 8.70711C16.9024 8.31658 16.9024 7.68342 17.2929 7.29289Z`,fill:`currentColor`})]}));VK.displayName=`Code2Icon`;var HK=(0,_.memo)(({className:e,...t})=>(0,M.jsx)(`svg`,{width:`24`,height:`24`,className:e,viewBox:`0 0 24 24`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,...t,children:(0,M.jsx)(`path`,{d:`M15.0222 3H19C19.5523 3 20 3.44772 20 4C20 4.55228 19.5523 5 19 5H15.693L10.443 19H14C14.5523 19 15 19.4477 15 20C15 20.5523 14.5523 21 14 21H9.02418C9.00802 21.0004 8.99181 21.0004 8.97557 21H5C4.44772 21 4 20.5523 4 20C4 19.4477 4.44772 19 5 19H8.30704L13.557 5H10C9.44772 5 9 4.55228 9 4C9 3.44772 9.44772 3 10 3H14.9782C14.9928 2.99968 15.0075 2.99967 15.0222 3Z`,fill:`currentColor`})}));HK.displayName=`ItalicIcon`;var UK=(0,_.memo)(({className:e,...t})=>(0,M.jsxs)(`svg`,{width:`24`,height:`24`,className:e,viewBox:`0 0 24 24`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,...t,children:[(0,M.jsx)(`path`,{d:`M9.00039 3H16.0001C16.5524 3 17.0001 3.44772 17.0001 4C17.0001 4.55229 16.5524 5 16.0001 5H9.00011C8.68006 4.99983 8.36412 5.07648 8.07983 5.22349C7.79555 5.37051 7.55069 5.5836 7.36585 5.84487C7.181 6.10614 7.06155 6.40796 7.01754 6.72497C6.97352 7.04198 7.00623 7.36492 7.11292 7.66667C7.29701 8.18737 7.02414 8.75872 6.50344 8.94281C5.98274 9.1269 5.4114 8.85403 5.2273 8.33333C5.01393 7.72984 4.94851 7.08396 5.03654 6.44994C5.12456 5.81592 5.36346 5.21229 5.73316 4.68974C6.10285 4.1672 6.59256 3.74101 7.16113 3.44698C7.72955 3.15303 8.36047 2.99975 9.00039 3Z`,fill:`currentColor`}),(0,M.jsx)(`path`,{d:`M18 13H20C20.5523 13 21 12.5523 21 12C21 11.4477 20.5523 11 20 11H4C3.44772 11 3 11.4477 3 12C3 12.5523 3.44772 13 4 13H14C14.7956 13 15.5587 13.3161 16.1213 13.8787C16.6839 14.4413 17 15.2044 17 16C17 16.7956 16.6839 17.5587 16.1213 18.1213C15.5587 18.6839 14.7956 19 14 19H6C5.44772 19 5 19.4477 5 20C5 20.5523 5.44772 21 6 21H14C15.3261 21 16.5979 20.4732 17.5355 19.5355C18.4732 18.5979 19 17.3261 19 16C19 14.9119 18.6453 13.8604 18 13Z`,fill:`currentColor`})]}));UK.displayName=`StrikeIcon`;var WK=(0,_.memo)(({className:e,...t})=>(0,M.jsxs)(`svg`,{width:`24`,height:`24`,className:e,viewBox:`0 0 24 24`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,...t,children:[(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M3.29289 7.29289C3.68342 6.90237 4.31658 6.90237 4.70711 7.29289L12.7071 15.2929C13.0976 15.6834 13.0976 16.3166 12.7071 16.7071C12.3166 17.0976 11.6834 17.0976 11.2929 16.7071L3.29289 8.70711C2.90237 8.31658 2.90237 7.68342 3.29289 7.29289Z`,fill:`currentColor`}),(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12.7071 7.29289C13.0976 7.68342 13.0976 8.31658 12.7071 8.70711L4.70711 16.7071C4.31658 17.0976 3.68342 17.0976 3.29289 16.7071C2.90237 16.3166 2.90237 15.6834 3.29289 15.2929L11.2929 7.29289C11.6834 6.90237 12.3166 6.90237 12.7071 7.29289Z`,fill:`currentColor`}),(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M17.4079 14.3995C18.0284 14.0487 18.7506 13.9217 19.4536 14.0397C20.1566 14.1578 20.7977 14.5138 21.2696 15.0481L21.2779 15.0574L21.2778 15.0575C21.7439 15.5988 22 16.2903 22 17C22 18.0823 21.3962 18.8401 20.7744 19.3404C20.194 19.8073 19.4858 20.141 18.9828 20.378C18.9638 20.387 18.9451 20.3958 18.9266 20.4045C18.4473 20.6306 18.2804 20.7817 18.1922 20.918C18.1773 20.9412 18.1619 20.9681 18.1467 21H21C21.5523 21 22 21.4477 22 22C22 22.5523 21.5523 23 21 23H17C16.4477 23 16 22.5523 16 22C16 21.1708 16.1176 20.4431 16.5128 19.832C16.9096 19.2184 17.4928 18.8695 18.0734 18.5956C18.6279 18.334 19.138 18.0901 19.5207 17.7821C19.8838 17.49 20 17.2477 20 17C20 16.7718 19.9176 16.5452 19.7663 16.3672C19.5983 16.1792 19.3712 16.0539 19.1224 16.0121C18.8722 15.9701 18.6152 16.015 18.3942 16.1394C18.1794 16.2628 18.0205 16.4549 17.9422 16.675C17.7572 17.1954 17.1854 17.4673 16.665 17.2822C16.1446 17.0972 15.8728 16.5254 16.0578 16.005C16.2993 15.3259 16.7797 14.7584 17.4039 14.4018L17.4079 14.3995L17.4079 14.3995Z`,fill:`currentColor`})]}));WK.displayName=`SubscriptIcon`;var GK=(0,_.memo)(({className:e,...t})=>(0,M.jsxs)(`svg`,{width:`24`,height:`24`,className:e,viewBox:`0 0 24 24`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,...t,children:[(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12.7071 7.29289C13.0976 7.68342 13.0976 8.31658 12.7071 8.70711L4.70711 16.7071C4.31658 17.0976 3.68342 17.0976 3.29289 16.7071C2.90237 16.3166 2.90237 15.6834 3.29289 15.2929L11.2929 7.29289C11.6834 6.90237 12.3166 6.90237 12.7071 7.29289Z`,fill:`currentColor`}),(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M3.29289 7.29289C3.68342 6.90237 4.31658 6.90237 4.70711 7.29289L12.7071 15.2929C13.0976 15.6834 13.0976 16.3166 12.7071 16.7071C12.3166 17.0976 11.6834 17.0976 11.2929 16.7071L3.29289 8.70711C2.90237 8.31658 2.90237 7.68342 3.29289 7.29289Z`,fill:`currentColor`}),(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M17.405 1.40657C18.0246 1.05456 18.7463 0.92634 19.4492 1.04344C20.1521 1.16054 20.7933 1.51583 21.2652 2.0497L21.2697 2.05469L21.2696 2.05471C21.7431 2.5975 22 3.28922 22 4.00203C22 5.08579 21.3952 5.84326 20.7727 6.34289C20.1966 6.80531 19.4941 7.13675 18.9941 7.37261C18.9714 7.38332 18.9491 7.39383 18.9273 7.40415C18.4487 7.63034 18.2814 7.78152 18.1927 7.91844C18.1778 7.94155 18.1625 7.96834 18.1473 8.00003H21C21.5523 8.00003 22 8.44774 22 9.00003C22 9.55231 21.5523 10 21 10H17C16.4477 10 16 9.55231 16 9.00003C16 8.17007 16.1183 7.44255 16.5138 6.83161C16.9107 6.21854 17.4934 5.86971 18.0728 5.59591C18.6281 5.33347 19.1376 5.09075 19.5208 4.78316C19.8838 4.49179 20 4.25026 20 4.00203C20 3.77192 19.9178 3.54865 19.7646 3.37182C19.5968 3.18324 19.3696 3.05774 19.1205 3.01625C18.8705 2.97459 18.6137 3.02017 18.3933 3.14533C18.1762 3.26898 18.0191 3.45826 17.9406 3.67557C17.7531 4.19504 17.18 4.46414 16.6605 4.27662C16.141 4.0891 15.8719 3.51596 16.0594 2.99649C16.303 2.3219 16.7817 1.76125 17.4045 1.40689L17.405 1.40657Z`,fill:`currentColor`})]}));GK.displayName=`SuperscriptIcon`;var KK=(0,_.memo)(({className:e,...t})=>(0,M.jsx)(`svg`,{width:`24`,height:`24`,className:e,viewBox:`0 0 24 24`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,...t,children:(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M7 4C7 3.44772 6.55228 3 6 3C5.44772 3 5 3.44772 5 4V10C5 11.8565 5.7375 13.637 7.05025 14.9497C8.36301 16.2625 10.1435 17 12 17C13.8565 17 15.637 16.2625 16.9497 14.9497C18.2625 13.637 19 11.8565 19 10V4C19 3.44772 18.5523 3 18 3C17.4477 3 17 3.44772 17 4V10C17 11.3261 16.4732 12.5979 15.5355 13.5355C14.5979 14.4732 13.3261 15 12 15C10.6739 15 9.40215 14.4732 8.46447 13.5355C7.52678 12.5979 7 11.3261 7 10V4ZM4 19C3.44772 19 3 19.4477 3 20C3 20.5523 3.44772 21 4 21H20C20.5523 21 21 20.5523 21 20C21 19.4477 20.5523 19 20 19H4Z`,fill:`currentColor`})}));KK.displayName=`UnderlineIcon`;var qK={bold:BK,italic:HK,underline:KK,strike:UK,code:VK,superscript:GK,subscript:WK},JK={bold:`mod+b`,italic:`mod+i`,underline:`mod+u`,strike:`mod+shift+s`,code:`mod+e`,superscript:`mod+.`,subscript:`mod+,`};function YK(e,t){return!e||!e.isEditable||!GR(t,e)||XR(e,[`image`])?!1:e.can().toggleMark(t)}function XK(e,t){return!e||!e.isEditable?!1:e.isActive(t)}function ZK(e,t){return!e||!e.isEditable||!YK(e,t)?!1:e.chain().focus().toggleMark(t).run()}function QK(e){let{editor:t,type:n,hideWhenUnavailable:r}=e;return t?r?!t.isEditable||!GR(n,t)?!1:t.isActive(`code`)?!0:YK(t,n):!0:!1}function $K(e){return e.charAt(0).toUpperCase()+e.slice(1)}function eq(e){let{editor:t,type:n,hideWhenUnavailable:r=!1,onToggled:i}=e,{editor:a}=nW(t),[o,s]=(0,_.useState)(!0),c=YK(a,n),l=XK(a,n);return(0,_.useEffect)(()=>
206{if(!a)return;let e=()=>{s(QK({editor:a,type:n,hideWhenUnavailable:r}))};return e(),a.on(`selectionUpdate`,e),()=>{a.off(`selectionUpdate`,e)}},[a,n,r]),{isVisible:o,isActive:l,handleMark:(0,_.useCallback)(()=>{if(!a)return!1;let e=ZK(a,n);return e&&i?.(),e},[a,n,i]),canToggle:c,label:$K(n),shortcutKeys:JK[n],Icon:qK[n]}}function tq({align:e,shortcutKeys:t=sq[e]}){return(0,M.jsx)(rW,{children:WR({shortcutKeys:t})})}var nq=(0,_.forwardRef)(({editor:e,align:t,text:n,hideWhenUnavailable:r=!1,onAligned:i,showShortcut:a=!1,onClick:o,icon:s,children:c,...l},u)=>{let{editor:d}=nW(e),{isVisible:f,handleTextAlign:p,label:m,canAlign:h,isActive:g,Icon:v,shortcutKeys:y}=hq({editor:d,align:t,hideWhenUnavailable:r,onAligned:i}),b=(0,_.useCallback)(e=>{o?.(e),!e.defaultPrevented&&p()},[p,o]);if(!f)return null;let x=s??v;return(0,M.jsx)($R,{type:`button`,disabled:!h,variant:`ghost`,"data-active-state":g?`on`:`off`,"data-disabled":!h,role:`button`,tabIndex:-1,"aria-label":m,"aria-pressed":g,tooltip:m,onClick:b,...l,ref:u,children:c??(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(x,{className:`tiptap-button-icon`}),n&&(0,M.jsx)(`span`,{className:`tiptap-button-text`,children:n}),a&&(0,M.jsx)(tq,{align:t,shortcutKeys:y})]})})});nq.displayName=`TextAlignButton`;var rq=(0,_.memo)(({className:e,...t})=>(0,M.jsxs)(`svg`,{width:`24`,height:`24`,className:e,viewBox:`0 0 24 24`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,...t,children:[(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M2 6C2 5.44772 2.44772 5 3 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H3C2.44772 7 2 6.55228 2 6Z`,fill:`currentColor`}),(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M6 12C6 11.4477 6.44772 11 7 11H17C17.5523 11 18 11.4477 18 12C18 12.5523 17.5523 13 17 13H7C6.44772 13 6 12.5523 6 12Z`,fill:`currentColor`}),(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M4 18C4 17.4477 4.44772 17 5 17H19C19.5523 17 20 17.4477 20 18C20 18.5523 19.5523 19 19 19H5C4.44772 19 4 18.5523 4 18Z`,fill:`currentColor`})]}));rq.displayName=`AlignCenterIcon`;var iq=(0,_.memo)(({className:e,...t})=>(0,M.jsxs)(`svg`,{width:`24`,height:`24`,className:e,viewBox:`0 0 24 24`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,...t,children:[(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M2 6C2 5.44772 2.44772 5 3 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H3C2.44772 7 2 6.55228 2 6Z`,fill:`currentColor`}),(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M2 12C2 11.4477 2.44772 11 3 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H3C2.44772 13 2 12.5523 2 12Z`,fill:`currentColor`}),(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M2 18C2 17.4477 2.44772 17 3 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H3C2.44772 19 2 18.5523 2 18Z`,fill:`currentColor`})]}));iq.displayName=`AlignJustifyIcon`;var aq=(0,_.memo)(({className:e,...t})=>(0,M.jsxs)(`svg`,{width:`24`,height:`24`,className:e,viewBox:`0 0 24 24`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,...t,children:[(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M2 6C2 5.44772 2.44772 5 3 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H3C2.44772 7 2 6.55228 2 6Z`,fill:`currentColor`}),(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M2 12C2 11.4477 2.44772 11 3 11H15C15.5523 11 16 11.4477 16 12C16 12.5523 15.5523 13 15 13H3C2.44772 13 2 12.5523 2 12Z`,fill:`currentColor`}),(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M2 18C2 17.4477 2.44772 17 3 17H17C17.5523 17 18 17.4477 18 18C18 18.5523 17.5523 19 17 19H3C2.44772 19 2 18.5523 2 18Z`,fill:`currentColor`})]}));aq.displayName=`AlignLeftIcon`;var oq=(0,_.memo)(({className:e,...t})=>(0,M.jsxs)(`svg`,{width:`24`,height:`24`,className:e,viewBox:`0 0 24 24`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,...t,children:[(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M2 6C2 5.44772 2.44772 5 3 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H3C2.44772 7 2 6.55228 2 6Z`,fill:`currentColor`}),(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M8 12C8 11.4477 8.44772 11 9 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H9C8.44772 13 8 12.5523 8 12Z`,fill:`currentColor`}),(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M6 18C6 17.4477 6.44772 17 7 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H7C6.44772 19 6 18.5523 6 18Z`,fill:`currentColor`})]}));oq.displayName=`AlignRightIcon`;var sq={left:`mod+shift+l`,center:`mod+shift+e`,right:`mod+shift+r`,justify:`mod+shift+j`},cq={left:aq,center:rq,right:oq,justify:iq},lq={left:`Align left`,center:`Align center`,right:`Align right`,justify:`Align justify`};function uq(e,t){return!e||!e.isEditable||!JR(e,`textAlign`)||XR(e,[`image`,`horizontalRule`])?!1:e.can().setTextAlign(t)}function dq(e){return`setTextAlign`in e}function fq(e,t){return!e||!e.isEditable?!1:e.isActive({textAlign:t})}function pq(e,t){if(!e||!e.isEditable||!uq(e,t))return!1;let n=e.chain().focus();return dq(n)?n.setTextAlign(t).run():!1}function mq(e){let{editor:t,hideWhenUnavailable:n,align:r}=e;return t?n?!t.isEditable||!JR(t,`textAlign`)?!1:t.isActive(`code`)?!0:uq(t,r):!0:!1}function hq(e){let{editor:t,align:n,hideWhenUnavailable:r=!1,onAligned:i}=e,{editor:a}=nW(t),[o,s]=(0,_.useState)(!0),c=uq(a,n),l=fq(a,n);return(0,_.useEffect)(()=>
206{if(!a)return;let e=()=>{s(mq({editor:a,align:n,hideWhenUnavailable:r}))};return e(),a.on(`selectionUpdate`,e),()=>{a.off(`selectionUpdate`,e)}},[a,r,n]),{isVisible:o,isActive:l,handleTextAlign:(0,_.useCallback)(()=>{if(!a)return!1;let e=pq(a,n);return e&&i?.(),e},[a,n,i]),canAlign:c,label:lq[n],shortcutKeys:sq[n],Icon:cq[n]}}function gq({action:e,shortcutKeys:t=bq[e]}){return(0,M.jsx)(rW,{children:WR({shortcutKeys:t})})}var _q=(0,_.forwardRef)(({editor:e,action:t,text:n,hideWhenUnavailable:r=!1,onExecuted:i,showShortcut:a=!1,onClick:o,children:s,...c},l)=>{let{editor:u}=nW(e),{isVisible:d,handleAction:f,label:p,canExecute:m,Icon:h,shortcutKeys:g}=Eq({editor:u,action:t,hideWhenUnavailable:r,onExecuted:i}),v=(0,_.useCallback)(e=>{o?.(e),!e.defaultPrevented&&f()},[f,o]);return d?(0,M.jsx)($R,{type:`button`,disabled:!m,variant:`ghost`,"data-disabled":!m,role:`button`,tabIndex:-1,"aria-label":p,tooltip:p,onClick:v,...c,ref:l,children:s??(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(h,{className:`tiptap-button-icon`}),n&&(0,M.jsx)(`span`,{className:`tiptap-button-text`,children:n}),a&&(0,M.jsx)(gq,{action:t,shortcutKeys:g})]})}):null});_q.displayName=`UndoRedoButton`;var vq=(0,_.memo)(({className:e,...t})=>(0,M.jsx)(`svg`,{width:`24`,height:`24`,className:e,viewBox:`0 0 24 24`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,...t,children:(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M15.7071 2.29289C15.3166 1.90237 14.6834 1.90237 14.2929 2.29289C13.9024 2.68342 13.9024 3.31658 14.2929 3.70711L17.5858 7H9.5C7.77609 7 6.12279 7.68482 4.90381 8.90381C3.68482 10.1228 3 11.7761 3 13.5C3 14.3536 3.16813 15.1988 3.49478 15.9874C3.82144 16.7761 4.30023 17.4926 4.90381 18.0962C6.12279 19.3152 7.77609 20 9.5 20H13C13.5523 20 14 19.5523 14 19C14 18.4477 13.5523 18 13 18H9.5C8.30653 18 7.16193 17.5259 6.31802 16.682C5.90016 16.2641 5.56869 15.768 5.34254 15.2221C5.1164 14.6761 5 14.0909 5 13.5C5 12.3065 5.47411 11.1619 6.31802 10.318C7.16193 9.47411 8.30653 9 9.5 9H17.5858L14.2929 12.2929C13.9024 12.6834 13.9024 13.3166 14.2929 13.7071C14.6834 14.0976 15.3166 14.0976 15.7071 13.7071L20.7071 8.70711C21.0976 8.31658 21.0976 7.68342 20.7071 7.29289L15.7071 2.29289Z`,fill:`currentColor`})}));vq.displayName=`Redo2Icon`;var yq=(0,_.memo)(({className:e,...t})=>(0,M.jsx)(`svg`,{width:`24`,height:`24`,className:e,viewBox:`0 0 24 24`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,...t,children:(0,M.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M9.70711 3.70711C10.0976 3.31658 10.0976 2.68342 9.70711 2.29289C9.31658 1.90237 8.68342 1.90237 8.29289 2.29289L3.29289 7.29289C2.90237 7.68342 2.90237 8.31658 3.29289 8.70711L8.29289 13.7071C8.68342 14.0976 9.31658 14.0976 9.70711 13.7071C10.0976 13.3166 10.0976 12.6834 9.70711 12.2929L6.41421 9H14.5C15.0909 9 15.6761 9.1164 16.2221 9.34254C16.768 9.56869 17.2641 9.90016 17.682 10.318C18.0998 10.7359 18.4313 11.232 18.6575 11.7779C18.8836 12.3239 19 12.9091 19 13.5C19 14.0909 18.8836 14.6761 18.6575 15.2221C18.4313 15.768 18.0998 16.2641 17.682 16.682C17.2641 17.0998 16.768 17.4313 16.2221 17.6575C15.6761 17.8836 15.0909 18 14.5 18H11C10.4477 18 10 18.4477 10 19C10 19.5523 10.4477 20 11 20H14.5C15.3536 20 16.1988 19.8319 16.9874 19.5052C17.7761 19.1786 18.4926 18.6998 19.0962 18.0962C19.6998 17.4926 20.1786 16.7761 20.5052 15.9874C20.8319 15.1988 21 14.3536 21 13.5C21 12.6464 20.8319 11.8012 20.5052 11.0126C20.1786 10.2239 19.6998 9.50739 19.0962 8.90381C18.4926 8.30022 17.7761 7.82144 16.9874 7.49478C16.1988 7.16813 15.3536 7 14.5 7H6.41421L9.70711 3.70711Z`,fill:`currentColor`})}));yq.displayName=`Undo2Icon`;var bq={undo:`mod+z`,redo:`mod+shift+z`},xq={undo:`Undo`,redo:`Redo`},Sq={undo:yq,redo:vq};function Cq(e,t){return!e||!e.isEditable||XR(e,[`image`])?!1:t===`undo`?e.can().undo():e.can().redo()}function wq(e,t){if(!e||!e.isEditable||!Cq(e,t))return!1;let n=e.chain().focus();return t===`undo`?n.undo().run():n.redo().run()}function Tq(e){let{editor:t,hideWhenUnavailable:n,action:r}=e;return t?n?t.isEditable?t.isActive(`code`)?!0:Cq(t,r):!1:!0:!1}function Eq(e){let{editor:t,action:n,hideWhenUnavailable:r=!1,onExecuted:i}=e,{editor:a}=nW(t),[o,s]=(0,_.useState)(!0),c=Cq(a,n);return(0,_.useEffect)(()=>
206{if(!a)return;let e=()=>{s(Tq({editor:a,hideWhenUnavailable:r,action:n}))};return e(),a.on(`transaction`,e),()=>{a.off(`transaction`,e)}},[a,r,n]),{isVisible:o,handleAction:(0,_.useCallback)(()=>{if(!a)return!1;let e=wq(a,n);return e&&i?.(),e},[a,n,i]),canExecute:c,label:xq[n],shortcutKeys:bq[n],Icon:Sq[n]}}function Dq({isMobile:e,onHighlighterClick:t,onLinkClick:n}){return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(HU,{}),(0,M.jsxs)(YU,{children:[(0,M.jsx)(_q,{action:`undo`}),(0,M.jsx)(_q,{action:`redo`})]}),(0,M.jsx)(XU,{}),(0,M.jsxs)(YU,{children:[(0,M.jsx)(TW,{modal:!e,levels:[1,2,3,4]}),(0,M.jsx)(YW,{modal:!e,types:[`bulletList`,`orderedList`,`taskList`]}),(0,M.jsx)(ZW,{}),(0,M.jsx)(aG,{})]}),(0,M.jsx)(XU,{}),(0,M.jsxs)(YU,{children:[(0,M.jsx)(zK,{type:`bold`}),(0,M.jsx)(zK,{type:`italic`}),(0,M.jsx)(zK,{type:`strike`}),(0,M.jsx)(zK,{type:`code`}),(0,M.jsx)(zK,{type:`underline`}),e?(0,M.jsx)(fK,{onClick:t}):(0,M.jsx)(mK,{}),e?(0,M.jsx)(OK,{onClick:n}):(0,M.jsx)(jK,{})]}),(0,M.jsx)(XU,{}),(0,M.jsxs)(YU,{children:[(0,M.jsx)(zK,{type:`superscript`}),(0,M.jsx)(zK,{type:`subscript`})]}),(0,M.jsx)(XU,{}),(0,M.jsxs)(YU,{children:[(0,M.jsx)(nq,{align:`left`}),(0,M.jsx)(nq,{align:`center`}),(0,M.jsx)(nq,{align:`right`}),(0,M.jsx)(nq,{align:`justify`})]}),(0,M.jsx)(XU,{}),(0,M.jsx)(YU,{children:(0,M.jsx)(gK,{text:`Add`})}),(0,M.jsx)(HU,{})]})}function Oq({type:e,onBack:t}){return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(YU,{children:(0,M.jsxs)($R,{"data-style":`ghost`,onClick:t,children:[(0,M.jsx)(ZU,{className:`tiptap-button-icon`}),e===`highlighter`?(0,M.jsx)(QU,{className:`tiptap-button-icon`}):(0,M.jsx)($U,{className:`tiptap-button-icon`})]})}),(0,M.jsx)(XU,{}),e===`highlighter`?(0,M.jsx)(pK,{}):(0,M.jsx)(AK,{})]})}function kq(e){let t=zoe(B.notes.prosemirrorSync,e.noteId);return t.isLoading?(0,M.jsx)(`p`,{className:`text-muted-foreground`,children:`Loading...`}):t.initialContent===null?(0,M.jsxs)(`div`,{className:`flex flex-col gap-2 px-4 py-8`,children:[(0,M.jsx)(z,{onClick:()=>void t.create({type:`doc`,content:[]}),children:`Initialise document`}),(0,M.jsx)(z,{variant:`ghost`,onClick:e.onBack,children:`Back`})]}):(0,M.jsx)(Aq,{noteId:e.noteId,initialTitle:e.initialTitle,filedIn:e.filedIn,onBack:e.onBack,syncExtension:t.extension,initialContent:t.initialContent})}function Aq({noteId:e,initialTitle:t,filedIn:n,onBack:r,syncExtension:i,initialContent:a}){let o=Ii(B.notes.mutations.setArchived),s=$oe({noteId:e,initialTitle:t}),[c,l]=(0,_.useState)(t),[u,d]=(0,_.useState)(`main`),[f,p]=(0,_.useState)(null),[m,h]=(0,_.useState)(0),g=nC(),{height:v}=xL();(0,_.useEffect)(()=>{if(!f)return;let e=()=>h(f.getBoundingClientRect().height);e();let t=new ResizeObserver(e);return t.observe(f),()=>t.disconnect()},[f]);let y=Soe({immediatelyRender:!1,shouldRerenderOnTransaction:!1,editorProps:{attributes:{autocomplete:`off`,autocorrect:`off`,autocapitalize:`off`,"aria-label":`Note body`,class:`simple-editor`}},extensions:i===null?VU:[...VU,i],content:a}),b=Zoe({editor:y,overlayHeight:m}),x=g?u:`main`,S=async()=>{await s.flush(),r()},C=async()=>{await s.flush(),await o({id:e,archived:!0}),r()};return y?(0,M.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,M.jsxs)(`header`,{className:`note-editor-chrome shrink-0 border-b border-border px-4 py-3`,children:[(0,M.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[648px] items-center gap-2`,children:[(0,M.jsxs)(z,{variant:`ghost`,size:`sm`,onClick:()=>void S(),"aria-label":`Back to list`,children:[(0,M.jsx)(ZU,{className:`size-4`}),` Back`]}),(0,M.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,M.jsx)(Woe,{noteId:e,filedIn:n}),(0,M.jsxs)(z,{variant:`ghost`,size:`sm`,onClick:()=>void C(),"aria-label":`Archive note`,children:[(0,M.jsx)(px,{className:`size-4`}),` Archive`]})]})]}),(0,M.jsx)(iC,{value:c,onChange:e=>{let t=e.target.value;l(t),s.setTitle(t)},placeholder:`Title`,className:`mx-auto mt-3 max-w-[648px] border-none bg-transparent px-0 text-lg font-medium shadow-none focus-visible:ring-0`})]}
206),(0,M.jsx)(jq,{editor:y,toolbarRef:p,isMobile:g,viewportHeight:v,bodyRectY:b.y,mobileToolbarView:x,onHighlighterClick:()=>d(`highlighter`),onLinkClick:()=>d(`link`),onMobileToolbarBack:()=>d(`main`)})]}):(0,M.jsx)(`p`,{className:`text-muted-foreground`,children:`Loading...`})}function jq({editor:e,toolbarRef:t,isMobile:n,viewportHeight:r,bodyRectY:i,mobileToolbarView:a,onHighlighterClick:o,onLinkClick:s,onMobileToolbarBack:c}){return(0,M.jsx)(`div`,{className:`simple-editor-wrapper min-h-0 flex-1`,"data-testid":`note-editor-surface`,children:(0,M.jsxs)(sL.Provider,{value:{editor:e},children:[(0,M.jsx)(JU,{ref:t,style:n&&r>0?{bottom:`calc(100% - ${r-i}px)`}:void 0,children:a===`main`?(0,M.jsx)(Dq,{isMobile:n,onHighlighterClick:o,onLinkClick:s}):(0,M.jsx)(Oq,{type:a===`highlighter`?`highlighter`:`link`,onBack:c})}),(0,M.jsx)(rL,{editor:e,role:`presentation`,className:`simple-editor-content`})]})})}function Mq({children:e}){return(0,M.jsx)(`div`,{className:`note-editor-page flex h-[calc(100dvh-3rem)] min-h-0 flex-col`,children:e})}function Nq(e){return e.trim().slice(0,240)}function Pq(e){return{kind:`pending-upload`,key:e.localId,preview:Nq(e.body),createdAt:e.createdAt,syncStatus:e.syncStatus,lastSyncError:e.lastSyncError}}function Fq(e){return{kind:`inbox-note`,key:e._id,noteId:e._id,title:e.title,preview:e.preview,updatedAt:e.updatedAt}}function Iq(e){return{kind:`inbox-task`,key:e._id,taskId:e._id,title:e.title,context:e.context,updatedAt:e.updatedAt}}function Lq(e){let t=e.pendingCaptures.map(Pq);return e.presentation===`pending-only`?{pendingUploads:t,inboxTasks:[],inboxNotes:[],isTasksLoading:!1,isNotesLoading:!1}:{pendingUploads:t,inboxTasks:(e.inboxTasks??[]).map(Iq),inboxNotes:(e.inboxNotes??[]).map(Fq),isTasksLoading:e.inboxTasks===void 0,isNotesLoading:e.inboxNotes===void 0}}function Rq(){let{pendingCaptures:e}=Dw(),t=Ow(),n=t.inbox.presentation===`live-inbox`,r=Fi(B.notes.queries.listInbox,n?{}:`skip`),i=Fi(B.tasks.queries.listInbox,n?{}:`skip`);return(0,_.useMemo)(()=>Lq({presentation:t.inbox.presentation,pendingCaptures:e,inboxNotes:r,inboxTasks:i}),[t.inbox.presentation,e,r,i])}function zq(){return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Xi,{children:(0,M.jsx)(Bq,{})}),(0,M.jsx)(Zi,{children:(0,M.jsx)(`main`,{className:`container mx-auto flex flex-col gap-6 px-4 py-8 max-w-3xl`,children:(0,M.jsx)(zw,{})})})]})}function Bq(){let e=Rq(),t=Ow(),n=qC(),r=Ii(B.tasks.mutations.complete);return n===null?(0,M.jsx)(lne,{feed:e,title:`Inbox`,description:`Anything you capture lands here first. Process when you're ready.`,pendingDescription:t.inbox.presentation===`pending-only`?`Captured offline â these upload automatically when you're back online.`:`Waiting to sync to your inbox.`,emptyHint:`Your inbox is empty. Capture a brain dump to get started.`,pendingEmptyHint:`Nothing waiting to upload. Capture a brain dump while offline.`,onSelectNote:e=>WC(`/inbox`,e),onSelectTask:()=>WC(`/tasks`),onCompleteTask:e=>void r({id:e})}):(0,M.jsx)(Vq,{noteId:n})}function Vq({noteId:e}){let t=Fi(B.notes.queries.get,{id:e});return t===void 0?(0,M.jsxs)(`main`,{className:`container mx-auto flex flex-col gap-4 px-4 py-8 max-w-3xl`,children:[(0,M.jsx)(pC,{className:`h-10 w-full`}),(0,M.jsx)(pC,{className:`h-64 w-full`})]}):(0,M.jsx)(Mq,{children:(0,M.jsx)(kq,{noteId:e,initialTitle:t.title,filedIn:t.filedIn,onBack:()=>WC(`/inbox`)},e)})}function Hq({title:e,description:t}){return(0,M.jsxs)(`main`,{className:`container mx-auto flex flex-col items-center gap-4 px-4 py-16 max-w-lg text-center`,children:[(0,M.jsx)(Nx,{className:`size-10 text-muted-foreground`}),(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(`h1`,{className:`text-xl font-semibold`,children:e}),(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t})]}),(0,M.jsx)(z,{onClick:()=>WC(`/capture`),children:`Go to capture`})]})}function Uq({title:e,description:t,emptyHint:n,notesQuery:r,onSelect:i}){let[a,o]=(0,_.useState)(``),s=a.trim()!==``,c=Fi(r,s?`skip`:{}),l=Fi(B.notes.queries.search,s?{query:a.trim()}:`skip`),u=s?l:c;return(0,M.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:e}),(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t})]}),(0,M.jsx)(iC,{type:`search`,"aria-label":`Search notes`,placeholder:`Search notesâ¦`,value:a,onChange:e=>o(e.target.value)}),u===void 0?(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(pC,{className:`h-16 w-full`}),(0,M.jsx)(pC,{className:`h-16 w-full`}),(0,M.jsx)(pC,{className:`h-16 w-full`})]}):u.length===0?(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:s?`No notes match your search.`:n}):(0,M.jsx)(`ul`,{className:`flex flex-col gap-2`,children:u.map(e=>(0,M.jsx)(`li`,{children:(0,M.jsxs)(`button`,{type:`button`,onClick:()=>
206i(e._id),className:`w-full rounded-md border border-border bg-card px-4 py-3 text-left transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,M.jsx)(`div`,{className:`font-medium`,children:e.title||`Untitled`}),(0,M.jsx)(`div`,{className:`mt-1 line-clamp-2 text-sm text-muted-foreground whitespace-pre-wrap`,children:e.preview||`(empty)`})]})},e._id))})]})}function Wq(e){return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Xi,{children:(0,M.jsx)(Gq,{...e})}),(0,M.jsx)(Zi,{children:(0,M.jsx)(`main`,{className:`container mx-auto flex flex-col gap-6 px-4 py-8 max-w-3xl`,children:(0,M.jsx)(zw,{})})})]})}function Gq({collection:e,title:t,description:n,emptyHint:r,notesQuery:i}){let a=qC();return a===null?(0,M.jsx)(`main`,{className:`container mx-auto flex flex-col gap-6 px-4 py-8 max-w-3xl`,children:(0,M.jsx)(Uq,{title:t,description:n,emptyHint:r,notesQuery:i,onSelect:t=>WC(e,t)})}):(0,M.jsx)(Mq,{children:(0,M.jsx)(Kq,{id:a,onBack:()=>WC(e)})})}function Kq({id:e,onBack:t}){let n=Fi(B.notes.queries.get,{id:e});return n===void 0?(0,M.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,M.jsx)(pC,{className:`h-10 w-full`}),(0,M.jsx)(pC,{className:`h-64 w-full`})]}):(0,M.jsx)(kq,{noteId:e,initialTitle:n.title,filedIn:n.filedIn,onBack:t},e)}function qq(){let e=Ow();return!e.canViewLiveNotes&&e.routeAccess===`redirect`?(0,M.jsx)(Hq,{title:`Notes unavailable offline`,description:`Live notes need a connection. You can still capture brain dumps offline â they'll upload when you're back online.`}):(0,M.jsx)(Wq,{collection:`/notes`,title:`All notes`,description:`Every note you've kept, newest first. A fallback / audit surface.`,emptyHint:`No notes yet. Capture something from the Inbox.`,notesQuery:B.notes.queries.listAll})}function Jq({className:e,...t}){return(0,M.jsx)(Ko,{"data-slot":`accordion`,className:L(`flex w-full flex-col`,e),...t})}function Yq({className:e,...t}){return(0,M.jsx)(qo,{"data-slot":`accordion-item`,className:L(`not-last:border-b`,e),...t})}function Xq({className:e,children:t,...n}){return(0,M.jsx)(Jo,{className:`flex`,children:(0,M.jsxs)(Yo,{"data-slot":`accordion-trigger`,className:L(`group/accordion-trigger relative flex flex-1 items-start justify-between rounded-lg border border-transparent py-2.5 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:after:border-ring disabled:pointer-events-none disabled:opacity-50 **:data-[slot=accordion-trigger-icon]:ml-auto **:data-[slot=accordion-trigger-icon]:size-4 **:data-[slot=accordion-trigger-icon]:text-muted-foreground`,e),...n,children:[t,(0,M.jsx)(wx,{"data-slot":`accordion-trigger-icon`,className:`pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden`}),(0,M.jsx)(Ex,{"data-slot":`accordion-trigger-icon`,className:`pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline`})]})})}function Zq({className:e,children:t,...n}){return(0,M.jsx)(Xo,{"data-slot":`accordion-content`,className:`overflow-hidden text-sm data-open:animate-accordion-down data-closed:animate-accordion-up`,...n,children:(0,M.jsx)(`div`,{className:L(`h-(--radix-accordion-content-height) pt-0 pb-2.5 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4`,e),children:t})})}var Qq=eC(`group/alert relative grid w-full gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-card text-card-foreground`,destructive:`bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current`}},defaultVariants:{variant:`default`}});function $q({className:e,variant:t,...n}){return(0,M.jsx)(`div`,{"data-slot":`alert`,role:`alert`,className:L(Qq({variant:t}),e),...n})}function eJ({className:e,...t}){return(0,M.jsx)(`div`,{"data-slot":`alert-title`,className:L(`font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground`,e),...t})}function tJ({className:e,...t}){return(0,M.jsx)(`div`,{"data-slot":`alert-description`,className:L(`text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4`,e),...t})}function nJ({className:e,...t}){return(0,M.jsx)(`div`,{"data-slot":`alert-action`,className:L(`absolute top-2 right-2`,e),...t})}function rJ({className:e,size:t=`default`,...n}){return(0,M.jsx)(ru,{"data-slot":`avatar`,"data-size":t,className:L(`group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten`,e),...n})}function iJ({className:e,...t}){return(0,M.jsx)(iu,{"data-slot":`avatar-image`,className:L(`aspect-square size-full rounded-full object-cover`,e),...t})}function aJ({className:e,...t}){return(0,M.jsx)(au,{"data-slot":`avatar-fallback`,className:L(`flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs`,e),...t})}var oJ=eC(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}});function sJ({className:e,variant:t=`default`,asChild:n=!1,...r}){return(0,M.jsx)(n?wa:`span`,{"data-slot":`badge`,"data-variant":t,className:L(oJ({variant:t}),e),...r})}function cJ({className:e,...t}){return(0,M.jsx)(gu,{"data-slot":`checkbox`,className:L(`peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary`,e),...t,children:(0,M.jsx)(vu,{"data-slot":`checkbox-indicator`,className:`grid place-content-center text-current transition-none [&>svg]:size-3.5`,children:(0,M.jsx)(Cx,{})})})}function lJ({className:e,...t}){return(0,M.jsx)(vee,{"data-slot":`label`,className:L(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function uJ({className:e,value:t,...n}){return(0,M.jsx)(Sg,{"data-slot":`progress`,className:L(`relative flex h-1 w-full items-center overflow-x-hidden rounded-full bg-muted`,e),...n,children:(0,M.jsx)(Cg,{"data-slot":`progress-indicator`,className:`size-full flex-1 bg-primary transition-all`,style:{transform:`translateX(-${100-(t||0)}%)`}})})}function dJ({...e}){return(0,M.jsx)(M_,{"data-slot":`select`,...e})}function fJ({...e}){return(0,M.jsx)(Lee,{"data-slot":`select-value`,...e})}function pJ({className:e,size:t=`default`,children:n,...r}){return(0,M.jsxs)(N_,{"data-slot":`select-trigger`,"data-size":t,className:L(`flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,M.jsx)(Ree,{asChild:!0,children:(0,M.jsx)(wx,{className:`pointer-events-none size-4 text-muted-foreground`})})]})}function mJ({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...i}){return(0,M.jsx)(zee,{children:(0,M.jsxs)(Bee,{"data-slot":`select-content`,"data-align-trigger":n===`item-aligned`,className:L(`relative z-50 max-h-(--radix-select-content-available-height) min-w-36 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground
206/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...i,children:[(0,M.jsx)(gJ,{}),(0,M.jsx)(Vee,{"data-position":n,className:L(`data-[position=popper]:h-(--radix-select-trigger-height) data-[position=popper]:w-full data-[position=popper]:min-w-(--radix-select-trigger-width)`,n===`popper`&&``),children:t}),(0,M.jsx)(_J,{})]})})}function hJ({className:e,children:t,...n}){return(0,M.jsxs)(Hee,{"data-slot":`select-item`,className:L(`relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,M.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`,children:(0,M.jsx)(Wee,{children:(0,M.jsx)(Cx,{className:`pointer-events-none`})})}),(0,M.jsx)(Uee,{children:t})]})}function gJ({className:e,...t}){return(0,M.jsx)(Gee,{"data-slot":`select-scroll-up-button`,className:L(`z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,M.jsx)(Ex,{})})}function _J({className:e,...t}){return(0,M.jsx)(Kee,{"data-slot":`select-scroll-down-button`,className:L(`z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,M.jsx)(wx,{})})}function vJ({className:e,defaultValue:t,value:n,min:r=0,max:i=100,...a}){let o=_.useMemo(()=>Array.isArray(n)?n:Array.isArray(t)?t:[r,i],[n,t,r,i]);return(0,M.jsxs)(gv,{"data-slot":`slider`,defaultValue:t,value:n,min:r,max:i,className:L(`relative flex w-full touch-none items-center select-none data-disabled:opacity-50 data-vertical:h-full data-vertical:min-h-40 data-vertical:w-auto data-vertical:flex-col`,e),...a,children:[(0,M.jsx)(_v,{"data-slot":`slider-track`,className:`relative grow overflow-hidden rounded-full bg-muted data-horizontal:h-1 data-horizontal:w-full data-vertical:h-full data-vertical:w-1`,children:(0,M.jsx)(vv,{"data-slot":`slider-range`,className:`absolute bg-primary select-none data-horizontal:h-full data-vertical:w-full`})}),Array.from({length:o.length},(e,t)=>(0,M.jsx)(yv,{"data-slot":`slider-thumb`,className:`relative block size-3 shrink-0 rounded-full border border-ring bg-white ring-ring/50 transition-[color,box-shadow] select-none after:absolute after:-inset-2 hover:ring-3 focus-visible:ring-3 focus-visible:outline-hidden active:ring-3 disabled:pointer-events-none disabled:opacity-50`},t))]})}function yJ({className:e,size:t=`default`,...n}){return(0,M.jsx)(Av,{"data-slot":`switch`,"data-size":t,className:L(`peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50`,e),...n,children:(0,M.jsx)(jv,{"data-slot":`switch-thumb`,className:`pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dar
206k:data-unchecked:bg-foreground`})})}function bJ({className:e,...t}){return(0,M.jsx)(`div`,{"data-slot":`table-container`,className:`relative w-full overflow-x-auto`,children:(0,M.jsx)(`table`,{"data-slot":`table`,className:L(`w-full caption-bottom text-sm`,e),...t})})}function xJ({className:e,...t}){return(0,M.jsx)(`thead`,{"data-slot":`table-header`,className:L(`[&_tr]:border-b`,e),...t})}function SJ({className:e,...t}){return(0,M.jsx)(`tbody`,{"data-slot":`table-body`,className:L(`[&_tr:last-child]:border-0`,e),...t})}function CJ({className:e,...t}){return(0,M.jsx)(`tr`,{"data-slot":`table-row`,className:L(`border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted`,e),...t})}function wJ({className:e,...t}){return(0,M.jsx)(`th`,{"data-slot":`table-head`,className:L(`h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0`,e),...t})}function TJ({className:e,...t}){return(0,M.jsx)(`td`,{"data-slot":`table-cell`,className:L(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0`,e),...t})}function EJ({className:e,...t}){return(0,M.jsx)(`caption`,{"data-slot":`table-caption`,className:L(`mt-4 text-sm text-muted-foreground`,e),...t})}function DJ({className:e,orientation:t=`horizontal`,...n}){return(0,M.jsx)(Kv,{"data-slot":`tabs`,"data-orientation":t,className:L(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var OJ=eC(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function kJ({className:e,variant:t=`default`,...n}){return(0,M.jsx)(qv,{"data-slot":`tabs-list`,"data-variant":t,className:L(OJ({variant:t}),e),...n})}function AJ({className:e,...t}){return(0,M.jsx)(Jv,{"data-slot":`tabs-trigger`,className:L(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function jJ({className:e,...t}){return(0,M.jsx)(Yv,{"data-slot":`tabs-content`,className:L(`flex-1 text-sm outline-none`,e),...t})}function MJ(){return(0,M.jsxs)(`main`,{className:`container mx-auto flex flex-col gap-12 px-4 py-12`,children:[(0,M.jsxs)(`header`,{className:`flex flex-col gap-2`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(_S,{className:`size-5 text-muted-foreground`}),(0,M.jsx)(sJ,{variant:`secondary`,children:`shadcn/ui`})]}),(0,M.jsx)(`h1`,{className:`text-3xl font-bold tracking-tight md:text-4xl`,children:`UI Playground`}),(0,M.jsx)(`p`,{className:`max-w-2xl text-muted-foreground`,children:`A live tour of every shadcn component installed in this project. Use the tabs below to jump between categories.`})]}),(0,M.jsxs)(DJ,{defaultValue:`buttons`,className:`flex flex-col gap-6`,children:[(0,M.jsxs)(kJ,{children:[(0,M.jsx)(AJ,{value:`buttons`,children:`Buttons & Badges`}),(0,M.jsx)(AJ,{value:`forms`,children:`Forms`}),(0,M.jsx)(AJ,{value:`overlays`,children:`Overlays`}),(0,M.jsx)(AJ,{value:`data`,children:`Data`}),(0,M.jsx)(AJ,{value:`feedback`,children:`Feedback`})]}),(0,M.jsxs)(jJ,{value:`buttons`,className:`flex flex-col gap-6`,children:[(0,M.jsx)(PJ,{}),(0,M.jsx)(FJ,{})]}),(0,M.jsx)(jJ,{value:`forms`,className:`flex flex-col gap-6`,children:(0,M.jsx)(IJ,{})}),(0,M.jsx)(jJ,{value:`overlays`,className:`flex flex-col gap-6`,children:(0,M.jsx)(LJ,{})}),(0,M.jsxs)(jJ,{value:`data`,className:`flex flex-col gap-6`,children:[(0,M.jsx)(RJ,{}),(0,M.jsx)(zJ,{})]}),(0,M.jsx)(jJ,{value:`feedback`,className:`flex flex-col gap-6`,children:(0,M.jsx)(BJ,{})})]})]})}function NJ({title:e,description:t,children:n}){return(0,M.jsxs)(Nw,{children:[(0,M.jsxs)(Pw,{children:[(0,M.jsx)(Fw,{children:e}),t?(0,M.jsx)(Iw,{children:t}):null]}),(0,M.jsx)(Lw,{children:n})]})}function PJ(){return(0,M.jsx)(NJ,{title:`Buttons`,description:`Every variant and size, including icon and asChild patterns.`,children:(0,M.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,M.jsx)(z,{children:`Default`}),(0,M.jsx)(z,{variant:`secondary`,children:`Secondary`}),(0,M.jsx)(z,{variant:`outline`,children:`Outline`}),(0,M.jsx)(z,{variant:`ghost`,children:`Ghost`}),(0,M.jsx)(z,{variant:`destructive`,children:`Destructive`}),(0,M.jsx)(z,{variant:`link`,children:`Link`})]}),(0,M.jsx)(aC,{}),(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,M.jsx)(z,{size:`xs`,children:`Extra small`}),(0,M.jsx)(z,{size:`sm`,children:`Small`}),(0,M.jsx)(z,{children:`Default`}),(0,M.jsx)(z,{size:`lg`,children:`Large`}),(0,M.jsx)(z,{size:`icon`,"aria-label":`Settings`,children:(0,M.jsx)(OS,{})}),(0,M.jsx)(z,{size:`icon-sm`,variant:`outline`,"aria-label":`Copy`,children:(0,M.jsx)(Lx,{})})]}),(0,M.jsx)(aC,{}),(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,M.jsx)(z,{disabled:!0,children:`Disabled`}),(0,M.jsxs)(z,{children:[(0,M.jsx)(cS,{}),` With icon`]}),(0,M.jsxs)(z,{variant:`outline`,children:[`Open menu `,(0,M.jsx)(wx,{})]})]})]})})}function FJ(){return(0,M.jsx)(NJ,{title:`Badges & Avatars`,children:(0,M.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,M.jsx)(sJ,{children:`Default`}),(0,M.jsx)(sJ,{variant:`secondary`,children:`Secondary`}),(0,M.jsx)(sJ,{variant:`outline`,children:`Outline`}),(0,M.jsx)(sJ,{variant:`destructive`,children:`Destructive`}),(0,M.jsx)(sJ,{variant:`ghost`,children:`Ghost`}),(0,M.jsxs)(sJ,{children:[(0,M.jsx)(Ox,{}),` With icon`]})]}),(0,M.jsx)(aC,{}),(0,M.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,M.jsxs)(rJ,{children:[(0,M.jsx)(iJ,{src:`https://github.com/shadcn.png`,alt:`@shadcn`}),(0,M.jsx)(aJ,{children:`SC`})]}),(0,M.jsx)(rJ,{children:(0,M.jsx)(aJ,{children:`MR`})}),(0,M.jsxs)(rJ,{className:`size-12`,children:[(0,M.jsx)(iJ,{src:`https://github.com/vercel.png`,alt:`@vercel`}),(0,M.jsx)(aJ,{children:`VC`})]})]})]})})}function IJ(){let[e,t]=(0,_.useState)([50]),[n,r]=(0,_.useState)(!0),[i,a]=(0,_.useState)(!1);return(0,M.jsx)(NJ,{title:`Form controls`,description:`Inputs, selects, switches, sliders, and checkboxes.`,children:(0,M.jsxs)(`form`,{className:`grid gap-6 md:grid-cols-2`,onSubmit:e=>{e.preventDefault(),Hb.success(`Form submitted`,{description:`This is a demo â nothing was sent anywhere.`})},children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(lJ,{htmlFor:`name`,children:`N
206ame`}),(0,M.jsx)(iC,{id:`name`,placeholder:`Ada Lovelace`})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(lJ,{htmlFor:`email`,children:`Email`}),(0,M.jsx)(iC,{id:`email`,type:`email`,placeholder:`[email protected]`})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2 md:col-span-2`,children:[(0,M.jsx)(lJ,{htmlFor:`bio`,children:`Bio`}),(0,M.jsx)(Bw,{id:`bio`,placeholder:`Tell us about yourself...`,rows:4})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(lJ,{htmlFor:`role`,children:`Role`}),(0,M.jsxs)(dJ,{children:[(0,M.jsx)(pJ,{id:`role`,children:(0,M.jsx)(fJ,{placeholder:`Pick a role`})}),(0,M.jsxs)(mJ,{children:[(0,M.jsx)(hJ,{value:`engineer`,children:`Engineer`}),(0,M.jsx)(hJ,{value:`designer`,children:`Designer`}),(0,M.jsx)(hJ,{value:`pm`,children:`Product manager`}),(0,M.jsx)(hJ,{value:`other`,children:`Other`})]})]})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,M.jsxs)(lJ,{htmlFor:`volume`,children:[`Volume â `,e[0]]}),(0,M.jsx)(vJ,{id:`volume`,value:e,onValueChange:t,max:100,step:1})]}),(0,M.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border p-3`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,M.jsx)(lJ,{htmlFor:`notif`,children:`Push notifications`}),(0,M.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Receive updates about your account.`})]}),(0,M.jsx)(yJ,{id:`notif`,checked:n,onCheckedChange:r})]}),(0,M.jsxs)(`label`,{className:`flex items-center gap-2 rounded-lg border p-3`,children:[(0,M.jsx)(cJ,{checked:i,onCheckedChange:a,id:`terms`}),(0,M.jsx)(`span`,{className:`text-sm`,children:`I agree to the terms and conditions.`})]}),(0,M.jsxs)(`div`,{className:`flex items-center justify-end gap-2 md:col-span-2`,children:[(0,M.jsx)(z,{type:`reset`,variant:`outline`,children:`Reset`}),(0,M.jsx)(z,{type:`submit`,disabled:i!==!0,children:`Submit`})]})]})})}function LJ(){return(0,M.jsx)(NJ,{title:`Overlays`,description:`Dialogs, dropdowns, and tooltips.`,children:(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,M.jsxs)(lw,{children:[(0,M.jsx)(uw,{asChild:!0,children:(0,M.jsx)(z,{children:`Open dialog`})}),(0,M.jsxs)(mw,{children:[(0,M.jsxs)(hw,{children:[(0,M.jsx)(_w,{children:`Are you absolutely sure?`}),(0,M.jsx)(vw,{children:`This action cannot be undone. This will permanently delete the example data.`})]}),(0,M.jsxs)(gw,{children:[(0,M.jsx)(fw,{asChild:!0,children:(0,M.jsx)(z,{variant:`outline`,children:`Cancel`})}),(0,M.jsx)(fw,{asChild:!0,children:(0,M.jsxs)(z,{variant:`destructive`,children:[(0,M.jsx)(IS,{}),` Delete`]})})]})]})]}),(0,M.jsxs)(HS,{children:[(0,M.jsx)(US,{asChild:!0,children:(0,M.jsxs)(z,{variant:`outline`,children:[`Account `,(0,M.jsx)(wx,{})]})}),(0,M.jsxs)(WS,{align:`start`,children:[(0,M.jsx)(qS,{children:`My account`}),(0,M.jsx)(JS,{}),(0,M.jsxs)(KS,{children:[(0,M.jsx)(RS,{}),` Profile`]}),(0,M.jsxs)(KS,{children:[(0,M.jsx)(OS,{}),` Settings`]}),(0,M.jsxs)(KS,{children:[(0,M.jsx)(vx,{}),` Notifications`]}),(0,M.jsx)(JS,{}),(0,M.jsxs)(KS,{variant:`destructive`,children:[(0,M.jsx)(IS,{}),` Delete account`]})]})]}),(0,M.jsxs)(Tb,{children:[(0,M.jsx)(Eb,{asChild:!0,children:(0,M.jsx)(z,{variant:`outline`,size:`icon`,"aria-label":`Info`,children:(0,M.jsx)(Zx,{})})}),(0,M.jsx)(Db,{children:`This is a tooltip.`})]})]})})}function RJ(){let e=[{id:`INV-001`,status:`Paid`,method:`Credit card`,total:`$250.00`},{id:`INV-002`,status:`Pending`,method:`PayPal`,total:`$150.00`},{id:`INV-003`,status:`Unpaid`,method:`Bank transfer`,total:`$350.00`},{id:`INV-004`,status:`Paid`,method:`Credit card`,total:`$450.00`}],t={Paid:`default`,Pending:`secondary`,Unpaid:`destructive`};return(0,M.jsx)(NJ,{title:`Table`,children:(0,M.jsxs)(bJ,{children:[(0,M.jsx)(EJ,{children:`A list of recent invoices.`}),(0,M.jsx)(xJ,{children:(0,M.jsxs)(CJ,{children:[(0,M.jsx)(wJ,{children:`Invoice`}),(0,M.jsx)(wJ,{children:`Status`}),(0,M.jsx)(wJ,{children:`Method`}),(0,M.jsx)(wJ,{className:`text-right`,children:`Amount`})]})}),(0,M.jsx)(SJ,{children:e.map(e=>(0,M.jsxs)(CJ,{children:[(0,M.jsx)(TJ,{className:`font-medium`,children:e.id}),(0,M.jsx)(TJ,{children:(0,M.jsx)(sJ,{variant:t[e.status]??`outline`,children:e.status})}),(0,M.jsx)(TJ,{children:e.method}),(0,M.jsx)(TJ,{className:`text-right`,children:e.total})]},e.id))})]})})}function zJ(){return(0,M.jsx)(NJ,{title:`Accordion`,children:(0,M.jsxs)(Jq,{type:`single`,collapsible:!0,className:`w-full`,children:[(0,M.jsxs)(Yq,{value:`item-1`,children:[(0,M.jsx)(Xq,{children:`Is it accessible?`}),(0,M.jsx)(Zq,{children:`Yes. It adheres to the WAI-ARIA design pattern.`})]}),(0,M.jsxs)(Yq,{value:`item-2`,children:[(0,M.jsx)(Xq,{children:`Is it styled?`}),(0,M.jsx)(Zq,{children:`Yes. It comes with default styles you can override with Tailwind utilities.`})]}),(0,M.jsxs)(Yq,{value:`item-3`,children:[(0,M.jsx)(Xq,{children:`Is it animated?`}),(0,M.jsx)(Zq,{children:`Yes. It uses CSS keyframes for smooth open/close transitions.`})]})]})})}function BJ(){return(0,M.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,M.jsx)(NJ,{title:`Alerts`,children:(0,M.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,M.jsxs)($q,{children:[(0,M.jsx)(Zx,{}),(0,M.jsx)(eJ,{children:`Heads up!`}),(0,M.jsx)(tJ,{children:`This is a default alert â nothing to worry about.`})]}),(0,M.jsxs)($q,{variant:`destructive`,children:[(0,M.jsx)(Dx,{}),(0,M.jsx)(eJ,{children:`Something went wrong`}),(0,M.jsx)(tJ,{children:`Your session expired. Please sign in again.`}),(0,M.jsx)(nJ,{children:(0,M.jsx)(z,{size:`sm`,variant:`outline`,children:`Retry`})})]})]})}),(0,M.jsx)(NJ,{title:`Progress & Skeleton`,children:(0,M.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(lJ,{children:`Progress â 60%`}),(0,M.jsx)(uJ,{value:60})]}),(0,M.jsx)(aC,{}),(0,M.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,M.jsx)(pC,{className:`size-10 rounded-full`}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(pC,{className:`h-3 w-40`}),(0,M.jsx)(pC,{className:`h-3 w-24`})]})]})]})}),(0,M.jsx)(NJ,{title:`Toasts (Sonner)`,description:`Click a button to fire a toast.`,children:(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,M.jsx)(z,{onClick:()=>Hb(`Event has been created.`),children:`Default toast`}),(0,M.jsx)(z,{variant:`secondary`,onClick:()=>Hb.success(`Saved!`,{description:`Your changes are live.`}),children:`Success`}),(0,M.jsx)(z,{variant:`outline`,onClick:()=>Hb.info(`FYI â this is informational.`),children:`Info`}),(0,M.jsx)(z,{variant:`destructive`,onClick:()=>Hb.error(`Could not save`,{description:`Try again in a moment.`}),children:`Error`})]})})]})}var VJ=365.2425,HJ=6048e5,UJ=864e5,WJ=43200,GJ=1440,KJ=3600*24;KJ*7,KJ*VJ/12*3;var qJ=Symbol.for(`constructDateFrom`);function JJ(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&qJ in e?e[qJ](t):e instanceof Date?new e.constructor(t):new Date(t)}function YJ(e,t){return JJ(t||e,e)}var XJ={};function ZJ(){return XJ}
206function QJ(e,t){let n=ZJ(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=YJ(e,t?.in),a=i.getDay(),o=(a<r?7:0)+a-r;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function $J(e,t){return QJ(e,{...t,weekStartsOn:1})}function eY(e,t){let n=YJ(e,t?.in),r=n.getFullYear(),i=JJ(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);let a=$J(i),o=JJ(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);let s=$J(o);return n.getTime()>=a.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function tY(e){let t=YJ(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-+n}function nY(e,...t){let n=JJ.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function rY(e,t){let n=YJ(e,t?.in);return n.setHours(0,0,0,0),n}function iY(e,t,n){let[r,i]=nY(n?.in,e,t),a=rY(r),o=rY(i),s=+a-tY(a),c=+o-tY(o);return Math.round((s-c)/UJ)}function aY(e,t){let n=eY(e,t),r=JJ(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),$J(r)}function oY(e,t){let n=YJ(e)-+YJ(t);return n<0?-1:n>0?1:n}function sY(e){return JJ(e,Date.now())}function cY(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function lY(e){return!(!cY(e)&&typeof e!=`number`||isNaN(+YJ(e)))}function uY(e,t,n){let[r,i]=nY(n?.in,e,t),a=r.getFullYear()-i.getFullYear(),o=r.getMonth()-i.getMonth();return a*12+o}function dY(e){return t=>{let n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}function fY(e,t){return YJ(e)-+YJ(t)}function pY(e,t){let n=YJ(e,t?.in);return n.setHours(23,59,59,999),n}function mY(e,t){let n=YJ(e,t?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function hY(e,t){let n=YJ(e,t?.in);return+pY(n,t)==+mY(n,t)}function gY(e,t,n){let[r,i,a]=nY(n?.in,e,e,t),o=oY(i,a),s=Math.abs(uY(i,a));if(s<1)return 0;i.getMonth()===1&&i.getDate()>27&&i.setDate(30),i.setMonth(i.getMonth()-o*s);let c=oY(i,a)===-o;hY(r)&&s===1&&oY(r,a)===1&&(c=!1);let l=o*(s-+c);return l===0?0:l}function _Y(e,t,n){let r=fY(e,t)/1e3;return dY(n?.roundingMethod)(r)}function vY(e,t){let n=YJ(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}var yY={lessThanXSeconds:{one:`less than a second`,other:`less than {{count}} seconds`},xSeconds:{one:`1 second`,other:`{{count}} seconds`},halfAMinute:`half a minute`,lessThanXMinutes:{one:`less than a minute`,other:`less than {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`about 1 hour`,other:`about {{count}} hours`},xHours:{one:`1 hour`,other:`{{count}} hours`},xDays:{one:`1 day`,other:`{{count}} days`},aboutXWeeks:{one:`about 1 week`,other:`about {{count}} weeks`},xWeeks:{one:`1 week`,other:`{{count}} weeks`},aboutXMonths:{one:`about 1 month`,other:`about {{count}} months`},xMonths:{one:`1 month`,other:`{{count}} months`},aboutXYears:{one:`about 1 year`,other:`about {{count}} years`},xYears:{one:`1 year`,other:`{{count}} years`},overXYears:{one:`over 1 year`,other:`over {{count}} years`},almostXYears:{one:`almost 1 year`,other:`almost {{count}} years`}},bY=(e,t,n)=>{let r,i=yY[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r};function xY(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var SY={date:xY({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:xY({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:xY({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},CY={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},wY=(e,t,n,r)=>CY[e];function TY(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}var EY={ordinalNumber:(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},era:TY({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:TY({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:TY({values:{narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},defaultWidth:`wide`}),day:TY({values:{narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},defaultWidth:`wide`}),dayPeriod:TY({values:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},defaultFormattingWidth:`wide`})};function DY(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?kY(s,e=>e.test(o)):OY(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}
vendor: 6,444 bytes, line 206
206}function OY(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function kY(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function AY(e){return(t,n={})=>{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}var jY={code:`en-US`,formatDistance:bY,formatLong:SY,formatRelative:wY,localize:EY,match:{ordinalNumber:AY({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:DY({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:DY({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:DY({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:DY({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:DY({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function MY(e,t){let n=YJ(e,t?.in);return iY(n,vY(n))+1}function NY(e,t){let n=YJ(e,t?.in),r=$J(n)-+aY(n);return Math.round(r/HJ)+1}function PY(e,t){let n=YJ(e,t?.in),r=n.getFullYear(),i=ZJ(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=JJ(t?.in||e,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);let s=QJ(o,t),c=JJ(t?.in||e,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);let l=QJ(c,t);return+n>=+s?r+1:+n>=+l?r:r-1}function FY(e,t){let n=ZJ(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=PY(e,t),a=JJ(t?.in||e,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),QJ(a,t)}function IY(e,t){let n=YJ(e,t?.in),r=QJ(n,t)-+FY(n,t);return Math.round(r/HJ)+1}function LY(e,t){return(e<0?`-`:``)+Math.abs(e).toString().padStart(t,`0`)}var RY={y(e,t){let n=e.getFullYear(),r=n>0?n:1-n;return LY(t===`yy`?r%100:r,t.length)},M(e,t){let n=e.getMonth();return t===`M`?String(n+1):LY(n+1,2)},d(e,t){return LY(e.getDate(),t.length)},a(e,t){let n=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.toUpperCase();case`aaa`:return n;case`aaaaa`:return n[0];default:return n===`am`?`a.m.`:`p.m.`}},h(e,t){return LY(e.getHours()%12||12,t.length)},H(e,t){return LY(e.getHours(),t.length)},m(e,t){return LY(e.getMinutes(),t.length)},s(e,t){return LY(e.getSeconds(),t.length)},S(e,t){let n=t.length,r=e.getMilliseconds();return LY(Math.trunc(r*10**(n-3)),t.length)}},zY={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},BY={G:function(e,t,n){let r=+(e.getFullYear()>0);switch(t){case`G`:case`GG`:case`GGG`:return n.era(r,{width:`abbreviated`});case`GGGGG`:return n.era(r,{width:`narrow`});default:return n.era(r,{width:`wide`})}},y:function(e,t,n){if(t===`yo`){let t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:`year`})}return RY.y(e,t)},Y:function(e,t,n,r){let i=PY(e,r),a=i>0?i:1-i;return t===`YY`?LY(a%100,2):t===`Yo`?n.ordinalNumber(a,{unit:`year`}):LY(a,t.length)},R:function(e,t){return LY(eY(e),t.length)},u:function(e,t){return LY(e.getFullYear(),t.length)},Q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`Q`:return String(r);case`QQ`:return LY(r,2);case`Qo`:return n.ordinalNumber(r,{unit:`quarter`});case`QQQ`:return n.quarter(r,{width:`abbreviated`,context:`formatting`});case`QQQQQ`:return n.quarter(r,{width:`narrow`,context:`formatting`});default:return n.quarter(r,{width:`wide`,context:`formatting`})}},q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`q`:return String(r);case`qq`:return LY(r,2);case`qo`:return n.ordinalNumber(r,{unit:`quarter`});case`qqq`:return n.quarter(r,{width:`abbreviated`,context:`standalone`});case`qqqqq`:return n.quarter(r,{width:`narrow`,context:`standalone`});default:return n.quarter(r,{width:`wide`,context:`standalone`})}},M:function(e,t,n){let r=e.getMonth();switch(t){case`M`:case`MM`:return RY.M(e,t);case`Mo`:return n.ordinalNumber(r+1,{unit:`month`});case`MMM`:return n.month(r,{width:`abbreviated`,context:`formatting`});case`MMMMM`:return n.month(r,{width:`narrow`,context:`formatting`});default:return n.month(r,{width:`wide`,context:`formatting`})}},L:function(e,t,n){let r=e.getMonth();switch(t){case`L`:return String(r+1);case`LL`:return LY(r+1,2);case`Lo`:return n.ordinalNumber(r+1,{unit:`month`});case`LLL`:return n.month(r,{width:`abbreviated`,context:`standalone`});case`LLLLL`:return n.month(r,{width:`narrow`,context:`standalone`});default:return n.month(r,{width:`wide`,context:`standalone`})}},w:function(e,t,n,r){let i=IY(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):LY(i,t.length)},I:function(e,t,n){let r=NY(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):LY(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getDate(),{unit:`date`}):RY.d(e,t)},D:function(e,t,n){let r=MY(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):LY(r,t.length)},E:function(e,t,n){let r=e.getDay();
vendor: 4,363 bytes, line 206
206switch(t){case`E`:case`EE`:case`EEE`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`EEEEE`:return n.day(r,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},e:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`e`:return String(a);case`ee`:return LY(a,2);case`eo`:return n.ordinalNumber(a,{unit:`day`});case`eee`:return n.day(i,{width:`abbreviated`,context:`formatting`});case`eeeee`:return n.day(i,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(i,{width:`short`,context:`formatting`});default:return n.day(i,{width:`wide`,context:`formatting`})}},c:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`c`:return String(a);case`cc`:return LY(a,t.length);case`co`:return n.ordinalNumber(a,{unit:`day`});case`ccc`:return n.day(i,{width:`abbreviated`,context:`standalone`});case`ccccc`:return n.day(i,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(i,{width:`short`,context:`standalone`});default:return n.day(i,{width:`wide`,context:`standalone`})}},i:function(e,t,n){let r=e.getDay(),i=r===0?7:r;switch(t){case`i`:return String(i);case`ii`:return LY(i,t.length);case`io`:return n.ordinalNumber(i,{unit:`day`});case`iii`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`iiiii`:return n.day(r,{width:`narrow`,context:`formatting`});case`iiiiii`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},a:function(e,t,n){let r=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`});case`aaa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`aaaaa`:return n.dayPeriod(r,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(r,{width:`wide`,context:`formatting`})}},b:function(e,t,n){let r=e.getHours(),i;switch(i=r===12?zY.noon:r===0?zY.midnight:r/12>=1?`pm`:`am`,t){case`b`:case`bb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`bbb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`bbbbb`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},B:function(e,t,n){let r=e.getHours(),i;switch(i=r>=17?zY.evening:r>=12?zY.afternoon:r>=4?zY.morning:zY.night,t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`BBBBB`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},h:function(e,t,n){if(t===`ho`){let t=e.getHours()%12;return t===0&&(t=12),n.ordinalNumber(t,{unit:`hour`})}return RY.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getHours(),{unit:`hour`}):RY.H(e,t)},K:function(e,t,n){let r=e.getHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):LY(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):LY(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getMinutes(),{unit:`minute`}):RY.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getSeconds(),{unit:`second`}):RY.s(e,t)},S:function(e,t){return RY.S(e,t)},X:function(e,t,n){let r=e.getTimezoneOffset();if(r===0)return`Z`;switch(t){case`X`:return HY(r);case`XXXX`:case`XX`:return UY(r);default:return UY(r,`:`)}},x:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`x`:return HY(r);case`xxxx`:case`xx`:return UY(r);default:return UY(r,`:`)}},O:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+VY(r,`:`);default:return`GMT`+UY(r,`:`)}},z:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+VY(r,`:`);default:return`GMT`+UY(r,`:`)}},t:function(e,t,n){return LY(Math.trunc(e/1e3),t.length)},T:function(e,t,n){return LY(+e,t.length)}};function VY(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Math.trunc(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+LY(a,2)}function HY(e,t){return e%60==0?(e>0?`-`:`+`)+LY(Math.abs(e)/60,2):UY(e,t)}function UY(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=LY(Math.trunc(r/60),2),a=LY(r%60,2);return n+i+t+a}var WY=(e,t)=>
206{switch(e){case`P`:return t.date({width:`short`});case`PP`:return t.date({width:`medium`});case`PPP`:return t.date({width:`long`});default:return t.date({width:`full`})}},GY=(e,t)=>{switch(e){case`p`:return t.time({width:`short`});case`pp`:return t.time({width:`medium`});case`ppp`:return t.time({width:`long`});default:return t.time({width:`full`})}},KY={p:GY,P:(e,t)=>{let n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return WY(e,t);let a;switch(r){case`P`:a=t.dateTime({width:`short`});break;case`PP`:a=t.dateTime({width:`medium`});break;case`PPP`:a=t.dateTime({width:`long`});break;default:a=t.dateTime({width:`full`});break}return a.replace(`{{date}}`,WY(r,t)).replace(`{{time}}`,GY(i,t))}},qY=/^D+$/,JY=/^Y+$/,YY=[`D`,`DD`,`YY`,`YYYY`];function XY(e){return qY.test(e)}function ZY(e){return JY.test(e)}function QY(e,t,n){let r=$Y(e,t,n);if(console.warn(r),YY.includes(e))throw RangeError(r)}function $Y(e,t,n){let r=e[0]===`Y`?`years`:`days of the month`;return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}var eX=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,tX=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,nX=/^'([^]*?)'?$/,rX=/''/g,iX=/[a-zA-Z]/;function aX(e,t,n){let r=ZJ(),i=n?.locale??r.locale??jY,a=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=YJ(e,n?.in);if(!lY(s))throw RangeError(`Invalid time value`);let c=t.match(tX).map(e=>{let t=e[0];if(t===`p`||t===`P`){let n=KY[t];return n(e,i.formatLong)}return e}).join(``).match(eX).map(e=>{if(e===`''`)return{isToken:!1,value:`'`};let t=e[0];if(t===`'`)return{isToken:!1,value:oX(e)};if(BY[t])return{isToken:!0,value:e};if(t.match(iX))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));let l={firstWeekContainsDate:a,weekStartsOn:o,locale:i};return c.map(r=>{if(!r.isToken)return r.value;let a=r.value;(!n?.useAdditionalWeekYearTokens&&ZY(a)||!n?.useAdditionalDayOfYearTokens&&XY(a))&&QY(a,t,String(e));let o=BY[a[0]];return o(s,a,i.localize,l)}).join(``)}function oX(e){let t=e.match(nX);return t?t[1].replace(rX,`'`):e}function sX(e,t,n){let r=ZJ(),i=n?.locale??r.locale??jY,a=oY(e,t);if(isNaN(a))throw RangeError(`Invalid time value`);let o=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:a}),[s,c]=nY(n?.in,...a>0?[t,e]:[e,t]),l=_Y(c,s),u=(tY(c)-tY(s))/1e3,d=Math.round((l-u)/60),f;if(d<2)return n?.includeSeconds?l<5?i.formatDistance(`lessThanXSeconds`,5,o):l<10?i.formatDistance(`lessThanXSeconds`,10,o):l<20?i.formatDistance(`lessThanXSeconds`,20,o):l<40?i.formatDistance(`halfAMinute`,0,o):l<60?i.formatDistance(`lessThanXMinutes`,1,o):i.formatDistance(`xMinutes`,1,o):d===0?i.formatDistance(`lessThanXMinutes`,1,o):i.formatDistance(`xMinutes`,d,o);if(d<45)return i.formatDistance(`xMinutes`,d,o);if(d<90)return i.formatDistance(`aboutXHours`,1,o);if(d<1440){let e=Math.round(d/60);return i.formatDistance(`aboutXHours`,e,o)}else if(d<2520)return i.formatDistance(`xDays`,1,o);else if(d<43200){let e=Math.round(d/GJ);return i.formatDistance(`xDays`,e,o)}else if(d<43200*2)return f=Math.round(d/WJ),i.formatDistance(`aboutXMonths`,f,o);if(f=gY(c,s),f<12){let e=Math.round(d/WJ);return i.formatDistance(`xMonths`,e,o)}else{let e=f%12,t=Math.trunc(f/12);return e<3?i.formatDistance(`aboutXYears`,t,o):e<9?i.formatDistance(`overXYears`,t,o):i.formatDistance(`almostXYears`,t+1,o)}}function cX(e,t){return sX(e,sY(e),t)}var lX=6e3,uX={ownerTokenIdentifier:j.string(),content:j.string(),updatedAt:j.number()};j.object({_id:j.id(`userMemory`),_creationTime:j.number(),...uX}),rw(uX).index(`by_owner`,[`ownerTokenIdentifier`]);var dX=[{key:`morningOrientation`,label:`Morning orientation`,description:`Each morning, XO sends one or two things that matter today over Telegram â drawn from what it remembers. XO stays silent on mornings with nothing worth saying.`}];function fX(){let e=Fi(B.settings.queries.get,{}),t=Ii(B.settings.mutations.update);return(0,M.jsxs)(Nw,{children:[(0,M.jsxs)(Pw,{children:[(0,M.jsx)(Fw,{children:`Permissions`}),(0,M.jsx)(Iw,{children:`What XO is allowed to do on its own. Everything here is off until you turn it on.`})]}),(0,M.jsx)(Lw,{className:`flex flex-col gap-6`,children:dX.map(n=>(0,M.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1`,children:[(0,M.jsx)(lJ,{htmlFor:n.key,children:n.label}),(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n.description})]}),(0,M.jsx)(yJ,{id:n.key,checked:e?.[n.key]??!1,disabled:e===void 0,onCheckedChange:e=>void t({[n.key]:e})})]},n.key))})]})}function pX(){let e=Fi(B.userMemory.queries.get,{}),t=Ii(B.userMemory.mutations.set),[n,r]=(0,_.useState)(null);return(0,M.jsxs)(Nw,{children:[(0,M.jsxs)(Pw,{children:[(0,M.jsx)(Fw,{children:`Memory`}),(0,M.jsx)(Iw,{children:`What XO carries between sessions. Rewritten after each conversation; yours to correct or blank at any time.`})]}),(0,M.jsx)(Lw,{className:`flex flex-col gap-3`,children:e===void 0?(0,M.jsx)(pC,{className:`h-24 w-full`}):n===null?e===null||e.content.trim()===``?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Nothing yet. Memory forms as you talk with XO.`}),(0,M.jsx)(`div`,{children:(0,M.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>r(``),children:`Write it yourself`})})]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`pre`,{className:`max-h-72 overflow-y-auto rounded-md bg-muted/50 p-3 text-xs whitespace-pre-wrap break-words font-mono`,children:e.content}),(0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,M.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Updated`,` `,cX(e.updatedAt,{addSuffix:!0}
206),` ·`,` `,e.content.length.toLocaleString(),` /`,` `,lX.toLocaleString(),` characters`]}),(0,M.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>r(e.content),children:`Edit`})]})]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Bw,{value:n,onChange:e=>r(e.target.value),maxLength:lX,rows:12,className:`font-mono text-xs`}),(0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,M.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[n.length.toLocaleString(),` /`,` `,lX.toLocaleString(),` characters`]}),(0,M.jsxs)(`div`,{className:`flex gap-2`,children:[(0,M.jsx)(z,{variant:`ghost`,size:`sm`,onClick:()=>r(null),children:`Cancel`}),(0,M.jsx)(z,{size:`sm`,onClick:()=>{t({content:n}),r(null)},children:`Save`})]})]})]})})]})}function mX(){let e=Fi(B.telegram.queries.myLinks,{}),t=Fi(B.heartbeat.queries.latest,{});return(0,M.jsxs)(Nw,{children:[(0,M.jsxs)(Pw,{children:[(0,M.jsx)(Fw,{children:`Telegram`}),(0,M.jsx)(Iw,{children:`Chats linked to your XO. Each linked chat talks to the same brain and memory as voice and in-app chat.`})]}),(0,M.jsxs)(Lw,{className:`flex flex-col gap-2`,children:[e===void 0?(0,M.jsx)(pC,{className:`h-10 w-full`}):e.length===0?(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No chat linked yet. Message the XO bot on Telegram to link one.`}):e.map(e=>(0,M.jsxs)(`div`,{className:`flex items-center justify-between rounded-md border border-border px-3 py-2`,children:[(0,M.jsxs)(`span`,{className:`text-sm`,children:[`Chat `,e.chatId]}),(0,M.jsxs)(sJ,{variant:`secondary`,children:[`linked `,cX(e.createdAt,{addSuffix:!0})]})]},e._id)),t!==void 0&&(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t===null?`No daily heartbeat sent yet.`:`Last heartbeat ${cX(t.sentAt,{addSuffix:!0})}.`})]})]})}var hX=720*60*60*1e3;function gX(){let[e]=(0,_.useState)(()=>Date.now()-hX),t=Fi(B.usage.queries.mine,{sinceMs:e});return(0,M.jsxs)(Nw,{children:[(0,M.jsxs)(Pw,{children:[(0,M.jsx)(Fw,{children:`Usage`}),(0,M.jsx)(Iw,{children:`Model tokens over the last 30 days.`})]}),(0,M.jsx)(Lw,{children:t===void 0?(0,M.jsx)(pC,{className:`h-10 w-full`}):(0,M.jsxs)(`div`,{className:`grid grid-cols-3 gap-4`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`p`,{className:`text-2xl font-semibold tabular-nums`,children:t.inputTokens.toLocaleString()}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`tokens in`})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`p`,{className:`text-2xl font-semibold tabular-nums`,children:t.outputTokens.toLocaleString()}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`tokens out`})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`p`,{className:`text-2xl font-semibold tabular-nums`,children:t.events.toLocaleString()}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`generations`})]})]})})]})}function _X(){let{isLoading:e,isAuthenticated:t}=Ki();return e?null:t?(0,M.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col gap-4 p-4`,children:[(0,M.jsx)(fX,{}),(0,M.jsx)(pX,{}),(0,M.jsx)(mX,{}),(0,M.jsx)(gX,{})]}):(0,M.jsx)(`div`,{className:`flex flex-1 items-center p-4`,children:(0,M.jsx)(zw,{})})}var vX=[`@home`,`@computer`,`@phone`,`@errands`,`@work`];function yX(){return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Xi,{children:(0,M.jsx)(bX,{})}),(0,M.jsx)(Zi,{children:(0,M.jsx)(`main`,{className:`container mx-auto flex flex-col gap-6 px-4 py-8 max-w-3xl`,children:(0,M.jsx)(zw,{})})})]})}function bX(){let e=Fi(B.tasks.queries.listByStatus,{status:`inbox`}),t=Fi(B.tasks.queries.listByStatus,{status:`next`}),n=Fi(B.tasks.queries.listByStatus,{status:`waiting`}),r=Fi(B.tasks.queries.listByStatus,{status:`someday`}),i=Fi(B.projects.queries.listOwned,{}),a=Ii(B.tasks.mutations.create),o=(0,_.useMemo)(()=>{let e=new Map;for(let t of i??[])e.set(t._id,t.name);return e},[i]),[s,c]=(0,_.useState)(``),l=async()=>{let e=s.trim();e!==``&&(c(``),await a({title:e,status:`next`}))};return(0,M.jsxs)(`main`,{className:`container mx-auto flex flex-col gap-8 px-4 py-8 max-w-3xl`,children:[(0,M.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,M.jsx)(`h1`,{className:`text-2xl font-semibold`,children:`Actions`}),(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`The next physical, visible thing. Next actions give every project a doorway;
206 waiting-fors and someday/maybe keep the rest off your mind.`})]}),(0,M.jsxs)(`form`,{className:`flex gap-2`,onSubmit:e=>{e.preventDefault(),l()},children:[(0,M.jsx)(iC,{value:s,onChange:e=>c(e.target.value),placeholder:`Add a next actionâ¦`,"aria-label":`Add a next action`}),(0,M.jsxs)(z,{type:`submit`,disabled:s.trim()===``,children:[(0,M.jsx)(SS,{className:`size-4`}),` Add`]})]}),(0,M.jsx)(xX,{icon:(0,M.jsx)(Xx,{className:`size-4 text-primary`}),title:`To clarify`,hint:`captured, not yet sorted`,tasks:e,renderWhenEmpty:!1,projectNameById:o,projects:i}),(0,M.jsx)(xX,{icon:(0,M.jsx)(Cx,{className:`size-4 text-primary`}),title:`Next actions`,hint:`one clear step at a time`,emptyHint:`No next actions yet. Add the smallest doable step above.`,tasks:t,renderWhenEmpty:!0,projectNameById:o,projects:i}),(0,M.jsx)(xX,{icon:(0,M.jsx)(Mx,{className:`size-4 text-primary`}),title:`Waiting for`,hint:`tracked, so you can let go`,tasks:n,renderWhenEmpty:!1,projectNameById:o,projects:i}),(0,M.jsx)(xX,{icon:(0,M.jsx)(Fx,{className:`size-4 text-primary`}),title:`Someday / maybe`,hint:`no pressure, no guilt`,tasks:r,renderWhenEmpty:!1,projectNameById:o,projects:i})]})}function xX({icon:e,title:t,hint:n,emptyHint:r,tasks:i,renderWhenEmpty:a,projectNameById:o,projects:s}){return i===void 0?a?(0,M.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,M.jsx)(SX,{icon:e,title:t,hint:n}),(0,M.jsx)(pC,{className:`h-14 w-full`})]}):null:i.length===0&&!a?null:(0,M.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,M.jsx)(SX,{icon:e,title:t,hint:n}),i.length===0?(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r}):(0,M.jsx)(`ul`,{className:`flex flex-col divide-y divide-border rounded-lg border border-border/60`,children:i.map(e=>(0,M.jsx)(CX,{task:e,projectName:e.projectId?o.get(e.projectId):void 0,projects:s},e._id))})]})}function SX({icon:e,title:t,hint:n}){return(0,M.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[(0,M.jsxs)(`h2`,{className:`inline-flex items-center gap-2 text-sm font-semibold uppercase tracking-wide`,children:[e,` `,t]}),(0,M.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n})]})}function CX({task:e,projectName:t,projects:n}){let r=Ii(B.tasks.mutations.complete),i=Ii(B.tasks.mutations.reopen),a=Ii(B.tasks.mutations.setStatus),o=Ii(B.tasks.mutations.setProject),s=Ii(B.tasks.mutations.setContext),c=Ii(B.tasks.mutations.setArchived),l=e.status===`done`;return(0,M.jsxs)(`li`,{className:`flex items-center gap-3 px-4 py-3`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:()=>void(l?i({id:e._id}):r({id:e._id})),"aria-label":l?`Reopen task`:`Complete task`,className:L(`flex size-5 shrink-0 items-center justify-center rounded-full border transition-colors`,l?`border-primary bg-primary text-primary-foreground`:`border-border hover:border-primary/60`),children:l?(0,M.jsx)(Cx,{className:`size-3`,strokeWidth:3}):null}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsx)(`p`,{className:L(`truncate text-sm`,l&&`text-muted-foreground line-through`),children:e.title||`Untitled action`}),(0,M.jsxs)(`div`,{className:`mt-0.5 flex flex-wrap items-center gap-1.5`,children:[e.context?(0,M.jsx)(sJ,{variant:`secondary`,className:`font-normal`,children:e.context}):null,t?(0,M.jsx)(sJ,{variant:`outline`,className:`font-normal`,children:t}):null,e.waitingFor?(0,M.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`from `,e.waitingFor]}):null]})]}),(0,M.jsxs)(HS,{children:[(0,M.jsx)(US,{asChild:!0,children:(0,M.jsx)(z,{variant:`ghost`,size:`icon`,"aria-label":`Task actions`,children:(0,M.jsx)(Vx,{className:`size-4`})})}),(0,M.jsxs)(WS,{align:`end`,children:[(0,M.jsx)(qS,{children:`Move to`}),[[`next`,`Next action`],[`waiting`,`Waiting for`],[`someday`,`Someday / maybe`],[`inbox`,`Inbox (re-clarify)`]].map(([t,n])=>(0,M.jsx)(KS,{disabled:e.status===t,onSelect:()=>void a({id:e._id,status:t}),children:n},t)),(0,M.jsx)(JS,{}),(0,M.jsxs)(YS,{children:[(0,M.jsx)(XS,{children:`Project`}),(0,M.jsxs)(ZS,{children:[(0,M.jsx)(KS,{disabled:e.projectId===void 0,onSelect:()=>void o({id:e._id,projectId:null}),children:`None`}),(n??[]).length>0?(0,M.jsx)(JS,{}):null,(n??[]).map(t=>(0,M.jsx)(KS,{disabled:e.projectId===t._id,onSelect:()=>void o({id:e._id,projectId:t._id}),children:t.name},t._id))]})]}),(0,M.jsxs)(YS,{children:[(0,M.jsx)(XS,{children:`Context`}),(0,M.jsxs)(ZS,{children:[(0,M.jsx)(KS,{disabled:e.context===void 0,onSelect:()=>
206void s({id:e._id,context:null}),children:`Clear`}),(0,M.jsx)(JS,{}),vX.map(t=>(0,M.jsx)(KS,{disabled:e.context===t,onSelect:()=>void s({id:e._id,context:t}),children:t},t))]})]}),(0,M.jsx)(JS,{}),(0,M.jsx)(KS,{variant:`destructive`,onSelect:()=>void c({id:e._id,archived:!0}),children:`Archive`})]})]})]})}function wX(e,t){return t.forEach(function(t){t&&typeof t!=`string`&&!Array.isArray(t)&&Object.keys(t).forEach(function(n){if(n!==`default`&&!(n in e)){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}})}),Object.freeze(e)}var TX=Object.defineProperty,EX=(e,t,n)=>t in e?TX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,DX=(e,t,n)=>EX(e,typeof t==`symbol`?t:t+``,n),OX=class{constructor(){DX(this,`_locking`),DX(this,`_locks`),this._locking=Promise.resolve(),this._locks=0}isLocked(){return this._locks>0}lock(){this._locks+=1;let e,t=new Promise(t=>e=()=>{--this._locks,t()}),n=this._locking.then(()=>e);return this._locking=this._locking.then(()=>t),n}};function kX(e,t){if(!e)throw Error(t)}var AX=34028234663852886e22,jX=-34028234663852886e22,MX=4294967295,NX=2147483647,PX=-2147483648;function FX(e){if(typeof e!=`number`)throw Error(`invalid int 32: `+typeof e);if(!Number.isInteger(e)||e>NX||e<PX)throw Error(`invalid int 32: `+e)}function IX(e){if(typeof e!=`number`)throw Error(`invalid uint 32: `+typeof e);if(!Number.isInteger(e)||e>MX||e<0)throw Error(`invalid uint 32: `+e)}function LX(e){if(typeof e!=`number`)throw Error(`invalid float 32: `+typeof e);if(Number.isFinite(e)&&(e>AX||e<jX))throw Error(`invalid float 32: `+e)}var RX=Symbol(`@bufbuild/protobuf/enum-type`);function zX(e){let t=e[RX];return kX(t,`missing enum type on enum object`),t}function BX(e,t,n,r){e[RX]=VX(t,n.map(t=>({no:t.no,name:t.name,localName:e[t.no]})))}function VX(e,t,n){let r=Object.create(null),i=Object.create(null),a=[];for(let e of t){let t=UX(e);a.push(t),r[e.name]=t,i[e.no]=t}return{typeName:e,values:a,findName(e){return r[e]},findNumber(e){return i[e]}}}function HX(e,t,n){let r={};for(let e of t){let t=UX(e);r[t.localName]=t.no,r[t.no]=t.localName}return BX(r,e,t),r}function UX(e){return`localName`in e?e:Object.assign(Object.assign({},e),{localName:e.name})}var WX=class{equals(e){return this.getType().runtime.util.equals(this.getType(),this,e)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(e,t){let n=this.getType().runtime.bin,r=n.makeReadOptions(t);return n.readMessage(this,r.readerFactory(e),e.byteLength,r),this}fromJson(e,t){let n=this.getType(),r=n.runtime.json,i=r.makeReadOptions(t);return r.readMessage(n,e,i,this),this}fromJsonString(e,t){let n;try{n=JSON.parse(e)}catch(e){throw Error(`cannot decode ${this.getType().typeName} from JSON: ${e instanceof Error?e.message:String(e)}`)}return this.fromJson(n,t)}toBinary(e){let t=this.getType().runtime.bin,n=t.makeWriteOptions(e),r=n.writerFactory();return t.writeMessage(this,r,n),r.finish()}toJson(e){let t=this.getType().runtime.json,n=t.makeWriteOptions(e);return t.writeMessage(this,n)}toJsonString(e){let t=this.toJson(e);return JSON.stringify(t,null,e?.prettySpaces??0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}};function GX(e,t,n,r){let i=r?.localName??t.substring(t.lastIndexOf(`.`)+1),a={[i]:function(t){e.util.initFields(this),e.util.initPartial(t,this)}}[i];return Object.setPrototypeOf(a.prototype,new WX),Object.assign(a,{runtime:e,typeName:t,fields:e.util.newFieldList(n),fromBinary(e,t){return new a().fromBinary(e,t)},fromJson(e,t){return new a().fromJson(e,t)},fromJsonString(e,t){return new a().fromJsonString(e,t)},equals(t,n){return e.util.equals(a,t,n)}}),a}function KX(){let e=0,t=0;for(let n=0;n<28;n+=7){let r=this.buf[this.pos++];if(e|=(r&127)<<n,!(r&128))return this.assertBounds(),[e,t]}let n=this.buf[this.pos++];if(e|=(n&15)<<28,t=(n&112)>>4,!(n&128))return this.assertBounds(),[e,t];for(let n=3;n<=31;n+=7){let r=this.buf[this.pos++];if(t|=(r&127)<<n,!(r&128))return this.assertBounds(),[e,t]}throw Error(`invalid varint`)}function qX(e,t,n){for(let r=0;r<28;r+=7){let i=e>>>r,a=!(!(i>>>7)&&t==0),o=(a?i|128:i)&255;if(n.push(o),!a)return}let r=e>>>
vendor: 10,418 bytes, lines 206-207
20628&15|(t&7)<<4,i=!!(t>>3);if(n.push((i?r|128:r)&255),i){for(let e=3;e<31;e+=7){let r=t>>>e,i=!!(r>>>7),a=(i?r|128:r)&255;if(n.push(a),!i)return}n.push(t>>>31&1)}}var JX=4294967296;function YX(e){let t=e[0]===`-`;t&&(e=e.slice(1));let n=1e6,r=0,i=0;function a(t,a){let o=Number(e.slice(t,a));i*=n,r=r*n+o,r>=JX&&(i+=r/JX|0,r%=JX)}return a(-24,-18),a(-18,-12),a(-12,-6),a(-6),t?eZ(r,i):$X(r,i)}function XX(e,t){let n=$X(e,t),r=n.hi&2147483648;r&&(n=eZ(n.lo,n.hi));let i=ZX(n.lo,n.hi);return r?`-`+i:i}function ZX(e,t){var n=QX(e,t);if(e=n.lo,t=n.hi,t<=2097151)return String(JX*t+e);let r=e&16777215,i=(e>>>24|t<<8)&16777215,a=t>>16&65535,o=r+i*6777216+a*6710656,s=i+a*8147497,c=a*2,l=1e7;return o>=l&&(s+=Math.floor(o/l),o%=l),s>=l&&(c+=Math.floor(s/l),s%=l),c.toString()+tZ(s)+tZ(o)}function QX(e,t){return{lo:e>>>0,hi:t>>>0}}function $X(e,t){return{lo:e|0,hi:t|0}}function eZ(e,t){return t=~t,e?e=~e+1:t+=1,$X(e,t)}var tZ=e=>{let t=String(e);return`0000000`.slice(t.length)+t};function nZ(e,t){if(e>=0){for(;e>127;)t.push(e&127|128),e>>>=7;t.push(e)}else{for(let n=0;n<9;n++)t.push(e&127|128),e>>=7;t.push(1)}}function rZ(){let e=this.buf[this.pos++],t=e&127;if(!(e&128)||(e=this.buf[this.pos++],t|=(e&127)<<7,!(e&128))||(e=this.buf[this.pos++],t|=(e&127)<<14,!(e&128))||(e=this.buf[this.pos++],t|=(e&127)<<21,!(e&128)))return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let t=5;e&128&&t<10;t++)e=this.buf[this.pos++];if(e&128)throw Error(`invalid varint`);return this.assertBounds(),t>>>0}function iZ(){let e=new DataView(new ArrayBuffer(8));if(typeof BigInt==`function`&&typeof e.getBigInt64==`function`&&typeof e.getBigUint64==`function`&&typeof e.setBigInt64==`function`&&typeof e.setBigUint64==`function`&&(typeof process!=`object`||{}.BUF_BIGINT_DISABLE!==`1`)){let t=BigInt(`-9223372036854775808`),n=BigInt(`9223372036854775807`),r=BigInt(`0`),i=BigInt(`18446744073709551615`);return{zero:BigInt(0),supported:!0,parse(e){let r=typeof e==`bigint`?e:BigInt(e);if(r>n||r<t)throw Error(`int64 invalid: ${e}`);return r},uParse(e){let t=typeof e==`bigint`?e:BigInt(e);if(t>i||t<r)throw Error(`uint64 invalid: ${e}`);return t},enc(t){return e.setBigInt64(0,this.parse(t),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(t){return e.setBigInt64(0,this.uParse(t),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec(t,n){return e.setInt32(0,t,!0),e.setInt32(4,n,!0),e.getBigInt64(0,!0)},uDec(t,n){return e.setInt32(0,t,!0),e.setInt32(4,n,!0),e.getBigUint64(0,!0)}}}let t=e=>kX(/^-?[0-9]+$/.test(e),`int64 invalid: ${e}`),n=e=>kX(/^[0-9]+$/.test(e),`uint64 invalid: ${e}`);return{zero:`0`,supported:!1,parse(e){return typeof e!=`string`&&(e=e.toString()),t(e),e},uParse(e){return typeof e!=`string`&&(e=e.toString()),n(e),e},enc(e){return typeof e!=`string`&&(e=e.toString()),t(e),YX(e)},uEnc(e){return typeof e!=`string`&&(e=e.toString()),n(e),YX(e)},dec(e,t){return XX(e,t)},uDec(e,t){return ZX(e,t)}}}var aZ=iZ(),K;(function(e){e[e.DOUBLE=1]=`DOUBLE`,e[e.FLOAT=2]=`FLOAT`,e[e.INT64=3]=`INT64`,e[e.UINT64=4]=`UINT64`,e[e.INT32=5]=`INT32`,e[e.FIXED64=6]=`FIXED64`,e[e.FIXED32=7]=`FIXED32`,e[e.BOOL=8]=`BOOL`,e[e.STRING=9]=`STRING`,e[e.BYTES=12]=`BYTES`,e[e.UINT32=13]=`UINT32`,e[e.SFIXED32=15]=`SFIXED32`,e[e.SFIXED64=16]=`SFIXED64`,e[e.SINT32=17]=`SINT32`,e[e.SINT64=18]=`SINT64`})(K||={});var oZ;(function(e){e[e.BIGINT=0]=`BIGINT`,e[e.STRING=1]=`STRING`})(oZ||={});function sZ(e,t,n){if(t===n)return!0;if(e==K.BYTES){if(!(t instanceof Uint8Array)||!(n instanceof Uint8Array)||t.length!==n.length)return!1;for(let e=0;e<t.length;e++)if(t[e]!==n[e])return!1;return!0}switch(e){case K.UINT64:case K.FIXED64:case K.INT64:case K.SFIXED64:case K.SINT64:return t==n}return!1}function cZ(e,t){switch(e){case K.BOOL:return!1;case K.UINT64:case K.FIXED64:case K.INT64:case K.SFIXED64:case K.SINT64:return t==0?aZ.zero:`0`;case K.DOUBLE:case K.FLOAT:return 0;case K.BYTES:return new Uint8Array;case K.STRING:return``;default:return 0}}function lZ(e,t){switch(e){case K.BOOL:return t===!1;case K.STRING:return t===``;case K.BYTES:return t instanceof Uint8Array&&!t.byteLength;default:return t==0}}function uZ(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function dZ(e){if(Array.isArray(e))return e}function fZ(e,t,n){return(t=_Z(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pZ(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function mZ(){throw TypeError(`Invalid attempt to destructure non-iterable instance. 207In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hZ(e,t){return dZ(e)||pZ(e,t)||vZ(e,t)||mZ()}function gZ(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function _Z(e){var t=gZ(e,`string`);return typeof t==`symbol`?t:t+``}function vZ(e,t){if(e){if(typeof e==`string`)return uZ(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?uZ(e,t):void 0}}var yZ;(function(e){e[e.Varint=0]=`Varint`,e[e.Bit64=1]=`Bit64`,e[e.LengthDelimited=2]=`LengthDelimited`,e[e.StartGroup=3]=`StartGroup`,e[e.EndGroup=4]=`EndGroup`,e[e.Bit32=5]=`Bit32`})(yZ||={});var bZ=class{constructor(e){this.stack=[],this.textEncoder=e??new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let t=0;t<this.chunks.length;t++)e+=this.chunks[t].length;let t=new Uint8Array(e),n=0;for(let e=0;e<this.chunks.length;e++)t.set(this.chunks[e],n),n+=this.chunks[e].length;return this.chunks=[],t}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),t=this.stack.pop();if(!t)throw Error(`invalid state, fork stack empty`);return this.chunks=t.chunks,this.buf=t.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,t){return this.uint32((e<<3|t)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(IX(e);e>127;)this.buf.push(e&127|128),e>>>=7;return this.buf.push(e),this}int32(e){return FX(e),nZ(e,this.buf),this}bool(e){return this.buf.push(+!!e),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let t=this.textEncoder.encode(e);return this.uint32(t.byteLength),this.raw(t)}float(e){LX(e);let t=new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,e,!0),this.raw(t)}double(e){let t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!0),this.raw(t)}fixed32(e){IX(e);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){FX(e);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return FX(e),e=(e<<1^e>>31)>>>0,nZ(e,this.buf),this}sfixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),r=aZ.enc(e);return n.setInt32(0,r.lo,!0),n.setInt32(4,r.hi,!0),this.raw(t)}fixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),r=aZ.uEnc(e);return n.setInt32(0,r.lo,!0),n.setInt32(4,r.hi,!0),this.raw(t)}int64(e){let t=aZ.enc(e);return qX(t.lo,t.hi,this.buf),this}sint64(e){let t=aZ.enc(e),n=t.hi>>31;return qX(t.lo<<1^n,(t.hi<<1|t.lo>>>31)^n,this.buf),this}uint64(e){let t=aZ.uEnc(e);return qX(t.lo,t.hi,this.buf),this}},xZ=class{constructor(e,t){this.varint64=KX,this.uint32=rZ,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=t??new TextDecoder}tag(){let e=this.uint32(),t=e>>>3,n=e&7;if(t<=0||n<0||n>5)throw Error(`illegal tag: field no `+t+` wire type `+n);return[t,n]}skip(e,t){let n=this.pos;switch(e){case yZ.Varint:for(;this.buf[this.pos++]&128;);break;case yZ.Bit64:this.pos+=4;case yZ.Bit32:this.pos+=4;break;case yZ.LengthDelimited:let n=this.uint32();this.pos+=n;break;case yZ.StartGroup:for(;;){let e=hZ(this.tag(),2),n=e[0],r=e[1];if(r===yZ.EndGroup){if(t!==void 0&&n!==t)throw Error(`invalid end group tag`);break}this.skip(r,n)}break;default:throw Error(`cant skip wire type `+e)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw RangeError(`premature EOF`)}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return aZ.dec(...this.varint64())}uint64(){return aZ.uDec(...this.varint64())}sint64(){let e=hZ(this.varint64(),2),t=e[0],n=e[1],r=-(t&1);return t=(t>>>1|(n&1)<<31)^r,n=n>>>1^r,aZ.dec(t,n)}bool(){let e=hZ(this.varint64(),2),t=e[0],n=e[1];return t!==0||n!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return aZ.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return aZ.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(){return this.textDecoder.decode(this.bytes())}};function SZ(e,t,n,r){let i;return{typeName:t,extendee:n,get field(){if(!i){let n=typeof r==`function`?r():r;n.name=t.split(`.`).pop(),n.jsonName=`[${t}]`,i=e.util.newFieldList([n]).list()[0]}return i},runtime:e}}function CZ(e){let t=e.field.localName,n=Object.create(null);return n[t]=wZ(e),[n,()=>n[t]]}function wZ(e){let t=e.field;if(t.repeated)return[];if(t.default!==void 0)return t.default;switch(t.kind){case`enum`:return t.T.values[0].no;case`scalar`:return cZ(t.T,t.L);case`message`:let e=t.T,n=new e;return e.fieldWrapper?e.fieldWrapper.unwrapField(n):n;case`map`:throw`map fields are not allowed to be extensions`}}function TZ(e,t){if(!t.repeated&&(t.kind==`enum`||t.kind==`scalar`)){for(let n=e.length-1;n>=0;--n)if(e[n].no==t.no)return[e[n]];return[]}return e.filter(e=>e.no===t.no)}var EZ=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
207+/`.split(``),DZ=[];for(let e=0;e<EZ.length;e++)DZ[EZ[e].charCodeAt(0)]=e;DZ[45]=EZ.indexOf(`+`),DZ[95]=EZ.indexOf(`/`);var OZ={dec(e){let t=e.length*3/4;e[e.length-2]==`=`?t-=2:e[e.length-1]==`=`&&--t;let n=new Uint8Array(t),r=0,i=0,a,o=0;for(let t=0;t<e.length;t++){if(a=DZ[e.charCodeAt(t)],a===void 0)switch(e[t]){case`=`:i=0;case` 208`:case`\r`:case` `:case` `:continue;default:throw Error(`invalid base64 string.`)}switch(i){case 0:o=a,i=1;break;case 1:n[r++]=o<<2|(a&48)>>4,o=a,i=2;break;case 2:n[r++]=(o&15)<<4|(a&60)>>2,o=a,i=3;break;case 3:n[r++]=(o&3)<<6|a,i=0;break}}if(i==1)throw Error(`invalid base64 string.`);return n.subarray(0,r)},enc(e){let t=``,n=0,r,i=0;for(let a=0;a<e.length;a++)switch(r=e[a],n){case 0:t+=EZ[r>>2],i=(r&3)<<4,n=1;break;case 1:t+=EZ[i|r>>4],i=(r&15)<<2,n=2;break;case 2:t+=EZ[i|r>>6],t+=EZ[r&63],n=0;break}return n&&(t+=EZ[i],t+=`=`,n==1&&(t+=`=`)),t}};function kZ(e,t,n){MZ(t,e);let r=t.runtime.bin.makeReadOptions(n),i=TZ(e.getType().runtime.bin.listUnknownFields(e),t.field),a=hZ(CZ(t),2),o=a[0],s=a[1];for(let e of i)t.runtime.bin.readField(o,r.readerFactory(e.data),t.field,e.wireType,r);return s()}function AZ(e,t,n,r){MZ(t,e);let i=t.runtime.bin.makeReadOptions(r),a=t.runtime.bin.makeWriteOptions(r);if(jZ(e,t)){let n=e.getType().runtime.bin.listUnknownFields(e).filter(e=>e.no!=t.field.no);e.getType().runtime.bin.discardUnknownFields(e);for(let t of n)e.getType().runtime.bin.onUnknownField(e,t.no,t.wireType,t.data)}let o=a.writerFactory(),s=t.field;!s.opt&&!s.repeated&&(s.kind==`enum`||s.kind==`scalar`)&&(s=Object.assign(Object.assign({},t.field),{opt:!0})),t.runtime.bin.writeField(s,n,o,a);let c=i.readerFactory(o.finish());for(;c.pos<c.len;){let t=hZ(c.tag(),2),n=t[0],r=t[1],i=c.skip(r,n);e.getType().runtime.bin.onUnknownField(e,n,r,i)}}function jZ(e,t){let n=e.getType();return t.extendee.typeName===n.typeName&&!!n.runtime.bin.listUnknownFields(e).find(e=>e.no==t.field.no)}function MZ(e,t){kX(e.extendee.typeName==t.getType().typeName,`extension ${e.typeName} can only be applied to message ${e.extendee.typeName}`)}function NZ(e,t){let n=e.localName;if(e.repeated)return t[n].length>0;if(e.oneof)return t[e.oneof.localName].case===n;switch(e.kind){case`enum`:case`scalar`:return e.opt||e.req?t[n]!==void 0:e.kind==`enum`?t[n]!==e.T.values[0].no:!lZ(e.T,t[n]);case`message`:return t[n]!==void 0;case`map`:return Object.keys(t[n]).length>0}}function PZ(e,t){let n=e.localName,r=!e.opt&&!e.req;if(e.repeated)t[n]=[];else if(e.oneof)t[e.oneof.localName]={case:void 0};else switch(e.kind){case`map`:t[n]={};break;case`enum`:t[n]=r?e.T.values[0].no:void 0;break;case`scalar`:t[n]=r?cZ(e.T,e.L):void 0;break;case`message`:t[n]=void 0;break}}function FZ(e,t){if(typeof e!=`object`||!e||!Object.getOwnPropertyNames(WX.prototype).every(t=>t in e&&typeof e[t]==`function`))return!1;let n=e.getType();return n===null||typeof n!=`function`||!(`typeName`in n)||typeof n.typeName!=`string`?!1:t===void 0?!0:n.typeName==t.typeName}function IZ(e,t){return FZ(t)||!e.fieldWrapper?t:e.fieldWrapper.wrapField(t)}K.DOUBLE,K.FLOAT,K.INT64,K.UINT64,K.INT32,K.UINT32,K.BOOL,K.STRING,K.BYTES;var LZ={ignoreUnknownFields:!1},RZ={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};function zZ(e){return e?Object.assign(Object.assign({},LZ),e):LZ}function BZ(e){return e?Object.assign(Object.assign({},RZ),e):RZ}var VZ=Symbol(),HZ=Symbol();function UZ(){return{makeReadOptions:zZ,makeWriteOptions:BZ,readMessage(e,t,n,r){if(t==null||Array.isArray(t)||typeof t!=`object`)throw Error(`cannot decode message ${e.typeName} from JSON: ${WZ(t)}`);r??=new e;let i=new Map,a=n.typeRegistry;for(let s of Object.entries(t)){var o=hZ(s,2);let t=o[0],c=o[1],l=e.fields.findJsonName(t);if(l){if(l.oneof){if(c===null&&l.kind==`scalar`)continue;let n=i.get(l.oneof);if(n!==void 0)throw Error(`cannot decode message ${e.typeName} from JSON: multiple keys for oneof "${l.oneof.name}" present: "${n}", "${t}"`);i.set(l.oneof,t)}GZ(r,c,l,n,e)}else{let i=!1;if(a?.findExtension&&t.startsWith(`[`)&&t.endsWith(`]`)){let o=a.findExtension(t.substring(1,t.length-1));if(o&&o.extendee.typeName==e.typeName){i=!0;let e=hZ(CZ(o),2),t=e[0],a=e[1];GZ(t,c,o.field,n,o),AZ(r,o,a(),n)}}if(!i&&!n.ignoreUnknownFields)throw Error(`cannot decode message ${e.typeName} from JSON: key "${t}" is unknown`)}}return r},writeMessage(e,t){let n=e.getType(),r={},i;try{for(i of n.fields.byNumber()){if(!NZ(i,e)){if(i.req)throw`required field not set`;if(!t.emitDefaultValues||!YZ(i))continue}let n=i.oneof?e[i.oneof.localName].value:e[i.localName],a=XZ(i,n,t);a!==void 0&&(r[t.useProtoFieldName?i.name:i.jsonName]=a)}let a=t.typeRegistry;if(a?.findExtensionFor)for(let i of n.runtime.bin.listUnknownFields(e)){let o=a.findExtensionFor(n.typeName,i.no);if(o&&jZ(e,o)){let n=kZ(e,o,t),i=XZ(o.field,n,t);i!==void 0&&(r[o.field.jsonName]=i)}}}catch(e){let t=i?`cannot encode field ${n.typeName}.${i.name} to JSON`:`cannot encode message ${n.typeName} to JSON`,r=e instanceof Error?e.message:String(e);throw Error(t+(r.length>0?`: ${r}`:``))}return r}
vendor: 19,902 bytes, line 208
208,readScalar(e,t,n){return qZ(e,t,n??oZ.BIGINT,!0)},writeScalar(e,t,n){if(t!==void 0&&(n||lZ(e,t)))return QZ(e,t)},debug:WZ}}function WZ(e){if(e===null)return`null`;switch(typeof e){case`object`:return Array.isArray(e)?`array`:`object`;case`string`:return e.length>100?`string`:`"${e.split(`"`).join(`\\"`)}"`;default:return String(e)}}function GZ(e,t,n,r,i){let a=n.localName;if(n.repeated){if(kX(n.kind!=`map`),t===null)return;if(!Array.isArray(t))throw Error(`cannot decode field ${i.typeName}.${n.name} from JSON: ${WZ(t)}`);let o=e[a];for(let e of t){if(e===null)throw Error(`cannot decode field ${i.typeName}.${n.name} from JSON: ${WZ(e)}`);switch(n.kind){case`message`:o.push(n.T.fromJson(e,r));break;case`enum`:let t=JZ(n.T,e,r.ignoreUnknownFields,!0);t!==HZ&&o.push(t);break;case`scalar`:try{o.push(qZ(n.T,e,n.L,!0))}catch(t){let r=`cannot decode field ${i.typeName}.${n.name} from JSON: ${WZ(e)}`;throw t instanceof Error&&t.message.length>0&&(r+=`: ${t.message}`),Error(r)}break}}}else if(n.kind==`map`){if(t===null)return;if(typeof t!=`object`||Array.isArray(t))throw Error(`cannot decode field ${i.typeName}.${n.name} from JSON: ${WZ(t)}`);let s=e[a];for(let e of Object.entries(t)){var o=hZ(e,2);let a=o[0],c=o[1];if(c===null)throw Error(`cannot decode field ${i.typeName}.${n.name} from JSON: map value null`);let l;try{l=KZ(n.K,a)}catch(e){let r=`cannot decode map key for field ${i.typeName}.${n.name} from JSON: ${WZ(t)}`;throw e instanceof Error&&e.message.length>0&&(r+=`: ${e.message}`),Error(r)}switch(n.V.kind){case`message`:s[l]=n.V.T.fromJson(c,r);break;case`enum`:let e=JZ(n.V.T,c,r.ignoreUnknownFields,!0);e!==HZ&&(s[l]=e);break;case`scalar`:try{s[l]=qZ(n.V.T,c,oZ.BIGINT,!0)}catch(e){let r=`cannot decode map value for field ${i.typeName}.${n.name} from JSON: ${WZ(t)}`;throw e instanceof Error&&e.message.length>0&&(r+=`: ${e.message}`),Error(r)}break}}}else switch(n.oneof&&(e=e[n.oneof.localName]={case:a},a=`value`),n.kind){case`message`:let o=n.T;if(t===null&&o.typeName!=`google.protobuf.Value`)return;let s=e[a];FZ(s)?s.fromJson(t,r):(e[a]=s=o.fromJson(t,r),o.fieldWrapper&&!n.oneof&&(e[a]=o.fieldWrapper.unwrapField(s)));break;case`enum`:let c=JZ(n.T,t,r.ignoreUnknownFields,!1);switch(c){case VZ:PZ(n,e);break;case HZ:break;default:e[a]=c;break}break;case`scalar`:try{let r=qZ(n.T,t,n.L,!1);switch(r){case VZ:PZ(n,e);break;default:e[a]=r;break}}catch(e){let r=`cannot decode field ${i.typeName}.${n.name} from JSON: ${WZ(t)}`;throw e instanceof Error&&e.message.length>0&&(r+=`: ${e.message}`),Error(r)}break}}function KZ(e,t){if(e===K.BOOL)switch(t){case`true`:t=!0;break;case`false`:t=!1;break}return qZ(e,t,oZ.BIGINT,!0).toString()}function qZ(e,t,n,r){if(t===null)return r?cZ(e,n):VZ;switch(e){case K.DOUBLE:case K.FLOAT:if(t===`NaN`)return NaN;if(t===`Infinity`)return 1/0;if(t===`-Infinity`)return-1/0;if(t===``||typeof t==`string`&&t.trim().length!==t.length||typeof t!=`string`&&typeof t!=`number`)break;let r=Number(t);if(Number.isNaN(r)||!Number.isFinite(r))break;return e==K.FLOAT&&LX(r),r;case K.INT32:case K.FIXED32:case K.SFIXED32:case K.SINT32:case K.UINT32:let i;if(typeof t==`number`?i=t:typeof t==`string`&&t.length>0&&t.trim().length===t.length&&(i=Number(t)),i===void 0)break;return e==K.UINT32||e==K.FIXED32?IX(i):FX(i),i;case K.INT64:case K.SFIXED64:case K.SINT64:if(typeof t!=`number`&&typeof t!=`string`)break;let a=aZ.parse(t);return n?a.toString():a;case K.FIXED64:case K.UINT64:if(typeof t!=`number`&&typeof t!=`string`)break;let o=aZ.uParse(t);return n?o.toString():o;case K.BOOL:if(typeof t!=`boolean`)break;return t;case K.STRING:if(typeof t!=`string`)break;return t;case K.BYTES:if(t===``)return new Uint8Array;if(typeof t!=`string`)break;return OZ.dec(t)}throw Error()}function JZ(e,t,n,r){if(t===null)return e.typeName==`google.protobuf.NullValue`?0:r?e.values[0].no:VZ;switch(typeof t){case`number`:if(Number.isInteger(t))return t;break;case`string`:let r=e.findName(t);if(r!==void 0)return r.no;if(n)return HZ;break}throw Error(`cannot decode enum ${e.typeName} from JSON: ${WZ(t)}`)}function YZ(e){return e.repeated||e.kind==`map`?!0:!(e.oneof||e.kind==`message`||e.opt||e.req)}function XZ(e,t,n){if(e.kind==`map`){kX(typeof t==`object`&&!!t);let o={},s=Object.entries(t);switch(e.V.kind){case`scalar`:for(let t of s){var r=hZ(t,2);let n=r[0],i=r[1];o[n.toString()]=QZ(e.V.T,i)}break;case`message`:for(let e of s){var i=hZ(e,2);let t=i[0],r=i[1];o[t.toString()]=r.toJson(n)}break;case`enum`:let t=e.V.T;for(let e of s){var a=hZ(e,2);let r=a[0],i=a[1];o[r.toString()]=ZZ(t,i,n.enumAsInteger)}break}return n.emitDefaultValues||s.length>0?o:void 0}if(e.repeated){kX(Array.isArray(t));let r=[];switch(e.kind){case`scalar`:for(let n=0;n<t.length;n++)r.push(QZ(e.T,t[n]));break;case`enum`:for(let i=0;i<t.length;i++)r.push(ZZ(e.T,t[i],n.enumAsInteger));break;case`message`:for(let e=0;e<t.length;e++)r.push(t[e].toJson(n));break}return n.emitDefaultValues||r.length>0?r:void 0}switch(e.kind){case`scalar`:return QZ(e.T,t);case`enum`:return ZZ(e.T,t,n.enumAsInteger);case`message`:return IZ(e.T,t).toJson(n)}}function ZZ(e,t,n){return kX(typeof t==`number`),e.typeName==`google.protobuf.NullValue`?null:n?t:e.findNumber(t)?.name??t}function QZ(e,t){switch(e){case K.INT32:case K.SFIXED32:case K.SINT32:case K.FIXED32:case K.UINT32:return kX(typeof t==`number`),t;case K.FLOAT:case K.DOUBLE:return kX(typeof t==`number`),Number.isNaN(t)?`NaN`:t===1/0?`Infinity`:t===-1/0?`-Infinity`:t;case K.STRING:return kX(typeof t==`string`),t;case K.BOOL:return kX(typeof t==`boolean`),t;case K.UINT64:case K.FIXED64:case K.INT64:case K.SFIXED64:case K.SINT64:return kX(typeof t==`bigint`||typeof t==`string`||typeof t==`number`),t.toString();case K.BYTES:return kX(t instanceof Uint8Array),OZ.enc(t)}}var $Z=Symbol(`@bufbuild/protobuf/unknown-fields`),eQ={readUnknownFields:!0,readerFactory:e=>new xZ(e)},tQ={writeUnknownFields:!0,writerFactory:()=>new bZ};function nQ(e){return e?Object.assign(Object.assign({},eQ),e):eQ}function rQ(e){return e?Object.assign(Object.assign({},tQ),e):tQ}function iQ(){return{makeReadOptions:nQ,makeWriteOptions:rQ,listUnknownFields(e){return e[$Z]??[]},discardUnknownFields(e){delete e[$Z]},writeUnknownFields(e,t){let n=e[$Z];if(n)for(let e of n)t.tag(e.no,e.wireType).raw(e.data)},onUnknownField(e,t,n,r){let i=e;Array.isArray(i[$Z])||(i[$Z]=[]),i[$Z].push({no:t,wireType:n,data:r})},readMessage(e,t,n,r,i){let a=e.getType(),o=i?t.len:t.pos+n,s,c;for(;t.pos<o;){var l=hZ(t.tag(),2);if(s=l[0],c=l[1],i===!0&&c==yZ.EndGroup)break;let n=a.fields.find(s);if(!n){let n=t.skip(c,s);r.readUnknownFields&&this.onUnknownField(e,s,c,n);continue}aQ(e,t,n,c,r)}if(i&&(c!=yZ.EndGroup||s!==n))throw Error(`invalid end group tag`)},readField:aQ,writeMessage(e,t,n){let r=e.getType();for(let i of r.fields.byNumber()){if(!NZ(i,e)){if(i.req)throw Error(`cannot encode field ${r.typeName}.${i.name} to binary: required field not set`);continue}uQ(i,i.oneof?e[i.oneof.localName].value:e[i.localName],t,n)}return n.writeUnknownFields&&this.writeUnknownFields(e,t),t},writeField(e,t,n,r){t!==void 0&&uQ(e,t,n,r)}}}function aQ(e,t,n,r,i){let a=n.repeated,o=n.localName;switch(n.oneof&&(e=e[n.oneof.localName],e.case!=o&&delete e.value,e.case=o,o=`value`),n.kind){case`scalar`:case`enum`:let s=n.kind==`enum`?K.INT32:n.T,c=lQ;if(n.kind==`scalar`&&n.L>0&&(c=cQ),a){let n=e[o];if(r==yZ.LengthDelimited&&s!=K.STRING&&s!=K.BYTES){let e=t.uint32()+t.pos;for(;t.pos<e;)n.push(c(t,s))}else n.push(c(t,s))}else e[o]=c(t,s);break;case`message`:let l=n.T;a?e[o].push(oQ(t,new l,i,n)):FZ(e[o])?oQ(t,e[o],i,n):(e[o]=oQ(t,new l,i,n),l.fieldWrapper&&!n.oneof&&!n.repeated&&(e[o]=l.fieldWrapper.unwrapField(e[o])));break;case`map`:let u=hZ(sQ(n,t,i),2),d=u[0],f=u[1];e[o][d]=f;break}}function oQ(e,t,n,r){let i=t.getType().runtime.bin,a=r?.delimited;return i.readMessage(t,e,a?r.no:e.uint32(),n,a),t}function sQ(e,t,n){let r=t.uint32(),i=t.pos+r,a,o;for(;t.pos<i;)switch(hZ(t.tag(),1)[0]){case 1:a=lQ(t,e.K);break;case 2:switch(e.V.kind){case`scalar`:o=lQ(t,e.V.T);break;case`enum`:o=t.int32();break;case`message`:o=oQ(t,new e.V.T,n,void 0);break}break}if(a===void 0&&(a=cZ(e.K,oZ.BIGINT)),typeof a!=`string`&&typeof a!=`number`&&(a=a.toString()),o===void 0)switch(e.V.kind){case`scalar`:o=cZ(e.V.T,oZ.BIGINT);break;case`enum`:o=e.V.T.values[0].no;break;case`message`:o=new e.V.T;break}return[a,o]}function cQ(e,t){let n=lQ(e,t);return typeof n==`bigint`?n.toString():n}function lQ(e,t){switch(t){case K.STRING:return e.string();case K.BOOL:return e.bool();case K.DOUBLE:return e.double();case K.FLOAT:return e.float();case K.INT32:return e.int32();case K.INT64:return e.int64();case K.UINT64:return e.uint64();case K.FIXED64:return e.fixed64();case K.BYTES:return e.bytes();case K.FIXED32:return e.fixed32();case K.SFIXED32:return e.sfixed32();case K.SFIXED64:return e.sfixed64();case K.SINT64:return e.sint64();case K.UINT32:return e.uint32();case K.SINT32:return e.sint32()}}function uQ(e,t,n,r){kX(t!==void 0);let i=e.repeated;switch(e.kind){case`scalar`:case`enum`:let o=e.kind==`enum`?K.INT32:e.T;if(i)if(kX(Array.isArray(t)),e.packed)mQ(n,o,e.no,t);else for(let r of t)pQ(n,o,e.no,r);else pQ(n,o,e.no,t);break;case`message`:if(i){kX(Array.isArray(t));for(let i of t)fQ(n,r,e,i)}else fQ(n,r,e,t);break;case`map`:kX(typeof t==`object`&&!!t);for(let i of Object.entries(t)){var a=hZ(i,2);let t=a[0],o=a[1];dQ(n,r,e,t,o)}break}}function dQ(e,t,n,r,i){e.tag(n.no,yZ.LengthDelimited),e.fork();let a=r;switch(n.K){case K.INT32:case K.FIXED32:case K.UINT32:case K.SFIXED32:case K.SINT32:a=Number.parseInt(r);break;case K.BOOL:kX(r==`true`||r==`false`),a=r==`true`;break}switch(pQ(e,n.K,1,a),n.V.kind){case`scalar`:pQ(e,n.V.T,2,i);break;case`enum`:pQ(e,K.INT32,2,i);break;case`message`:kX(i!==void 0),e.tag(2,yZ.LengthDelimited).bytes(i.toBinary(t));break}e.join()}function fQ(e,t,n,r){let i=IZ(n.T,r);n.delimited?e.tag(n.no,yZ.StartGroup).raw(i.toBinary(t)).tag(n.no,yZ.EndGroup):e.tag(n.no,yZ.LengthDelimited).bytes(i.toBinary(t))}function pQ(e,t,n,r){kX(r!==void 0);let i=hZ(hQ(t),2),a=i[0],o=i[1];e.tag(n,a)[o](r)}function mQ(e,t,n,r){if(!r.length)return;e.tag(n,yZ.LengthDelimited).fork();let i=hZ(hQ(t),2)[1];for(let t=0;t<r.length;t++)e[i](r[t]);e.join()}function hQ(e){let t=yZ.Varint;switch(e){case K.BYTES:case K.STRING:t=yZ.LengthDelimited;break;case K.DOUBLE:case K.FIXED64:case K.SFIXED64:t=yZ.Bit64;break;case K.FIXED32:case K.SFIXED32:case K.FLOAT:t=yZ.Bit32;break}let n=K[e].toLowerCase();return[t,n]}function gQ(){return{setEnumType:BX,initPartial(e,t){if(e===void 0)return;let n=t.getType();for(let i of n.fields.byMember()){let n=i.localName,a=t,o=e;if(o[n]!=null)switch(i.kind){case`oneof`:let e=o[n].case;if(e===void 0)continue;let t=i.findField(e),s=o[n].value;t&&t.kind==`message`&&!FZ(s,t.T)?s=new t.T(s):t&&t.kind===`scalar`&&t.T===K.BYTES&&(s=vQ(s)),a[n]={case:e,value:s};break;case`scalar`:case`enum`:let c=o[n];i.T===K.BYTES&&(c=i.repeated?c.map(vQ):vQ(c)),a[n]=c;break;case`map`:switch(i.V.kind){case`scalar`:case`enum`:if(i.V.T===K.BYTES)for(let e of Object.entries(o[n])){var r=hZ(e,2);let t=r[0],i=r[1];a[n][t]=vQ(i)}else Object.assign(a[n],o[n]);break;case`message`:let e=i.V.T;for(let t of Object.keys(o[n])){let r=o[n][t];e.fieldWrapper||(r=new e(r)),a[n][t]=r}break}break;case`message`:let l=i.T;if(i.repeated)a[n]=o[n].map(e=>FZ(e,l)?e:new l(e));else{let e=o[n];l.fieldWrapper?l.typeName===`google.protobuf.BytesValue`?a[n]=vQ(e):a[n]=e:a[n]=FZ(e,l)?e:new l(e)}break}}},equals(e,t,n){return t===n?!0:!t||!n?!1:e.fields.byMember().every(e=>{let r=t[e.localName],i=n[e.localName];if(e.repeated){if(r.length!==i.length)return!1;switch(e.kind){case`message`:return r.every((t,n)=>e.T.equals(t,i[n]));case`scalar`:return r.every((t,n)=>sZ(e.T,t,i[n]));case`enum`:return r.every((e,t)=>sZ(K.INT32,e,i[t]))}throw Error(`repeated cannot contain ${e.kind}`)}switch(e.kind){case`message`:let t=r,n=i;return e.T.fieldWrapper&&(t!==void 0&&!FZ(t)&&(t=e.T.fieldWrapper.wrapField(t)),n!==void 0&&!FZ(n)&&(n=e.T.fieldWrapper.wrapField(n))),e.T.equals(t,n);case`enum`:return sZ(K.INT32,r,i);case`scalar`:return sZ(e.T,r,i);case`oneof`:if(r.case!==i.case)return!1;let a=e.findField(r.case);if(a===void 0)return!0;switch(a.kind){case`message`:return a.T.equals(r.value,i.value);case`enum`:return sZ(K.INT32,r.value,i.value);case`scalar`:return sZ(a.T,r.value,i.value)}throw Error(`oneof cannot contain ${a.kind}`);case`map`:let o=Object.keys(r).concat(Object.keys(i));switch(e.V.kind){case`message`:let t=e.V.T;return o.every(e=>t.equals(r[e],i[e]));case`enum`:return o.every(e=>sZ(K.INT32,r[e],i[e]));case`scalar`:let n=e.V.T;return o.every(e=>sZ(n,r[e],i[e]))}break}})},clone(e){let t=e.getType(),n=new t,r=n;for(let n of t.fields.byMember()){let t=e[n.localName],a;if(n.repeated)a=t.map(_Q);else if(n.kind==`map`){a=r[n.localName];for(let e of Object.entries(t)){var i=hZ(e,2);let t=i[0],n=i[1];a[t]=_Q(n)}}else a=n.kind==`oneof`?n.findField(t.case)?{case:t.case,value:_Q(t.value)}:{case:void 0}:_Q(t);r[n.localName]=a}for(let n of t.runtime.bin.listUnknownFields(e))t.runtime.bin.onUnknownField(r,n.no,n.wireType,n.data);return n}}}function _Q(e){if(e===void 0)return e;if(FZ(e))return e.clone();if(e instanceof Uint8Array){let t=new Uint8Array(e.byteLength);return t.set(e),t}return e}function vQ(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function yQ(e,t,n){return{syntax:e,json:UZ(),bin:iQ(),util:Object.assign(Object.assign({},gQ()),{newFieldList:t,initFields:n}),makeMessageType(e,t,n){return GX(this,e,t,n)},makeEnum:HX,makeEnumType:VX,getEnumType:zX,makeExtension(e,t,n){return SZ(this,e,t,n)}}}var bQ=class{constructor(e,t){this._fields=e,this._normalizer=t}findJsonName(e){if(!this.jsonNames){let e={};for(let t of this.list())e[t.jsonName]=e[t.name]=t;this.jsonNames=e}return this.jsonNames[e]}find(e){if(!this.numbers){let e={};for(let t of this.list())e[t.no]=t;this.numbers=e}return this.numbers[e]}list(){return this.all||=this._normalizer(this._fields),this.all}byNumber(){return this.numbersAsc||=this.list().concat().sort((e,t)=>e.no-t.no),this.numbersAsc}byMember(){if(!this.members){this.members=[];let e=this.members,t;for(let n of this.list())n.oneof?n.oneof!==t&&(t=n.oneof,e.push(t)):e.push(n)}return this.members}};function xQ(e,t){let n=wQ(e);return t?n:kQ(OQ(n))}function SQ(e){return xQ(e,!1)}var CQ=wQ;function wQ(e){let t=!1,n=[];for(let r=0;r<e.length;r++){let i=e.charAt(r);switch(i){case`_`:t=!0;break;case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:n.push(i),t=!1;break;default:t&&(t=!1,i=i.toUpperCase()),n.push(i);break}}return n.join(``)}var TQ=new Set([`constructor`,`toString`,`toJSON`,`valueOf`]),EQ=new Set([`getType`,`clone`,`equals`,`fromBinary`,`fromJson`,`fromJsonString`,`toBinary`,`toJson`,`toJsonString`,`toObject`]),DQ=e=>`${e}\$`,OQ=e=>EQ.has(e)?DQ(e):e,kQ=e=>TQ.has(e)?DQ(e):e,AQ=class{constructor(e){this.kind=`oneof`,this.repeated=!1,this.packed=!1,this.opt=!1,this.req=!1,this.default=void 0,this.fields=[],this.name=e,this.localName=SQ(e)}addField(e){kX(e.oneof===this,`field ${e.name} not one of ${this.name}`),this.fields.push(e)}findField(e){if(!this._lookup){this._lookup=Object.create(null);for(let e=0;e<this.fields.length;e++)this._lookup[this.fields[e].localName]=this.fields[e]}return this._lookup[e]}};function jQ(e,t){let n=[],r;for(let t of typeof e==`function`?e():e){let e=t;if(e.localName=xQ(t.name,t.oneof!==void 0),e.jsonName=t.jsonName??CQ(t.name),e.repeated=t.repeated??!1,t.kind==`scalar`&&(e.L=t.L??oZ.BIGINT),e.delimited=t.delimited??!1,e.req=t.req??!1,e.opt=t.opt??!1,t.packed===void 0&&(e.packed=t.kind==`enum`||t.kind==`scalar`&&t.T!=K.BYTES&&t.T!=K.STRING),t.oneof!==void 0){let n=typeof t.oneof==`string`?t.oneof:t.oneof.name;(!r||r.name!=n)&&(r=new AQ(n)),e.oneof=r,r.addField(e)}n.push(e)}return n}var q=yQ(`proto3`,e=>new bQ(e,e=>jQ(e)),e=>{for(let t of e.getType().fields.byMember()){if(t.opt)continue;let n=t.localName,r=e;if(t.repeated){r[n]=[];continue}switch(t.kind){case`oneof`:r[n]={case:void 0};break;case`enum`:r[n]=0;break;case`map`:r[n]={};break;case`scalar`:r[n]=cZ(t.T,t.L);break}}}),MQ=class e extends WX{constructor(e){super(),this.seconds=aZ.zero,this.nanos=0,q.util.initPartial(e,this)}fromJson(e,t){if(typeof e!=`string`)throw Error(`cannot decode google.protobuf.Timestamp from JSON: ${q.json.debug(e)}`);let n=e.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/);if(!n)throw Error(`cannot decode google.protobuf.Timestamp from JSON: invalid RFC 3339 string`);let r=Date.parse(n[1]+`-`+n[2]+`-`+n[3]+`T`+n[4]+`:`+n[5]+`:`+n[6]+(n[8]?n[8]:`Z`));if(Number.isNaN(r))throw Error(`cannot decode google.protobuf.Timestamp from JSON: invalid RFC 3339 string`);if(r<Date.parse(`0001-01-01T00:00:00Z`)||r>Date.parse(`9999-12-31T23:59:59Z`))throw Error(`cannot decode message google.protobuf.Timestamp from JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive`);return this.seconds=aZ.parse(r/1e3),this.nanos=0,n[7]&&(this.nanos=parseInt(`1`+n[7]+`0`.repeat(9-n[7].length))-1e9),this}toJson(e){let t=Number(this.seconds)*1e3;if(t<Date.parse(`0001-01-01T00:00:00Z`)||t>Date.parse(`9999-12-31T23:59:59Z`))throw Error(`cannot encode google.protobuf.Timestamp to JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive`);if(this.nanos<0)throw Error(`cannot encode google.protobuf.Timestamp to JSON: nanos must not be negative`);let n=`Z`;if(this.nanos>0){let e=(this.nanos+1e9).toString().substring(1);n=e.substring(3)===`000000`?`.`+e.substring(0,3)+`Z`:e.substring(6)===`000`?`.`+e.substring(0,6)+`Z`:`.`+e+`Z`}return new Date(t).toISOString().replace(`.000Z`,n)}toDate(){return new Date(Number(this.seconds)*1e3+Math.ceil(this.nanos/1e6))}static now(){return e.fromDate(new Date)}static fromDate(t){let n=t.getTime();return new e({seconds:aZ.parse(Math.floor(n/1e3)),nanos:n%1e3*1e6})}static fromBinary(t,n){return new e().fromBinary(t,n)}static fromJson(t,n){return new e().fromJson(t,n)}static fromJsonString(t,n){return new e().fromJsonString(t,n)}static equals(t,n){return q.util.equals(e,t,n)}};MQ.runtime=q,MQ.typeName=`google.protobuf.Timestamp`,MQ.fields=q.util.newFieldList(()=>[{no:1,name:`seconds`,kind:`scalar`,T:3},{no:2,name:`nanos`,kind:`scalar`,T:5}]);var NQ=q.makeMessageType(`livekit.MetricsBatch`,()=>[{no:1,name:`timestamp_ms`,kind:`scalar`,T:3},{no:2,name:`normalized_timestamp`,kind:`message`,T:MQ},{no:3,name:`str_data`,kind:`scalar`,T:9,repeated:!0},{no:4,name:`time_series`,kind:`message`,T:PQ,repeated:!0},{no:5,name:`events`,kind:`message`,T:IQ,repeated:!0}]),PQ=q.makeMessageType(`livekit.TimeSeriesMetric`,()=>[{no:1,name:`label`,kind:`scalar`,T:13},{no:2,name:`participant_identity`,kind:`scalar`,T:13},{no:3,name:`track_sid`,kind:`scalar`,T:13},{no:4,name:`samples`,kind:`message`,T:FQ,repeated:!0},{no:5,name:`rid`,kind:`scalar`,T:13}]),FQ=q.makeMessageType(`livekit.MetricSample`,()=>[{no:1,name:`timestamp_ms`,kind:`scalar`,T:3},{no:2,name:`normalized_timestamp`,kind:`message`,T:MQ},{no:3,name:`value`,kind:`scalar`,T:2}]),IQ=q.makeMessageType(`livekit.EventMetric`,()=>[{no:1,name:`label`,kind:`scalar`,T:13},{no:2,name:`participant_identity`,kind:`scalar`,T:13},{no:3,name:`track_sid`,kind:`scalar`,T:13},{no:4,name:`start_timestamp_ms`,kind:`scalar`,T:3},{no:5,name:`end_timestamp_ms`,kind:`scalar`,T:3,opt:!0},{no:6,name:`normalized_start_timestamp`,kind:`message`,T:MQ},{no:7,name:`normalized_end_timestamp`,kind:`message`,T:MQ,opt:!0},{no:8,name:`metadata`,kind:`scalar`,T:9},{no:9,name:`rid`,kind:`scalar`,T:13}]),LQ=q.makeEnum(`livekit.BackupCodecPolicy`,[{no:0,name:`PREFER_REGRESSION`},{no:1,name:`SIMULCAST`},{no:2,name:`REGRESSION`}]),RQ=q.makeEnum(`livekit.TrackType`,[{no:0,name:`AUDIO`},{no:1,name:`VIDEO`},{no:2,name:`DATA`}]),zQ=q.makeEnum(`livekit.TrackSource`,[{no:0,name:`UNKNOWN`},{no:1,name:`CAMERA`},{no:2,name:`MICROPHONE`}
vendor: 14,050 bytes, line 208
208,{no:3,name:`SCREEN_SHARE`},{no:4,name:`SCREEN_SHARE_AUDIO`}]),BQ=q.makeEnum(`livekit.VideoQuality`,[{no:0,name:`LOW`},{no:1,name:`MEDIUM`},{no:2,name:`HIGH`},{no:3,name:`OFF`}]),VQ=q.makeEnum(`livekit.ConnectionQuality`,[{no:0,name:`POOR`},{no:1,name:`GOOD`},{no:2,name:`EXCELLENT`},{no:3,name:`LOST`}]),HQ=q.makeEnum(`livekit.ClientConfigSetting`,[{no:0,name:`UNSET`},{no:1,name:`DISABLED`},{no:2,name:`ENABLED`}]),UQ=q.makeEnum(`livekit.DisconnectReason`,[{no:0,name:`UNKNOWN_REASON`},{no:1,name:`CLIENT_INITIATED`},{no:2,name:`DUPLICATE_IDENTITY`},{no:3,name:`SERVER_SHUTDOWN`},{no:4,name:`PARTICIPANT_REMOVED`},{no:5,name:`ROOM_DELETED`},{no:6,name:`STATE_MISMATCH`},{no:7,name:`JOIN_FAILURE`},{no:8,name:`MIGRATION`},{no:9,name:`SIGNAL_CLOSE`},{no:10,name:`ROOM_CLOSED`},{no:11,name:`USER_UNAVAILABLE`},{no:12,name:`USER_REJECTED`},{no:13,name:`SIP_TRUNK_FAILURE`},{no:14,name:`CONNECTION_TIMEOUT`},{no:15,name:`MEDIA_FAILURE`},{no:16,name:`AGENT_ERROR`}]),WQ=q.makeEnum(`livekit.ReconnectReason`,[{no:0,name:`RR_UNKNOWN`},{no:1,name:`RR_SIGNAL_DISCONNECTED`},{no:2,name:`RR_PUBLISHER_FAILED`},{no:3,name:`RR_SUBSCRIBER_FAILED`},{no:4,name:`RR_SWITCH_CANDIDATE`}]),GQ=q.makeEnum(`livekit.SubscriptionError`,[{no:0,name:`SE_UNKNOWN`},{no:1,name:`SE_CODEC_UNSUPPORTED`},{no:2,name:`SE_TRACK_NOTFOUND`}]),KQ=q.makeEnum(`livekit.AudioTrackFeature`,[{no:0,name:`TF_STEREO`},{no:1,name:`TF_NO_DTX`},{no:2,name:`TF_AUTO_GAIN_CONTROL`},{no:3,name:`TF_ECHO_CANCELLATION`},{no:4,name:`TF_NOISE_SUPPRESSION`},{no:5,name:`TF_ENHANCED_NOISE_CANCELLATION`},{no:6,name:`TF_PRECONNECT_BUFFER`}]),qQ=q.makeEnum(`livekit.PacketTrailerFeature`,[{no:0,name:`PTF_USER_TIMESTAMP`},{no:1,name:`PTF_FRAME_ID`}]),JQ=q.makeMessageType(`livekit.Room`,()=>[{no:1,name:`sid`,kind:`scalar`,T:9},{no:2,name:`name`,kind:`scalar`,T:9},{no:3,name:`empty_timeout`,kind:`scalar`,T:13},{no:14,name:`departure_timeout`,kind:`scalar`,T:13},{no:4,name:`max_participants`,kind:`scalar`,T:13},{no:5,name:`creation_time`,kind:`scalar`,T:3},{no:15,name:`creation_time_ms`,kind:`scalar`,T:3},{no:6,name:`turn_password`,kind:`scalar`,T:9},{no:7,name:`enabled_codecs`,kind:`message`,T:YQ,repeated:!0},{no:8,name:`metadata`,kind:`scalar`,T:9},{no:9,name:`num_participants`,kind:`scalar`,T:13},{no:11,name:`num_publishers`,kind:`scalar`,T:13},{no:10,name:`active_recording`,kind:`scalar`,T:8},{no:13,name:`version`,kind:`message`,T:M$}]),YQ=q.makeMessageType(`livekit.Codec`,()=>[{no:1,name:`mime`,kind:`scalar`,T:9},{no:2,name:`fmtp_line`,kind:`scalar`,T:9}]),XQ=q.makeMessageType(`livekit.ParticipantPermission`,()=>[{no:1,name:`can_subscribe`,kind:`scalar`,T:8},{no:2,name:`can_publish`,kind:`scalar`,T:8},{no:3,name:`can_publish_data`,kind:`scalar`,T:8},{no:9,name:`can_publish_sources`,kind:`enum`,T:q.getEnumType(zQ),repeated:!0},{no:7,name:`hidden`,kind:`scalar`,T:8},{no:8,name:`recorder`,kind:`scalar`,T:8},{no:10,name:`can_update_metadata`,kind:`scalar`,T:8},{no:11,name:`agent`,kind:`scalar`,T:8},{no:12,name:`can_subscribe_metrics`,kind:`scalar`,T:8},{no:13,name:`can_manage_agent_session`,kind:`scalar`,T:8}]),ZQ=q.makeMessageType(`livekit.ParticipantInfo`,()=>[{no:1,name:`sid`,kind:`scalar`,T:9},{no:2,name:`identity`,kind:`scalar`,T:9},{no:3,name:`state`,kind:`enum`,T:q.getEnumType(QQ)},{no:4,name:`tracks`,kind:`message`,T:r$,repeated:!0},{no:5,name:`metadata`,kind:`scalar`,T:9},{no:6,name:`joined_at`,kind:`scalar`,T:3},{no:17,name:`joined_at_ms`,kind:`scalar`,T:3},{no:9,name:`name`,kind:`scalar`,T:9},{no:10,name:`version`,kind:`scalar`,T:13},{no:11,name:`permission`,kind:`message`,T:XQ},{no:12,name:`region`,kind:`scalar`,T:9},{no:13,name:`is_publisher`,kind:`scalar`,T:8},{no:14,name:`kind`,kind:`enum`,T:q.getEnumType($Q)},{no:15,name:`attributes`,kind:`map`,K:9,V:{kind:`scalar`,T:9}},{no:16,name:`disconnect_reason`,kind:`enum`,T:q.getEnumType(UQ)},{no:18,name:`kind_details`,kind:`enum`,T:q.getEnumType(e$),repeated:!0},{no:19,name:`data_tracks`,kind:`message`,T:i$,repeated:!0},{no:20,name:`client_protocol`,kind:`scalar`,T:5}]),QQ=q.makeEnum(`livekit.ParticipantInfo.State`,[{no:0,name:`JOINING`},{no:1,name:`JOINED`},{no:2,name:`ACTIVE`},{no:3,name:`DISCONNECTED`}]),$Q=q.makeEnum(`livekit.ParticipantInfo.Kind`,[{no:0,name:`STANDARD`},{no:1,name:`INGRESS`},{no:2,name:`EGRESS`},{no:3,name:`SIP`},{no:4,name:`AGENT`},{no:7,name:`CONNECTOR`},{no:8,name:`BRIDGE`}]),e$=q.makeEnum(`livekit.ParticipantInfo.KindDetail`,[{no:0,name:`CLOUD_AGENT`},{no:1,name:`FORWARDED`},{no:2,name:`CONNECTOR_WHATSAPP`},{no:3,name:`CONNECTOR_TWILIO`},{no:4,name:`BRIDGE_RTSP`}]),t$=q.makeEnum(`livekit.Encryption.Type`,[{no:0,name:`NONE`},{no:1,name:`GCM`},{no:2,name:`CUSTOM`}]),n$=q.makeMessageType(`livekit.SimulcastCodecInfo`,()=>[{no:1,name:`mime_type`,kind:`scalar`,T:9},{no:2,name:`mid`,kind:`scalar`,T:9},{no:3,name:`cid`,kind:`scalar`,T:9},{no:4,name:`layers`,kind:`message`,T:o$,repeated:!0},{no:5,name:`video_layer_mode`,kind:`enum`,T:q.getEnumType(s$)},{no:6,name:`sdp_cid`,kind:`scalar`,T:9}]),r$=q.makeMessageType(`livekit.TrackInfo`,()=>[{no:1,name:`sid`,kind:`scalar`,T:9},{no:2,name:`type`,kind:`enum`,T:q.getEnumType(RQ)},{no:3,name:`name`,kind:`scalar`,T:9},{no:4,name:`muted`,kind:`scalar`,T:8},{no:5,name:`width`,kind:`scalar`,T:13},{no:6,name:`height`,kind:`scalar`,T:13},{no:7,name:`simulcast`,kind:`scalar`,T:8},{no:8,name:`disable_dtx`,kind:`scalar`,T:8},{no:9,name:`source`,kind:`enum`,T:q.getEnumType(zQ)},{no:10,name:`layers`,kind:`message`,T:o$,repeated:!0},{no:11,name:`mime_type`,kind:`scalar`,T:9},{no:12,name:`mid`,kind:`scalar`,T:9},{no:13,name:`codecs`,kind:`message`,T:n$,repeated:!0},{no:14,name:`stereo`,kind:`scalar`,T:8},{no:15,name:`disable_red`,kind:`scalar`,T:8},{no:16,name:`encryption`,kind:`enum`,T:q.getEnumType(t$)},{no:17,name:`stream`,kind:`scalar`,T:9},{no:18,name:`version`,kind:`message`,T:M$},{no:19,name:`audio_features`,kind:`enum`,T:q.getEnumType(KQ),repeated:!0},{no:20,name:`backup_codec_policy`,kind:`enum`,T:q.getEnumType(LQ)},{no:21,name:`packet_trailer_features`,kind:`enum`,T:q.getEnumType(qQ),repeated:!0}]),i$=q.makeMessageType(`livekit.DataTrackInfo`,()=>[{no:1,name:`pub_handle`,kind:`scalar`,T:13},{no:2,name:`sid`,kind:`scalar`,T:9},{no:3,name:`name`,kind:`scalar`,T:9},{no:4,name:`encryption`,kind:`enum`,T:q.getEnumType(t$)}]),a$=q.makeMessageType(`livekit.DataTrackSubscriptionOptions`,()=>[{no:1,name:`target_fps`,kind:`scalar`,T:13,opt:!0}]),o$=q.makeMessageType(`livekit.VideoLayer`,()=>[{no:1,name:`quality`,kind:`enum`,T:q.getEnumType(BQ)},{no:2,name:`width`,kind:`scalar`,T:13},{no:3,name:`height`,kind:`scalar`,T:13},{no:4,name:`bitrate`,kind:`scalar`,T:13},{no:5,name:`ssrc`,kind:`scalar`,T:13},{no:6,name:`spatial_layer`,kind:`scalar`,T:5},{no:7,name:`rid`,kind:`scalar`,T:9},{no:8,name:`repair_ssrc`,kind:`scalar`,T:13}]),s$=q.makeEnum(`livekit.VideoLayer.Mode`,[{no:0,name:`MODE_UNUSED`},{no:1,name:`ONE_SPATIAL_LAYER_PER_STREAM`},{no:2,name:`MULTIPLE_SPATIAL_LAYERS_PER_STREAM`},{no:3,name:`ONE_SPATIAL_LAYER_PER_STREAM_INCOMPLETE_RTCP_SR`}]),c$=q.makeMessageType(`livekit.DataPacket`,()=>[{no:1,name:`kind`,kind:`enum`,T:q.getEnumType(l$)},{no:4,name:`participant_identity`,kind:`scalar`,T:9},{no:5,name:`destination_identities`,kind:`scalar`,T:9,repeated:!0},{no:2,name:`user`,kind:`message`,T:m$,oneof:`value`},{no:3,name:`speaker`,kind:`message`,T:f$,oneof:`value`},{no:6,name:`sip_dtmf`,kind:`message`,T:h$,oneof:`value`},{no:7,name:`transcription`,kind:`message`,T:g$,oneof:`value`},{no:8,name:`metrics`,kind:`message`,T:NQ,oneof:`value`},{no:9,name:`chat_message`,kind:`message`,T:v$,oneof:`value`},{no:10,name:`rpc_request`,kind:`message`,T:y$,oneof:`value`},{no:11,name:`rpc_ack`,kind:`message`,T:b$,oneof:`value`},{no:12,name:`rpc_response`,kind:`message`,T:x$,oneof:`value`},{no:13,name:`stream_header`,kind:`message`,T:I$,oneof:`value`},{no:14,name:`stream_chunk`,kind:`message`,T:L$,oneof:`value`},{no:15,name:`stream_trailer`,kind:`message`,T:R$,oneof:`value`},{no:18,name:`encrypted_packet`,kind:`message`,T:u$,oneof:`value`},{no:16,name:`sequence`,kind:`scalar`,T:13},{no:17,name:`participant_sid`,kind:`scalar`,T:9}]),l$=q.makeEnum(`livekit.DataPacket.Kind`,[{no:0,name:`RELIABLE`},{no:1,name:`LOSSY`}]),u$=q.makeMessageType(`livekit.EncryptedPacket`,()=>[{no:1,name:`encryption_type`,kind:`enum`,T:q.getEnumType(t$)},{no:2,name:`iv`,kind:`scalar`,T:12},{no:3,name:`key_index`,kind:`scalar`,T:13},{no:4,name:`encrypted_value`,kind:`scalar`,T:12}]),d$=q.makeMessageType(`livekit.EncryptedPacketPayload`,()=>[{no:1,name:`user`,kind:`message`,T:m$,oneof:`value`},{no:3,name:`chat_message`,kind:`message`,T:v$,oneof:`value`},{no:4,name:`rpc_request`,kind:`message`,T:y$,oneof:`value`},{no:5,name:`rpc_ack`,kind:`message`,T:b$,oneof:`value`},{no:6,name:`rpc_response`,kind:`message`,T:x$,oneof:`value`},{no:7,name:`stream_header`,kind:`message`,T:I$,oneof:`value`},{no:8,name:`stream_chunk`,kind:`message`,T:L$,oneof:`value`},{no:9,name:`stream_trailer`,kind:`message`,T:R$,oneof:`value`}]),f$=q.makeMessageType(`livekit.ActiveSpeakerUpdate`,()=>[{no:1,name:`speakers`,kind:`message`,T:p$,repeated:!0}]),p$=q.makeMessageType(`livekit.SpeakerInfo`,()=>[{no:1,name:`sid`,kind:`scalar`,T:9},{no:2,name:`level`,kind:`scalar`,T:2},{no:3,name:`active`,kind:`scalar`,T:8}]),m$=q.makeMessageType(`livekit.UserPacket`,()=>[{no:1,name:`participant_sid`,kind:`scalar`,T:9},{no:5,name:`participant_identity`,kind:`scalar`,T:9},{no:2,name:`payload`,kind:`scalar`,T:12},{no:3,name:`destination_sids`,kind:`scalar`,T:9,repeated:!0},{no:6,name:`destination_identities`,kind:`scalar`,T:9,repeated:!0},{no:4,name:`topic`,kind:`scalar`,T:9,opt:!0},{no:8,name:`id`,kind:`scalar`,T:9,opt:!0},{no:9,name:`start_time`,kind:`scalar`,T:4,opt:!0},{no:10,name:`end_time`,kind:`scalar`,T:4,opt:!0},{no:11,name:`nonce`,kind:`scalar`,T:12}]),h$=q.makeMessageType(`livekit.SipDTMF`,()=>[{no:3,name:`code`,kind:`scalar`,T:13},{no:4,name:`digit`,kind:`scalar`,T:9}]),g$=q.makeMessageType(`livekit.Transcription`,()=>[{no:2,name:`transcribed_participant_identity`,kind:`scalar`,T:9},{no:3,name:`track_id`,kind:`scalar`,T:9},{no:4,name:`segments`,kind:`message`,T:_$,repeated:!0}]),_$=q.makeMessageType(`livekit.TranscriptionSegment`,()=>[{no:1,name:`id`,kind:`scalar`,T:9},{no:2,name:`text`,kind:`scalar`,T:9},{no:3,name:`start_time`,kind:`scalar`,T:4},{no:4,name:`end_time`,kind:`scalar`,T:4},{no:5,name:`final`,kind:`scalar`,T:8},{no:6,name:`language`,kind:`scalar`,T:9}]),v$=q.makeMessageType(`livekit.ChatMessage`,()=>[{no:1,name:`id`,kind:`scalar`,T:9},{no:2,name:`timestamp`,kind:`scalar`,T:3},{no:3,name:`edit_timestamp`,kind:`scalar`,T:3,opt:!0},{no:4,name:`message`,kind:`scalar`,T:9},{no:5,name:`deleted`,kind:`scalar`,T:8},{no:6,name:`generated`,kind:`scalar`,T:8}]),y$=q.makeMessageType(`livekit.RpcRequest`,()=>[{no:1,name:`id`,kind:`scalar`,T:9},{no:2,name:`method`,kind:`scalar`,T:9},{no:3,name:`payload`,kind:`scalar`,T:9},{no:4,name:`response_timeout_ms`,kind:`scalar`,T:13},{no:5,name:`version`,kind:`scalar`,T:13},{no:6,name:`compressed_payload`,kind:`scalar`,T:12}]),b$=q.makeMessageType(`livekit.RpcAck`,()=>[{no:1,name:`request_id`,kind:`scalar`,T:9}]),x$=q.makeMessageType(`livekit.RpcResponse`,()=>[{no:1,name:`request_id`,kind:`scalar`,T:9},{no:2,name:`payload`,kind:`scalar`,T:9,oneof:`value`},{no:3,name:`error`,kind:`message`,T:S$,oneof:`value`},{no:4,name:`compressed_payload`,kind:`scalar`,T:12,oneof:`value`}]),S$=q.makeMessageType(`livekit.RpcError`,()=>[{no:1,name:`code`,kind:`scalar`,T:13},{no:2,name:`message`,kind:`scalar`,T:9},{no:3,name:`data`,kind:`scalar`,T:9}]),C$=q.makeMessageType(`livekit.ParticipantTracks`,()=>[{no:1,name:`participant_sid`,kind:`scalar`,T:9},{no:2,name:`track_sids`,kind:`scalar`,T:9,repeated:!0}]),w$=q.makeMessageType(`livekit.ServerInfo`,()=>[{no:1,name:`edition`,kind:`enum`,T:q.getEnumType(T$)},{no:2,name:`version`,kind:`scalar`,T:9},{no:3,name:`protocol`,kind:`scalar`,T:5},{no:4,name:`region`,kind:`scalar`,T:9},{no:5,name:`node_id`,kind:`scalar`,T:9},{no:6,name:`debug_info`,kind:`scalar`,T:9},{no:7,name:`agent_protocol`,kind:`scalar`,T:5}]),T$=q.makeEnum(`livekit.ServerInfo.Edition`,[{no:0,name:`Standard`},{no:1,name:`Cloud`}]),E$=q.makeMessageType(`livekit.ClientInfo`,()=>[{no:1,name:`sdk`,kind:`enum`,T:q.getEnumType(D$)},{no:2,name:`version`,kind:`scalar`,T:9},{no:3,name:`protocol`,kind:`scalar`,T:5},{no:4,name:`os`,kind:`scalar`,T:9},{no:5,name:`os_version`,kind:`scalar`,T:9},{no:6,name:`device_model`,kind:`scalar`,T:9},{no:7,name:`browser`,kind:`scalar`,T:9},{no:8,name:`browser_version`,kind:`scalar`,T:9},{no:9,name:`address`,kind:`scalar`,T:9},{no:10,name:`network`,kind:`scalar`,T:9},{no:11,name:`other_sdks`,kind:`scalar`,T:9},{no:12,name:`client_protocol`,kind:`scalar`,T:5},{no:13,name:`capabilities`,kind:`enum`,T:q.getEnumType(O$),repeated:!0}]),D$=q.makeEnum(`livekit.ClientInfo.SDK`,[{no:0,name:`UNKNOWN`},{no:1,name:`JS`},{no:2,name:`SWIFT`},{no:3,name:`ANDROID`},{no:4,name:`FLUTTER`},{no:5,name:`GO`},{no:6,name:`UNITY`},{no:7,name:`REACT_NATIVE`},{no:8,name:`RUST`},{no:9,name:`PYTHON`},{no:10,name:`CPP`},{no:11,name:`UNITY_WEB`},{no:12,name:`NODE`},{no:13,name:`UNREAL`},{no:14,name:`ESP32`}]),O$=q.makeEnum(`livekit.ClientInfo.Capability`,[{no:0,name:`CAP_UNUSED`},{no:1,name:`CAP_PACKET_TRAILER`}]),k$=q.makeMessageType(`livekit.ClientConfiguration`,()=>[{no:1,name:`video`,kind:`message`,T:A$},{no:2,name:`screen`,kind:`message`,T:A$},{no:3,name:`resume_connection`,kind:`enum`,T:q.getEnumType(HQ)},{no:4,name:`disabled_codecs`,kind:`message`,T:j$},{no:5,name:`force_relay`,kind:`enum`,T:q.getEnumType(HQ)}]),A$=q.makeMessageType(`livekit.VideoConfiguration`,()=>[{no:1,name:`hardware_encoder`,kind:`enum`,T:q.getEnumType(HQ)}]),j$=q.makeMessageType(`livekit.DisabledCodecs`,()=>[{no:1,name:`codecs`,kind:`message`,T:YQ,repeated:!0},{no:2,name:`publish`,kind:`message`,T:YQ,repeated:!0}]),M$=q.makeMessageType(`livekit.TimedVersion`,()=>[{no:1,name:`unix_micro`,kind:`scalar`,T:3},{no:2,name:`ticks`,kind:`scalar`,T:5}]),N$=q.makeEnum(`livekit.DataStream.OperationType`,[{no:0,name:`CREATE`},{no:1,name:`UPDATE`}
vendor: 16,384 bytes, line 208
208,{no:2,name:`DELETE`},{no:3,name:`REACTION`}]),P$=q.makeMessageType(`livekit.DataStream.TextHeader`,()=>[{no:1,name:`operation_type`,kind:`enum`,T:q.getEnumType(N$)},{no:2,name:`version`,kind:`scalar`,T:5},{no:3,name:`reply_to_stream_id`,kind:`scalar`,T:9},{no:4,name:`attached_stream_ids`,kind:`scalar`,T:9,repeated:!0},{no:5,name:`generated`,kind:`scalar`,T:8}],{localName:`DataStream_TextHeader`}),F$=q.makeMessageType(`livekit.DataStream.ByteHeader`,()=>[{no:1,name:`name`,kind:`scalar`,T:9}],{localName:`DataStream_ByteHeader`}),I$=q.makeMessageType(`livekit.DataStream.Header`,()=>[{no:1,name:`stream_id`,kind:`scalar`,T:9},{no:2,name:`timestamp`,kind:`scalar`,T:3},{no:3,name:`topic`,kind:`scalar`,T:9},{no:4,name:`mime_type`,kind:`scalar`,T:9},{no:5,name:`total_length`,kind:`scalar`,T:4,opt:!0},{no:7,name:`encryption_type`,kind:`enum`,T:q.getEnumType(t$)},{no:8,name:`attributes`,kind:`map`,K:9,V:{kind:`scalar`,T:9}},{no:9,name:`text_header`,kind:`message`,T:P$,oneof:`content_header`},{no:10,name:`byte_header`,kind:`message`,T:F$,oneof:`content_header`}],{localName:`DataStream_Header`}),L$=q.makeMessageType(`livekit.DataStream.Chunk`,()=>[{no:1,name:`stream_id`,kind:`scalar`,T:9},{no:2,name:`chunk_index`,kind:`scalar`,T:4},{no:3,name:`content`,kind:`scalar`,T:12},{no:4,name:`version`,kind:`scalar`,T:5},{no:5,name:`iv`,kind:`scalar`,T:12,opt:!0}],{localName:`DataStream_Chunk`}),R$=q.makeMessageType(`livekit.DataStream.Trailer`,()=>[{no:1,name:`stream_id`,kind:`scalar`,T:9},{no:2,name:`reason`,kind:`scalar`,T:9},{no:3,name:`attributes`,kind:`map`,K:9,V:{kind:`scalar`,T:9}}],{localName:`DataStream_Trailer`}),z$=q.makeMessageType(`livekit.SubscribedAudioCodec`,()=>[{no:1,name:`codec`,kind:`scalar`,T:9},{no:2,name:`enabled`,kind:`scalar`,T:8}]),B$=q.makeEnum(`livekit.SignalTarget`,[{no:0,name:`PUBLISHER`},{no:1,name:`SUBSCRIBER`}]),V$=q.makeEnum(`livekit.StreamState`,[{no:0,name:`ACTIVE`},{no:1,name:`PAUSED`}]),H$=q.makeEnum(`livekit.CandidateProtocol`,[{no:0,name:`UDP`},{no:1,name:`TCP`},{no:2,name:`TLS`}]),U$=q.makeMessageType(`livekit.SignalRequest`,()=>[{no:1,name:`offer`,kind:`message`,T:a1,oneof:`message`},{no:2,name:`answer`,kind:`message`,T:a1,oneof:`message`},{no:3,name:`trickle`,kind:`message`,T:$$,oneof:`message`},{no:4,name:`add_track`,kind:`message`,T:K$,oneof:`message`},{no:5,name:`mute`,kind:`message`,T:e1,oneof:`message`},{no:6,name:`subscription`,kind:`message`,T:s1,oneof:`message`},{no:7,name:`track_setting`,kind:`message`,T:u1,oneof:`message`},{no:8,name:`leave`,kind:`message`,T:p1,oneof:`message`},{no:10,name:`update_layers`,kind:`message`,T:h1,oneof:`message`},{no:11,name:`subscription_permission`,kind:`message`,T:k1,oneof:`message`},{no:12,name:`sync_state`,kind:`message`,T:M1,oneof:`message`},{no:13,name:`simulate`,kind:`message`,T:F1,oneof:`message`},{no:14,name:`ping`,kind:`scalar`,T:3,oneof:`message`},{no:15,name:`update_metadata`,kind:`message`,T:g1,oneof:`message`},{no:16,name:`ping_req`,kind:`message`,T:I1,oneof:`message`},{no:17,name:`update_audio_track`,kind:`message`,T:d1,oneof:`message`},{no:18,name:`update_video_track`,kind:`message`,T:f1,oneof:`message`},{no:19,name:`publish_data_track_request`,kind:`message`,T:q$,oneof:`message`},{no:20,name:`unpublish_data_track_request`,kind:`message`,T:Y$,oneof:`message`},{no:21,name:`update_data_subscription`,kind:`message`,T:c1,oneof:`message`}]),W$=q.makeMessageType(`livekit.SignalResponse`,()=>[{no:1,name:`join`,kind:`message`,T:t1,oneof:`message`},{no:2,name:`answer`,kind:`message`,T:a1,oneof:`message`},{no:3,name:`offer`,kind:`message`,T:a1,oneof:`message`},{no:4,name:`trickle`,kind:`message`,T:$$,oneof:`message`},{no:5,name:`update`,kind:`message`,T:o1,oneof:`message`},{no:6,name:`track_published`,kind:`message`,T:r1,oneof:`message`},{no:8,name:`leave`,kind:`message`,T:p1,oneof:`message`},{no:9,name:`mute`,kind:`message`,T:e1,oneof:`message`},{no:10,name:`speakers_changed`,kind:`message`,T:v1,oneof:`message`},{no:11,name:`room_update`,kind:`message`,T:y1,oneof:`message`},{no:12,name:`connection_quality`,kind:`message`,T:x1,oneof:`message`},{no:13,name:`stream_state_update`,kind:`message`,T:C1,oneof:`message`},{no:14,name:`subscribed_quality_update`,kind:`message`,T:E1,oneof:`message`},{no:15,name:`subscription_permission_update`,kind:`message`,T:A1,oneof:`message`},{no:16,name:`refresh_token`,kind:`scalar`,T:9,oneof:`message`},{no:17,name:`track_unpublished`,kind:`message`,T:i1,oneof:`message`},{no:18,name:`pong`,kind:`scalar`,T:3,oneof:`message`},{no:19,name:`reconnect`,kind:`message`,T:n1,oneof:`message`},{no:20,name:`pong_resp`,kind:`message`,T:L1,oneof:`message`},{no:21,name:`subscription_response`,kind:`message`,T:B1,oneof:`message`},{no:22,name:`request_response`,kind:`message`,T:V1,oneof:`message`},{no:23,name:`track_subscribed`,kind:`message`,T:U1,oneof:`message`},{no:24,name:`room_moved`,kind:`message`,T:j1,oneof:`message`},{no:25,name:`media_sections_requirement`,kind:`message`,T:J1,oneof:`message`},{no:26,name:`subscribed_audio_codec_update`,kind:`message`,T:D1,oneof:`message`},{no:27,name:`publish_data_track_response`,kind:`message`,T:J$,oneof:`message`},{no:28,name:`unpublish_data_track_response`,kind:`message`,T:X$,oneof:`message`},{no:29,name:`data_track_subscriber_handles`,kind:`message`,T:Z$,oneof:`message`}]),G$=q.makeMessageType(`livekit.SimulcastCodec`,()=>[{no:1,name:`codec`,kind:`scalar`,T:9},{no:2,name:`cid`,kind:`scalar`,T:9},{no:4,name:`layers`,kind:`message`,T:o$,repeated:!0},{no:5,name:`video_layer_mode`,kind:`enum`,T:q.getEnumType(s$)}]),K$=q.makeMessageType(`livekit.AddTrackRequest`,()=>[{no:1,name:`cid`,kind:`scalar`,T:9},{no:2,name:`name`,kind:`scalar`,T:9},{no:3,name:`type`,kind:`enum`,T:q.getEnumType(RQ)},{no:4,name:`width`,kind:`scalar`,T:13},{no:5,name:`height`,kind:`scalar`,T:13},{no:6,name:`muted`,kind:`scalar`,T:8},{no:7,name:`disable_dtx`,kind:`scalar`,T:8},{no:8,name:`source`,kind:`enum`,T:q.getEnumType(zQ)},{no:9,name:`layers`,kind:`message`,T:o$,repeated:!0},{no:10,name:`simulcast_codecs`,kind:`message`,T:G$,repeated:!0},{no:11,name:`sid`,kind:`scalar`,T:9},{no:12,name:`stereo`,kind:`scalar`,T:8},{no:13,name:`disable_red`,kind:`scalar`,T:8},{no:14,name:`encryption`,kind:`enum`,T:q.getEnumType(t$)},{no:15,name:`stream`,kind:`scalar`,T:9},{no:16,name:`backup_codec_policy`,kind:`enum`,T:q.getEnumType(LQ)},{no:17,name:`audio_features`,kind:`enum`,T:q.getEnumType(KQ),repeated:!0},{no:18,name:`packet_trailer_features`,kind:`enum`,T:q.getEnumType(qQ),repeated:!0}]),q$=q.makeMessageType(`livekit.PublishDataTrackRequest`,()=>[{no:1,name:`pub_handle`,kind:`scalar`,T:13},{no:2,name:`name`,kind:`scalar`,T:9},{no:3,name:`encryption`,kind:`enum`,T:q.getEnumType(t$)}]),J$=q.makeMessageType(`livekit.PublishDataTrackResponse`,()=>[{no:1,name:`info`,kind:`message`,T:i$}]),Y$=q.makeMessageType(`livekit.UnpublishDataTrackRequest`,()=>[{no:1,name:`pub_handle`,kind:`scalar`,T:13}]),X$=q.makeMessageType(`livekit.UnpublishDataTrackResponse`,()=>[{no:1,name:`info`,kind:`message`,T:i$}]),Z$=q.makeMessageType(`livekit.DataTrackSubscriberHandles`,()=>[{no:1,name:`sub_handles`,kind:`map`,K:13,V:{kind:`message`,T:Q$}}]),Q$=q.makeMessageType(`livekit.DataTrackSubscriberHandles.PublishedDataTrack`,()=>[{no:1,name:`publisher_identity`,kind:`scalar`,T:9},{no:2,name:`publisher_sid`,kind:`scalar`,T:9},{no:3,name:`track_sid`,kind:`scalar`,T:9}],{localName:`DataTrackSubscriberHandles_PublishedDataTrack`}),$$=q.makeMessageType(`livekit.TrickleRequest`,()=>[{no:1,name:`candidateInit`,kind:`scalar`,T:9},{no:2,name:`target`,kind:`enum`,T:q.getEnumType(B$)},{no:3,name:`final`,kind:`scalar`,T:8}]),e1=q.makeMessageType(`livekit.MuteTrackRequest`,()=>[{no:1,name:`sid`,kind:`scalar`,T:9},{no:2,name:`muted`,kind:`scalar`,T:8}]),t1=q.makeMessageType(`livekit.JoinResponse`,()=>[{no:1,name:`room`,kind:`message`,T:JQ},{no:2,name:`participant`,kind:`message`,T:ZQ},{no:3,name:`other_participants`,kind:`message`,T:ZQ,repeated:!0},{no:4,name:`server_version`,kind:`scalar`,T:9},{no:5,name:`ice_servers`,kind:`message`,T:_1,repeated:!0},{no:6,name:`subscriber_primary`,kind:`scalar`,T:8},{no:7,name:`alternative_url`,kind:`scalar`,T:9},{no:8,name:`client_configuration`,kind:`message`,T:k$},{no:9,name:`server_region`,kind:`scalar`,T:9},{no:10,name:`ping_timeout`,kind:`scalar`,T:5},{no:11,name:`ping_interval`,kind:`scalar`,T:5},{no:12,name:`server_info`,kind:`message`,T:w$},{no:13,name:`sif_trailer`,kind:`scalar`,T:12},{no:14,name:`enabled_publish_codecs`,kind:`message`,T:YQ,repeated:!0},{no:15,name:`fast_publish`,kind:`scalar`,T:8}]),n1=q.makeMessageType(`livekit.ReconnectResponse`,()=>[{no:1,name:`ice_servers`,kind:`message`,T:_1,repeated:!0},{no:2,name:`client_configuration`,kind:`message`,T:k$},{no:3,name:`server_info`,kind:`message`,T:w$},{no:4,name:`last_message_seq`,kind:`scalar`,T:13}]),r1=q.makeMessageType(`livekit.TrackPublishedResponse`,()=>[{no:1,name:`cid`,kind:`scalar`,T:9},{no:2,name:`track`,kind:`message`,T:r$}]),i1=q.makeMessageType(`livekit.TrackUnpublishedResponse`,()=>[{no:1,name:`track_sid`,kind:`scalar`,T:9}]),a1=q.makeMessageType(`livekit.SessionDescription`,()=>[{no:1,name:`type`,kind:`scalar`,T:9},{no:2,name:`sdp`,kind:`scalar`,T:9},{no:3,name:`id`,kind:`scalar`,T:13},{no:4,name:`mid_to_track_id`,kind:`map`,K:9,V:{kind:`scalar`,T:9}}]),o1=q.makeMessageType(`livekit.ParticipantUpdate`,()=>[{no:1,name:`participants`,kind:`message`,T:ZQ,repeated:!0}]),s1=q.makeMessageType(`livekit.UpdateSubscription`,()=>[{no:1,name:`track_sids`,kind:`scalar`,T:9,repeated:!0},{no:2,name:`subscribe`,kind:`scalar`,T:8},{no:3,name:`participant_tracks`,kind:`message`,T:C$,repeated:!0}]),c1=q.makeMessageType(`livekit.UpdateDataSubscription`,()=>[{no:1,name:`updates`,kind:`message`,T:l1,repeated:!0}]),l1=q.makeMessageType(`livekit.UpdateDataSubscription.Update`,()=>[{no:1,name:`track_sid`,kind:`scalar`,T:9},{no:2,name:`subscribe`,kind:`scalar`,T:8},{no:3,name:`options`,kind:`message`,T:a$}],{localName:`UpdateDataSubscription_Update`}),u1=q.makeMessageType(`livekit.UpdateTrackSettings`,()=>[{no:1,name:`track_sids`,kind:`scalar`,T:9,repeated:!0},{no:3,name:`disabled`,kind:`scalar`,T:8},{no:4,name:`quality`,kind:`enum`,T:q.getEnumType(BQ)},{no:5,name:`width`,kind:`scalar`,T:13},{no:6,name:`height`,kind:`scalar`,T:13},{no:7,name:`fps`,kind:`scalar`,T:13},{no:8,name:`priority`,kind:`scalar`,T:13}]),d1=q.makeMessageType(`livekit.UpdateLocalAudioTrack`,()=>[{no:1,name:`track_sid`,kind:`scalar`,T:9},{no:2,name:`features`,kind:`enum`,T:q.getEnumType(KQ),repeated:!0}]),f1=q.makeMessageType(`livekit.UpdateLocalVideoTrack`,()=>[{no:1,name:`track_sid`,kind:`scalar`,T:9},{no:2,name:`width`,kind:`scalar`,T:13},{no:3,name:`height`,kind:`scalar`,T:13}]),p1=q.makeMessageType(`livekit.LeaveRequest`,()=>[{no:1,name:`can_reconnect`,kind:`scalar`,T:8},{no:2,name:`reason`,kind:`enum`,T:q.getEnumType(UQ)},{no:3,name:`action`,kind:`enum`,T:q.getEnumType(m1)},{no:4,name:`regions`,kind:`message`,T:R1}]),m1=q.makeEnum(`livekit.LeaveRequest.Action`,[{no:0,name:`DISCONNECT`},{no:1,name:`RESUME`},{no:2,name:`RECONNECT`}]),h1=q.makeMessageType(`livekit.UpdateVideoLayers`,()=>[{no:1,name:`track_sid`,kind:`scalar`,T:9},{no:2,name:`layers`,kind:`message`,T:o$,repeated:!0}]),g1=q.makeMessageType(`livekit.UpdateParticipantMetadata`,()=>[{no:1,name:`metadata`,kind:`scalar`,T:9},{no:2,name:`name`,kind:`scalar`,T:9},{no:3,name:`attributes`,kind:`map`,K:9,V:{kind:`scalar`,T:9}},{no:4,name:`request_id`,kind:`scalar`,T:13}]),_1=q.makeMessageType(`livekit.ICEServer`,()=>[{no:1,name:`urls`,kind:`scalar`,T:9,repeated:!0},{no:2,name:`username`,kind:`scalar`,T:9},{no:3,name:`credential`,kind:`scalar`,T:9}]),v1=q.makeMessageType(`livekit.SpeakersChanged`,()=>[{no:1,name:`speakers`,kind:`message`,T:p$,repeated:!0}]),y1=q.makeMessageType(`livekit.RoomUpdate`,()=>[{no:1,name:`room`,kind:`message`,T:JQ}]),b1=q.makeMessageType(`livekit.ConnectionQualityInfo`,()=>[{no:1,name:`participant_sid`,kind:`scalar`,T:9},{no:2,name:`quality`,kind:`enum`,T:q.getEnumType(VQ)},{no:3,name:`score`,kind:`scalar`,T:2}]),x1=q.makeMessageType(`livekit.ConnectionQualityUpdate`,()=>[{no:1,name:`updates`,kind:`message`,T:b1,repeated:!0}]),S1=q.makeMessageType(`livekit.StreamStateInfo`,()=>[{no:1,name:`participant_sid`,kind:`scalar`,T:9},{no:2,name:`track_sid`,kind:`scalar`,T:9},{no:3,name:`state`,kind:`enum`,T:q.getEnumType(V$)}]),C1=q.makeMessageType(`livekit.StreamStateUpdate`,()=>[{no:1,name:`stream_states`,kind:`message`,T:S1,repeated:!0}]),w1=q.makeMessageType(`livekit.SubscribedQuality`,()=>[{no:1,name:`quality`,kind:`enum`,T:q.getEnumType(BQ)},{no:2,name:`enabled`,kind:`scalar`,T:8}]),T1=q.makeMessageType(`livekit.SubscribedCodec`,()=>[{no:1,name:`codec`,kind:`scalar`,T:9},{no:2,name:`qualities`,kind:`message`,T:w1,repeated:!0}]),E1=q.makeMessageType(`livekit.SubscribedQualityUpdate`,()=>[{no:1,name:`track_sid`,kind:`scalar`,T:9},{no:2,name:`subscribed_qualities`,kind:`message`,T:w1,repeated:!0},{no:3,name:`subscribed_codecs`,kind:`message`,T:T1,repeated:!0}]),D1=q.makeMessageType(`livekit.SubscribedAudioCodecUpdate`,()=>[{no:1,name:`track_sid`,kind:`scalar`,T:9},{no:2,name:`subscribed_audio_codecs`,kind:`message`,T:z$,repeated:!0}]),O1=q.makeMessageType(`livekit.TrackPermission`,()=>[{no:1,name:`participant_sid`,kind:`scalar`,T:9},{no:2,name:`all_tracks`,kind:`scalar`,T:8},{no:3,name:`track_sids`,kind:`scalar`,T:9,repeated:!0},{no:4,name:`participant_identity`,kind:`scalar`,T:9}]),k1=q.makeMessageType(`livekit.SubscriptionPermission`,()=>[{no:1,name:`all_participants`,kind:`scalar`,T:8},{no:2,name:`track_permissions`,kind:`message`,T:O1,repeated:!0}]),A1=q.makeMessageType(`livekit.SubscriptionPermissionUpdate`,()=>[{no:1,name:`participant_sid`,kind:`scalar`,T:9},{no:2,name:`track_sid`,kind:`scalar`,T:9},{no:3,name:`allowed`,kind:`scalar`,T:8}]),j1=q.makeMessageType(`livekit.RoomMovedResponse`,()=>[{no:1,name:`room`,kind:`message`,T:JQ},{no:2,name:`token`,kind:`scalar`,T:9},{no:3,name:`participant`,kind:`message`,T:ZQ},{no:4,name:`other_participants`,kind:`message`,T:ZQ,repeated:!0}]),M1=q.makeMessageType(`livekit.SyncState`,()=>[{no:1,name:`answer`,kind:`message`,T:a1},{no:2,name:`subscription`,kind:`message`,T:s1},{no:3,name:`publish_tracks`,kind:`message`,T:r1,repeated:!0},{no:4,name:`data_channels`,kind:`message`,T:P1,repeated:!0},{no:5,name:`offer`,kind:`message`,T:a1},{no:6,name:`track_sids_disabled`,kind:`scalar`,T:9,repeated:!0},{no:7,name:`datachannel_receive_states`,kind:`message`,T:N1,repeated:!0},{no:8,name:`publish_data_tracks`,kind:`message`,T:J$,repeated:!0}]),N1=q.makeMessageType(`livekit.DataChannelReceiveState`,()=>[{no:1,name:`publisher_sid`,kind:`scalar`,T:9},{no:2,name:`last_seq`,kind:`scalar`,T:13}]),P1=q.makeMessageType(`livekit.DataChannelInfo`,()=>[{no:1,name:`label`,kind:`scalar`,T:9},{no:2,name:`id`,kind:`scalar`,T:13},{no:3,name:`target`,kind:`enum`,T:q.getEnumType(B$)}]),F1=q.makeMessageType(`livekit.SimulateScenario`,()=>[{no:1,name:`speaker_update`,kind:`scalar`,T:5,oneof:`scenario`},{no:2,name:`node_failure`,kind:`scalar`,T:8,oneof:`scenario`},{no:3,name:`migration`,kind:`scalar`,T:8,oneof:`scenario`},{no:4,name:`server_leave`,kind:`scalar`,T:8,oneof:`scenario`},{no:5,name:`switch_candidate_protocol`,kind:`enum`,T:q.getEnumType(H$),oneof:`scenario`},{no:6,name:`subscriber_bandwidth`,kind:`scalar`,T:3,oneof:`scenario`},{no:7,name:`disconnect_signal_on_resume`,kind:`scalar`,T:8,oneof:`scenario`},{no:8,name:`disconnect_signal_on_resume_no_messages`,kind:`scalar`,T:8,oneof:`scenario`},{no:9,name:`leave_request_full_reconnect`,kind:`scalar`,T:8,oneof:`scenario`}]),I1=q.makeMessageType(`livekit.Ping`,()=>[{no:1,name:`timestamp`,kind:`scalar`,T:3},{no:2,name:`rtt`,kind:`scalar`,T:3}]),L1=q.makeMessageType(`livekit.Pong`,()=>[{no:1,name:`last_ping_timestamp`,kind:`scalar`,T:3},{no:2,name:`timestamp`,kind:`scalar`,T:3}]),R1=q.makeMessageType(`livekit.RegionSettings`,()=>[{no:1,name:`regions`,kind:`message`,T:z1,repeated:!0}]),z1=q.makeMessageType(`livekit.RegionInfo`,()=>[{no:1,name:`region`,kind:`scalar`,T:9},{no:2,name:`url`,kind:`scalar`,T:9},{no:3,name:`distance`,kind:`scalar`,T:3}]),B1=q.makeMessageType(`livekit.SubscriptionResponse`,()=>[{no:1,name:`track_sid`,kind:`scalar`,T:9},{no:2,name:`err`,kind:`enum`,T:q.getEnumType(GQ)}]),V1=q.makeMessageType(`livekit.RequestResponse`,()=>[{no:1,name:`request_id`,kind:`scalar`,T:13},{no:2,name:`reason`,kind:`enum`,T:q
vendor: 26,027 bytes, line 208
208.getEnumType(H1)},{no:3,name:`message`,kind:`scalar`,T:9},{no:4,name:`trickle`,kind:`message`,T:$$,oneof:`request`},{no:5,name:`add_track`,kind:`message`,T:K$,oneof:`request`},{no:6,name:`mute`,kind:`message`,T:e1,oneof:`request`},{no:7,name:`update_metadata`,kind:`message`,T:g1,oneof:`request`},{no:8,name:`update_audio_track`,kind:`message`,T:d1,oneof:`request`},{no:9,name:`update_video_track`,kind:`message`,T:f1,oneof:`request`},{no:10,name:`publish_data_track`,kind:`message`,T:q$,oneof:`request`},{no:11,name:`unpublish_data_track`,kind:`message`,T:Y$,oneof:`request`}]),H1=q.makeEnum(`livekit.RequestResponse.Reason`,[{no:0,name:`OK`},{no:1,name:`NOT_FOUND`},{no:2,name:`NOT_ALLOWED`},{no:3,name:`LIMIT_EXCEEDED`},{no:4,name:`QUEUED`},{no:5,name:`UNSUPPORTED_TYPE`},{no:6,name:`UNCLASSIFIED_ERROR`},{no:7,name:`INVALID_HANDLE`},{no:8,name:`INVALID_NAME`},{no:9,name:`DUPLICATE_HANDLE`},{no:10,name:`DUPLICATE_NAME`}]),U1=q.makeMessageType(`livekit.TrackSubscribed`,()=>[{no:1,name:`track_sid`,kind:`scalar`,T:9}]),W1=q.makeMessageType(`livekit.ConnectionSettings`,()=>[{no:1,name:`auto_subscribe`,kind:`scalar`,T:8},{no:2,name:`adaptive_stream`,kind:`scalar`,T:8},{no:3,name:`subscriber_allow_pause`,kind:`scalar`,T:8,opt:!0},{no:4,name:`disable_ice_lite`,kind:`scalar`,T:8},{no:5,name:`auto_subscribe_data_track`,kind:`scalar`,T:8,opt:!0}]),G1=q.makeMessageType(`livekit.JoinRequest`,()=>[{no:1,name:`client_info`,kind:`message`,T:E$},{no:2,name:`connection_settings`,kind:`message`,T:W1},{no:3,name:`metadata`,kind:`scalar`,T:9},{no:4,name:`participant_attributes`,kind:`map`,K:9,V:{kind:`scalar`,T:9}},{no:5,name:`add_track_requests`,kind:`message`,T:K$,repeated:!0},{no:6,name:`publisher_offer`,kind:`message`,T:a1},{no:7,name:`reconnect`,kind:`scalar`,T:8},{no:8,name:`reconnect_reason`,kind:`enum`,T:q.getEnumType(WQ)},{no:9,name:`participant_sid`,kind:`scalar`,T:9},{no:10,name:`sync_state`,kind:`message`,T:M1}]),K1=q.makeMessageType(`livekit.WrappedJoinRequest`,()=>[{no:1,name:`compression`,kind:`enum`,T:q.getEnumType(q1)},{no:2,name:`join_request`,kind:`scalar`,T:12}]),q1=q.makeEnum(`livekit.WrappedJoinRequest.Compression`,[{no:0,name:`NONE`},{no:1,name:`GZIP`}]),J1=q.makeMessageType(`livekit.MediaSectionsRequirement`,()=>[{no:1,name:`num_audios`,kind:`scalar`,T:13},{no:2,name:`num_videos`,kind:`scalar`,T:13}]);function Y1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var X1={exports:{}},Z1=X1.exports,Q1;function $1(){return Q1?X1.exports:(Q1=1,(function(e){(function(t,n){e.exports?e.exports=n():t.log=n()})(Z1,function(){var e=function(){},t=`undefined`,n=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),r=[`trace`,`debug`,`info`,`warn`,`error`],i={},a=null;function o(e,t){var n=e[t];if(typeof n.bind==`function`)return n.bind(e);try{return Function.prototype.bind.call(n,e)}catch{return function(){return Function.prototype.apply.apply(n,[e,arguments])}}}function s(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function c(r){return r===`debug`&&(r=`log`),typeof console===t?!1:r===`trace`&&n?s:console[r]===void 0?console.log===void 0?e:o(console,`log`):o(console,r)}function l(){for(var n=this.getLevel(),i=0;i<r.length;i++){var a=r[i];this[a]=i<n?e:this.methodFactory(a,n,this.name)}if(this.log=this.debug,typeof console===t&&n<this.levels.SILENT)return`No console available for logging`}function u(e){return function(){typeof console!==t&&(l.call(this),this[e].apply(this,arguments))}}function d(e,t,n){return c(e)||u.apply(this,arguments)}function f(e,n){var o=this,s,c,u,f=`loglevel`;typeof e==`string`?f+=`:`+e:typeof e==`symbol`&&(f=void 0);function p(e){var n=(r[e]||`silent`).toUpperCase();if(!(typeof window===t||!f)){try{window.localStorage[f]=n;return}catch{}try{window.document.cookie=encodeURIComponent(f)+`=`+n+`;`}catch{}}}function m(){var e;if(!(typeof window===t||!f)){try{e=window.localStorage[f]}catch{}if(typeof e===t)try{var n=window.document.cookie,r=encodeURIComponent(f),i=n.indexOf(r+`=`);i!==-1&&(e=/^([^;]+)/.exec(n.slice(i+r.length+1))[1])}catch{}return o.levels[e]===void 0&&(e=void 0),e}}function h(){if(!(typeof window===t||!f)){try{window.localStorage.removeItem(f)}catch{}try{window.document.cookie=encodeURIComponent(f)+`=; expires=Thu, 01 Jan 1970 00:00:00 UTC`}catch{}}}function g(e){var t=e;if(typeof t==`string`&&o.levels[t.toUpperCase()]!==void 0&&(t=o.levels[t.toUpperCase()]),typeof t==`number`&&t>=0&&t<=o.levels.SILENT)return t;throw TypeError(`log.setLevel() called with invalid level: `+e)}o.name=e,o.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},o.methodFactory=n||d,o.getLevel=function(){return u??c??s},o.setLevel=function(e,t){return u=g(e),t!==!1&&p(u),l.call(o)},o.setDefaultLevel=function(e){c=g(e),m()||o.setLevel(e,!1)},o.resetLevel=function(){u=null,h(),l.call(o)},o.enableAll=function(e){o.setLevel(o.levels.TRACE,e)},o.disableAll=function(e){o.setLevel(o.levels.SILENT,e)},o.rebuild=function(){if(a!==o&&(s=g(a.getLevel())),l.call(o),a===o)for(var e in i)i[e].rebuild()},s=g(a?a.getLevel():`WARN`);var _=m();_!=null&&(u=g(_)),l.call(o)}a=new f,a.getLogger=function(e){if(typeof e!=`symbol`&&typeof e!=`string`||e===``)throw TypeError(`You must supply a name when creating a logger.`);var t=i[e];return t||=i[e]=new f(e,a.methodFactory),t};var p=typeof window===t?void 0:window.log;return a.noConflict=function(){return typeof window!==t&&window.log===a&&(window.log=p),a},a.getLoggers=function(){return i},a.default=a,a})})(X1),X1.exports)}var e0=$1(),t0;(function(e){e[e.trace=0]=`trace`,e[e.debug=1]=`debug`,e[e.info=2]=`info`,e[e.warn=3]=`warn`,e[e.error=4]=`error`,e[e.silent=5]=`silent`})(t0||={});var n0;(function(e){e.Default=`livekit`,e.Room=`livekit-room`,e.TokenSource=`livekit-token-source`,e.Participant=`livekit-participant`,e.Track=`livekit-track`,e.Publication=`livekit-track-publication`,e.Engine=`livekit-engine`,e.Signal=`livekit-signal`,e.PCManager=`livekit-pc-manager`,e.PCTransport=`livekit-pc-transport`,e.E2EE=`lk-e2ee`,e.DataTracks=`livekit-data-tracks`})(n0||={});var r0=e0.getLogger(n0.Default);Object.values(n0).map(e=>e0.getLogger(e)),r0.setDefaultLevel(t0.info);function i0(e,t){let n=e0.getLogger(e);return n.setDefaultLevel(r0.getLevel()),t?a0(n,t):n}function a0(e,t){let n=n=>(r,i)=>{let a=t(),o=a||i?Object.assign(Object.assign({},a),i):void 0;e[n](r,o)},r=Object.create(e);return r.trace=n(`trace`),r.debug=n(`debug`),r.info=n(`info`),r.warn=n(`warn`),r.error=n(`error`),r}var o0=e0.getLogger(n0.E2EE),s0=7e3,c0=[0,300,4*300,9*300,16*300,s0,s0,s0,s0,s0],l0=class{constructor(e){this._retryDelays=e===void 0?c0:[...e]}nextRetryDelayInMs(e){if(e.retryCount>=this._retryDelays.length)return null;let t=this._retryDelays[e.retryCount];return e.retryCount<=1?t:t+Math.random()*1e3}};function u0(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function J(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function d0(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function f0(e){return this instanceof f0?(this.v=e,this):new f0(e)}function p0(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i=Object.create((typeof AsyncIterator==`function`?AsyncIterator:Object).prototype),s(`next`),s(`throw`),s(`return`,o),i[Symbol.asyncIterator]=function(){return this},i;function o(e){return function(t){return Promise.resolve(t).then(e,d)}}function s(e,t){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||c(e,t)})},t&&(i[e]=t(i[e])))}function c(e,t){try{l(r[e](t))}catch(e){f(a[0][3],e)}}function l(e){e.value instanceof f0?Promise.resolve(e.value.v).then(u,d):f(a[0][2],e)}function u(e){c(`next`,e)}function d(e){c(`throw`,e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}}function m0(e){var t,n;return t={},r(`next`),r(`throw`,function(e){throw e}),r(`return`),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:f0(e[r](t)),done:!1}:i?i(t):t}:i}}function h0(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof d0==`function`?d0(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}}var g0={exports:{}},_0;function Yce(){if(_0)return g0.exports;_0=1;var e=typeof Reflect==`object`?Reflect:null,t=e&&typeof e.apply==`function`?e.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},n=e&&typeof e.ownKeys==`function`?e.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};function r(e){console&&console.warn&&console.warn(e)}var i=Number.isNaN||function(e){return e!==e};function a(){a.init.call(this)}g0.exports=a,g0.exports.once=_,a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var o=10;function s(e){if(typeof e!=`function`)throw TypeError(`The "listener" argument must be of type Function. Received type `+typeof e)}Object.defineProperty(a,`defaultMaxListeners`,{enumerable:!0,get:function(){return o},set:function(e){if(typeof e!=`number`||e<0||i(e))throw RangeError(`The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received `+e+`.`);o=e}}),a.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(e){if(typeof e!=`number`||e<0||i(e))throw RangeError(`The value of "n" is out of range. It must be a non-negative number. Received `+e+`.`);return this._maxListeners=e,this};function c(e){return e._maxListeners===void 0?a.defaultMaxListeners:e._maxListeners}a.prototype.getMaxListeners=function(){return c(this)},a.prototype.emit=function(e){for(var n=[],r=1;r<arguments.length;r++)n.push(arguments[r]);var i=e===`error`,a=this._events;if(a!==void 0)i&&=a.error===void 0;else if(!i)return!1;if(i){var o;if(n.length>0&&(o=n[0]),o instanceof Error)throw o;var s=Error(`Unhandled error.`+(o?` (`+o.message+`)`:``));throw s.context=o,s}var c=a[e];if(c===void 0)return!1;if(typeof c==`function`)t(c,this,n);else for(var l=c.length,u=m(c,l),r=0;r<l;++r)t(u[r],this,n);return!0};function l(e,t,n,i){var a,o,l;if(s(n),o=e._events,o===void 0?(o=e._events=Object.create(null),e._eventsCount=0):(o.newListener!==void 0&&(e.emit(`newListener`,t,n.listener?n.listener:n),o=e._events),l=o[t]),l===void 0)l=o[t]=n,++e._eventsCount;else if(typeof l==`function`?l=o[t]=i?[n,l]:[l,n]:i?l.unshift(n):l.push(n),a=c(e),a>0&&l.length>a&&!l.warned){l.warned=!0;var u=Error(`Possible EventEmitter memory leak detected. `+l.length+` `+String(t)+` listeners added. Use emitter.setMaxListeners() to increase limit`);u.name=`MaxListenersExceededWarning`,u.emitter=e,u.type=t,u.count=l.length,r(u)}return e}a.prototype.addListener=function(e,t){return l(this,e,t,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(e,t){return l(this,e,t,!0)};function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=u.bind(r);return i.listener=n,r.wrapFn=i,i}a.prototype.once=function(e,t){return s(t),this.on(e,d(this,e,t)),this},a.prototype.prependOnceListener=function(e,t){return s(t),this.prependListener(e,d(this,e,t)),this},a.prototype.removeListener=function(e,t){var n,r,i,a,o;if(s(t),r=this._events,r===void 0||(n=r[e],n===void 0))return this;if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit(`removeListener`,e,n.listener||t));else if(typeof n!=`function`){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;i===0?n.shift():h(n,i),n.length===1&&(r[e]=n[0]),r.removeListener!==void 0&&this.emit(`removeListener`,e,o||t)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(e){var t,n=this._events,r;if(n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i=Object.keys(n),a;for(r=0;r<i.length;++r)a=i[r],a!==`removeListener`&&this.removeAllListeners(a);return this.removeAllListeners(`removeListener`),this._events=Object.create(null),this._eventsCount=0,this}if(t=n[e],typeof t==`function`)this.removeListener(e,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this};function f(e,t,n){var r=e._events;if(r===void 0)return[];var i=r[t];return i===void 0?[]:typeof i==`function`?n?[i.listener||i]:[i]:n?g(i):m(i,i.length)}a.prototype.listeners=function(e){return f(this,e,!0)},a.prototype.rawListeners=function(e){return f(this,e,!1)},a.listenerCount=function(e,t){return typeof e.listenerCount==`function`?e.listenerCount(t):p.call(e,t)},a.prototype.listenerCount=p;function p(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n==`function`)return 1;if(n!==void 0)return n.length}return 0}a.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]};function m(e,t){for(var n=Array(t),r=0;r<t;++r)n[r]=e[r];return n}function h(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function g(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function _(e,t){return new Promise(function(n,r){function i(n){e.removeListener(t,a),r(n)}function a(){typeof e.removeListener==`function`&&e.removeListener(`error`,i),n([].slice.call(arguments))}y(e,t,a,{once:!0}),t!==`error`&&v(e,i,{once:!0})})}function v(e,t,n){typeof e.on==`function`&&y(e,`error`,t,n)}function y(e,t,n,r){if(typeof e.on==`function`)r.once?e.once(t,n):e.on(t,n);else if(typeof e.addEventListener==`function`)e.addEventListener(t,function i(a){r.once&&e.removeEventListener(t,i),n(a)});else throw TypeError(`The "emitter" argument must be of type EventEmitter. Received type `+typeof e)}return g0.exports}var v0=Yce(),y0=!0,b0=!0;function x0(e,t,n){let r=e.match(t);return r&&r.length>=n&&parseFloat(r[n],10)}function S0(e,t,n){if(!e.RTCPeerConnection)return;if(!Object.getOwnPropertyDescriptor(EventTarget.prototype,`addEventListener`).writable){C0(`Unable to polyfill events`);return}let r=e.RTCPeerConnection.prototype,i=r.addEventListener;r.addEventListener=function(e,r){if(e!==t)return i.apply(this,arguments);let a=e=>{let t=n(e);t&&(r.handleEvent?r.handleEvent(t):r(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(r,a),i.apply(this,[e,a])};let a=r.removeEventListener;r.removeEventListener=function(e,n){if(e!==t||!this._eventMap||!this._eventMap[t]||!this._eventMap[t].has(n))return a.apply(this,arguments);let r=this._eventMap[t].get(n);return this._eventMap[t].delete(n),this._eventMap[t].size===0&&delete this._eventMap[t],Object.keys(this._eventMap).length===0&&delete this._eventMap,a.apply(this,[e,r])},Object.defineProperty(r,`on`+t,{get(){return this[`_on`+t]},set(e){this[`_on`+t]&&(this.removeEventListener(t,this[`_on`+t]),delete this[`_on`+t]),e&&this.addEventListener(t,this[`_on`+t]=e)},enumerable:!0,configurable:!0})}function Xce(e){return typeof e==`boolean`?(y0=e,e?`adapter.js logging disabled`:`adapter.js logging enabled`):Error(`Argument type: `+typeof e+`. Please use a boolean.`)}function Zce(e){return typeof e==`boolean`?(b0=!e,`adapter.js deprecation warnings `+(e?`disabled`:`enabled`)):Error(`Argument type: `+typeof e+`. Please use a boolean.`)}function C0(){if(typeof window==`object`){if(y0)return;typeof console<`u`&&typeof console.log==`function`&&console.log.apply(console,arguments)}}function w0(e,t){b0&&console.warn(e+` is deprecated, please use `+t+` instead.`)}function Qce(e){let t={browser:null,version:null};if(e===void 0||!e.navigator||!e.navigator.userAgent)return t.browser=`Not a browser.`,t;let n=e.navigator;if(n.userAgentData&&n.userAgentData.brands){let e=n.userAgentData.brands.find(e=>e.brand===`Chromium`);if(e)return{browser:`chrome`,version:parseInt(e.version,10)}}if(n.mozGetUserMedia)t.browser=`firefox`,t.version=parseInt(x0(n.userAgent,/Firefox\/(\d+)\./,1));else if(n.webkitGetUserMedia||e.isSecureContext===!1&&e.webkitRTCPeerConnection)t.browser=`chrome`,t.version=parseInt(x0(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2))||null;else if(e.RTCPeerConnection&&n.userAgent.match(/AppleWebKit\/(\d+)\./))t.browser=`safari`,t.version=parseInt(x0(n.userAgent,/AppleWebKit\/(\d+)\./,1)),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&`currentDirection`in e.RTCRtpTransceiver.prototype,t._safariVersion=x0(n.userAgent,/Version\/(\d+(\.?\d+))/,1);else return t.browser=`Not a supported browser.`,t;return t}function T0(e){return Object.prototype.toString.call(e)===`[object Object]`}function E0(e){return T0(e)?Object.keys(e).reduce(function(t,n){let r=T0(e[n]),i=r?E0(e[n]):e[n],a=r&&!Object.keys(i).length;return i===void 0||a?t:Object.assign(t,{[n]:i})},{}):e}function D0(e,t,n){!t||n.has(t.id)||(n.set(t.id,t),Object.keys(t).forEach(r=>{r.endsWith(`Id`)?D0(e,e.get(t[r]),n):r.endsWith(`Ids`)&&t[r].forEach(t=>{D0(e,e.get(t),n)})}))}function O0(e,t,n){let r=n?`outbound-rtp`:`inbound-rtp`,i=new Map;if(t===null)return i;let a=[];return e.forEach(e=>{e.type===`track`&&e.trackIdentifier===t.id&&a.push(e)}),a.forEach(t=>{e.forEach(n=>{n.type===r&&n.trackId===t.id&&D0(e,n,i)})}),i}var k0=C0;function A0(e,t){let n=e&&e.navigator;if(!n.mediaDevices)return;let r=function(e){if(typeof e!=`object`||e.mandatory||e.optional)return e;let t={};return Object.keys(e).forEach(n=>{if(n===`require`||n===`advanced`||n===`mediaSource`)return;let r=typeof e[n]==`object`?e[n]:{ideal:e[n]};r.exact!==void 0&&typeof r.exact==`number`&&(r.min=r.max=r.exact);let i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):t===`deviceId`?`sourceId`:t};if(r.ideal!==void 0){t.optional=t.optional||[];let e={};typeof r.ideal==`number`?(e[i(`min`,n)]=r.ideal,t.optional.push(e),e={},e[i(`max`,n)]=r.ideal,t.optional.push(e)):(e[i(``,n)]=r.ideal,t.optional.push(e))}r.exact!==void 0&&typeof r.exact!=`number`?(t.mandatory=t.mandatory||{},t.mandatory[i(``,n)]=r.exact):[`min`,`max`].forEach(e=>{r[e]!==void 0&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,n)]=r[e])})}),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},i=function(e,i){if(t.version>=61)return i(e);if(e=JSON.parse(JSON.stringify(e)),e&&typeof e.audio==`object`){let t=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])};e=JSON.parse(JSON.stringify(e)),t(e.audio,`autoGainControl`,`googAutoGainControl`),t(e.audio,`noiseSuppression`,`googNoiseSuppression`),e.audio=r(e.audio)}if(e&&typeof e.video==`object`){let a=e.video.facingMode;a&&=typeof a==`object`?a:{ideal:a};let o=t.version<66;if(a&&(a.exact===`user`||a.exact===`environment`||a.ideal===`user`||a.ideal===`environment`)&&!(n.mediaDevices.getSupportedConstraints&&n.mediaDevices.getSupportedConstraints().facingMode&&!o)){delete e.video.facingMode;let t;if(a.exact===`environment`||a.ideal===`environment`?t=[`back`,`rear`]:(a.exact===`user`||a.ideal===`user`)&&(t=[`front`]),t)return n.mediaDevices.enumerateDevices().then(n=>{n=n.filter(e=>e.kind===`videoinput`);let o=n.find(e=>t.some(t=>e.label.toLowerCase().includes(t)));return!o&&n.length&&t.includes(`back`)&&(o=n[n.length-1]),o&&(e.video.deviceId=a.exact?{exact:o.deviceId}:{ideal:o.deviceId}),e.video=r(e.video),k0(`chrome: `+JSON.stringify(e)),i(e)})}e.video=r(e.video)}return k0(`chrome: `+JSON.stringify(e)),i(e)},a=function(e){return t.version>=64?e:{name:{PermissionDeniedError:`NotAllowedError`,PermissionDismissedError:`NotAllowedError`,InvalidStateError:`NotAllowedError`,DevicesNotFoundError:`NotFoundError`,ConstraintNotSatisfiedError:`OverconstrainedError`,TrackStartError:`NotReadableError`,MediaDeviceFailedDueToShutdown:`NotAllowedError`,MediaDeviceKillSwitchOn:`NotAllowedError`,TabCaptureError:`AbortError`,ScreenCaptureError:`AbortError`,DeviceCaptureError:`AbortError`}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString(){return this.name+(this.message&&`: `)+this.message}}};if(n.getUserMedia=function(e,t,r){i(e,e=>{n.webkitGetUserMedia(e,t,e=>{r&&r(a(e))})})}.bind(n),n.mediaDevices.getUserMedia){let e=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(t){return i(t,t=>e(t).then(e=>{if(t.audio&&!e.getAudioTracks().length||t.video&&!e.getVideoTracks().length)throw e.getTracks().forEach(e=>{e.stop()}),new DOMException(``,`NotFoundError`);return e},e=>Promise.reject(a(e))))}}}function j0(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function M0(e,t){if(!(t.version>102))if(typeof e==`object`&&e.RTCPeerConnection&&!(`ontrack`in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,`ontrack`,{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener(`track`,this._ontrack),this.addEventListener(`track`,this._ontrack=e)},enumerable:!0,configurable:!0});let t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener(`addtrack`,n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===n.track.id):{track:n.track};let i=new Event(`track`);i.track=n.track,i.receiver=r,i.transceiver={receiver:r},i.streams=[t.stream],this.dispatchEvent(i)}),t.stream.getTracks().forEach(n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===n.id):{track:n};let i=new Event(`track`);i.track=n,i.receiver=r,i.transceiver={receiver:r},i.streams=[t.stream],this.dispatchEvent(i)})},this.addEventListener(`addstream`,this._ontrackpoly)),t.apply(this,arguments)}}else S0(e,`track`,e=>(e.transceiver||Object.defineProperty(e,`transceiver`,{value:{receiver:e.receiver}}),e))}function N0(e){if(typeof e==`object`&&e.RTCPeerConnection&&!(`getSenders`in e.RTCPeerConnection.prototype)&&`createDTMFSender`in e.RTCPeerConnection.prototype){let t=function(e,t){return{track:t,get dtmf(){return this._dtmf===void 0&&(t.kind===`audio`?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};let n=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){let i=n.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};let r=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){r.apply(this,arguments);let t=this._senders.indexOf(e);t!==-1&&this._senders.splice(t,1)}}let n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],n.apply(this,[e]),e.getTracks().forEach(e=>{this._senders.push(t(this,e))})};let r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],r.apply(this,[e]),e.getTracks().forEach(e=>{let t=this._senders.find(t=>t.track===e);t&&this._senders.splice(this._senders.indexOf(t),1)})}}else if(typeof e==`object`&&e.RTCPeerConnection&&`getSenders`in e.RTCPeerConnection.prototype&&`createDTMFSender`in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!(`dtmf`in e.RTCRtpSender.prototype)){let t=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e},Object.defineProperty(e.RTCRtpSender.prototype,`dtmf`,{get(){return this._dtmf===void 0&&(this.track.kind===`audio`?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function P0(e,t){if(t.version>=67||!(typeof e==`object`&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!(`getStats`in e.RTCRtpSender.prototype)){let t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});let n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){let e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){let e=this;return this._pc.getStats().then(t=>O0(t,e.track,!0))}}if(!(`getStats`in e.RTCRtpReceiver.prototype)){let t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){let e=t.apply(this,[]);
vendor: 4,561 bytes, line 208
208return e.forEach(e=>e._pc=this),e}),S0(e,`track`,e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){let e=this;return this._pc.getStats().then(t=>O0(t,e.track,!1))}}if(!(`getStats`in e.RTCRtpSender.prototype&&`getStats`in e.RTCRtpReceiver.prototype))return;let n=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){let e=arguments[0],t,n,r;return this.getSenders().forEach(n=>{n.track===e&&(t?r=!0:t=n)}),this.getReceivers().forEach(t=>(t.track===e&&(n?r=!0:n=t),t.track===e)),r||t&&n?Promise.reject(new DOMException(`There are more than one sender or receiver for the track.`,`InvalidAccessError`)):t?t.getStats():n?n.getStats():Promise.reject(new DOMException(`There is no sender or receiver for the track.`,`InvalidAccessError`))}return n.apply(this,arguments)}}function F0(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(e=>this._shimmedLocalStreams[e][0])};let t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){if(!n)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};let r=t.apply(this,arguments);return this._shimmedLocalStreams[n.id]?this._shimmedLocalStreams[n.id].indexOf(r)===-1&&this._shimmedLocalStreams[n.id].push(r):this._shimmedLocalStreams[n.id]=[n,r],r};let n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException(`Track already exists.`,`InvalidAccessError`)});let t=this.getSenders();n.apply(this,arguments);let r=this.getSenders().filter(e=>t.indexOf(e)===-1);this._shimmedLocalStreams[e.id]=[e].concat(r)};let r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],r.apply(this,arguments)};let i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach(t=>{let n=this._shimmedLocalStreams[t].indexOf(e);n!==-1&&this._shimmedLocalStreams[t].splice(n,1),this._shimmedLocalStreams[t].length===1&&delete this._shimmedLocalStreams[t]}),i.apply(this,arguments)}}function I0(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return F0(e);let n=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){let e=n.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map(e=>this._reverseStreams[e.id])};let r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException(`Track already exists.`,`InvalidAccessError`)}),!this._reverseStreams[t.id]){let n=new e.MediaStream(t.getTracks());this._streams[t.id]=n,this._reverseStreams[n.id]=t,t=n}r.apply(this,[t])};let i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,n){if(this.signalingState===`closed`)throw new DOMException(`The RTCPeerConnection's signalingState is 'closed'.`,`InvalidStateError`);let r=[].slice.call(arguments,1);if(r.length!==1||!r[0].getTracks().find(e=>e===t))throw new DOMException(`The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.`,`NotSupportedError`);if(this.getSenders().find(e=>e.track===t))throw new DOMException(`Track already exists.`,`InvalidAccessError`);this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};let i=this._streams[n.id];if(i)i.addTrack(t),Promise.resolve().then(()=>{this.dispatchEvent(new Event(`negotiationneeded`))});else{let r=new e.MediaStream([t]);this._streams[n.id]=r,this._reverseStreams[r.id]=n,this.addStream(r)}
vendor: 14,473 bytes, line 208
208return this.getSenders().find(e=>e.track===t)};function a(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{let r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(i.id,`g`),r.id)}),new RTCSessionDescription({type:t.type,sdp:n})}function o(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{let r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(r.id,`g`),i.id)}),new RTCSessionDescription({type:t.type,sdp:n})}[`createOffer`,`createAnswer`].forEach(function(t){let n=e.RTCPeerConnection.prototype[t],r={[t](){let e=arguments;return arguments.length&&typeof arguments[0]==`function`?n.apply(this,[t=>{let n=a(this,t);e[0].apply(null,[n])},t=>{e[1]&&e[1].apply(null,t)},arguments[2]]):n.apply(this,arguments).then(e=>a(this,e))}};e.RTCPeerConnection.prototype[t]=r[t]});let s=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return!arguments.length||!arguments[0].type||(arguments[0]=o(this,arguments[0])),s.apply(this,arguments)};let c=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,`localDescription`);Object.defineProperty(e.RTCPeerConnection.prototype,`localDescription`,{get(){let e=c.get.apply(this);return e.type===``?e:a(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){if(this.signalingState===`closed`)throw new DOMException(`The RTCPeerConnection's signalingState is 'closed'.`,`InvalidStateError`);if(!e._pc)throw new DOMException(`Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.`,`TypeError`);if(e._pc!==this)throw new DOMException(`Sender was not created by this connection.`,`InvalidAccessError`);this._streams=this._streams||{};let t;Object.keys(this._streams).forEach(n=>{this._streams[n].getTracks().find(t=>e.track===t)&&(t=this._streams[n])}),t&&(t.getTracks().length===1?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event(`negotiationneeded`)))}}function L0(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&[`setLocalDescription`,`setRemoteDescription`,`addIceCandidate`].forEach(function(t){let n=e.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new(t===`addIceCandidate`?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=r[t]})}function R0(e,t){t.version>102||S0(e,`negotiationneeded`,e=>{let n=e.target;if(!((t.version<72||n.getConfiguration&&n.getConfiguration().sdpSemantics===`plan-b`)&&n.signalingState!==`stable`))return e})}var z0=Object.freeze({__proto__:null,fixNegotiationNeeded:R0,shimAddTrackRemoveTrack:I0,shimAddTrackRemoveTrackWithNative:F0,shimGetSendersWithDtmf:N0,shimGetUserMedia:A0,shimMediaStream:j0,shimOnTrack:M0,shimPeerConnection:L0,shimSenderReceiverGetStats:P0});function B0(e,t){let n=e&&e.navigator,r=e&&e.MediaStreamTrack;if(n.getUserMedia=function(e,t,r){w0(`navigator.getUserMedia`,`navigator.mediaDevices.getUserMedia`),n.mediaDevices.getUserMedia(e).then(t,r)},!(t.version>55&&`autoGainControl`in n.mediaDevices.getSupportedConstraints())){let e=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])},t=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(n){return typeof n==`object`&&typeof n.audio==`object`&&(n=JSON.parse(JSON.stringify(n)),e(n.audio,`autoGainControl`,`mozAutoGainControl`),e(n.audio,`noiseSuppression`,`mozNoiseSuppression`)),t(n)},r&&r.prototype.getSettings){let t=r.prototype.getSettings;r.prototype.getSettings=function(){let n=t.apply(this,arguments);return e(n,`mozAutoGainControl`,`autoGainControl`),e(n,`mozNoiseSuppression`,`noiseSuppression`),n}}if(r&&r.prototype.applyConstraints){let t=r.prototype.applyConstraints;r.prototype.applyConstraints=function(n){return this.kind===`audio`&&typeof n==`object`&&(n=JSON.parse(JSON.stringify(n)),e(n,`autoGainControl`,`mozAutoGainControl`),e(n,`noiseSuppression`,`mozNoiseSuppression`)),t.apply(this,[n])}}}}function $ce(e,t){e.navigator.mediaDevices&&`getDisplayMedia`in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(n){if(!(n&&n.video)){let e=new DOMException(`getDisplayMedia without video constraints is undefined`);return e.name=`NotFoundError`,e.code=8,Promise.reject(e)}return n.video===!0?n.video={mediaSource:t}:n.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(n)})}function V0(e){typeof e==`object`&&e.RTCTrackEvent&&`receiver`in e.RTCTrackEvent.prototype&&!(`transceiver`in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,`transceiver`,{get(){return{receiver:this.receiver}}})}function H0(e,t){typeof e!=`object`||!(e.RTCPeerConnection||e.mozRTCPeerConnection)||(!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&[`setLocalDescription`,`setRemoteDescription`,`addIceCandidate`].forEach(function(t){let n=e.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new(t===`addIceCandidate`?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=r[t]}))}function U0(e,t){if(typeof e!=`object`||!(e.RTCPeerConnection||e.mozRTCPeerConnection)||t.version>=151)return;let n={inboundrtp:`inbound-rtp`,outboundrtp:`outbound-rtp`,candidatepair:`candidate-pair`,localcandidate:`local-candidate`,remotecandidate:`remote-candidate`},r=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){let e=Array.prototype.slice.call(arguments),i=e[0],a=e[1],o=e[2];return this.signalingState===`closed`?Promise.resolve(new Map):r.apply(this,[i||null]).then(e=>{if(t.version<53&&!a)try{e.forEach(e=>{e.type=n[e.type]||e.type})}catch(t){if(t.name!==`TypeError`)throw t;e.forEach((t,r)=>{e.set(r,Object.assign({},t,{type:n[t.type]||t.type}))})}return e}).then(a,o)}}function W0(e){if(!(typeof e==`object`&&e.RTCPeerConnection&&e.RTCRtpSender)||e.RTCRtpSender&&`getStats`in e.RTCRtpSender.prototype)return;let t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});let n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){let e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function G0(e){if(!(typeof e==`object`&&e.RTCPeerConnection&&e.RTCRtpSender)||e.RTCRtpSender&&`getStats`in e.RTCRtpReceiver.prototype)return;let t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),S0(e,`track`,e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function K0(e){!e.RTCPeerConnection||`removeStream`in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){w0(`removeStream`,`removeTrack`),this.getSenders().forEach(t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)})})}function q0(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function J0(e){if(!(typeof e==`object`&&e.RTCPeerConnection))return;let t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let e=arguments[1]&&arguments[1].sendEncodings;e===void 0&&(e=[]),e=[...e];let n=e.length>0;n&&e.forEach(e=>{if(`rid`in e&&!/^[a-z0-9]{0,16}$/i.test(e.rid))throw TypeError(`Invalid RID value provided.`);if(`scaleResolutionDownBy`in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw RangeError(`scale_resolution_down_by must be >= 1.0`);if(`maxFramerate`in e&&!(parseFloat(e.maxFramerate)>=0))throw RangeError(`max_framerate must be >= 0.0`)});let r=t.apply(this,arguments);if(n){let t=r.sender,n=t.getParameters();(!(`encodings`in n)||n.encodings.length===1&&Object.keys(n.encodings[0]).length===0)&&(n.encodings=e,t.sendEncodings=e,this.setParametersPromises.push(t.setParameters(n).then(()=>{delete t.sendEncodings}).catch(()=>{delete t.sendEncodings})))}return r})}function Y0(e){if(!(typeof e==`object`&&e.RTCRtpSender))return;let t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){let e=t.apply(this,arguments);return`encodings`in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function X0(e){if(!(typeof e==`object`&&e.RTCPeerConnection))return;let t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}function Z0(e){if(!(typeof e==`object`&&e.RTCPeerConnection))return;let t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}var Q0=Object.freeze({__proto__:null,shimAddTransceiver:J0,shimCreateAnswer:Z0,shimCreateOffer:X0,shimGetDisplayMedia:$ce,shimGetParameters:Y0,shimGetStats:U0,shimGetUserMedia:B0,shimOnTrack:V0,shimPeerConnection:H0,shimRTCDataChannel:q0,shimReceiverGetStats:G0,shimRemoveStream:K0,shimSenderGetStats:W0});function $0(e){if(!(typeof e!=`object`||!e.RTCPeerConnection)){if(`getLocalStreams`in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||=[],this._localStreams}),!(`addStream`in e.RTCPeerConnection.prototype)){let t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||=[],this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach(n=>t.call(this,n,e)),e.getVideoTracks().forEach(n=>t.call(this,n,e))},e.RTCPeerConnection.prototype.addTrack=function(e){var n=[...arguments].slice(1);return n&&n.forEach(e=>{this._localStreams?this._localStreams.includes(e)||this._localStreams.push(e):this._localStreams=[e]}),t.apply(this,arguments)}}`removeStream`in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||=[];let t=this._localStreams.indexOf(e);if(t===-1)return;this._localStreams.splice(t,1);let n=e.getTracks();this.getSenders().forEach(e=>{n.includes(e.track)&&this.removeTrack(e)})})}}function e2(e){if(!(typeof e!=`object`||!e.RTCPeerConnection)&&(`getRemoteStreams`in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!(`onaddstream`in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,`onaddstream`,{get(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener(`addstream`,this._onaddstream),this.removeEventListener(`track`,this._onaddstreampoly)),this.addEventListener(`addstream`,this._onaddstream=e),this.addEventListener(`track`,this._onaddstreampoly=e=>{e.streams.forEach(e=>{if(this._remoteStreams||=[],this._remoteStreams.includes(e))return;this._remoteStreams.push(e);let t=new Event(`addstream`);t.stream=e,this.dispatchEvent(t)})})}});let t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){let e=this;return this._onaddstreampoly||this.addEventListener(`track`,this._onaddstreampoly=function(t){t.streams.forEach(t=>{if(e._remoteStreams||=[],e._remoteStreams.indexOf(t)>=0)return;e._remoteStreams.push(t);let n=new Event(`addstream`);n.stream=t,e.dispatchEvent(n)})}),t.apply(e,arguments)}}}function t2(e){if(typeof e!=`object`||!e.RTCPeerConnection)return;let t=e.RTCPeerConnection.prototype,n=t.createOffer,r=t.createAnswer,i=t.setLocalDescription,a=t.setRemoteDescription,o=t.addIceCandidate;t.createOffer=function(e,t){let r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i},t.createAnswer=function(e,t){let n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),Promise.resolve()):i};let s=function(e,t,n){let r=i.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r};t.setLocalDescription=s,s=function(e,t,n){let r=a.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.setRemoteDescription=s,s=function(e,t,n){let r=o.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.addIceCandidate=s}function n2(e){let t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){let e=t.mediaDevices,n=e.getUserMedia.bind(e);t.mediaDevices.getUserMedia=e=>n(r2(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,n,r){t.mediaDevices.getUserMedia(e).then(n,r)}.bind(t))}function r2(e){return e&&e.video!==void 0?Object.assign({},e,{video:E0(e.video)}):e}function i2(e){if(!e.RTCPeerConnection)return;let t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,n){if(e&&e.iceServers){let t=[];for(let n=0;n<e.iceServers.length;n++){let r=e.iceServers[n];r.urls===void 0&&r.url?(w0(`RTCIceServer.url`,`RTCIceServer.urls`),r=JSON.parse(JSON.stringify(r)),r.urls=r.url,delete r.url,t.push(r)):t.push(e.iceServers[n])}e.iceServers=t}return new t(e,n)},e.RTCPeerConnection.prototype=t.prototype,`generateCertificate`in t&&Object.defineProperty(e.RTCPeerConnection,`generateCertificate`,{get(){return t.generateCertificate}})}function a2(e){typeof e==`object`&&e.RTCTrackEvent&&`receiver`in e.RTCTrackEvent.prototype&&!(`transceiver`in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,`transceiver`,{get(){return{receiver:this.receiver}}})}function o2(e){let t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){e.offerToReceiveAudio!==void 0&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);let t=this.getTransceivers().find(e=>e.receiver.track.kind===`audio`);e.offerToReceiveAudio===!1&&t?t.direction===`sendrecv`?t.setDirection?t.setDirection(`sendonly`):t.direction=`sendonly`:t.direction===`recvonly`&&(t.setDirection?t.setDirection(`
208inactive`):t.direction=`inactive`):e.offerToReceiveAudio===!0&&!t&&this.addTransceiver(`audio`,{direction:`recvonly`}),e.offerToReceiveVideo!==void 0&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);let n=this.getTransceivers().find(e=>e.receiver.track.kind===`video`);e.offerToReceiveVideo===!1&&n?n.direction===`sendrecv`?n.setDirection?n.setDirection(`sendonly`):n.direction=`sendonly`:n.direction===`recvonly`&&(n.setDirection?n.setDirection(`inactive`):n.direction=`inactive`):e.offerToReceiveVideo===!0&&!n&&this.addTransceiver(`video`,{direction:`recvonly`})}return t.apply(this,arguments)}}function s2(e){typeof e!=`object`||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var c2=Object.freeze({__proto__:null,shimAudioContext:s2,shimCallbacksAPI:t2,shimConstraints:r2,shimCreateOfferLegacy:o2,shimGetUserMedia:n2,shimLocalStreamsAPI:$0,shimRTCIceServerUrls:i2,shimRemoteStreamsAPI:e2,shimTrackEventTransceiver:a2}),l2={exports:{}},u2;function ele(){return u2?l2.exports:(u2
vendor: 10,578 bytes, lines 208-239
208=1,(function(e){let t={};t.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)},t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split(` 209`).map(e=>e.trim())},t.splitSections=function(e){return e.split(` 210m=`).map((e,t)=>(t>0?`m=`+e:e).trim()+`\r 211`)},t.getDescription=function(e){let n=t.splitSections(e);return n&&n[0]},t.getMediaSections=function(e){let n=t.splitSections(e);return n.shift(),n},t.matchPrefix=function(e,n){return t.splitLines(e).filter(e=>e.indexOf(n)===0)},t.parseCandidate=function(e){let t;t=e.indexOf(`a=candidate:`)===0?e.substring(12).split(` `):e.substring(10).split(` `);let n={foundation:t[0],component:{1:`rtp`,2:`rtcp`}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]};for(let e=8;e<t.length;e+=2)switch(t[e]){case`raddr`:n.relatedAddress=t[e+1];break;case`rport`:n.relatedPort=parseInt(t[e+1],10);break;case`tcptype`:n.tcpType=t[e+1];break;case`ufrag`:n.ufrag=t[e+1],n.usernameFragment=t[e+1];break;default:n[t[e]]===void 0&&(n[t[e]]=t[e+1]);break}return n},t.writeCandidate=function(e){let t=[];t.push(e.foundation);let n=e.component;n===`rtp`?t.push(1):n===`rtcp`?t.push(2):t.push(n),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);let r=e.type;return t.push(`typ`),t.push(r),r!==`host`&&e.relatedAddress&&e.relatedPort!==void 0&&(t.push(`raddr`),t.push(e.relatedAddress),t.push(`rport`),t.push(e.relatedPort)),e.tcpType&&e.protocol.toLowerCase()===`tcp`&&(t.push(`tcptype`),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push(`ufrag`),t.push(e.usernameFragment||e.ufrag)),`candidate:`+t.join(` `)},t.parseIceOptions=function(e){return e.substring(14).split(` `)},t.parseRtpMap=function(e){let t=e.substring(9).split(` `),n={payloadType:parseInt(t.shift(),10)};return t=t[0].split(`/`),n.name=t[0],n.clockRate=parseInt(t[1],10),n.channels=t.length===3?parseInt(t[2],10):1,n.numChannels=n.channels,n},t.writeRtpMap=function(e){let t=e.payloadType;e.preferredPayloadType!==void 0&&(t=e.preferredPayloadType);let n=e.channels||e.numChannels||1;return`a=rtpmap:`+t+` `+e.name+`/`+e.clockRate+(n===1?``:`/`+n)+`\r 212`},t.parseExtmap=function(e){let t=e.substring(9).split(` `);return{id:parseInt(t[0],10),direction:t[0].indexOf(`/`)>0?t[0].split(`/`)[1]:`sendrecv`,uri:t[1],attributes:t.slice(2).join(` `)}},t.writeExtmap=function(e){return`a=extmap:`+(e.id||e.preferredId)+(e.direction&&e.direction!==`sendrecv`?`/`+e.direction:``)+` `+e.uri+(e.attributes?` `+e.attributes:``)+`\r 213`},t.parseFmtp=function(e){let t={},n,r=e.substring(e.indexOf(` `)+1).split(`;`);for(let e=0;e<r.length;e++)n=r[e].trim().split(`=`),t[n[0].trim()]=n[1];return t},t.writeFmtp=function(e){let t=``,n=e.payloadType;if(e.preferredPayloadType!==void 0&&(n=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){let r=[];Object.keys(e.parameters).forEach(t=>{e.parameters[t]===void 0?r.push(t):r.push(t+`=`+e.parameters[t])}),t+=`a=fmtp:`+n+` `+r.join(`;`)+`\r 214`}return t},t.parseRtcpFb=function(e){let t=e.substring(e.indexOf(` `)+1).split(` `);return{type:t.shift(),parameter:t.join(` `)}},t.writeRtcpFb=function(e){let t=``,n=e.payloadType;return e.preferredPayloadType!==void 0&&(n=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach(e=>{t+=`a=rtcp-fb:`+n+` `+e.type+(e.parameter&&e.parameter.length?` `+e.parameter:``)+`\r 215`}),t},t.parseSsrcMedia=function(e){let t=e.indexOf(` `),n={ssrc:parseInt(e.substring(7,t),10)},r=e.indexOf(`:`,t);return r>-1?(n.attribute=e.substring(t+1,r),n.value=e.substring(r+1)):n.attribute=e.substring(t+1),n},t.parseSsrcGroup=function(e){let t=e.substring(13).split(` `);return{semantics:t.shift(),ssrcs:t.map(e=>parseInt(e,10))}},t.getMid=function(e){let n=t.matchPrefix(e,`a=mid:`)[0];if(n)return n.substring(6)},t.parseFingerprint=function(e){let t=e.substring(14).split(` `);return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},t.getDtlsParameters=function(e,n){return{role:`auto`,fingerprints:t.matchPrefix(e+n,`a=fingerprint:`).map(t.parseFingerprint)}},t.writeDtlsParameters=function(e,t){let n=`a=setup:`+t+`\r 216`;return e.fingerprints.forEach(e=>{n+=`a=fingerprint:`+e.algorithm+` `+e.value+`\r 217`}),n},t.parseCryptoLine=function(e){let t=e.substring(9).split(` `);return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},t.writeCryptoLine=function(e){return`a=crypto:`+e.tag+` `+e.cryptoSuite+` `+(typeof e.keyParams==`object`?t.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?` `+e.sessionParams.join(` `):``)+`\r 218`},t.parseCryptoKeyParams=function(e){if(e.indexOf(`inline:`)!==0)return null;let t=e.substring(7).split(`|`);return{keyMethod:`inline`,keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(`:`)[0]:void 0,mkiLength:t[2]?t[2].split(`:`)[1]:void 0}},t.writeCryptoKeyParams=function(e){return e.keyMethod+`:`+e.keySalt+(e.lifeTime?`|`+e.lifeTime:``)+(e.mkiValue&&e.mkiLength?`|`+e.mkiValue+`:`+e.mkiLength:``)},t.getCryptoParameters=function(e,n){return t.matchPrefix(e+n,`a=crypto:`).map(t.parseCryptoLine)},t.getIceParameters=function(e,n){let r=t.matchPrefix(e+n,`a=ice-ufrag:`)[0],i=t.matchPrefix(e+n,`a=ice-pwd:`)[0];return r&&i?{usernameFragment:r.substring(12),password:i.substring(10)}:null},t.writeIceParameters=function(e){let t=`a=ice-ufrag:`+e.usernameFragment+`\r 219a=ice-pwd:`+e.password+`\r 220`;return e.iceLite&&(t+=`a=ice-lite\r 221`),t},t.parseRtpParameters=function(e){let n={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},r=t.splitLines(e)[0].split(` `);n.profile=r[2];for(let i=3;i<r.length;i++){let a=r[i],o=t.matchPrefix(e,`a=rtpmap:`+a+` `)[0];if(o){let r=t.parseRtpMap(o),i=t.matchPrefix(e,`a=fmtp:`+a+` `);switch(r.parameters=i.length?t.parseFmtp(i[0]):{},r.rtcpFeedback=t.matchPrefix(e,`a=rtcp-fb:`+a+` `).map(t.parseRtcpFb),n.codecs.push(r),r.name.toUpperCase()){case`RED`:case`ULPFEC`:n.fecMechanisms.push(r.name.toUpperCase());break}}}t.matchPrefix(e,`a=extmap:`).forEach(e=>{n.headerExtensions.push(t.parseExtmap(e))});let i=t.matchPrefix(e,`a=rtcp-fb:* `).map(t.parseRtcpFb);return n.codecs.forEach(e=>{i.forEach(t=>{e.rtcpFeedback.find(e=>e.type===t.type&&e.parameter===t.parameter)||e.rtcpFeedback.push(t)})}),n},t.writeRtpDescription=function(e,n){let r=``;r+=`m=`+e+` `,r+=n.codecs.length>0?`9`:`0`,r+=` `+(n.profile||`UDP/TLS/RTP/SAVPF`)+` `,r+=n.codecs.map(e=>e.preferredPayloadType===void 0?e.payloadType:e.preferredPayloadType).join(` `)+`\r 222`,r+=`c=IN IP4 0.0.0.0\r 223`,r+=`a=rtcp:9 IN IP4 0.0.0.0\r 224`,n.codecs.forEach(e=>{r+=t.writeRtpMap(e),r+=t.writeFmtp(e),r+=t.writeRtcpFb(e)});let i=0;return n.codecs.forEach(e=>{e.maxptime>i&&(i=e.maxptime)}),i>0&&(r+=`a=maxptime:`+i+`\r 225`),n.headerExtensions&&n.headerExtensions.forEach(e=>{r+=t.writeExtmap(e)}),r},t.parseRtpEncodingParameters=function(e){let n=[],r=t.parseRtpParameters(e),i=r.fecMechanisms.indexOf(`RED`)!==-1,a=r.fecMechanisms.indexOf(`ULPFEC`)!==-1,o=t.matchPrefix(e,`a=ssrc:`).map(e=>t.parseSsrcMedia(e)).filter(e=>e.attribute===`cname`),s=o.length>0&&o[0].ssrc,c,l=t.matchPrefix(e,`a=ssrc-group:FID`).map(e=>e.substring(17).split(` `).map(e=>parseInt(e,10)));l.length>0&&l[0].length>1&&l[0][0]===s&&(c=l[0][1]),r.codecs.forEach(e=>{if(e.name.toUpperCase()===`RTX`&&e.parameters.apt){let t={ssrc:s,codecPayloadType:parseInt(e.parameters.apt,10)};s&&c&&(t.rtx={ssrc:c}),n.push(t),i&&(t=JSON.parse(JSON.stringify(t)),t.fec={ssrc:s,mechanism:a?`red+ulpfec`:`red`},n.push(t))}}),n.length===0&&s&&n.push({ssrc:s});let u=t.matchPrefix(e,`b=`);return u.length&&(u=u[0].indexOf(`b=TIAS:`)===0?parseInt(u[0].substring(7),10):u[0].indexOf(`b=AS:`)===0?parseInt(u[0].substring(5),10)*1e3*.95-2e3*8:void 0,n.forEach(e=>{e.maxBitrate=u})),n},t.parseRtcpParameters=function(e){let n={},r=t.matchPrefix(e,`a=ssrc:`).map(e=>t.parseSsrcMedia(e)).filter(e=>e.attribute===`cname`)[0];r&&(n.cname=r.value,n.ssrc=r.ssrc);let i=t.matchPrefix(e,`a=rtcp-rsize`);return n.reducedSize=i.length>0,n.compound=i.length===0,n.mux=t.matchPrefix(e,`a=rtcp-mux`).length>0,n},t.writeRtcpParameters=function(e){let t=``;return e.reducedSize&&(t+=`a=rtcp-rsize\r 226`),e.mux&&(t+=`a=rtcp-mux\r 227`),e.ssrc!==void 0&&e.cname&&(t+=`a=ssrc:`+e.ssrc+` cname:`+e.cname+`\r 228`),t},t.parseMsid=function(e){let n,r=t.matchPrefix(e,`a=msid:`);if(r.length===1)return n=r[0].substring(7).split(` `),{stream:n[0],track:n[1]};let i=t.matchPrefix(e,`a=ssrc:`).map(e=>t.parseSsrcMedia(e)).filter(e=>e.attribute===`msid`);if(i.length>0)return n=i[0].value.split(` `),{stream:n[0],track:n[1]}},t.parseSctpDescription=function(e){let n=t.parseMLine(e),r=t.matchPrefix(e,`a=max-message-size:`),i;r.length>0&&(i=parseInt(r[0].substring(19),10)),isNaN(i)&&(i=65536);let a=t.matchPrefix(e,`a=sctp-port:`);if(a.length>0)return{port:parseInt(a[0].substring(12),10),protocol:n.fmt,maxMessageSize:i};let o=t.matchPrefix(e,`a=sctpmap:`);if(o.length>0){let e=o[0].substring(10).split(` `);return{port:parseInt(e[0],10),protocol:e[1],maxMessageSize:i}}},t.writeSctpDescription=function(e,t){let n=[];return n=e.protocol===`DTLS/SCTP`?[`m=`+e.kind+` 9 `+e.protocol+` `+t.port+`\r 229`,`c=IN IP4 0.0.0.0\r 230`,`a=sctpmap:`+t.port+` `+t.protocol+` 65535\r 231`]:[`m=`+e.kind+` 9 `+e.protocol+` `+t.protocol+`\r 232`,`c=IN IP4 0.0.0.0\r 233`,`a=sctp-port:`+t.port+`\r 234`],t.maxMessageSize!==void 0&&n.push(`a=max-message-size:`+t.maxMessageSize+`\r 235`),n.join(``)},t.generateSessionId=function(){return Math.random().toString().substr(2,22)},t.writeSessionBoilerplate=function(e,n,r){let i,a=n===void 0?2:n;return i=e||t.generateSessionId(),`v=0\r 236o=`+(r||`thisisadapterortc`)+` `+i+` `+a+` IN IP4 127.0.0.1\r 237s=-\r 238t=0 0\r 239`},t.getDirection=function(e,n){let r=t.splitLines(e);for(let e=0;e<r.length;e++)switch(r[e]){case`a=sendrecv`:case`a=sendonly`:case`a=recvonly`:case`a=inactive`:return r[e].substring(2)}return n?t.getDirection(n):`sendrecv`},t.getKind=function(e){return t.splitLines(e)[0].split(` `)[0].substring(2)},t.isRejected=function(e){return e.split(` `,2)[1]===`0`},t.parseMLine=function(e){let n=t.splitLines(e)[0].substring(2).split(` `);return{kind:n[0],port:parseInt(n[1],10),protocol:n[2],fmt:n.slice(3).join(` `)}},t.parseOLine=function(e){let n=t.matchPrefix(e,`o=`)[0].substring(2).split(` `);return{username:n[0],sessionId:n[1],sessionVersion:parseInt(n[2],10),netType:n[3],addressType:n[4],address:n[5]}},t.isValidSDP=function(e){if(typeof e!=`string`||e.length===0)return!1;let n=t.splitLines(e);for(let e=0;e<n.length;e++)if(n[e].length<2||n[e].charAt(1)!==`=`)return!1;return!0},e.exports=t})(
vendor: 99,145 bytes, lines 239-244
239l2),l2.exports)}var d2=ele(),f2=Y1(d2),tle=wX({__proto__:null,default:f2},[d2]);function p2(e){if(!e.RTCIceCandidate||e.RTCIceCandidate&&`foundation`in e.RTCIceCandidate.prototype)return;let t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if(typeof e==`object`&&e.candidate&&e.candidate.indexOf(`a=`)===0&&(e=JSON.parse(JSON.stringify(e)),e.candidate=e.candidate.substring(2)),e.candidate&&e.candidate.length){let n=new t(e),r=f2.parseCandidate(e.candidate);for(let e in r)e in n||Object.defineProperty(n,e,{value:r[e]});return n.toJSON=function(){return{candidate:n.candidate,sdpMid:n.sdpMid,sdpMLineIndex:n.sdpMLineIndex,usernameFragment:n.usernameFragment}},n}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,S0(e,`icecandidate`,t=>(t.candidate&&Object.defineProperty(t,`candidate`,{value:new e.RTCIceCandidate(t.candidate),writable:`false`}),t))}function m2(e){!e.RTCIceCandidate||e.RTCIceCandidate&&`relayProtocol`in e.RTCIceCandidate.prototype||S0(e,`icecandidate`,e=>{if(e.candidate){let t=f2.parseCandidate(e.candidate.candidate);t.type===`relay`&&(e.candidate.relayProtocol={0:`tls`,1:`tcp`,2:`udp`}[t.priority>>24])}return e})}function h2(e,t){if(!e.RTCPeerConnection)return;`sctp`in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,`sctp`,{get(){return this._sctp===void 0?null:this._sctp}});let n=function(e){if(!e||!e.sdp)return!1;let t=f2.splitSections(e.sdp);return t.shift(),t.some(e=>{let t=f2.parseMLine(e);return t&&t.kind===`application`&&t.protocol.indexOf(`SCTP`)!==-1})},r=function(e){let t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(t===null||t.length<2)return-1;let n=parseInt(t[1],10);return n===n?n:-1},i=function(e){let n=65536;return t.browser===`firefox`&&(n=t.version<57?e===-1?16384:2147483637:t.version<60?t.version===57?65535:65536:2147483637),n},a=function(e,n){let r=65536;t.browser===`firefox`&&t.version===57&&(r=65535);let i=f2.matchPrefix(e.sdp,`a=max-message-size:`);return i.length>0?r=parseInt(i[0].substring(19),10):t.browser===`firefox`&&n!==-1&&(r=2147483637),r},o=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,t.browser===`chrome`&&t.version>=76&&this.getConfiguration().sdpSemantics===`plan-b`&&Object.defineProperty(this,`sctp`,{get(){return this._sctp===void 0?null:this._sctp},enumerable:!0,configurable:!0}),n(arguments[0])){let e=r(arguments[0]),t=i(e),n=a(arguments[0],e),o;o=t===0&&n===0?1/0:t===0||n===0?Math.max(t,n):Math.min(t,n);let s={};Object.defineProperty(s,`maxMessageSize`,{get(){return o}}),this._sctp=s}return o.apply(this,arguments)}}function g2(e,t){if(!(e.RTCPeerConnection&&`createDataChannel`in e.RTCPeerConnection.prototype)||t.browser===`chrome`&&t.version>149||t.browser===`firefox`&&t.version>60)return;function n(e,t){let n=e.send;e.send=function(){let r=arguments[0],i=r.length||r.size||r.byteLength;if(e.readyState===`open`&&t.sctp&&i>t.sctp.maxMessageSize)throw TypeError(`Message too large (can send a maximum of `+t.sctp.maxMessageSize+` bytes)`);return n.apply(e,arguments)}}let r=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){let e=r.apply(this,arguments);return n(e,this),e},S0(e,`datachannel`,e=>(n(e.channel,e.target),e))}function _2(e){if(!e.RTCPeerConnection||`connectionState`in e.RTCPeerConnection.prototype)return;let t=e.RTCPeerConnection.prototype;Object.defineProperty(t,`connectionState`,{get(){return{completed:`connected`,checking:`connecting`}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,`onconnectionstatechange`,{get(){return this._onconnectionstatechange||null},set(e){this._onconnectionstatechange&&(this.removeEventListener(`connectionstatechange`,this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener(`connectionstatechange`,this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),[`setLocalDescription`,`setRemoteDescription`].forEach(e=>{let n=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=e=>{let t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;let n=new Event(`connectionstatechange`,e);t.dispatchEvent(n)}return e},this.addEventListener(`iceconnectionstatechange`,this._connectionstatechangepoly)),n.apply(this,arguments)}})}function v2(e,t){if(!e.RTCPeerConnection||t.browser===`chrome`&&t.version>=71||t.browser===`safari`&&t._safariVersion>=13.1)return;let n=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&t.sdp.indexOf(` 240a=extmap-allow-mixed`)!==-1){let n=t.sdp.split(` 241`).filter(e=>e.trim()!==`a=extmap-allow-mixed`).join(` 242`);e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:n}):t.sdp=n}return n.apply(this,arguments)}}function y2(e,t){if(!(e.RTCPeerConnection&&e.RTCPeerConnection.prototype))return;let n=e.RTCPeerConnection.prototype.addIceCandidate;!n||n.length===0||(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?(t.browser===`chrome`&&t.version<78||t.browser===`firefox`&&t.version<68||t.browser===`safari`)&&arguments[0]&&arguments[0].candidate===``?Promise.resolve():n.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function b2(e,t){if(!(e.RTCPeerConnection&&e.RTCPeerConnection.prototype))return;let n=e.RTCPeerConnection.prototype.setLocalDescription;!n||n.length===0||(e.RTCPeerConnection.prototype.setLocalDescription=function(){let e=arguments[0]||{};if(typeof e!=`object`||e.type&&e.sdp)return n.apply(this,arguments);if(e={type:e.type,sdp:e.sdp},!e.type)switch(this.signalingState){case`stable`:case`have-local-offer`:case`have-remote-pranswer`:e.type=`offer`;break;default:e.type=`answer`;break}return e.sdp||e.type!==`offer`&&e.type!==`answer`?n.apply(this,[e]):(e.type===`offer`?this.createOffer:this.createAnswer).apply(this).then(e=>n.apply(this,[e]))})}var nle=Object.freeze({__proto__:null,removeExtmapAllowMixed:v2,shimAddIceCandidateNullOrEmpty:y2,shimConnectionState:_2,shimMaxMessageSize:h2,shimParameterlessSetLocalDescription:b2,shimRTCIceCandidate:p2,shimRTCIceCandidateRelayProtocol:m2,shimSendThrowTypeError:g2});function rle(){let e=(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}).window,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0},n=C0,r=Qce(e),i={browserDetails:r,commonShim:nle,extractVersion:x0,disableLog:Xce,disableWarnings:Zce,sdp:tle};switch(r.browser){case`chrome`:if(!z0||!L0||!t.shimChrome)return n(`Chrome shim is not included in this adapter release.`),i;if(r.version===null)return n(`Chrome shim can not determine version, not shimming.`),i;n(`adapter.js shimming chrome.`),i.browserShim=z0,y2(e,r),b2(e),A0(e,r),j0(e),L0(e,r),M0(e,r),I0(e,r),N0(e),P0(e,r),R0(e,r),p2(e),m2(e),_2(e),h2(e,r),g2(e,r),v2(e,r);break;case`firefox`:if(!Q0||!H0||!t.shimFirefox)return n(`Firefox shim is not included in this adapter release.`),i;n(`adapter.js shimming firefox.`),i.browserShim=Q0,y2(e,r),b2(e),B0(e,r),H0(e,r),U0(e,r),V0(e),K0(e),W0(e),G0(e),q0(e),J0(e),Y0(e),X0(e),Z0(e),p2(e),_2(e),h2(e,r),g2(e,r);break;case`safari`:if(!c2||!t.shimSafari)return n(`Safari shim is not included in this adapter release.`),i;n(`adapter.js shimming safari.`),i.browserShim=c2,y2(e,r),b2(e),i2(e),o2(e),t2(e),$0(e),e2(e),a2(e),n2(e),s2(e),p2(e),m2(e),h2(e,r),g2(e,r),v2(e,r);break;default:n(`Unsupported browser!`);break}return i}rle({window:typeof window>`u`?void 0:window});var x2,S2,C2=class extends (S2=Promise){constructor(e){super(e)}catch(e){return super.catch(e)}static reject(e){return super.reject(e)}static all(e){return super.all(e)}static race(e){return super.race(e)}};x2=C2,C2.resolve=e=>Reflect.get(S2,`resolve`,x2).call(x2,e);var ile=/version\/(\d+(\.?_?\d+)+)/i,w2;function T2(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e===void 0&&typeof navigator>`u`)return;let n=(e??navigator.userAgent).toLowerCase();return(w2===void 0||t)&&(w2=ale.find(e=>e.test.test(n))?.describe(n)),w2}var ale=[{test:/firefox|iceweasel|fxios/i,describe(e){return{name:`Firefox`,version:E2(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e),os:e.toLowerCase().includes(`fxios`)?`iOS`:void 0,osVersion:D2(e)}}},{test:/chrom|crios|crmo/i,describe(e){return{name:`Chrome`,version:E2(/(?:chrome|chromium|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e),os:e.toLowerCase().includes(`crios`)?`iOS`:void 0,osVersion:D2(e)}}},{test:/safari|applewebkit/i,describe(e){return{name:`Safari`,version:E2(ile,e),os:e.includes(`mobile/`)?`iOS`:`macOS`,osVersion:D2(e)}}}];function E2(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,r=t.match(e);return r&&r.length>=n&&r[n]||``}function D2(e){return e.includes(`mac os`)?E2(/\(.+?(\d+_\d+(:?_\d+)?)/,e,1).replace(/_/g,`.`):void 0}var ole=`2.20.0`,O2=class extends Error{constructor(e,t,n){super(t||`an error has occurred`),this.name=`LiveKitError`,this.code=e,n?.cause!==void 0&&(this.cause=n?.cause)}},k2=class extends O2{},A2;(function(e){e[e.NotAllowed=0]=`NotAllowed`,e[e.ServerUnreachable=1]=`ServerUnreachable`,e[e.InternalError=2]=`InternalError`,e[e.Cancelled=3]=`Cancelled`,e[e.LeaveRequest=4]=`LeaveRequest`,e[e.Timeout=5]=`Timeout`,e[e.WebSocket=6]=`WebSocket`,e[e.ServiceNotFound=7]=`ServiceNotFound`})(A2||={});var j2=class e extends k2{constructor(e,t,n,r){super(1,e),this.name=`ConnectionError`,this.status=n,this.reason=t,this.context=r,this.reasonName=A2[t]}static notAllowed(t,n,r){return new e(t,A2.NotAllowed,n,r)}static timeout(t){return new e(t,A2.Timeout)}static leaveRequest(t,n){return new e(t,A2.LeaveRequest,void 0,n)}static internal(t,n){return new e(t,A2.InternalError,void 0,n)}static cancelled(t){return new e(t,A2.Cancelled)}static serverUnreachable(t,n){return new e(t,A2.ServerUnreachable,n)}static websocket(t,n,r){return new e(t,A2.WebSocket,n,r)}static serviceNotFound(t,n){return new e(t,A2.ServiceNotFound,void 0,n)}},M2=class extends O2{constructor(e){super(21,e??`device is unsupported`),this.name=`DeviceUnsupportedError`}},N2=class extends O2{constructor(e){super(20,e??`track is invalid`),this.name=`TrackInvalidError`}},sle=class extends O2{constructor(e){super(10,e??`unsupported server`),this.name=`UnsupportedServer`}},P2=class extends O2{constructor(e){super(12,e??`unexpected connection state`),this.name=`UnexpectedConnectionState`}},F2=class extends O2{constructor(e){super(13,e??`unable to negotiate`),this.name=`NegotiationError`}},cle=class extends O2{constructor(e){super(14,e??`unable to publish data`),this.name=`PublishDataError`}},I2=class extends O2{constructor(e,t){super(15,e),this.name=`PublishTrackError`,this.status=t}},L2=class extends k2{constructor(e,t){super(15,e),this.name=`SignalRequestError`,this.reason=t,this.reasonName=typeof t==`string`?t:H1[t]}},R2;(function(e){e[e.AlreadyOpened=0]=`AlreadyOpened`,e[e.AbnormalEnd=1]=`AbnormalEnd`,e[e.DecodeFailed=2]=`DecodeFailed`,e[e.LengthExceeded=3]=`LengthExceeded`,e[e.Incomplete=4]=`Incomplete`,e[e.HandlerAlreadyRegistered=7]=`HandlerAlreadyRegistered`,e[e.EncryptionTypeMismatch=8]=`EncryptionTypeMismatch`})(R2||={});var z2=class extends k2{constructor(e,t){super(16,e),this.name=`DataStreamError`,this.reason=t,this.reasonName=R2[t]}},B2=class extends O2{constructor(e){super(18,e),this.name=`SignalReconnectError`}},V2;(function(e){e.PermissionDenied=`PermissionDenied`,e.NotFound=`NotFound`,e.DeviceInUse=`DeviceInUse`,e.Other=`Other`})(V2||={}),(function(e){function t(t){if(t&&`name`in t)return t.name===`NotFoundError`||t.name===`DevicesNotFoundError`?e.NotFound:t.name===`NotAllowedError`||t.name===`PermissionDeniedError`?e.PermissionDenied:t.name===`NotReadableError`||t.name===`TrackStartError`?e.DeviceInUse:e.Other}e.getFailure=t})(V2||={});var H2=class{};H2.setTimeout=function(){return setTimeout(...arguments)},H2.setInterval=function(){return setInterval(...arguments)},H2.clearTimeout=function(){return clearTimeout(...arguments)},H2.clearInterval=function(){return clearInterval(...arguments)};var Y;(function(e){e.Connected=`connected`,e.Reconnecting=`reconnecting`,e.SignalReconnecting=`signalReconnecting`,e.Reconnected=`reconnected`,e.Disconnected=`disconnected`,e.ConnectionStateChanged=`connectionStateChanged`,e.Moved=`moved`,e.MediaDevicesChanged=`mediaDevicesChanged`,e.ParticipantConnected=`participantConnected`,e.ParticipantDisconnected=`participantDisconnected`,e.TrackPublished=`trackPublished`,e.TrackSubscribed=`trackSubscribed`,e.TrackSubscriptionFailed=`trackSubscriptionFailed`,e.TrackUnpublished=`trackUnpublished`,e.TrackUnsubscribed=`trackUnsubscribed`,e.TrackMuted=`trackMuted`,e.TrackUnmuted=`trackUnmuted`,e.LocalTrackPublished=`localTrackPublished`,e.LocalTrackUnpublished=`localTrackUnpublished`,e.LocalAudioSilenceDetected=`localAudioSilenceDetected`,e.ActiveSpeakersChanged=`activeSpeakersChanged`,e.ParticipantMetadataChanged=`participantMetadataChanged`,e.ParticipantNameChanged=`participantNameChanged`,e.ParticipantAttributesChanged=`participantAttributesChanged`,e.ParticipantActive=`participantActive`,e.RoomMetadataChanged=`roomMetadataChanged`,e.DataReceived=`dataReceived`,e.SipDTMFReceived=`sipDTMFReceived`,e.TranscriptionReceived=`transcriptionReceived`,e.ConnectionQualityChanged=`connectionQualityChanged`,e.TrackStreamStateChanged=`trackStreamStateChanged`,e.TrackSubscriptionPermissionChanged=`trackSubscriptionPermissionChanged`,e.TrackSubscriptionStatusChanged=`trackSubscriptionStatusChanged`,e.AudioPlaybackStatusChanged=`audioPlaybackChanged`,e.VideoPlaybackStatusChanged=`videoPlaybackChanged`,e.MediaDevicesError=`mediaDevicesError`,e.ParticipantPermissionsChanged=`participantPermissionsChanged`,e.SignalConnected=`signalConnected`,e.RecordingStatusChanged=`recordingStatusChanged`,e.ParticipantEncryptionStatusChanged=`participantEncryptionStatusChanged`,e.EncryptionError=`encryptionError`,e.DCBufferStatusChanged=`dcBufferStatusChanged`,e.ActiveDeviceChanged=`activeDeviceChanged`,e.ChatMessage=`chatMessage`,e.LocalTrackSubscribed=`localTrackSubscribed`,e.MetricsReceived=`metricsReceived`,e.DataTrackPublished=`dataTrackPublished`,e.DataTrackUnpublished=`dataTrackUnpublished`,e.LocalDataTrackPublished=`localDataTrackPublished`,e.LocalDataTrackUnpublished=`localDataTrackUnpublished`})(Y||={});var X;(function(e){e.TrackPublished=`trackPublished`,e.TrackSubscribed=`trackSubscribed`,e.TrackSubscriptionFailed=`trackSubscriptionFailed`,e.TrackUnpublished=`trackUnpublished`,e.TrackUnsubscribed=`trackUnsubscribed`,e.TrackMuted=`trackMuted`,e.TrackUnmuted=`trackUnmuted`,e.LocalTrackPublished=`localTrackPublished`,e.LocalTrackUnpublished=`localTrackUnpublished`,e.LocalTrackCpuConstrained=`localTrackCpuConstrained`,e.LocalSenderCreated=`localSenderCreated`,e.ParticipantMetadataChanged=`participantMetadataChanged`,e.ParticipantNameChanged=`participantNameChanged`,e.DataReceived=`dataReceived`,e.SipDTMFReceived=`sipDTMFReceived`,e.TranscriptionReceived=`transcriptionReceived`,e.IsSpeakingChanged=`isSpeakingChanged`,e.ConnectionQualityChanged=`connectionQualityChanged`,e.TrackStreamStateChanged=`trackStreamStateChanged`,e.TrackSubscriptionPermissionChanged=`trackSubscriptionPermissionChanged`,e.TrackSubscriptionStatusChanged=`trackSubscriptionStatusChanged`,e.TrackCpuConstrained=`trackCpuConstrained`,e.MediaDevicesError=`mediaDevicesError`,e.AudioStreamAcquired=`audioStreamAcquired`,e.ParticipantPermissionsChanged=`participantPermissionsChanged`,e.PCTrackAdded=`pcTrackAdded`,e.AttributesChanged=`attributesChanged`,e.LocalTrackSubscribed=`localTrackSubscribed`,e.ChatMessage=`chatMessage`,e.Active=`active`})(X||={});var Z;(function(e){e.TransportsCreated=`transportsCreated`,e.Connected=`connected`,e.Disconnected=`disconnected`,e.Resuming=`resuming`,e.Resumed=`resumed`,e.Restarting=`restarting`,e.Restarted=`restarted`,e.SignalResumed=`signalResumed`,e.SignalRestarted=`signalRestarted`,e.Closing=`closing`,e.MediaTrackAdded=`mediaTrackAdded`,e.ActiveSpeakersUpdate=`activeSpeakersUpdate`,e.DataPacketReceived=`dataPacketReceived`,e.RTPVideoMapUpdate=`rtpVideoMapUpdate`,e.DCBufferStatusChanged=`dcBufferStatusChanged`,e.ParticipantUpdate=`participantUpdate`,e.RoomUpdate=`roomUpdate`,e.SpeakersChanged=`speakersChanged`,e.StreamStateChanged=`streamStateChanged`,e.ConnectionQualityUpdate=`connectionQualityUpdate`,e.SubscriptionError=`subscriptionError`,e.SubscriptionPermissionUpdate=`subscriptionPermissionUpdate`,e.RemoteMute=`remoteMute`,e.SubscribedQualityUpdate=`subscribedQualityUpdate`,e.LocalTrackUnpublished=`localTrackUnpublished`,e.LocalTrackSubscribed=`localTrackSubscribed`,e.Offline=`offline`,e.SignalRequestResponse=`signalRequestResponse`,e.SignalConnected=`signalConnected`,e.RoomMoved=`roomMoved`,e.PublishDataTrackResponse=`publishDataTrackResponse`,e.UnPublishDataTrackResponse=`unPublishDataTrackResponse`,e.DataTrackSubscriberHandles=`dataTrackSubscriberHandles`,e.DataTrackPacketReceived=`dataTrackPacketReceived`,e.Joined=`joined`,e.TokenRefreshed=`tokenRefreshed`,e.ServerRegionsReported=`serverRegionsReported`})(Z||={});var Q;(function(e){e.Message=`message`,e.Muted=`muted`,e.Unmuted=`unmuted`,e.Restarted=`restarted`,e.Ended=`ended`,e.Subscribed=`subscribed`,e.Unsubscribed=`unsubscribed`,e.CpuConstrained=`cpuConstrained`,e.UpdateSettings=`updateSettings`,e.UpdateSubscription=`updateSubscription`,e.AudioPlaybackStarted=`audioPlaybackStarted`,e.AudioPlaybackFailed=`audioPlaybackFailed`,e.AudioSilenceDetected=`audioSilenceDetected`,e.VisibilityChanged=`visibilityChanged`,e.VideoDimensionsChanged=`videoDimensionsChanged`,e.VideoPlaybackStarted=`videoPlaybackStarted`,e.VideoPlaybackFailed=`videoPlaybackFailed`,e.ElementAttached=`elementAttached`,e.ElementDetached=`elementDetached`,e.UpstreamPaused=`upstreamPaused`,e.UpstreamResumed=`upstreamResumed`,e.SubscriptionPermissionChanged=`subscriptionPermissionChanged`,e.SubscriptionStatusChanged=`subscriptionStatusChanged`,e.SubscriptionFailed=`subscriptionFailed`,e.TrackProcessorUpdate=`trackProcessorUpdate`,e.AudioTrackFeatureUpdate=`audioTrackFeatureUpdate`,e.TranscriptionReceived=`transcriptionReceived`,e.TimeSyncUpdate=`timeSyncUpdate`,e.PreConnectBufferFlushed=`preConnectBufferFlushed`})(Q||={});function lle(e){return e===void 0?e:typeof structuredClone==`function`?typeof e==`object`&&e?structuredClone(Object.assign({},e)):structuredClone(e):JSON.parse(JSON.stringify(e))}var U2=class{constructor(e,t,n,r,i){if(typeof e==`object`)this.width=e.width,this.height=e.height,this.aspectRatio=e.aspectRatio,this.encoding={maxBitrate:e.maxBitrate,maxFramerate:e.maxFramerate,priority:e.priority};else if(t!==void 0&&n!==void 0)this.width=e,this.height=t,this.aspectRatio=e/t,this.encoding={maxBitrate:n,maxFramerate:r,priority:i};else throw TypeError(`Unsupported options: provide at least width, height and maxBitrate`)}get resolution(){return{width:this.width,height:this.height,frameRate:this.encoding.maxFramerate,aspectRatio:this.aspectRatio}}},ule=[`vp8`,`h264`],dle=[`vp8`,`h264`,`vp9`,`av1`,`h265`];function W2(e){return!!ule.find(t=>t===e)}var fle=W2,ple;(function(e){e[e.PREFER_REGRESSION=0]=`PREFER_REGRESSION`,e[e.SIMULCAST=1]=`SIMULCAST`,e[e.REGRESSION=2]=`REGRESSION`})(ple||={});var G2;(function(e){e.telephone={maxBitrate:12e3},e.speech={maxBitrate:24e3},e.music={maxBitrate:48e3},e.musicStereo={maxBitrate:64e3},e.musicHighQuality={maxBitrate:96e3},e.musicHighQualityStereo={maxBitrate:128e3}})(G2||={});var K2={h90:new U2(160,90,9e4,20),h180:new U2(320,180,16e4,20),h216:new U2(384,216,18e4,20),h360:new U2(640,360,45e4,20),h540:new U2(960,540,8e5,25),h720:new U2(1280,720,17e5,30),h1080:new U2(1920,1080,3e6,30),h1440:new U2(2560,1440,5e6,30),h2160:new U2(3840,2160,8e6,30)},q2={h120:new U2(160,120,7e4,20),h180:new U2(240,180,125e3,20),h240:new U2(320,240,14e4,20),h360:new U2(480,360,33e4,20),h480:new U2(640,480,5e5,20),h540:new U2(720,540,6e5,25),h720:new U2(960,720,13e5,30),h1080:new U2(1440,1080,23e5,30),h1440:new U2(1920,1440,38e5,30)},J2={h360fps3:new U2(640,360,2e5,3,`medium`),h360fps15:new U2(640,360,4e5,15,`medium`),h720fps5:new U2(1280,720,8e5,5,`medium`),h720fps15:new U2(1280,720,15e5,15,`medium`),h720fps30:new U2(1280,720,2e6,30,`medium`),h1080fps15:new U2(1920,1080,25e5,15,`medium`),h1080fps30:new U2(1920,1080,5e6,30,`medium`),original:new U2(0,0,7e6,30,`medium`)};function Y2(e,t,n){var r,i;let a=n4(e??{}),o=a.optionsWithoutProcessor,s=a.audioProcessor,c=a.videoProcessor,l=t?.processor,u=n?.processor,d=o??{};return d.audio===!0&&(d.audio={}),d.video===!0&&(d.video={}),d.audio&&(X2(d.audio,t),(r=d.audio).deviceId??(r.deviceId={ideal:`default`}),(s||l)&&(d.audio.processor=s??l)),d.video&&(X2(d.video,n),(i=d.video).deviceId??(i.deviceId={ideal:`default`}),(c||u)&&(d.video.processor=c??u)),d}function X2(e,t){return Object.keys(t).forEach(n=>{e[n]===void 0&&(e[n]=t[n])}),e}function Z2(e){var t,n;let r={};if(e.video)if(typeof e.video==`object`){let n={},i=n,a=e.video;Object.keys(a).forEach(e=>{switch(e){case`resolution`:X2(i,a.resolution);break;default:i[e]=a[e]}}),r.video=n,(t=r.video).deviceId??(t.deviceId={ideal:`default`})}else r.video=e.video?{deviceId:{ideal:`default`}}:!1;else r.video=!1;return e.audio?typeof e.audio==`object`?(r.audio=e.audio,(n=r.audio).deviceId??(n.deviceId={ideal:`default`})):r.audio={deviceId:{ideal:`default`}}:r.audio=!1,r}function mle(e){return J(this,arguments,void 0,function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:200;return function*(){let n=Q2();if(n){let r=n.createAnalyser();r.fftSize=2048;let i=r.frequencyBinCount,a=new Uint8Array(i);n.createMediaStreamSource(new MediaStream([e.mediaStreamTrack])).connect(r),yield l4(t),r.getByteTimeDomainData(a);let o=a.some(e=>e!==128&&e!==0);return n.close(),!o}return!1}()})}function Q2(){let e=typeof window<`u`&&(window.AudioContext||window.webkitAudioContext);if(e){let t=new e({latencyHint:`interactive`});if(t.state===`suspended`&&typeof window<`u`&&window.document?.body){let e=()=>J(this,void 0,void 0,function*(){var n;try{t.state===`suspended`&&(yield t.resume())}catch(e){console.warn(`Error trying to auto-resume audio context`,e)}finally{(n=window.document.body)==null||n.removeEventListener(`click`,e)}});t.addEventListener(`statechange`,()=>{var n;t.state===`closed`&&((n=window.document.body)==null||n.removeEventListener(`click`,e))}),window.document.body.addEventListener(`click`,e)}return t}}function hle(e){return e===`audioinput`?$.Source.Microphone:e===`videoinput`?$.Source.Camera:$.Source.Unknown}function $2(e){if(e===$.Source.Microphone)return`audioinput`;if(e===$.Source.Camera)return`videoinput`}function gle(e){let t=e.video??!0;return e.resolution&&e.resolution.width>0&&e.resolution.height>0&&(t=typeof t==`boolean`?{}:t,t=g4()?Object.assign(Object.assign({},t),{width:{max:e.resolution.width},height:{max:e.resolution.height},frameRate:e.resolution.frameRate}):Object.assign(Object.assign({},t),{width:{ideal:e.resolution.width},height:{ideal:e.resolution.height},frameRate:e.resolution.frameRate})),{audio:e.audio??!1,video:t,controller:e.controller,selfBrowserSurface:e.selfBrowserSurface,surfaceSwitching:e.surfaceSwitching,systemAudio:e.systemAudio,preferCurrentTab:e.preferCurrentTab}}function e4(e){return e.split(`/`)[1].toLowerCase()}function _le(e){let t=[];return e.forEach(e=>{e.track!==void 0&&t.push(new r1({cid:e.track.mediaStreamID,track:e.trackInfo}))}),t}function t4(e){return`mediaStreamTrack`in e?{trackID:e.sid,source:e.source,muted:e.isMuted,enabled:e.mediaStreamTrack.enabled,kind:e.kind,streamID:e.mediaStreamID,streamTrackID:e.mediaStreamTrack.id}:{trackID:e.trackSid,enabled:e.isEnabled,muted:e.isMuted,trackInfo:Object.assign({mimeType:e.mimeType,name:e.trackName,encrypted:e.isEncrypted,kind:e.kind,source:e.source},e.track?t4(e.track):{})}}function vle(){return typeof RTCRtpReceiver<`u`&&typeof RTCRtpReceiver.prototype.getSynchronizationSources==`function`}function yle(e,t){e===void 0&&(e={}),t===void 0&&(t={});let n=[...Object.keys(t),...Object.keys(e)],r={};for(let i of n)e[i]!==t[i]&&(r[i]=t[i]??``);return r}function n4(e){let t=Object.assign({},e),n,r;return typeof t.audio==`object`&&t.audio.processor&&(n=t.audio.processor,t.audio=Object.assign(Object.assign({},t.audio),{processor:void 0})),typeof t.video==`object`&&t.video.processor&&(r=t.video.processor,t.video=Object.assign(Object.assign({},t.video),{processor:void 0})),{audioProcessor:n,videoProcessor:r,optionsWithoutProcessor:lle(t)}}function ble(e){switch(e){case zQ.CAMERA:return $.Source.Camera;case zQ.MICROPHONE:return $.Source.Microphone;case zQ.SCREEN_SHARE:return $.Source.ScreenShare;case zQ.SCREEN_SHARE_AUDIO:return $.Source.ScreenShareAudio;default:return $.Source.Unknown}}function r4(e,t){return e.width*e.height<t.width*t.height}function xle(e,t){return e.layers?.find(e=>e.quality===t)}var Sle=5e3,i4=[],a4;(function(e){e[e.LOW=0]=`LOW`,e[e.MEDIUM=1]=`MEDIUM`,e[e.HIGH=2]=`HIGH`})(a4||={});var $=class e extends v0.EventEmitter{get streamState(){return this._streamState}setStreamState(e){this._streamState=e}constructor(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};super(),this.attachedElements=[],this.isMuted=!1,this._streamState=e.StreamState.Active,this.isInBackground=!1,this._currentBitrate=0,this.log=r0,this.appVisibilityChangedListener=()=>{this.backgroundTimeout&&clearTimeout(this.backgroundTimeout),document.visibilityState===`hidden`?this.backgroundTimeout=setTimeout(()=>this.handleAppVisibilityChanged(),Sle):this.handleAppVisibilityChanged()},this.log=i0(r.loggerName??n0.Track),this.loggerContextCb=r.loggerContextCb,this.setMaxListeners(100),this.kind=n,this._mediaStreamTrack=t,this._mediaStreamID=t.id,this.source=e.Source.Unknown}get logContext(){return Object.assign(Object.assign({},this.loggerContextCb?.call(this)),t4(this))}get currentBitrate(){return this._currentBitrate}get mediaStreamTrack(){return this._mediaStreamTrack}get mediaStreamID(){return this._mediaStreamID}attach(t){let n=`audio`;this.kind===e.Kind.Video&&(n=`video`),this.attachedElements.length===0&&this.kind===e.Kind.Video&&this.addAppVisibilityListener(),t||(n===`audio`&&(i4.forEach(e=>{e.parentElement===null&&!t&&(t=e)}),t&&i4.splice(i4.indexOf(t),1)),t||=document.createElement(n)),this.attachedElements.includes(t)||this.attachedElements.push(t),o4(this.mediaStreamTrack,t);let r=t.srcObject.getTracks(),i=r.some(e=>e.kind===`audio`);return t.play().then(()=>{this.emit(i?Q.AudioPlaybackStarted:Q.VideoPlaybackStarted)}).catch(e=>{e.name===`NotAllowedError`?this.emit(i?Q.AudioPlaybackFailed:Q.VideoPlaybackFailed,e):e.name===`AbortError`?r0.debug(`${i?`audio`:`video`} playback aborted, likely due to new play request`):r0.warn(`could not playback ${i?`audio`:`video`}`,e),i&&t&&r.some(e=>e.kind===`video`)&&e.name===`NotAllowedError`&&(t.muted=!0,t.play().catch(()=>{}))}),this.emit(Q.ElementAttached,t),t}detach(e){try{if(e){s4(this.mediaStreamTrack,e);let t=this.attachedElements.indexOf(e);return t>=0&&(this.attachedElements.splice(t,1),this.recycleElement(e),this.emit(Q.ElementDetached,e)),e}let t=[];return this.attachedElements.forEach(e=>{s4(this.mediaStreamTrack,e),t.push(e),this.recycleElement(e),this.emit(Q.ElementDetached,e)}),this.attachedElements=[],t}finally{this.attachedElements.length===0&&this.removeAppVisibilityListener()}}stop(){this.stopMonitor(),this._mediaStreamTrack.stop()}enable(){this._mediaStreamTrack.enabled=!0}disable(){this._mediaStreamTrack.enabled=!1}stopMonitor(){this.monitorInterval&&clearInterval(this.monitorInterval),this.timeSyncHandle&&cancelAnimationFrame(this.timeSyncHandle)}updateLoggerOptions(e){e.loggerName&&(this.log=i0(e.loggerName)),e.loggerContextCb&&(this.loggerContextCb=e.loggerContextCb)}recycleElement(e){if(e instanceof HTMLAudioElement){let t=!0;e.pause(),i4.forEach(e=>{e.parentElement||(t=!1)}),t&&i4.push(e)}}handleAppVisibilityChanged(){return J(this,void 0,void 0,function*(){this.isInBackground=document.visibilityState===`hidden`,!this.isInBackground&&this.kind===e.Kind.Video&&setTimeout(()=>this.attachedElements.forEach(e=>e.play().catch(()=>{})),0)})}addAppVisibilityListener(){y4()?(this.isInBackground=document.visibilityState===`hidden`,document.addEventListener(`visibilitychange`,this.appVisibilityChangedListener)):this.isInBackground=!1}removeAppVisibilityListener(){y4()&&document.removeEventListener(`visibilitychange`,this.appVisibilityChangedListener)}};function o4(e,t){let n;n=t.srcObject instanceof MediaStream?t.srcObject:new MediaStream;let r;r=e.kind===`audio`?n.getAudioTracks():n.getVideoTracks(),r.includes(e)||(r.forEach(e=>{n.removeTrack(e)}),n.addTrack(e)),(!g4()||!(t instanceof HTMLVideoElement))&&(t.autoplay=!0),t.muted=n.getAudioTracks().length===0,t instanceof HTMLVideoElement&&(t.playsInline=!0),t.srcObject!==n&&(t.srcObject=n,(g4()||m4())&&t instanceof HTMLVideoElement&&setTimeout(()=>{t.srcObject=n,t.play().catch(()=>{})},0))}function s4(e,t){if(t.srcObject instanceof MediaStream){let n=t.srcObject;n.removeTrack(e),n.getTracks().length>0?t.srcObject=n:t.srcObject=null}}(function(e){let t;(function(e){e.Audio=`audio`,e.Video=`video`,e.Unknown=`unknown`})(t=e.Kind||={});let n;(function(e){e.Camera=`camera`,e.Microphone=`microphone`,e.ScreenShare=`screen_share`,e.ScreenShareAudio=`screen_share_audio`,e.Unknown=`unknown`})(n=e.Source||={});let r;(function(e){e.Active=`active`,e.Paused=`paused`,e.Unknown=`unknown`})(r=e.StreamState||={});function i(e){switch(e){case t.Audio:return RQ.AUDIO;case t.Video:return RQ.VIDEO;default:return RQ.DATA}}e.kindToProto=i;function a(e){switch(e){case RQ.AUDIO:return t.Audio;case RQ.VIDEO:return t.Video;default:return t.Unknown}}e.kindFromProto=a;function o(e){switch(e){case n.Camera:return zQ.CAMERA;case n.Microphone:return zQ.MICROPHONE;case n.ScreenShare:return zQ.SCREEN_SHARE;case n.ScreenShareAudio:return zQ.SCREEN_SHARE_AUDIO;default:return zQ.UNKNOWN}}e.sourceToProto=o;function s(e){switch(e){case zQ.CAMERA:return n.Camera;case zQ.MICROPHONE:return n.Microphone;case zQ.SCREEN_SHARE:return n.ScreenShare;case zQ.SCREEN_SHARE_AUDIO:return n.ScreenShareAudio;default:return n.Unknown}}e.sourceFromProto=s;function c(e){switch(e){case V$.ACTIVE:return r.Active;case V$.PAUSED:return r.Paused;default:return r.Unknown}}e.streamStateFromProto=c})($||={});var Cle=`|`,c4=`https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension`;function wle(e){let t=e.split(Cle);return t.length>1?[t[0],e.substr(t[0].length+1)]:[e,``]}function l4(e){return new C2(t=>H2.setTimeout(t,e))}function u4(){return`addTransceiver`in RTCPeerConnection.prototype}function d4(){return`addTrack`in RTCPeerConnection.prototype}function Tle(){if(!(`getCapabilities`in RTCRtpSender)||g4()||m4())return!1;let e=RTCRtpSender.getCapabilities(`video`),t=!1;if(e){for(let n of e.codecs)if(n.mimeType.toLowerCase()===`video/av1`){t=!0;break}}return t}function Ele(){if(!(`getCapabilities`in RTCRtpSender)||m4())return!1;if(g4()){let e=T2();if(e?.version&&E4(e.version,`16`)<0||e?.os===`iOS`&&e?.osVersion&&E4(e.osVersion,`16`)<0)return!1}let e=RTCRtpSender.getCapabilities(`video`),t=!1;if(e){for(let n of e.codecs)if(n.mimeType.toLowerCase()===`video/vp9`){t=!0;break}}return t}function f4(e){return e===`av1`||e===`vp9`}function p4(e){return!document||_4()?!1:(e||=document.createElement(`audio`),`setSinkId`in e)}function Dle(){return typeof RTCPeerConnection>`u`?!1:u4()||d4()}function m4(){return T2()?.name===`Firefox`}function Ole(){let e=T2();return!!e&&e.name===`Chrome`&&e.os!==`iOS`}function h4(){return typeof window<`u`&&window.RTCRtpScriptTransform!==void 0&&!Ole()}function g4(){return T2()?.name===`Safari`}function _4(){let e=T2();return e?.name===`Safari`||e?.os===`iOS`}function kle(){let e=T2();return e?.name===`Safari`&&e.version.startsWith(`17.`)||e?.os===`iOS`&&!!e?.osVersion&&E4(e.osVersion,`17`)>=0}function Ale(e){return e||=T2(),e?.name===`Safari`&&E4(e.version,`18.3`)>0||e?.os===`iOS`&&!!e?.osVersion&&E4(e.osVersion,`18.3`)>0}function v4(){return y4()?navigator.userAgentData?.mobile??/Tablet|iPad|Mobile|Android|BlackBerry/.test(navigator.userAgent):!1}function jle(){let e=T2(),t=`17.2`;if(e)return e.name!==`Safari`&&e.os!==`iOS`||e.os===`iOS`&&e.osVersion&&E4(e.osVersion,t)>=0?!0:e.name===`Safari`&&E4(e.version,t)>=0}function y4(){return typeof document<`u`}function b4(){return navigator.product==`ReactNative`}function x4(e){return e.hostname.endsWith(`.livekit.cloud`)||e.hostname.endsWith(`.livekit.run`)}function S4(e){return x4(e)?e.hostname.split(`.`)[0]:null}function C4(){if(global&&global.LiveKitReactNativeGlobal)return global.LiveKitReactNativeGlobal}function w4(){if(!b4())return;let e=C4();if(e)return e.platform}function T4(){if(y4())return window.devicePixelRatio;if(b4()){let e=C4();if(e)return e.devicePixelRatio}return 1}function E4(e,t){let n=e.split(`.`),r=t.split(`.`),i=Math.min(n.length,r.length);for(let e=0;e<i;++e){let t=parseInt(n[e],10),a=parseInt(r[e],10);if(t>a)return 1;if(t<a)return-1;if(e===i-1&&t===a)return 0}return e===``&&t!==``?-1:t===``?1:n.length==r.length?0:n.length<r.length?-1:1}function Mle(e){for(let t of e)t.target.handleResize(t)}function Nle(e){for(let t of e)t.target.handleVisibilityChanged(t)}var D4=null,O4=()=>(D4||=new ResizeObserver(Mle),D4),k4=null,A4=()=>(k4||=new IntersectionObserver(Nle,{root:null,rootMargin:`0px`}),k4);function Ple(e){let t=new E$({capabilities:e,sdk:D$.JS,protocol:17,clientProtocol:1,version:ole});return b4()&&(t.os=w4()??``),t}function j4(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:16,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:16,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,i=document.createElement(`canvas`);i.width=e,i.height=t;let a=i.getContext(`2d`);a?.fillRect(0,0,i.width,i.height),r&&a&&(a.beginPath(),a.arc(e/2,t/2,50,0,Math.PI*2,!0),a.closePath(),a.fillStyle=`grey`,a.fill());let o=hZ(i.captureStream().getTracks(),1)[0];if(!o)throw Error(`Could not get empty media stream video track`);return o.enabled=n,o}var M4;function N4(){if(!M4){let e=new AudioContext,t=e.createOscillator(),n=e.createGain();n.gain.setValueAtTime(0,0);let r=e.createMediaStreamDestination();if(t.connect(n),n.connect(r),t.start(),M4=hZ(r.stream.getAudioTracks(),1)[0],!M4)throw Error(`Could not get empty media stream audio track`);M4.enabled=!1}return M4.clone()}var P4=class{get isResolved(){return this._isResolved}constructor(e,t){this._isResolved=!1,this.onFinally=t,this.promise=new Promise((t,n)=>J(this,void 0,void 0,function*(){this.resolve=t,this.reject=n,e&&(yield e(t,n))})).finally(()=>{var e;this._isResolved=!0,(e=this.onFinally)==null||e.call(this)})}};function Fle(e,t){let n=Object.assign({cloneTrack:!1,fftSize:2048,smoothingTimeConstant:.8,minDecibels:-100,maxDecibels:-80},t),r=Q2();if(!r)throw Error(`Audio Context not supported on this browser`);let i=n.cloneTrack?e.mediaStreamTrack.clone():e.mediaStreamTrack,a=r.createMediaStreamSource(new MediaStream([i])),o=r.createAnalyser();o.minDecibels=n.minDecibels,o.maxDecibels=n.maxDecibels,o.fftSize=n.fftSize,o.smoothingTimeConstant=n.smoothingTimeConstant,a.connect(o);let s=new Uint8Array(o.frequencyBinCount);return{calculateVolume:()=>{o.getByteFrequencyData(s);let e=0;for(let t of s)e+=(t/255)**2;return Math.sqrt(e/s.length)},analyser:o,cleanup:()=>J(this,void 0,void 0,function*(){yield r.close(),n.cloneTrack&&i.stop()})}}function Ile(e){return dle.includes(e)}function F4(e){if(typeof e==`string`||typeof e==`number`)return e;if(Array.isArray(e))return e[0];if(e.exact!==void 0)return Array.isArray(e.exact)?e.exact[0]:e.exact;if(e.ideal!==void 0)return Array.isArray(e.ideal)?e.ideal[0]:e.ideal;throw Error(`could not unwrap constraint`)}function Lle(e){return e.startsWith(`http`)?e.replace(/^(http)/,`ws`):e}function I4(e){return e.startsWith(`ws`)?e.replace(/^(ws)/,`http`):e}function Rle(e,t){return e.segments.map(e=>{let n=e.id,r=e.text,i=e.language,a=e.startTime,o=e.endTime,s=e.final,c=t.get(n)??Date.now(),l=Date.now();return s?t.delete(n):t.set(n,c),{id:n,text:r,startTime:Number.parseInt(a.toString()),endTime:Number.parseInt(o.toString()),final:s,language:i,firstReceivedTime:c,lastReceivedTime:l}})}function zle(e){let t=e.id,n=e.timestamp,r=e.message,i=e.editTimestamp;return{id:t,timestamp:Number.parseInt(n.toString()),editTimestamp:i?Number.parseInt(i.toString()):void 0,message:r}}function L4(e){switch(e.reason){case A2.LeaveRequest:return e.context;case A2.Cancelled:return UQ.CLIENT_INITIATED;case A2.NotAllowed:return UQ.USER_REJECTED;case A2.ServerUnreachable:return UQ.JOIN_FAILURE;default:return UQ.UNKNOWN_REASON}}function R4(e){return e===void 0?void 0:Number(e)}function z4(e){return e===void 0?void 0:BigInt(e)}function B4(e){return!!e&&!(e instanceof MediaStreamTrack)&&e.isLocal}function V4(e){return!!e&&e.kind==$.Kind.Audio}function H4(e){return!!e&&e.kind==$.Kind.Video}function U4(e){return B4(e)&&H4(e)}function W4(e){return B4(e)&&V4(e)}function G4(e){return!!e&&!e.isLocal}function Ble(e){return!!e&&!e.isLocal}function K4(e){return G4(e)&&H4(e)}function Vle(e){return e.isLocal}function Hle(e,t){let n=[],r=new TextEncoder().encode(e);for(;r.length>t;){let e=t;for(;e>0;){let t=r[e];if(t!==void 0&&(t&192)!=128)break;e--}n.push(r.slice(0,e)),r=r.slice(e)}return r.length>0&&n.push(r),n}function Ule(e){let t=e.get(`Cache-Control`);if(t){let e=t.match(/(?:^|[,\s])max-age=(\d+)/)?.[1];if(e)return parseInt(e,10)}}function q4(){return typeof CompressionStream<`u`}function Wle(){return q4()&&!m4()}function Gle(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=Kle(e,t);return n?r:Y4(r,`v1`)}function Kle(e,t){let n=new URL(Lle(e));return t.forEach((e,t)=>{n.searchParams.set(t,e)}),Y4(n,`rtc`)}function qle(e){return Y4(new URL(I4(e)),`validate`)}function J4(e){return e.endsWith(`/`)?e:`${e}/`}function Y4(e,t){return e.pathname=`${J4(e.pathname)}${t}`,e}function X4(e){if(typeof e==`string`)return W$.fromJson(JSON.parse(e),{ignoreUnknownFields:!0});if(e instanceof ArrayBuffer)return W$.fromBinary(new Uint8Array(e));throw Error(`could not decode websocket message: ${typeof e}`)}function Jle(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`Unknown reason`;if(!(e instanceof AbortSignal))return t;let n=e.reason;switch(typeof n){case`string`:return n;case`object`:return n instanceof Error?n.message:t;default:return`toString`in n?n.toString():t}}var Z4=`lk_e2ee`,Q4;(function(e){e.SetKey=`setKey`,e.RatchetRequest=`ratchetRequest`,e.KeyRatcheted=`keyRatcheted`})(Q4||={});var Yle;(function(e){e.KeyRatcheted=`keyRatcheted`})(Yle||={});var $4;(function(e){e.ParticipantEncryptionStatusChanged=`participantEncryptionStatusChanged`,e.EncryptionError=`encryptionError`})($4||={});var Xle;(function(e){e.Error=`cryptorError`})(Xle||={});function Zle(){return e3()||Qle()}function Qle(){return typeof window<`u`&&window.RTCRtpScriptTransform!==void 0}function e3(){return typeof window<`u`&&window.RTCRtpSender!==void 0&&window.RTCRtpSender.prototype.createEncodedStreams!==void 0}function $le(e){if(e.value?.case!==`sipDtmf`&&e.value?.case!==`metrics`&&e.value?.case!==`speaker`&&e.value?.case!==`transcription`&&e.value?.case!==`encryptedPacket`)return new d$({value:e.value})}v0.EventEmitter;var eue;(function(e){e[e.InvalidKey=0]=`InvalidKey`,e[e.MissingKey=1]=`MissingKey`,e[e.InternalError=2]=`InternalError`})(eue||={});function t3(){return h4()}function n3(e){return!!e?.worker&&(e3()||t3())}function r3(e){return!!(e?.timestamp||e?.frameId)}function tue(e){let t=[];return e?.timestamp&&t.push(qQ.PTF_USER_TIMESTAMP),e?.frameId&&t.push(qQ.PTF_FRAME_ID),t}function nue(e){if(!e||e.length===0)return;let t={};return e.includes(qQ.PTF_USER_TIMESTAMP)&&(t.timestamp=!0),e.includes(qQ.PTF_FRAME_ID)&&(t.frameId=!0),t.timestamp||t.frameId?t:void 0}function i3(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:50,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r,i=n.isImmediate??!1,a=n.callback??!1,o=n.maxWait,s=Date.now(),c=[];function l(){if(o!==void 0){let e=Date.now()-s;if(e+t>=o)return o-e}return t}let u=function(){var t=[...arguments];let n=this;return new Promise((o,u)=>{let d=function(){if(r=void 0,s=Date.now(),!i){let r=e.apply(n,t);a&&a(r),c.forEach(e=>{let t=e.resolve;return t(r)}),c=[]}},f=i&&r===void 0;if(r!==void 0&&H2.clearTimeout(r),r=H2.setTimeout(d,l()),f){let r=e.apply(n,t);return a&&a(r),o(r)}c.push({resolve:o,reject:u})})};return u.cancel=function(e){r!==void 0&&H2.clearTimeout(r),c.forEach(t=>{let n=t.reject;return n(e)}),c=[]},u}var a3=2e3;function o3(e,t){if(!t)return 0;let n,r;return`bytesReceived`in e?(n=e.bytesReceived,r=t.bytesReceived):`bytesSent`in e&&(n=e.bytesSent,r=t.bytesSent),n===void 0||r===void 0||e.timestamp===void 0||t.timestamp===void 0?0:(n-r)*8*1e3/(e.timestamp-t.timestamp)}var s3=class extends ${constructor(e,t,n,r,i){super(e,n,i),this.sid=t,this.receiver=r}get isLocal(){return!1}setMuted(e){this.isMuted!==e&&(this.isMuted=e,this._mediaStreamTrack.enabled=!e,this.emit(e?Q.Muted:Q.Unmuted,this))}setMediaStream(e){this.mediaStream=e;let t=n=>{n.track===this._mediaStreamTrack&&(e.removeEventListener(`removetrack`,t),this.receiver&&`playoutDelayHint`in this.receiver&&(this.receiver.playoutDelayHint=void 0),this.receiver=void 0,this._currentBitrate=0,this.emit(Q.Ended,this))};e.addEventListener(`removetrack`,t)}start(){this.startMonitor(),super.enable()}stop(){this.stopMonitor(),super.disable()}getRTCStatsReport(){return J(this,void 0,void 0,function*(){if(this.receiver?.getStats)return yield this.receiver.getStats()})}setPlayoutDelay(e){this.receiver?`playoutDelayHint`in this.receiver?this.receiver.playoutDelayHint=e:this.log.warn(`Playout delay not supported in this browser`):this.log.warn(`Cannot set playout delay, track already ended`)}getPlayoutDelay(){if(this.receiver){if(`playoutDelayHint`in this.receiver)return this.receiver.playoutDelayHint;this.log.warn(`Playout delay not supported in this browser`)}else this.log.warn(`Cannot get playout delay, track already ended`);return 0}startMonitor(){this.monitorInterval||=setInterval(()=>this.monitorReceiver(),a3),vle()&&this.registerTimeSyncUpdate()}registerTimeSyncUpdate(){let e=()=>{this.timeSyncHandle=requestAnimationFrame(()=>e());let t=this.receiver?.getSynchronizationSources()[0];if(t){let e=t.timestamp,n=t.rtpTimestamp;n&&this.rtpTimestamp!==n&&(this.emit(Q.TimeSyncUpdate,{timestamp:e,rtpTimestamp:n}),this.rtpTimestamp=n)}};e()}},c3=100,l3=class extends s3{constructor(e,t,n,r,i){super(e,t,$.Kind.Video,n,i),this.elementInfos=[],this.monitorReceiver=()=>J(this,void 0,void 0,function*(){if(!this.receiver){this._currentBitrate=0;return}let e=yield this.getReceiverStats();e&&this.prevStats&&this.receiver&&(this._currentBitrate=o3(e,this.prevStats)),this.prevStats=e}),this.debouncedHandleResize=i3(()=>{this.updateDimensions()},c3),this.adaptiveStreamSettings=r}get isAdaptiveStream(){return this.adaptiveStreamSettings!==void 0}lookupFrameMetadata(e){let t=e.rtpTimestamp;return this.frameMetadataExtractor?.lookupMetadata(t)}setStreamState(e){super.setStreamState(e),this.log.debug(`setStreamState`,e),this.isAdaptiveStream&&e===$.StreamState.Active&&this.updateVisibility()}get mediaStreamTrack(){return this._mediaStreamTrack}setMuted(e){super.setMuted(e),this.attachedElements.forEach(t=>{e?s4(this._mediaStreamTrack,t):o4(this._mediaStreamTrack,t)})}attach(e){if(e?super.attach(e):e=super.attach(),this.adaptiveStreamSettings&&this.elementInfos.find(t=>t.element===e)===void 0){let t=new rue(e);this.observeElementInfo(t)}return e}observeElementInfo(e){this.adaptiveStreamSettings&&this.elementInfos.find(t=>t===e)===void 0?(e.handleResize=()=>{this.debouncedHandleResize()},e.handleVisibilityChanged=()=>{this.updateVisibility()},this.elementInfos.push(e),e.observe(),this.debouncedHandleResize(),this.updateVisibility()):this.log.warn(`visibility resize observer not triggered`,this.logContext)}stopObservingElementInfo(e){if(!this.isAdaptiveStream){this.log.warn(`stopObservingElementInfo ignored`,this.logContext);return}let t=this.elementInfos.filter(t=>t===e);for(let e of t)e.stopObserving();this.elementInfos=this.elementInfos.filter(t=>t!==e),this.updateVisibility(),this.debouncedHandleResize()}detach(e){if(e)return this.stopObservingElement(e),super.detach(e);let t=super.detach();for(let e of t)this.stopObservingElement(e);return t}getDecoderImplementation(){return this.prevStats?.decoderImplementation}getReceiverStats(){return J(this,void 0,void 0,function*(){if(!this.receiver||!this.receiver.getStats)return;let e=yield this.receiver.getStats(),t,n=``,r=new Map;return e.forEach(e=>{e.type===`inbound-rtp`?(n=e.codecId,t={type:`video`,streamId:e.id,framesDecoded:e.framesDecoded,framesDropped:e.framesDropped,framesReceived:e.framesReceived,packetsReceived:e.packetsReceived,packetsLost:e.packetsLost,frameWidth:e.frameWidth,frameHeight:e.frameHeight,pliCount:e.pliCount,firCount:e.firCount,nackCount:e.nackCount,jitter:e.jitter,timestamp:e.timestamp,bytesReceived:e.bytesReceived,decoderImplementation:e.decoderImplementation}):e.type===`codec`&&r.set(e.id,e)}),t&&n!==``&&r.get(n)&&(t.mimeType=r.get(n).mimeType),t})}stopObservingElement(e){let t=this.elementInfos.filter(t=>t.element===e);for(let e of t)this.stopObservingElementInfo(e)}handleAppVisibilityChanged(){let e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return J(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),this.isAdaptiveStream&&this.updateVisibility()})}updateVisibility(e){let t=this.elementInfos.reduce((e,t)=>Math.max(e,t.visibilityChangedAt||0),0),n=this.adaptiveStreamSettings?.pauseVideoInBackground??!0?this.isInBackground:!1,r=this.elementInfos.some(e=>e.pictureInPicture),i=this.elementInfos.some(e=>e.visible)&&!n||r;if(!(this.lastVisible===i&&!e)){if(!i&&Date.now()-t<c3){H2.setTimeout(()=>{this.updateVisibility()},c3);return}this.lastVisible=i,this.emit(Q.VisibilityChanged,i,this)}}updateDimensions(){let e=0,t=0,n=this.getPixelDensity();for(let r of this.elementInfos){let i=r.width()*n,a=r.height()*n;i+a>e+t&&(e=i,t=a)}this.lastDimensions?.width===e&&this.lastDimensions?.height===t||(this.lastDimensions={width:e,height:t},this.emit(Q.VideoDimensionsChanged,this.lastDimensions,this))}getPixelDensity(){let e=this.adaptiveStreamSettings?.pixelDensity;return e===`screen`?T4():e||(T4()>2?2:1)}},rue=class{get visible(){return this.isPiP||this.isIntersecting}get pictureInPicture(){return this.isPiP}constructor(e,t){this.onVisibilityChanged=e=>{var t;let n=e.target,r=e.isIntersecting;n===this.element&&(this.isIntersecting=r,this.isPiP=u3(this.element),this.visibilityChangedAt=Date.now(),(t=this.handleVisibilityChanged)==null||t.call(this))},this.onEnterPiP=()=>{var e;(e=window.documentPictureInPicture?.window)==null||e.addEventListener(`pagehide`,this.onLeavePiP),queueMicrotask(()=>{requestAnimationFrame(()=>{var e;this.isPiP=u3(this.element),(e=this.handleVisibilityChanged)==null||e.call(this)})})},this.onLeavePiP=()=>{var e;this.isPiP=u3(this.element),(e=this.handleVisibilityChanged)==null||e.call(this)},this.element=e,this.isIntersecting=t??d3(e),this.isPiP=y4()&&u3(e),this.visibilityChangedAt=0}width(){return this.element.clientWidth}height(){return this.element.clientHeight}observe(){var e,t;this.isIntersecting=d3(this.element),this.isPiP=u3(this.element),this.element.handleResize=()=>{var e;(e=this.handleResize)==null||e.call(this)},this.element.handleVisibilityChanged=this.onVisibilityChanged,A4().observe(this.element),O4().observe(this.element),this.element.addEventListener(`enterpictureinpicture`,this.onEnterPiP),this.element.addEventListener(`leavepictureinpicture`,this.onLeavePiP),(e=window.documentPictureInPicture)==null||e.addEventListener(`enter`,this.onEnterPiP),(t=window.documentPictureInPicture?.window)==null||t.addEventListener(`pagehide`,this.onLeavePiP)}stopObserving(){var e,t,n,r;(e=A4())==null||e.unobserve(this.element),(t=O4())==null||t.unobserve(this.element),this.element.removeEventListener(`enterpictureinpicture`,this.onEnterPiP),this.element.removeEventListener(`leavepictureinpicture`,this.onLeavePiP),(n=window.documentPictureInPicture)==null||n.removeEventListener(`enter`,this.onEnterPiP),(r=window.documentPictureInPicture?.window)==null||r.removeEventListener(`pagehide`,this.onLeavePiP)}};function u3(e){return document.pictureInPictureElement===e?!0:window.documentPictureInPicture?.window?d3(e,window.documentPictureInPicture?.window):!1}function d3(e,t){let n=t||window,r=e.offsetTop,i=e.offsetLeft,a=e.offsetWidth,o=e.offsetHeight,s=e.hidden,c=getComputedStyle(e).display;for(;e.offsetParent;)e=e.offsetParent,r+=e.offsetTop,i+=e.offsetLeft;return r<n.pageYOffset+n.innerHeight&&i<n.pageXOffset+n.innerWidth&&r+o>n.pageYOffset&&i+a>n.pageXOffset&&!s&&c!==`none`}var iue=class extends v0.EventEmitter{constructor(e,t){super(),this.decryptDataRequests=new Map,this.encryptDataRequests=new Map,this.onWorkerMessage=e=>{let t=e.data,n=t.kind,r=t.data;switch(n){case`error`:if(r0.error(r.error.message),r.uuid){let e=this.decryptDataRequests.get(r.uuid);if(e?.reject){e.reject(r.error);break}let t=this.encryptDataRequests.get(r.uuid);if(t?.reject){t.reject(r.error);break}}this.emit($4.EncryptionError,r.error,r.participantIdentity);break;case`initAck`:r.enabled&&this.keyProvider.getKeys().forEach(e=>{this.postKey(e,!1)});break;case`enable`:if(r.enabled&&this.keyProvider.getKeys().forEach(e=>{this.postKey(e,!1)}),this.encryptionEnabled!==r.enabled&&r.participantIdentity===this.room?.localParticipant.identity)this.emit($4.ParticipantEncryptionStatusChanged,r.enabled,this.room.localParticipant),this.encryptionEnabled=r.enabled;else if(r.participantIdentity){let e=this.room?.getParticipantByIdentity(r.participantIdentity);if(!e)throw TypeError(`couldn't set encryption status, participant not found${r.participantIdentity}`);this.emit($4.ParticipantEncryptionStatusChanged,r.enabled,e)}break;case`ratchetKey`:this.keyProvider.emit(Q4.KeyRatcheted,r.ratchetResult,r.participantIdentity,r.keyIndex);break;case`decryptDataResponse`:let e=this.decryptDataRequests.get(r.uuid);e?.resolve&&e.resolve(r);break;case`encryptDataResponse`:let t=this.encryptDataRequests.get(r.uuid);t?.resolve&&t.resolve(r);break;case`packetTrailerMetadata`:this.handleFrameMetadata(r.trackId,r.rtpTimestamp,r.ssrc,r.metadata);break}},this.onWorkerError=e=>{r0.error(`e2ee worker encountered an error:`,{error:e.error}),this.emit($4.EncryptionError,e.error,void 0)},this.keyProvider=e.keyProvider,this.worker=e.worker,this.encryptionEnabled=!1,this.dataChannelEncryptionEnabled=t}get isEnabled(){return this.encryptionEnabled}get isDataChannelEncryptionEnabled(){return this.isEnabled&&this.dataChannelEncryptionEnabled}setup(e){if(!Zle())throw new M2(`tried to setup end-to-end encryption on an unsupported browser`);if(r0.info(`setting up e2ee`),e!==this.room){this.room=e,this.setupEventListeners(e,this.keyProvider);let t={kind:`init`,data:{keyProviderOptions:this.keyProvider.getOptions(),loglevel:o0.getLevel()}};this.worker&&(r0.info(`initializing worker`,{worker:this.worker}),this.worker.onmessage=this.onWorkerMessage,this.worker.onerror=this.onWorkerError,this.worker.postMessage(t))}}setParticipantCryptorEnabled(e,t){r0.debug(`set e2ee to ${e} for participant ${t}`),this.postEnable(e,t)}setSifTrailer(e){!e||e.length===0?r0.warn(`ignoring server sent trailer as it's empty`):this.postSifTrailer(e)}handleFrameMetadata(e,t,n,r){if(this.room){for(let i of[this.room.localParticipant,...this.room.remoteParticipants.values()])for(let a of i.trackPublications.values())if(a.track&&a.track.mediaStreamID===e&&a.track instanceof l3&&a.track.frameMetadataExtractor){a.track.frameMetadataExtractor.storeMetadata(t,n,r);return}}}setupEngine(e){e.on(Z.RTPVideoMapUpdate,e=>{this.postRTPMap(e)})}setupEventListeners(e,t){e.on(Y.TrackPublished,(e,t)=>this.setParticipantCryptorEnabled(e.trackInfo.encryption!==t$.NONE,t.identity)),e.on(Y.ConnectionStateChanged,t=>{t===L8.Connected&&e.remoteParticipants.forEach(e=>{e.trackPublications.forEach(t=>{this.setParticipantCryptorEnabled(t.trackInfo.encryption!==t$.NONE,e.identity)})})}).on(Y.TrackUnsubscribed,(e,t,n)=>{var r;let i={kind:`removeTransform`,data:{participantIdentity:n.identity,trackId:e.mediaStreamID}};(r=this.worker)==null||r.postMessage(i)}).on(Y.TrackSubscribed,(e,t,n)=>{this.setupE2EEReceiver(e,n.identity,t.trackInfo)}).on(Y.SignalConnected,()=>{if(!this.room)throw TypeError(`expected room to be present on signal connect`);let e=t.getLatestManuallySetKeyIndex();t.getKeys().forEach(t=>{this.postKey(t,e===(t.keyIndex??0))}),this.setParticipantCryptorEnabled(this.room.localParticipant.isE2EEEnabled,this.room.localParticipant.identity)}),e.localParticipant.on(X.LocalSenderCreated,(e,t)=>J(this,void 0,void 0,function*(){this.setupE2EESender(t,e)})),e.localParticipant.on(X.LocalTrackPublished,e=>{if(!H4(e.track)||!_4())return;let t={kind:`updateCodec`,data:{trackId:e.track.mediaStreamID,codec:e4(e.trackInfo.codecs[0].mimeType),participantIdentity:this.room.localParticipant.identity,hasPacketTrailer:!1}};this.worker.postMessage(t)}),t.on(Q4.SetKey,(e,t)=>this.postKey(e,t??!0)).on(Q4.RatchetRequest,(e,t)=>this.postRatchetRequest(e,t))}encryptData(e){return J(this,void 0,void 0,function*(){if(!this.worker)throw Error(`could not encrypt data, worker is missing`);let t=crypto.randomUUID(),n={kind:`encryptDataRequest`,data:{uuid:t,payload:e,participantIdentity:this.room.localParticipant.identity}},r=new P4;return r.onFinally=()=>{this.encryptDataRequests.delete(t)},this.encryptDataRequests.set(t,r),this.worker.postMessage(n),r.promise})}handleEncryptedData(e,t,n,r){if(!this.worker)throw Error(`could not handle encrypted data, worker is missing`);let i=crypto.randomUUID(),a={kind:`decryptDataRequest`,data:{uuid:i,payload:e,iv:t,participantIdentity:n,keyIndex:r}},o=new P4;return o.onFinally=()=>{this.decryptDataRequests.delete(i)},this.decryptDataRequests.set(i,o),this.worker.postMessage(a),o.promise}postRatchetRequest(e,t){if(!this.worker)throw Error(`could not ratchet key, worker is missing`);let n={kind:`ratchetRequest`,data:{participantIdentity:e,keyIndex:t}};this.worker.postMessage(n)}postKey(e,t){let n=e.key,r=e.participantIdentity,i=e.keyIndex;if(!this.worker)throw Error(`could not set key, worker is missing`);let a={kind:`setKey`,data:{participantIdentity:r,isPublisher:r===this.room?.localParticipant.identity,key:n,keyIndex:i,updateCurrentKeyIndex:t}};this.worker.postMessage(a)}postEnable(e,t){if(this.worker){let n={kind:`enable`,data:{enabled:e,participantIdentity:t}};this.worker.postMessage(n)}else throw ReferenceError(`failed to enable e2ee, worker is not ready`)}postRTPMap(e){if(!this.worker)throw TypeError(`could not post rtp map, worker is missing`);if(!this.room?.localParticipant.identity)throw TypeError(`could not post rtp map, local participant identity is missing`);let t={kind:`setRTPMap`,data:{map:e,participantIdentity:this.room.localParticipant.identity}};this.worker.postMessage(t)}postSifTrailer(e){if(!this.worker)throw Error(`could not post SIF trailer, worker is missing`);let t={kind:`setSifTrailer`,data:{trailer:e}};this.worker.postMessage(t)}setupE2EEReceiver(e,t,n){if(!e.receiver)return;if(!n?.mimeType||n.mimeType===``)throw TypeError(`MimeType missing from trackInfo, cannot set up E2EE cryptor`);let r=e.kind===`video`&&!!n.packetTrailerFeatures&&n.packetTrailerFeatures.length>0;this.handleReceiver(e.receiver,e.mediaStreamID,t,e.kind===`video`?e4(n.mimeType):void 0,r)}setupE2EESender(e,t){if(!B4(e)||!t){t||r0.warn(`early return because sender is not ready`);return}this.handleSender(t,e.mediaStreamID,void 0,H4(e)?e.publishOptions?.frameMetadata??e.publishOptions?.packetTrailer:void 0)}handleReceiver(e,t,n,r,i){return J(this,void 0,void 0,function*(){if(this.worker){if(h4()){let a={kind:`decode`,participantIdentity:n,trackId:t,codec:r,hasPacketTrailer:i};e.transform=new RTCRtpScriptTransform(this.worker,a)}else{if(Z4 in e&&r){let e={kind:`updateCodec`,data:{trackId:t,codec:r,participantIdentity:n,hasPacketTrailer:i}};this.worker.postMessage(e);return}let a=e.writableStream,o=e.readableStream;if(!a||!o){let t=e.createEncodedStreams();e.writableStream=t.writable,a=t.writable,e.readableStream=t.readable,o=t.readable}let s={kind:`decode`,data:{readableStream:o,writableStream:a,trackId:t,codec:r,participantIdentity:n,isReuse:Z4 in e,hasPacketTrailer:i}};this.worker.postMessage(s,[o,a])}e[Z4]=!0}})}handleSender(e,t,n,r){if(!(Z4 in e||!this.worker)){if(!this.room?.localParticipant.identity||this.room.localParticipant.identity===``)throw TypeError(`local identity needs to be known in order to set up encrypted sender`);if(h4()){r0.info(`initialize script transform`);let i={kind:`encode`,participantIdentity:this.room.localParticipant.identity,trackId:t,codec:n,hasPacketTrailer:r3(r),packetTrailer:r};e.transform=new RTCRtpScriptTransform(this.worker,i)}else{r0.info(`initialize encoded streams`);let i=e.createEncodedStreams(),a={kind:`encode`,data:{readableStream:i.readable,writableStream:i.writable,codec:n,trackId:t,participantIdentity:this.room.localParticipant.identity,isReuse:!1,hasPacketTrailer:r3(r),packetTrailer:r}};this.worker.postMessage(a,[i.readable,i.writable])}e[Z4]=!0}}},aue=300,oue=class{constructor(){this.metadataMap=new Map,this.activeSsrc=0}storeMetadata(e,t,n){for(this.activeSsrc!==0&&this.activeSsrc!==t&&this.metadataMap.clear(),this.activeSsrc=t;this.metadataMap.size>=aue;){let e=this.metadataMap.keys().next().value;this.metadataMap.delete(e)}this.metadataMap.set(e,n)}lookupMetadata(e){return this.metadataMap.get(e)}dispose(){this.metadataMap.clear(),this.activeSsrc=0}},sue=class{constructor(e){this.extractors=new Map,this.workerPipelines=new Map,this.onWorkerMessage=e=>{let t=e.data;if(t.kind===`metadata`){let e=this.extractors.get(t.data.trackId);e&&e.storeMetadata(t.data.rtpTimestamp,t.data.ssrc,t.data.metadata)}},this.onWorkerError=e=>{r0.error(`frame metadata worker encountered an error:`,{error:e.error})},this.worker=e?.worker}setup(e){e!==this.room&&(this.room=e,this.worker&&(this.worker.onmessage=this.onWorkerMessage,this.worker.onerror=this.onWorkerError,this.worker.postMessage({kind:`init`})),e.on(Y.TrackSubscribed,(e,t,n)=>{e.kind===`video`&&this.setupReceiver(e,t.trackInfo)}).on(Y.TrackUnsubscribed,e=>{this.teardownTrack(e)}).on(Y.Disconnected,()=>{this.cleanup()}))}setupReceiver(e,t){let n=e.receiver;if(!n)return;if(!(t?.packetTrailerFeatures&&t.packetTrailerFeatures.length>0)){this.room?.hasE2EESetup||this.setupPassthroughReceiver(n,e.mediaStreamID);return}if(!n3(this.worker?{worker:this.worker}:void 0)&&!this.room?.hasE2EESetup){r0.warn(`frame metadata transform not supported; skipping extraction`);return}let r=new oue,i=e.mediaStreamID;this.extractors.set(i,r),e.frameMetadataExtractor=r,!this.room?.hasE2EESetup&&this.setupWorkerReceiver(n,i,!0)}setupPassthroughReceiver(e,t){if(t3()){`transform`in e&&(e.transform=null);return}if(this.worker&&n3({worker:this.worker})&&!this.workerPipelines.has(e)){this.setupWorkerReceiver(e,t,!1);return}this.worker&&this.workerPipelines.has(e)&&this.setupWorkerReceiver(e,t,!1)}setupWorkerReceiver(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,r=this.worker;if(!r)return;if(t3()){e.transform=new RTCRtpScriptTransform(r,{kind:`decode`,trackId:t});return}let i=this.workerPipelines.get(e);if(i){let a={kind:`updateTrackId`,data:{oldTrackId:i,newTrackId:t,hasPacketTrailer:n}};r.postMessage(a),this.workerPipelines.set(e,t);return}if(!(`createEncodedStreams`in e)){r0.warn(`createEncodedStreams not supported`);return}let a;try{a=e.createEncodedStreams()}catch(e){r0.warn(`failed to create encoded streams`,{error:e});return}let o={kind:`decode`,data:{readableStream:a.readable,writableStream:a.writable,trackId:t,hasPacketTrailer:n}};r.postMessage(o,[a.readable,a.writable]),this.workerPipelines.set(e,t)}teardownTrack(e){let t=e.mediaStreamID,n=this.extractors.get(t);n&&(n.dispose(),this.extractors.delete(t)),e instanceof l3&&(e.frameMetadataExtractor=void 0)}cleanup(){var e;for(let e of this.extractors.values())e.dispose();this.extractors.clear(),this.workerPipelines.clear(),(e=this.worker)==null||e.terminate()}},cue=500,lue=15e3,f3=class e{constructor(){this.failedConnectionAttempts=new Map,this.backOffPromises=new Map}static getInstance(){return this._instance||=new e,this._instance}addFailedConnectionAttempt(e){let t=S4(new URL(e));if(!t)return;let n=this.failedConnectionAttempts.get(t)??0;this.failedConnectionAttempts.set(t,n+1),this.backOffPromises.set(t,l4(Math.min(cue*2**n,lue)))}getBackOffPromise(e){let t=new URL(e),n=t&&S4(t);return n&&this.backOffPromises.get(n)||Promise.resolve()}resetFailedConnectionAttempts(e){let t=new URL(e),n=t&&S4(t);n&&(this.failedConnectionAttempts.set(n,0),this.backOffPromises.set(n,Promise.resolve()))}resetAll(){this.backOffPromises.clear(),this.failedConnectionAttempts.clear()}};f3._instance=null;var p3=`default`,m3=class e{constructor(){this._previousDevices=[]}static getInstance(){return this.instance===void 0&&(this.instance=new e),this.instance}get previousDevices(){return this._previousDevices}getDevices(t){return J(this,arguments,void 0,function(t){var n=this;let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){if(e.userMediaPromiseMap?.size>0){r0.debug(`awaiting getUserMedia promise`);try{t?yield e.userMediaPromiseMap.get(t):yield Promise.all(e.userMediaPromiseMap.values())}catch{r0.warn(`error waiting for media permissons`)}}let i=yield navigator.mediaDevices.enumerateDevices();if(r&&!(g4()&&n.hasDeviceInUse(t))&&(i.filter(e=>e.kind===t).length===0||i.some(e=>{let n=e.label===``,r=t?e.kind===t:!0;return n&&r}))){let e={video:t!==`audioinput`&&t!==`audiooutput`,audio:t!==`videoinput`&&{deviceId:{ideal:`default`}}},n=yield navigator.mediaDevices.getUserMedia(e);i=yield navigator.mediaDevices.enumerateDevices(),n.getTracks().forEach(e=>{e.stop()})}return n._previousDevices=i,t&&(i=i.filter(e=>e.kind===t)),i}()})}normalizeDeviceId(e,t,n){return J(this,void 0,void 0,function*(){if(t!==p3)return t;let r=yield this.getDevices(e),i=r.find(e=>e.deviceId===p3);if(!i){r0.warn(`could not reliably determine default device`);return}let a=r.find(e=>e.deviceId!==p3&&e.groupId===(n??i.groupId));if(!a){r0.warn(`could not reliably determine default device`);return}return a?.deviceId})}hasDeviceInUse(t){return t?e.userMediaPromiseMap.has(t):e.userMediaPromiseMap.size>0}};m3.mediaDeviceKinds=[`audioinput`,`audiooutput`,`videoinput`],m3.userMediaPromiseMap=new Map;var h3=65535,g3=4294967295,_3=class e{static u16(t){return new e(t,h3)}static u32(t){return new e(t,g3)}constructor(e,t){if(this.value=e,e<0)throw Error(`WrapAroundUnsignedInt: cannot faithfully represent an integer smaller than 0`);if(t>2**53-1)throw Error(`WrapAroundUnsignedInt: cannot faithfully represent an integer bigger than MAX_SAFE_INTEGER.`);this.maxSize=t,this.clamp()}clamp(){for(;this.value>this.maxSize;)this.value-=this.maxSize+1;for(;this.value<0;)this.value+=this.maxSize+1}clone(){return new e(this.value,this.maxSize)}update(e){this.value=e(this.value),this.clamp()}increment(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;this.update(t=>t+e)}decrement(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;this.update(t=>t-e)}getThenIncrement(){let t=this.value;return this.increment(),new e(t,this.maxSize)}isBefore(e){let t=this.value>>>0,n=(e.value>>>0)-t>>>0;return n!==0&&n<this.maxSize+1}},v3=class e{static fromRtpTicks(t){return new e(t,9e4)}static rtpRandom(){let t=Math.round(Math.random()*g3);return e.fromRtpTicks(t)}constructor(e,t){this.timestamp=_3.u32(e),this.rateInHz=t}asTicks(){return this.timestamp.value}clone(){return new e(this.timestamp.value,this.rateInHz)}wrappingAdd(e){this.timestamp.increment(e)}isBefore(e){return this.timestamp.isBefore(e.timestamp)}},uue=class e{constructor(e,t,n){this.epoch=t,this.base=n,this.previous=n.clone(),this.rateInHz=e}static startingNow(t,n){return new e(n,new Date,t)}static startingAtTime(t,n,r){return new e(r,t,n)}static rtpStartingNow(t){return e.startingNow(t,9e4)}static rtpStartingAtTime(t,n){return e.startingAtTime(t,n,9e4)}now(){return this.at(new Date)}at(t){let n=t.getTime()-this.epoch.getTime(),r=e.durationInMsToTicks(n,this.rateInHz),i=this.base.clone();return i.wrappingAdd(r),i.isBefore(this.previous)&&(i=this.previous),this.previous=i.clone(),i.clone()}static durationInMsToTicks(e,t){let n=(e*1e6*t+5e8)/1e9;return Math.round(n)}};function y3(e){if(e instanceof DataView)return e;if(e instanceof ArrayBuffer)return new DataView(e);if(e instanceof Uint8Array)return new DataView(e.buffer,e.byteOffset,e.byteLength);throw Error(`Error coercing ${e} to DataView - input was not DataView, ArrayBuffer, or Uint8Array.`)}var b3;(function(e){e[e.Reserved=0]=`Reserved`,e[e.TooLarge=1]=`TooLarge`})(b3||={});var x3=class e extends k2{constructor(e,t){super(19,e),this.name=`DataTrackHandleError`,this.reason=t,this.reasonName=b3[t]}isReason(e){return this.reason===e}static tooLarge(){return new e(`Value too large to be a valid track handle`,b3.TooLarge)}static reserved(t){return new e(`0x${t.toString(16)} is a reserved value.`,b3.Reserved)}},due={fromNumber(e){if(e===0)throw x3.reserved(e);if(e>h3)throw x3.tooLarge();return e}},fue=class{constructor(){this.value=0}get(){return this.value+=1,this.value>h3?null:this.value}reset(){this.value=0}},S3={from(e){return{sid:e.sid,pubHandle:e.pubHandle,name:e.name,usesE2ee:e.encryption!==t$.NONE}},toProtobuf(e){return new i$({sid:e.sid,pubHandle:e.pubHandle,name:e.name,encryption:e.usesE2ee?t$.GCM:t$.NONE})}},C3;(function(e){e[e.WAITING=0]=`WAITING`,e[e.RUNNING=1]=`RUNNING`,e[e.COMPLETED=2]=`COMPLETED`})(C3||={});var pue=class{constructor(){this.pendingTasks=new Map,this.taskMutex=new OX,this.nextTaskIndex=0}run(e){return J(this,void 0,void 0,function*(){let t={id:this.nextTaskIndex++,enqueuedAt:Date.now(),status:C3.WAITING};this.pendingTasks.set(t.id,t);let n=yield this.taskMutex.lock();try{return t.executedAt=Date.now(),t.status=C3.RUNNING,yield e()}finally{t.status=C3.COMPLETED,this.pendingTasks.delete(t.id),n()}})}flush(){return J(this,void 0,void 0,function*(){return this.run(()=>J(this,void 0,void 0,function*(){}))})}snapshot(){return Array.from(this.pendingTasks.values())}},mue=class{get readyState(){return this.ws.readyState}constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t.signal?.aborted)throw new DOMException(`This operation was aborted`,`AbortError`);this.url=e;let n=new WebSocket(e,t.protocols??[]);n.binaryType=`arraybuffer`,this.ws=n;let r=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.closeCode,r=e.reason;return n.close(t,r)};this.opened=new C2((e,t)=>{let i=()=>{t(j2.websocket(`Encountered websocket error during connection establishment`))};n.onopen=()=>{e({readable:new ReadableStream({start(e){n.onmessage=t=>{let n=t.data;return e.enqueue(n)},n.onerror=t=>e.error(t)},cancel:r}),writable:new WritableStream({write(e){n.send(e)},abort(){n.close()},close:r}),protocol:n.protocol,extensions:n.extensions}),n.removeEventListener(`error`,i)},n.addEventListener(`error`,i)}),this.closed=new C2((e,t)=>{let r=()=>J(this,void 0,void 0,function*(){let r=new C2(e=>{n.readyState!==WebSocket.CLOSED&&n.addEventListener(`close`,t=>{e(t)},{once:!0})}),i=yield C2.race([l4(250),r]);i?e(i):t(j2.websocket(`Encountered unspecified websocket error without a timely close event`))});n.onclose=t=>{let i=t.code,a=t.reason;e({closeCode:i,reason:a}),n.removeEventListener(`error`,r)},n.addEventListener(`error`,r)}),t.signal&&(t.signal.onabort=()=>n.close()),this.close=r}},hue=[`syncState`,`trickle`,`offer`,`answer`,`simulate`,`leave`];function gue(e){let t=hue.indexOf(e.case)>=0;return r0.trace(`request allowed to bypass queue:`,{canPass:t,req:e}),t}var w3;(function(e){e[e.CONNECTING=0]=`CONNECTING`,e[e.CONNECTED=1]=`CONNECTED`,e[e.RECONNECTING=2]=`RECONNECTING`,e[e.DISCONNECTING=3]=`DISCONNECTING`,e[e.DISCONNECTED=4]=`DISCONNECTED`})(w3||={});var _ue=250,vue=class{get currentState(){return this.state}get isDisconnected(){return this.state===w3.DISCONNECTING||this.state===w3.DISCONNECTED}get isEstablishingConnection(){return this.state===w3.CONNECTING||this.state===w3.RECONNECTING}getNextRequestId(){return this._requestId+=1,this._requestId}constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.rtt=0,this.state=w3.DISCONNECTED,this.log=r0,this._requestId=0,this.useV0SignalPath=!1,this.resetCallbacks=()=>{this.onAnswer=void 0,this.onLeave=void 0,this.onLocalTrackPublished=void 0,this.onLocalTrackUnpublished=void 0,this.onNegotiateRequested=void 0,this.onOffer=void 0,this.onRemoteMuteChanged=void 0,this.onSubscribedQualityUpdate=void 0,this.onTokenRefresh=void 0,this.onTrickle=void 0,this.onClose=void 0,this.onMediaSectionsRequirement=void 0},this.loggerContextCb=t.loggerContextCb,this.log=i0(t.loggerName??n0.Signal,()=>this.logContext),this.useJSON=e,this.requestQueue=new pue,this.queuedRequests=[],this.closingLock=new OX,this.connectionLock=new OX,this.state=w3.DISCONNECTED}get logContext(){return this.loggerContextCb?.call(this)??{}}join(e,t,n,r){return J(this,arguments,void 0,function(e,t,n,r){var i=this;let a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1,o=arguments.length>5?arguments[5]:void 0;return function*(){return i.state=w3.CONNECTING,i.options=n,yield i.connect(e,t,n,r,a,o)}()})}reconnect(e,t,n,r){return J(this,void 0,void 0,function*(){if(!this.options){this.log.warn(`attempted to reconnect without signal options being set, ignoring`);return}return this.state=w3.RECONNECTING,this.clearPingInterval(),yield this.connect(e,t,Object.assign(Object.assign({},this.options),{reconnect:!0,sid:n,reconnectReason:r}),void 0,this.useV0SignalPath)})}connect(e,t,n,r){return J(this,arguments,void 0,function(e,t,n,r){var i=this;let a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1,o=arguments.length>5?arguments[5]:void 0;return function*(){let s=yield i.connectionLock.lock();i.connectOptions=n,i.useV0SignalPath=a;let c=Ple(n.clientInfoCapabilities),l=Gle(e,a?yue(t,c,n):yield bue(t,c,n,o),a).toString(),u=qle(l).toString();return new Promise((e,t)=>J(i,void 0,void 0,function*(){try{let i=!1,a=e=>J(this,void 0,void 0,function*(){if(i)return;i=!0;let n=Jle(e instanceof Event?e.currentTarget:e,`Abort handler called`);this.streamWriter&&!this.isDisconnected?this.sendLeave().then(()=>this.close(n)).catch(e=>{this.log.error(e),this.close()}):this.close(),o(),t(j2.cancelled(n))});r?.addEventListener(`abort`,a);let o=()=>{clearTimeout(s),r?.removeEventListener(`abort`,a)},s=setTimeout(()=>{a(j2.timeout(`room connection has timed out (signal)`))},n.websocketTimeout),c=(e,t)=>{this.handleSignalConnected(e,s,t)},d=new URL(l);if(d.searchParams.has(`access_token`)&&d.searchParams.set(`access_token`,`<redacted>`),this.ws){let e=performance.now();yield this.close(!1),this.log.debug(`closed previous ws connection in ${performance.now()-e}ms`)}this.log.info(`signal connecting to ${d}`,{reconnect:n.reconnect,reconnectReason:n.reconnectReason}),this.ws=new mue(l);try{this.ws.closed.then(e=>{this.isEstablishingConnection&&t(j2.internal(`Websocket got closed during a (re)connection attempt: ${e.reason}`)),e.closeCode!==1e3&&(this.log.warn(`websocket closed`,{reason:e.reason,code:e.closeCode,wasClean:e.closeCode===1e3,state:this.state}),this.state===w3.CONNECTED&&this.handleOnClose(e.reason??`Unexpected WS error`))}).catch(e=>{this.isEstablishingConnection&&t(j2.internal(`Websocket error during a (re)connection attempt: ${e}`))});let r=yield this.ws.opened.catch(e=>J(this,void 0,void 0,function*(){if(this.state!==w3.CONNECTED){this.state=w3.DISCONNECTED,clearTimeout(s),t(yield this.handleConnectionError(e,u));return}this.handleWSError(e),t(e)}));if(clearTimeout(s),!r)return;let i=r.readable.getReader();this.streamWriter=r.writable.getWriter();let a=yield i.read();if(i.releaseLock(),!a.value)throw j2.internal(`no message received as first message`);let o=X4(a.value),l=this.validateFirstMessage(o,n.reconnect??!1);if(!l.isValid){t(l.error);return}o.message?.case===`join`&&(this.pingTimeoutDuration=o.message.value.pingTimeout,this.pingIntervalDuration=o.message.value.pingInterval,this.pingTimeoutDuration&&this.pingTimeoutDuration>0&&this.log.debug(`ping config`,{timeout:this.pingTimeoutDuration,interval:this.pingIntervalDuration}),this.onJoined&&this.onJoined(o.message.value)),c(r,l.shouldProcessFirstMessage?o:void 0),e(l.response)}catch(e){t(e)}finally{o()}}finally{s()}}))}()})}startReadingLoop(e,t){return J(this,void 0,void 0,function*(){for(t&&this.handleSignalResponse(t);;){this.signalLatency&&(yield l4(this.signalLatency));let t=yield e.read(),n=t.done,r=t.value;if(n)break;let i=X4(r);this.handleSignalResponse(i)}})}close(){return J(this,arguments,void 0,function(){var e=this;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`Close method called on signal client`;return function*(){if([w3.DISCONNECTING||w3.DISCONNECTED].includes(e.state)){e.log.debug(`ignoring signal close as it's already in disconnecting state`);return}let r=yield e.closingLock.lock();try{if(e.clearPingInterval(),t&&(e.state=w3.DISCONNECTING),e.ws){e.ws.close({closeCode:1e3,reason:n});let t=e.ws.closed;e.ws=void 0,e.streamWriter=void 0,yield Promise.race([t,l4(_ue)])}}catch(t){e.log.debug(`websocket error while closing`,{error:t})}finally{t&&(e.state=w3.DISCONNECTED),r()}}()})}sendOffer(e,t){this.log.debug(`sending offer`,{offerSdp:e.sdp}),this.sendRequest({case:`offer`,value:E3(e,t)})}sendAnswer(e,t){return this.log.debug(`sending answer`,{answerSdp:e.sdp}),this.sendRequest({case:`answer`,value:E3(e,t)})}sendIceCandidate(e,t){return this.log.debug(`sending ice candidate`,{candidate:e}),this.sendRequest({case:`trickle`,value:new $$({candidateInit:JSON.stringify(e),target:t})})}sendMuteTrack(e,t){return this.sendRequest({case:`mute`,value:new e1({sid:e,muted:t})})}sendAddTrack(e){return this.sendRequest({case:`addTrack`,value:e})}sendUpdateLocalMetadata(e,t){return J(this,arguments,void 0,function(e,t){var n=this;let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){let i=n.getNextRequestId();return yield n.sendRequest({case:`updateMetadata`,value:new g1({requestId:i,metadata:e,name:t,attributes:r})}),i}()})}sendUpdateTrackSettings(e){this.sendRequest({case:`trackSetting`,value:e})}sendUpdateSubscription(e){return this.sendRequest({case:`subscription`,value:e})}sendSyncState(e){return this.sendRequest({case:`syncState`,value:e})}sendUpdateVideoLayers(e,t){return this.sendRequest({case:`updateLayers`,value:new h1({trackSid:e,layers:t})})}sendUpdateSubscriptionPermissions(e,t){return this.sendRequest({case:`subscriptionPermission`,value:new k1({allParticipants:e,trackPermissions:t})})}sendSimulateScenario(e){return this.sendRequest({case:`simulate`,value:e})}sendPing(){return Promise.all([this.sendRequest({case:`ping`,value:aZ.parse(Date.now())}),this.sendRequest({case:`pingReq`,value:new I1({timestamp:aZ.parse(Date.now()),rtt:aZ.parse(this.rtt)})})])}sendUpdateLocalAudioTrack(e,t){return this.sendRequest({case:`updateAudioTrack`,value:new d1({trackSid:e,features:t})})}sendLeave(){return this.sendRequest({case:`leave`,value:new p1({reason:UQ.CLIENT_INITIATED,action:m1.DISCONNECT})})}sendPublishDataTrackRequest(e,t,n){return this.sendRequest({case:`publishDataTrackRequest`,value:new q$({pubHandle:e,name:t,encryption:n?t$.GCM:t$.NONE})})}sendUnPublishDataTrackRequest(e){return this.sendRequest({case:`unpublishDataTrackRequest`,value:new Y$({pubHandle:e})})}sendUpdateDataSubscription(e,t){return this.sendRequest({case:`updateDataSubscription`,value:new c1({updates:[new l1({trackSid:e,subscribe:t})]})})}sendRequest(e){return J(this,arguments,void 0,function(e){var t=this;let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return function*(){if(!n&&!gue(e)&&t.state===w3.RECONNECTING){t.queuedRequests.push(()=>J(t,void 0,void 0,function*(){yield this.sendRequest(e,!0)}));return}if(n||(yield t.requestQueue.flush()),t.signalLatency&&(yield l4(t.signalLatency)),t.isDisconnected){t.log.debug(`skipping signal request (type: ${e.case}) - SignalClient disconnected`);return}if(!t.streamWriter){t.log.error(`cannot send signal request before connected, type: ${e?.case}`);return}let r=new U$({message:e});try{t.useJSON?yield t.streamWriter.write(r.toJsonString()):yield t.streamWriter.write(r.toBinary().buffer)}catch(e){t.log.error(`error sending signal message`,{error:e})}}()})}handleSignalResponse(e){let t=e.message;if(t==null){this.log.debug(`received unsupported message`);return}let n=!1;if(t.case===`answer`){let e=T3(t.value);this.onAnswer&&this.onAnswer(e,t.value.id,t.value.midToTrackId)}else if(t.case===`offer`){let e=T3(t.value);this.onOffer&&this.onOffer(e,t.value.id,t.value.midToTrackId)}else if(t.case===`trickle`){let e=JSON.parse(t.value.candidateInit);this.onTrickle&&this.onTrickle(e,t.value.target)}else t.case===`update`?this.onParticipantUpdate&&this.onParticipantUpdate(t.value.participants??[]):t.case===`trackPublished`?this.onLocalTrackPublished&&this.onLocalTrackPublished(t.value):t.case===`speakersChanged`?this.onSpeakersChanged&&this.onSpeakersChanged(t.value.speakers??[]):t.case===`leave`?this.onLeave&&this.onLeave(t.value):t.case===`mute`?this.onRemoteMuteChanged&&this.onRemoteMuteChanged(t.value.sid,t.value.muted):t.case===`roomUpdate`?this.onRoomUpdate&&t.value.room&&this.onRoomUpdate(t.value.room):t.case===`connectionQuality`?this.onConnectionQuality&&this.onConnectionQuality(t.value):t.case===`streamStateUpdate`?this.onStreamStateUpdate&&this.onStreamStateUpdate(t.value):t.case===`subscribedQualityUpdate`?this.onSubscribedQualityUpdate&&this.onSubscribedQualityUpdate(t.value):t.case===`subscriptionPermissionUpdate`?this.onSubscriptionPermissionUpdate&&this.onSubscriptionPermissionUpdate(t.value):t.case===`refreshToken`?this.onTokenRefresh&&this.onTokenRefresh(t.value):t.case===`trackUnpublished`?this.onLocalTrackUnpublished&&this.onLocalTrackUnpublished(t.value):t.case===`subscriptionResponse`?this.onSubscriptionError&&this.onSubscriptionError(t.value):t.case===`pong`||(t.case===`pongResp`?(this.rtt=Date.now()-Number.parseInt(t.value.lastPingTimestamp.toString()),this.resetPingTimeout(),n=!0):t.case===`requestResponse`?this.onRequestResponse&&this.onRequestResponse(t.value):t.case===`trackSubscribed`?this.onLocalTrackSubscribed&&this.onLocalTrackSubscribed(t.value.trackSid):t.case===`roomMoved`?(this.onTokenRefresh&&this.onTokenRefresh(t.value.token),this.onRoomMoved&&this.onRoomMoved(t.value)):t.case===`mediaSectionsRequirement`?this.onMediaSectionsRequirement&&this.onMediaSectionsRequirement(t.value):t.case===`publishDataTrackResponse`?this.onPublishDataTrackResponse&&this.onPublishDataTrackResponse(t.value):t.case===`unpublishDataTrackResponse`?this.onUnPublishDataTrackResponse&&this.onUnPublishDataTrackResponse(t.value):t.case===`dataTrackSubscriberHandles`?this.onDataTrackSubscriberHandles&&this.onDataTrackSubscriberHandles(t.value):this.log.debug(`unsupported message`,{msgCase:t.case}));n||this.resetPingTimeout()}setReconnected(){for(;this.queuedRequests.length>0;){let e=this.queuedRequests.shift();e&&this.requestQueue.run(e)}}handleOnClose(e){return J(this,void 0,void 0,function*(){if(this.state===w3.DISCONNECTED)return;let t=this.onClose;yield this.close(void 0,e),this.log.info(`websocket connection closed: ${e}`,{reason:e}),t&&t(e)})}handleWSError(e){this.log.error(`websocket error`,{error:e})}resetPingTimeout(){if(this.clearPingTimeout(),!this.pingTimeoutDuration){this.log.warn(`ping timeout duration not set`);return}this.pingTimeout=H2.setTimeout(()=>{this.log.warn(`ping timeout triggered. last pong received at: ${new Date(Date.now()-this.pingTimeoutDuration*1e3).toUTCString()}`),this.handleOnClose(`ping timeout`)},this.pingTimeoutDuration*1e3)}clearPingTimeout(){this.pingTimeout&&H2.clearTimeout(this.pingTimeout)}startPingInterval(){if(this.clearPingInterval(),this.resetPingTimeout(),!this.pingIntervalDuration){this.log.warn(`ping interval duration not set`);return}this.log.debug(`start ping interval`),this.pingInterval=H2.setInterval(()=>{this.sendPing()},this.pingIntervalDuration*1e3)}clearPingInterval(){this.log.debug(`clearing ping interval`),this.clearPingTimeout(),this.pingInterval&&H2.clearInterval(this.pingInterval)}handleSignalConnected(e,t,n){this.state=w3.CONNECTED,this.log.info(`signal connected`),clearTimeout(t),this.startPingInterval(),this.startReadingLoop(e.readable.getReader(),n)}validateFirstMessage(e,t){return e.message?.case===`join`?{isValid:!0,response:e.message.value}:this.state===w3.RECONNECTING&&e.message?.case!==`leave`?e.message?.case===`reconnect`?{isValid:!0,response:e.message.value}:(this.log.debug(`declaring signal reconnected without reconnect response received`),{isValid:!0,response:void 0,shouldProcessFirstMessage:!0}):this.isEstablishingConnection&&e.message?.case===`leave`?{isValid:!1,error:j2.leaveRequest(`Received leave request while trying to (re)connect`,e.message.value.reason)}:t?{isValid:!1,error:j2.internal(`Unexpected first message`)}:{isValid:!1,error:j2.internal(`did not receive join response, got ${e.message?.case} instead`)}}handleConnectionError(e,t){return J(this,void 0,void 0,function*(){try{let n=yield fetch(t);switch(n.status){case 404:let e=yield n.text();return e.includes(`requested room does not exist`)?j2.notAllowed(e,n.status):j2.serviceNotFound(`v1 RTC path not found. Consider upgrading your LiveKit server version`,`v0-rtc`);case 401:case 403:let t=yield n.text();return j2.notAllowed(t,n.status);default:break}return e instanceof j2?e:j2.internal(`Encountered unknown websocket error during connection: ${e}`,{status:n.status,statusText:n.statusText})}catch(e){return e instanceof j2?e:j2.serverUnreachable(e instanceof Error?e.message:`server was not reachable`)}})}};function T3(e){let t={type:`offer`,sdp:e.sdp};switch(e.type){case`answer`:case`offer`:case`pranswer`:case`rollback`:t.type=e.type;break}return t}function E3(e,t){return new a1({sdp:e.sdp,type:e.type,id:t})}function yue(e,t,n){let r=new URLSearchParams;return r.set(`access_token`,e),n.reconnect&&(r.set(`reconnect`,`1`),n.sid&&r.set(`sid`,n.sid)),r.set(`auto_subscribe`,n.autoSubscribe?`1`:`0`),r.set(`sdk`,b4()?`reactnative`:`js`),r.set(`version`,t.version),r.set(`protocol`,t.protocol.toString()),r.set(`client_protocol`,t.clientProtocol.toString()),t.deviceModel&&r.set(`device_model`,t.deviceModel),t.os&&r.set(`os`,t.os),t.osVersion&&r.set(`os_version`,t.osVersion),t.browser&&r.set(`browser`,t.browser),t.browserVersion&&r.set(`browser_version`,t.browserVersion),n.adaptiveStream&&r.set(`adaptive_stream`,`1`),n.reconnectReason&&r.set(`reconnect_reason`,n.reconnectReason.toString()),navigator.connection?.type&&r.set(`network`,navigator.connection.type),r}function bue(e,t,n,r){return J(this,void 0,void 0,function*(){let i=new URLSearchParams;i.set(`access_token`,e);let a=new G1({clientInfo:t,connectionSettings:new W1({autoSubscribe:!!n.autoSubscribe,adaptiveStream:!!n.adaptiveStream}),reconnect:!!n.reconnect,participantSid:n.sid?n.sid:void 0,publisherOffer:r});n.reconnectReason&&(a.reconnectReason=n.reconnectReason);let o=a.toBinary(),s,c;if(q4()){let e=new CompressionStream(`gzip`),t=e.writable.getWriter();t.write(new Uint8Array(o)),t.close();let n=[],r=e.readable.getReader();for(;;){let e=yield r.read(),t=e.done,i=e.value;if(t)break;n.push(i)}let i=n.reduce((e,t)=>e+t.length,0),a=new Uint8Array(i),l=0;for(let e of n)a.set(e,l),l+=e.length;s=a,c=q1.GZIP}else s=o,c=q1.NONE;let l=new K1({joinRequest:s,compression:c}).toBinary();return i.set(`join_request`,(e=>{let t=Array.from(e,e=>String.fromCodePoint(e)).join(``);return btoa(t)})(l).replace(/\+/g,`-`).replace(/\//g,`_`)),i})}var D3=class{constructor(){this.buffer=[],this._totalSize=0}push(e){this.buffer.push(e),this._totalSize+=e.data.byteLength}pop(){let e=this.buffer.shift();return e&&(this._totalSize-=e.data.byteLength),e}getAll(){return this.buffer.slice()}popToSequence(e){for(;this.buffer.length>0&&this.buffer[0].sequence<=e;)this.pop()}alignBufferedAmount(e){for(;this.buffer.length>0;){let t=this.buffer[0];if(this._totalSize-t.data.byteLength<=e)break;this.pop()}}get length(){return this.buffer.length}},xue=class{constructor(e){this._map=new Map,this._lastCleanup=0,this.ttl=e}set(e,t){let n=Date.now();n-this._lastCleanup>this.ttl/2&&this.cleanup();let r=n+this.ttl;return this._map.set(e,{value:t,expiresAt:r}),this}get(e){let t=this._map.get(e);if(t){if(t.expiresAt<Date.now()){this._map.delete(e);return}return t.value}}has(e){let t=this._map.get(e);return t?t.expiresAt<Date.now()?(this._map.delete(e),!1):!0:!1}delete(e){return this._map.delete(e)}clear(){this._map.clear()}cleanup(){let e=Date.now();for(let n of this._map.entries()){var t=hZ(n,2);let r=t[0];t[1].expiresAt<e&&this._map.delete(r)}this._lastCleanup=e}get size(){return this.cleanup(),this._map.size}forEach(e){this.cleanup();for(let n of this._map.entries()){var t=hZ(n,2);let r=t[0],i=t[1];i.expiresAt>=Date.now()&&e(i.value,r,this.asValueMap())}}map(e){this.cleanup();let t=[],n=this.asValueMap();for(let i of n.entries()){var r=hZ(i,2);let a=r[0],o=r[1];t.push(e(o,a,n))}return t}asValueMap(){let e=new Map;for(let n of this._map.entries()){var t=hZ(n,2);let r=t[0],i=t[1];i.expiresAt>=Date.now()&&e.set(r,i.value)}return e}},O3={},k3={},A3={exports:{}},j3;function M3(){if(j3)return A3.exports;j3=1;var e=A3.exports={v:[{name:`version`,reg:/^(\d*)$/}],o:[{name:`origin`,reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:[`username`,`sessionId`,`sessionVersion`,`netType`,`ipVer`,`address`],format:`%s %s %d %s IP%d %s`}],s:[{name:`name`}],i:[{name:`description`}],u:[{name:`uri`}],e:[{name:`email`}],p:[{name:`phone`}],z:[{name:`timezones`}],r:[{name:`repeats`}],t:[{name:`timing`,reg:/^(\d*) (\d*)/,names:[`start`,`stop`],format:`%d %d`}],c:[{name:`connection`,reg:/^IN IP(\d) (\S*)/,names:[`version`,`ip`],format:`IN IP%d %s`}],b:[{push:`bandwidth`,reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:[`type`,`limit`],format:`%s:%s`}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:[`type`,`port`,`protocol`,`payloads`],format:`%s %d %s %s`}],a:[{push:`rtp`,reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:[`payload`,`codec`,`rate`,`encoding`],format:function(e){return e.encoding?`rtpmap:%d %s/%s/%s`:e.rate?`rtpmap:%d %s/%s`:`rtpmap:%d %s`}},{push:`fmtp`,reg:/^fmtp:(\d*) ([\S| ]*)/,names:[`payload`,`config`],format:`fmtp:%d %s`},{name:`control`,reg:/^control:(.*)/,format:`control:%s`},{name:`rtcp`,reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:[`port`,`netType`,`ipVer`,`address`],format:function(e){return e.address==null?`rtcp:%d`:`rtcp:%d %s IP%d %s`}},{push:`rtcpFbTrrInt`,reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:[`payload`,`value`],format:`rtcp-fb:%s trr-int %d`},{push:`rtcpFb`,reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:[`payload`,`type`,`subtype`],format:function(e){return e.subtype==null?`rtcp-fb:%s %s`:`rtcp-fb:%s %s %s`}},{push:`ext`,reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:[`value`,`direction`,`encrypt-uri`,`uri`,`config`],format:function(e){return`extmap:%d`+(e.direction?`/%s`:`%v`)+(e[`encrypt-uri`]?` %s`:`%v`)+` %s`+(e.config?` %s`:``)}},{name:`extmapAllowMixed`,reg:/^(extmap-allow-mixed)/},{push:`crypto`,reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:[`id`,`suite`,`config`,`sessionConfig`],format:function(e){return e.sessionConfig==null?`crypto:%d %s %s`:`crypto:%d %s %s %s`}},{name:`setup`,reg:/^setup:(\w*)/,format:`setup:%s`},{name:`connectionType`,reg:/^connection:(new|existing)/,format:`connection:%s`},{name:`mid`,reg:/^mid:([^\s]*)/,format:`mid:%s`},{name:`msid`,reg:/^msid:(.*)/,format:`msid:%s`},{name:`ptime`,reg:/^ptime:(\d*(?:\.\d*)*)/,format:`ptime:%d`},{name:`maxptime`,reg:/^maxptime:(\d*(?:\.\d*)*)/,format:`maxptime:%d`},{name:`direction`,reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:`icelite`,reg:/^(ice-lite)/},{name:`iceUfrag`,reg:/^ice-ufrag:(\S*)/,format:`ice-ufrag:%s`},{name:`icePwd`,reg:/^ice-pwd:(\S*)/,format:`ice-pwd:%s`},{name:`fingerprint`,reg:/^fingerprint:(\S*) (\S*)/,names:[`type`,`hash`],format:`fingerprint:%s %s`},{push:`candidates`,reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:[`foundation`,`component`,`transport`,`priority`,`ip`,`port`,`type`,`raddr`,`rport`,`tcptype`,`generation`,`network-id`,`network-cost`],format:function(e){var t=`candidate:%s %d %s %d %s %d typ %s`;return t+=e.raddr==null?`%v%v`:` raddr %s rport %d`,t+=e.tcptype==null?`%v`:` tcptype %s`,e.generation!=null&&(t+=` generation %d`),t+=e[`network-id`]==null?`%v`:` network-id %d`,t+=e[`network-cost`]==null?`%v`:` network-cost %d`,t}},{name:`endOfCandidates`,reg:/^(end-of-candidates)/},{name:`remoteCandidates`,reg:/^remote-candidates:(.*)/,format:`remote-candidates:%s`},{name:`iceOptions`,reg:/^ice-options:(\S*)/,format:`ice-options:%s`},{push:`ssrcs`,reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:[`id`,`attribute`,`value`],format:function(e){var t=`ssrc:%d`;return e.attribute!=null&&(t+=` %s`,e.value!=null&&(t+=`:%s`)),t}},{push:`ssrcGroups`,reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:[`semantics`,`ssrcs`],format:`ssrc-group:%s %s`},{name:`msidSemantic`,reg:/^msid-semantic:\s?(\w*) (\S*)/,names:[`semantic`,`token`],format:`msid-semantic: %s %s`},{push:`groups`,reg:/^group:(\w*) (.*)/,names:[`type`,`mids`],format:`group:%s %s`},{name:`rtcpMux`,reg:/^(rtcp-mux)/},{name:`rtcpRsize`,reg:/^(rtcp-rsize)/},{name:`sctpmap`,reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:[`sctpmapNumber`,`app`,`maxMessageSize`],format:function(e){return e.maxMessageSize==null?`sctpmap:%s %s`:`sctpmap:%s %s %s`}},{name:`xGoogleFlag`,reg:/^x-google-flag:([^\s]*)/,format:`x-google-flag:%s`},{push:`rids`,reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:[`id`,`direction`,`params`],format:function(e){return e.params?`rid:%s %s %s`:`rid:%s %s`}},{push:`imageattrs`,reg:RegExp(`^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?`),names:[`pt`,`dir1`,`attrs1`,`dir2`,`attrs2`],format:function(e){return`imageattr:%s %s %s`+(e.dir2?` %s %s`:``)}},{name:`simulcast`,reg:RegExp(`^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$`),names:[`dir1`,`list1`,`dir2`,`list2`],format:function(e){return`simulcast:%s %s`+(e.dir2?` %s %s`:``)}},{name:`simulcast_03`,reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:[`value`],format:`simulcast: %s`},{name:`framerate`,reg:/^framerate:(\d+(?:$|\.\d+))/,format:`framerate:%s`},{name:`sourceFilter`,reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:[`filterMode`,`netType`,`addressTypes`,`destAddress`,`srcList`],format:`source-filter: %s %s %s %s %s`},{name:`bundleOnly`,reg:/^(bundle-only)/},{name:`label`,reg:/^label:(.+)/,format:`label:%s`},{name:`sctpPort`,reg:/^sctp-port:(\d+)$/,format:`sctp-port:%s`},{name:`maxMessageSize`,reg:/^max-message-size:(\d+)$/,format:`max-message-size:%s`},{push:`tsRefClocks`,reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:[`clksrc`,`clksrcExt`],format:function(e){return`ts-refclk:%s`+(e.clksrcExt==null?``:`=%s`)}},{name:`mediaClk`,reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:[`id`,`mediaClockName`,`mediaClockValue`,`rateNumerator`,`rateDenominator`],format:function(e){var t=`mediaclk:`;return t+=e.id==null?`%v%s`:`id=%s %s`,t+=e.mediaClockValue==null?``:`=%s`,t+=e.rateNumerator==null?``:` rate=%s`,t+=e.rateDenominator==null?``:`/%s`,t}},{name:`keywords`,reg:/^keywds:(.+)$/,format:`keywds:%s`},{name:`content`,reg:/^content:(.+)/,format:`content:%s`},{name:`bfcpFloorCtrl`,reg:/^floorctrl:(c-only|s-only|c-s)/,format:`floorctrl:%s`},{name:`bfcpConfId`,reg:/^confid:(\d+)/,format:`confid:%s`},{name:`bfcpUserId`,reg:/^userid:(\d+)/,format:`userid:%s`},{name:`bfcpFloorId`,reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:[`id`,`mStream`],format:`floorid:%s mstrm:%s`},{push:`invalid`,names:[`value`]}]};return Object.keys(e).forEach(function(t){e[t].forEach(function(e){e.reg||=/(.*)/,e.format||=`%s`})}),A3.exports}var N3;function Sue(){return N3?k3:(N3=1,(function(e){var t=function(e){return String(Number(e))===e?Number(e):e},n=function(e,n,r,i){if(i&&!r)n[i]=t(e[1]);else for(var a=0;a<r.length;a+=1)e[a+1]!=null&&(n[r[a]]=t(e[a+1]))},r=function(e,t,r){var i=e.name&&e.names;e.push&&!t[e.push]?t[e.push]=[]:i&&!t[e.name]&&(t[e.name]={});var a=e.push?{}:i?t[e.name]:t;n(r.match(e.reg),a,e.names,e.name),e.push&&t[e.push].push(a)},i=M3(),a=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},n=[],o=t;return e.split(/(\r\n|\r|\n)/).filter(a).forEach(function(e){var t=e[0],a=e.slice(2);t===`m`&&(n.push({rtp:[],fmtp:[]}),o=n[n.length-1]);for(var s=0;s<(i[t]||[]).length;s+=1){var c=i[t][s];if(c.reg.test(a))return r(c,o,a)}}),t.media=n,t};var o=function(e,n){var r=n.split(/=(.+)/,2);return r.length===2?e[r[0]]=t(r[1]):r.length===1&&n.length>1&&(e[r[0]]=void 0),e};e.parseParams=function(e){return e.split(/;\s?/).reduce(o,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){return e.toString().split(` `).map(Number)},e.parseRemoteCandidates=function(e){for(var n=[],r=e.split(` `).map(t),i=0;i<r.length;i+=3)n.push({component:r[i],ip:r[i+1],port:r[i+2]});return n},e.parseImageAttributes=function(e){return e.split(` `).map(function(e){return e.substring(1,e.length-1).split(`,`).reduce(o,{})})},e.parseSimulcastStreamList=function(e){return e.split(`;`).map(function(e){return e.split(`,`).map(function(e){var n,r=!1;return e[0]===`~`?(n=t(e.substring(1,e.length)),r=!0):n=t(e),{scid:n,paused:r}})})}})(k3),k3)}var P3,F3;function Cue(){if(F3)return P3;F3=1;var e=M3(),t=/%[sdv%]/g,n=function(e){var n=1,r=arguments,i=r.length;return e.replace(t,function(e){if(n>=i)return e;var t=r[n];switch(n+=1,e){case`%%`:return`%`;case`%s`:return String(t);case`%d`:return Number(t);case`%v`:return``}})},r=function(e,t,r){var i=t.format instanceof Function?t.format(t.push?r:r[t.name]):t.format,a=[e+`=`+i];if(t.names)for(var o=0;o<t.names.length;o+=1){var s=t.names[o];t.name?a.push(r[t.name][s]):a.push(r[t.names[o]])}else a.push(r[t.name]);return n.apply(null,a)},i=[`v`,`o`,`s`,`i`,`u`,`e`,`p`,`c`,`b`,`t`,`r`,`z`,`a`],a=[`i`,`c`,`b`,`a`];return P3=function(t,n){n||={},t.version??=0,t.name??=` `,t.media.forEach(function(e){e.payloads??=``});var o=n.outerOrder||i,s=n.innerOrder||a,c=[];return o.forEach(function(n){e[n].forEach(function(e){e.name in t&&t[e.name]!=null?c.push(r(n,e,t)):e.push in t&&t[e.push]!=null&&t[e.push].forEach(function(t){c.push(r(n,e,t))})})}),t.media.forEach(function(t){c.push(r(`m`,e.m[0],t)),s.forEach(function(n){e[n].forEach(function(e){e.name in t&&t[e.name]!=null?c.push(r(n,e,t)):e.push in t&&t[e.push]!=null&&t[e.push].forEach(function(t){c.push(r(n,e,t))})})})}),c.join(`\r 243`)+`\r 244`},P3}var I3;function wue(){if(I3)return O3;I3=1;var e=Sue(),t=Cue();return O3.grammar=M3(),O3.write=t,O3.parse=e.parse,O3.parseParams=e.parseParams,O3.parseFmtpConfig=e.parseFmtpConfig,O3.parsePayloads=e.parsePayloads,O3.parseRemoteCandidates=e.parseRemoteCandidates,O3.parseImageAttributes=e.parseImageAttributes,O3.parseSimulcastStreamList=e.parseSimulcastStreamList,O3}var L3=wue(),Tue=.7,Eue=20,R3={NegotiationStarted:`negotiationStarted`,NegotiationComplete:`negotiationComplete`,OfferAnswered:`offerAnswered`,RTPVideoPayloadTypes:`rtpVideoPayloadTypes`},z3=class extends v0.EventEmitter{get pc(){return this._pc||=this.createPC(),this._pc}constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),this.log=r0,this.ddExtID=0,this.latestOfferId=0,this.latestAcknowledgedOfferId=0,this.pendingCandidates=[],this.restartingIce=!1,this.renegotiate=!1,this.trackBitrates=[],this.remoteStereoMids=[],this.remoteNackMids=[],this.negotiate=i3(e=>J(this,void 0,void 0,function*(){this.emit(R3.NegotiationStarted);try{yield this.createAndSendOffer()}catch(t){if(e)e(t);else throw t}}),Eue),this.close=()=>{this._pc&&=(this.pendingInitialOffer=void 0,this._pc.close(),this._pc.onconnectionstatechange=null,this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.ondatachannel=null,this._pc.onnegotiationneeded=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ondatachannel=null,this._pc.ontrack=null,this._pc.onconnectionstatechange=null,this._pc.oniceconnectionstatechange=null,null)},this.log=i0(t.loggerName??n0.PCTransport),this.loggerOptions=t,this.config=e,this._pc=this.createPC(),this.offerLock=new OX}createPC(){let e=new RTCPeerConnection(this.config);return e.onicecandidate=e=>{var t;e.candidate&&((t=this.onIceCandidate)==null||t.call(this,e.candidate))},e.onicecandidateerror=e=>{var t;(t=this.onIceCandidateError)==null||t.call(this,e)},e.oniceconnectionstatechange=()=>{var t;(t=this.onIceConnectionStateChange)==null||t.call(this,e.iceConnectionState)},e.onsignalingstatechange=()=>{var t;(t=this.onSignalingStatechange)==null||t.call(this,e.signalingState)},e.onconnectionstatechange=()=>{var t;(t=this.onConnectionStateChange)==null||t.call(this,e.connectionState)},e.ondatachannel=e=>{var t;(t=this.onDataChannel)==null||t.call(this,e)},e.ontrack=e=>{var t;(t=this.onTrack)==null||t.call(this,e)},e}get logContext(){var e;return Object.assign({},(e=this.loggerOptions).loggerContextCb?.call(e))}get isICEConnected(){return this._pc!==null&&(this.pc.iceConnectionState===`connected`||this.pc.iceConnectionState===`completed`)}addIceCandidate(e){return J(this,void 0,void 0,function*(){if(this.pc.remoteDescription&&!this.restartingIce)return this.pc.addIceCandidate(e);this.pendingCandidates.push(e)})}setRemoteDescription(e,t){return J(this,void 0,void 0,function*(){if(e.type===`answer`&&this.latestOfferId>0&&t>0&&t!==this.latestOfferId)return this.log.warn(`ignoring answer for old offer`,Object.assign(Object.assign({},this.logContext),{offerId:t,latestOfferId:this.latestOfferId})),!1;let n;if(e.type===`offer`){let t=Due(e),n=t.stereoMids,r=t.nackMids;this.remoteStereoMids=n,this.remoteNackMids=r}else if(e.type===`answer`){if(this.pendingInitialOffer&&this._pc){let e=this.pendingInitialOffer;this.pendingInitialOffer=void 0;let t=L3.parse(e.sdp??``);t.media.forEach(e=>{V3(e)}),this.log.debug(`setting pending initial offer before processing answer`,this.logContext),yield this.setMungedSDP(e,L3.write(t))}let t=L3.parse(e.sdp??``);
244t.media.forEach(e=>{let t=H3(e.mid);e.type===`audio`&&this.trackBitrates.some(n=>{if(!n.transceiver||t!=n.transceiver.mid)return!1;let r=0;if(e.rtp.some(e=>e.codec.toUpperCase()===n.codec.toUpperCase()?(r=e.payload,!0):!1),r===0)return!0;let i=!1;for(let t of e.fmtp)if(t.payload===r){t.config=t.config.split(`;`).filter(e=>!e.includes(`maxaveragebitrate`)).join(`;`),n.maxbr>0&&(t.config+=`;maxaveragebitrate=${n.maxbr*1e3}`),i=!0;break}return i||n.maxbr>0&&e.fmtp.push({payload:r,config:`maxaveragebitrate=${n.maxbr*1e3}`}),!0})}),n=L3.write(t)}return yield this.setMungedSDP(e,n,!0),this.pendingCandidates.forEach(e=>{this.pc.addIceCandidate(e)}),this.pendingCandidates=[],this.restartingIce=!1,e.type===`answer`&&(this.latestAcknowledgedOfferId=t,this.emit(R3.OfferAnswered,t)),this.renegotiate?(this.renegotiate=!1,yield this.createAndSendOffer()):e.type===`answer`&&(this.emit(R3.NegotiationComplete),e.sdp&&L3.parse(e.sdp).media.forEach(e=>{e.type===`video`&&this.emit(R3.RTPVideoPayloadTypes,e.rtp)})),!0})}createInitialOffer(){return J(this,void 0,void 0,function*(){let e=yield this.offerLock.lock();try{if(this.pc.signalingState!==`stable`){this.log.warn(`signaling state is not stable, cannot create initial offer`,this.logContext);return}let e=this.latestOfferId+1;this.latestOfferId=e;let t=yield this.pc.createOffer();this.pendingInitialOffer={sdp:t.sdp,type:t.type};let n=L3.parse(t.sdp??``);return n.media.forEach(e=>{V3(e)}),t.sdp=L3.write(n),{offer:t,offerId:e}}finally{e()}})}createAndSendOffer(e){return J(this,void 0,void 0,function*(){let t=yield this.offerLock.lock();try{if(this.onOffer===void 0)return;if(e?.iceRestart&&(this.log.debug(`restarting ICE`,this.logContext),this.restartingIce=!0),this._pc&&(this._pc.signalingState===`have-local-offer`||this.pendingInitialOffer)){let t=this._pc.remoteDescription;if(e?.iceRestart&&t)yield this._pc.setRemoteDescription(t);else{this.renegotiate=!0,this.log.debug(`requesting renegotiation`,Object.assign({},this.logContext));return}}else if(!this._pc||this._pc.signalingState===`closed`){this.log.warn(`could not createOffer with closed peer connection`,this.logContext);return}this.log.debug(`starting to negotiate`,this.logContext);let t=this.latestOfferId+1;this.latestOfferId=t;let n=yield this.pc.createOffer(e);this.log.debug(`original offer`,Object.assign({sdp:n.sdp},this.logContext));let r=L3.parse(n.sdp??``);if(r.media.forEach(e=>{V3(e),e.type===`audio`?B3(e,[`all`],[]):e.type===`video`&&this.trackBitrates.some(t=>{if(!e.msid||!t.cid||!e.msid.includes(t.cid))return!1;let n=0;if(e.rtp.some(e=>e.codec.toUpperCase()===t.codec.toUpperCase()?(n=e.payload,!0):!1),n===0||(f4(t.codec)&&!g4()&&this.ensureVideoDDExtensionForSVC(e,r),!f4(t.codec)))return!0;let i=Math.round(t.maxbr*Tue);for(let t of e.fmtp)if(t.payload===n){t.config.includes(`x-google-start-bitrate`)||(t.config+=`;x-google-start-bitrate=${i}`);break}return!0})}),this.latestOfferId>t){this.log.warn(`latestOfferId mismatch`,Object.assign(Object.assign({},this.logContext),{latestOfferId:this.latestOfferId,offerId:t}));return}yield this.setMungedSDP(n,L3.write(r)),this.onOffer(n,this.latestOfferId)}finally{t()}})}createAndSetAnswer(){return J(this,void 0,void 0,function*(){let e=yield this.pc.createAnswer(),t=L3.parse(e.sdp??``);return t.media.forEach(e=>{V3(e),e.type===`audio`&&B3(e,this.remoteStereoMids,this.remoteNackMids)}),yield this.setMungedSDP(e,L3.write(t)),e})}createDataChannel(e,t){return this.pc.createDataChannel(e,t)}addTransceiver(e,t){return this.pc.addTransceiver(e,t)}addTransceiverOfKind(e,t){return this.pc.addTransceiver(e,t)}addTrack(e){if(!this._pc)throw new P2(`PC closed, cannot add track`);return this._pc.addTrack(e)}setTrackCodecBitrate(e){this.trackBitrates.push(e)}setConfiguration(e){if(!this._pc)throw new P2(`PC closed, cannot configure`);return this._pc?.setConfiguration(e)}canRemoveTrack(){return!!this._pc?.removeTrack}removeTrack(e){return this._pc?.removeTrack(e)}getConnectionState(){return this._pc?.connectionState??`closed`}getICEConnectionState(){return this._pc?.iceConnectionState??`closed`}getSignallingState(){return this._pc?.signalingState??`closed`}getTransceivers(){return this._pc?.getTransceivers()??[]}getSenders(){return this._pc?.getSenders()??[]}getLocalDescription(){return this._pc?.localDescription}getRemoteDescription(){return this.pc?.remoteDescription}getStats(){return this.pc.getStats()}getMaxMessageSize(){return this._pc?.sctp?.maxMessageSize}getConnectedAddress(){return J(this,void 0,void 0,function*(){if(!this._pc)return;let e=``,t=new Map,n=new Map;
vendor: 4,226 bytes, line 244
244if((yield this._pc.getStats()).forEach(r=>{switch(r.type){case`transport`:e=r.selectedCandidatePairId;break;case`candidate-pair`:e===``&&r.selected&&(e=r.id),t.set(r.id,r);break;case`remote-candidate`:n.set(r.id,`${r.address}:${r.port}`);break}}),e===``)return;let r=t.get(e)?.remoteCandidateId;if(r!==void 0)return n.get(r)})}setMungedSDP(e,t,n){return J(this,void 0,void 0,function*(){let r=e.sdp;if(t){e.sdp=t;try{this.log.debug(`setting munged ${n?`remote`:`local`} description`,this.logContext),n?yield this.pc.setRemoteDescription(e):yield this.pc.setLocalDescription(e);return}catch(n){this.log.warn(`not able to set ${e.type}, falling back to unmodified sdp`,Object.assign(Object.assign({},this.logContext),{error:n,mungedSdp:t,originalSdp:r})),e.sdp=r}}try{n?yield this._pc?.setRemoteDescription(e):yield this._pc?.setLocalDescription(e)}catch(i){let a=`unknown error`;i instanceof Error?a=i.message:typeof i==`string`&&(a=i);let o={error:a,sdp:e.sdp};throw t&&t!==r&&(o.mungedSdp=t),!n&&this.pc.remoteDescription&&(o.remoteSdp=this.pc.remoteDescription),this.log.error(`unable to set ${e.type}`,Object.assign(Object.assign({},this.logContext),{fields:o})),new F2(a)}})}ensureVideoDDExtensionForSVC(e,t){var n;if(!e.ext?.some(e=>e.uri===c4)){if(this.ddExtID===0){let e=0;t.media.forEach(t=>{var n;(n=t.ext)==null||n.forEach(t=>{t.value>e&&(e=t.value)})}),this.ddExtID=e+1}(n=e.ext)==null||n.push({value:this.ddExtID,uri:c4})}}};function B3(e,t,n){let r=H3(e.mid),i=0;e.rtp.some(e=>e.codec===`opus`?(i=e.payload,!0):!1),i>0&&(e.rtcpFb||=[],n.includes(r)&&!e.rtcpFb.some(e=>e.payload===i&&e.type===`nack`)&&e.rtcpFb.push({payload:i,type:`nack`}),(t.includes(r)||t.length===1&&t[0]===`all`)&&e.fmtp.some(e=>e.payload===i?(e.config.includes(`stereo=1`)||(e.config+=`;stereo=1`),!0):!1))}function Due(e){let t=[],n=[],r=L3.parse(e.sdp??``),i=0;return r.media.forEach(e=>{let r=H3(e.mid);e.type===`audio`&&(e.rtp.some(e=>e.codec===`opus`?(i=e.payload,!0):!1),e.rtcpFb?.some(e=>e.payload===i&&e.type===`nack`)&&n.push(r),e.fmtp.some(e=>e.payload===i?(e.config.includes(`sprop-stereo=1`)&&t.push(r),!0):!1))}),{stereoMids:t,nackMids:n}}function V3(e){if(e.connection){let t=e.connection.ip.indexOf(`:`)>=0;(e.connection.version===4&&t||e.connection.version===6&&!t)&&(e.connection.ip=`0.0.0.0`,e.connection.version=4)}}function H3(e){return typeof e==`number`?e.toFixed(0):e}var U3=`vp8`,Oue={audioPreset:G2.music,dtx:!0,red:!0,forceStereo:!1,simulcast:!0,screenShareEncoding:J2.h1080fps15.encoding,stopMicTrackOnMute:!1,videoCodec:U3,backupCodec:!0,preConnectBuffer:!1},W3={deviceId:{ideal:`default`},autoGainControl:!0,echoCancellation:!0,noiseSuppression:!0,voiceIsolation:!0},G3={deviceId:{ideal:`default`},resolution:K2.h720.resolution},kue={adaptiveStream:!1,dynacast:!1,stopLocalTrackOnUnpublish:!0,reconnectPolicy:new l0,disconnectOnPageLeave:!0,webAudioMix:!1,singlePeerConnection:!0},K3={autoSubscribe:!0,maxRetries:1,peerConnectionTimeout:15e3,websocketTimeout:15e3},q3;(function(e){e[e.NEW=0]=`NEW`,e[e.CONNECTING=1]=`CONNECTING`,e[e.CONNECTED=2]=`CONNECTED`,e[e.FAILED=3]=`FAILED`,e[e.CLOSING=4]=`CLOSING`,e[e.CLOSED=5]=`CLOSED`})(q3||={});var J3=class{get needsPublisher(){return this.isPublisherConnectionRequired}get needsSubscriber(){return this.isSubscriberConnectionRequired}get currentState(){return this.state}get mode(){return this._mode}constructor(e,t,n){this.peerConnectionTimeout=K3.peerConnectionTimeout,this.log=r0,this.updateState=()=>{var e;let t=this.state,n=this.requiredTransports.map(e=>e.getConnectionState());n.every(e=>e===`connected`)?this.state=q3.CONNECTED:n.some(e=>e===`failed`)?this.state=q3.FAILED:n.some(e=>e===`connecting`)?this.state=q3.CONNECTING:n.every(e=>e===`closed`)?this.state=q3.CLOSED:n.some(e=>e===`closed`)?this.state=q3.CLOSING:n.every(e=>e===`new`)&&(this.state=q3.NEW),t!==this.state&&(this.log.debug(`pc state change: from ${q3[t]} to ${q3[this.state]}`,this.logContext),(e=this.onStateChange)==null||e.call(this,this.state,this.publisher.getConnectionState(),this.subscriber?.getConnectionState()))},this.log=i0(t.loggerName??n0.PCManager),this.loggerOptions=t,this.isPublisherConnectionRequired=e!==`subscriber-primary`,this.isSubscriberConnectionRequired=e===`
244subscriber-primary`,this.publisher=new z3(n,t),this._mode=e,e!==`publisher-only`&&(this.subscriber=new z3(n,t),this.subscriber.onConnectionStateChange=this.updateState,this.subscriber.onIceConnectionStateChange=this.updateState,this.subscriber.onSignalingStatechange=this.updateState,this.subscriber.onIceCandidate=e=>{var t;(t=this.onIceCandidate)==null||t.call(this,e,B$.SUBSCRIBER)},this.subscriber.onDataChannel=e=>{var t;(t=this.onDataChannel)==null||t.call(this,e)},this.subscriber.onTrack=e=>{var t;(t=this.onTrack)==null||t.call(this,e)}),this.publisher.onConnectionStateChange=this.updateState,this.publisher.onIceConnectionStateChange=this.updateState,this.publisher.onSignalingStatechange=this.updateState,this.publisher.onIceCandidate=e=>{var t;(t=this.onIceCandidate)==null||t.call(this,e,B$.PUBLISHER)},this.publisher.onTrack=e=>{var t;(t=this.onTrack)==null||t.call(this,e)},this.publisher.onOffer=(e,t)=>{var n;(n=this.onPublisherOffer)==null||n.call(this,e,t)},this.state=q3.NEW,this.connectionLock=new OX,this.remoteOfferLock=new OX}get logContext(){var e;return Object.assign({},(e=this.loggerOptions).loggerContextCb?.call(e))}requirePublisher(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.isPublisherConnectionRequired=e,this.updateState()}createAndSendPublisherOffer(e){return this.publisher.createAndSendOffer(e)}setPublisherAnswer(e,t){return this.publisher.setRemoteDescription(e,t)}removeTrack(e){return this.publisher.removeTrack(e)}close(){return J(this,void 0,void 0,function*(){if(this.publisher&&this.publisher.getSignallingState()!==`closed`){let e=this.publisher;for(let t of e.getSenders())try{e.canRemoveTrack()&&e.removeTrack(t)}catch(e){this.log.warn(`could not removeTrack`,Object.assign(Object.assign({},this.logContext),{error:e}))}}yield Promise.all([this.publisher.close(),this.subscriber?.close()]),this.updateState()})}triggerIceRestart(){return J(this,void 0,void 0,function*(){this.subscriber&&(this.subscriber.restartingIce=!0),this.needsPublisher&&(yield this.createAndSendPublisherOffer({iceRestart:!0}))})}addIceCandidate(e,t){return J(this,void 0,void 0,function*(){t===B$.PUBLISHER?yield this.publisher.addIceCandidate(e):yield this.subscriber?.addIceCandidate(e)})}createSubscriberAnswerFromOffer(e,t){return J(this,void 0,void 0,function*(){this.log.debug(`received server offer`,Object.assign(Object.assign({},this.logContext),{RTCSdpType:e.type,sdp:e.sdp,signalingState:this.subscriber?.getSignallingState().toString()}));let n=yield this.remoteOfferLock.lock();try{return(yield this.subscriber?.setRemoteDescription(e,t))?yield this.subscriber?.createAndSetAnswer():void 0}finally{n()}})}updateConfiguration(e,t){var n;this.publisher.setConfiguration(e),(n=this.subscriber)==null||n.setConfiguration(e),t&&this.triggerIceRestart()}ensurePCTransportConnection(e,t){return J(this,void 0,void 0,function*(){let n=yield this.connectionLock.lock();try{this.isPublisherConnectionRequired&&this.publisher.getConnectionState()!==`connected`&&this.publisher.getConnectionState()!==`connecting`&&(this.log.debug(`negotiation required, start negotiating`,this.logContext),this.publisher.negotiate()),yield Promise.all(this.requiredTransports?.map(n=>this.ensureTransportConnected(n,e,t)))}finally{n()}})}negotiate(e){return J(this,void 0,void 0,function*(){return new C2((t,n)=>{let r=this.publisher.latestOfferId;if(this.publisher.latestAcknowledgedOfferId>r){this.log.debug(`negotiation already handled in more recent acknowledged offer`,this.logContext),t();return}let i=!1,a=()=>{i||(i=!0,clearTimeout(c),this.publisher.off(R3.OfferAnswered,o),e.signal.removeEventListener(`abort`,s))},o=e=>{e>r&&(a(),t())},s=()=>{a(),n(new F2(`negotiation aborted`))},c=setTimeout(()=>{a(),n(new F2(`negotiation timed out`))},this.peerConnectionTimeout);e.signal.addEventListener(`abort`,s),this.publisher.on(R3.OfferAnswered,o),this.publisher.negotiate(e=>{a(),e instanceof Error?n(e):n(Error(String(e)))})})})}addPublisherTransceiver(e,t){return this.publisher.addTransceiver(e,t)}addPublisherTransceiverOfKind(e,t){return this.publisher.addTransceiverOfKind(e,t)}getMidForReceiver(e){return(this.subscriber?this.subscriber.getTransceivers():this.publisher.getTransceivers()).find(t=>t.receiver===e)?.mid}getMaxPublisherMessageSize(){return this.publisher.getMaxMessageSize()}addPublisherTrack(e){return this.publisher.addTrack(e)}
vendor: 13,249 bytes, line 244
244createPublisherDataChannel(e,t){return this.publisher.createDataChannel(e,t)}getConnectedAddress(e){return e===B$.PUBLISHER||e===B$.SUBSCRIBER?this.publisher.getConnectedAddress():this.requiredTransports[0].getConnectedAddress()}get requiredTransports(){let e=[];return this.isPublisherConnectionRequired&&e.push(this.publisher),this.isSubscriberConnectionRequired&&this.subscriber&&e.push(this.subscriber),e}ensureTransportConnected(e,t){return J(this,arguments,void 0,function(e,t){var n=this;let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.peerConnectionTimeout;return function*(){if(e.getConnectionState()!==`connected`)return new Promise((e,i)=>J(n,void 0,void 0,function*(){let n=()=>{this.log.warn(`abort transport connection`,this.logContext),H2.clearTimeout(a),i(j2.cancelled(`room connection has been cancelled`))};t?.signal.aborted&&n(),t?.signal.addEventListener(`abort`,n);let a=H2.setTimeout(()=>{t?.signal.removeEventListener(`abort`,n),i(j2.internal(`could not establish pc connection`))},r);for(;this.state!==q3.CONNECTED;)if(yield l4(50),t?.signal.aborted){i(j2.cancelled(`room connection has been cancelled`));return}H2.clearTimeout(a),t?.signal.removeEventListener(`abort`,n),e()}))}()})}},Y3=typeof MediaRecorder<`u`,Aue=Y3?MediaRecorder:class{constructor(){throw Error(`MediaRecorder is not available in this environment`)}},jue=class extends Aue{constructor(e,t){if(!Y3)throw Error(`MediaRecorder is not available in this environment`);super(new MediaStream([e.mediaStreamTrack]),t);let n,r,i=()=>r===void 0,a=()=>{this.removeEventListener(`dataavailable`,n),this.removeEventListener(`stop`,a),this.removeEventListener(`error`,o),r?.close(),r=void 0},o=e=>{r?.error(e),this.removeEventListener(`dataavailable`,n),this.removeEventListener(`stop`,a),this.removeEventListener(`error`,o),r=void 0};this.byteStream=new ReadableStream({start:e=>{r=e,n=t=>J(this,void 0,void 0,function*(){let n;if(t.data.arrayBuffer){let e=yield t.data.arrayBuffer();n=new Uint8Array(e)}else if(t.data.byteArray)n=t.data.byteArray;else throw Error(`no data available!`);i()||e.enqueue(n)}),this.addEventListener(`dataavailable`,n)},cancel:()=>{a()}}),this.addEventListener(`stop`,a),this.addEventListener(`error`,o)}};function Mue(){return Y3}var Nue=1e3,Pue=1e4,X3=class extends ${get sender(){return this._sender}set sender(e){this._sender=e}get constraints(){return this._constraints}get hasPreConnectBuffer(){return!!this.localTrackRecorder}constructor(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,i=arguments.length>4?arguments[4]:void 0;super(e,t,i),this.manuallyStopped=!1,this.pendingDeviceChange=!1,this._isUpstreamPaused=!1,this.handleTrackMuteEvent=()=>this.debouncedTrackMuteHandler().catch(()=>this.log.debug(`track mute bounce got cancelled by an unmute event`,this.logContext)),this.debouncedTrackMuteHandler=i3(()=>J(this,void 0,void 0,function*(){yield this.pauseUpstream()}),5e3),this.handleTrackUnmuteEvent=()=>J(this,void 0,void 0,function*(){this.debouncedTrackMuteHandler.cancel(`unmute`),yield this.resumeUpstream()}),this.handleEnded=()=>{this.isInBackground&&(this.reacquireTrack=!0),this._mediaStreamTrack.removeEventListener(`mute`,this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener(`unmute`,this.handleTrackUnmuteEvent),this.emit(Q.Ended,this)},this.reacquireTrack=!1,this.providedByUser=r,this.muteLock=new OX,this.pauseUpstreamLock=new OX,this.trackChangeLock=new OX,this.trackChangeLock.lock().then(t=>J(this,void 0,void 0,function*(){try{yield this.setMediaStreamTrack(e,!0)}finally{t()}})),this._constraints=e.getConstraints(),n&&(this._constraints=n)}get id(){return this._mediaStreamTrack.id}get dimensions(){if(this.kind!==$.Kind.Video)return;let e=this._mediaStreamTrack.getSettings(),t=e.width,n=e.height;if(t&&n)return{width:t,height:n}}get isUpstreamPaused(){return this._isUpstreamPaused}get isUserProvided(){return this.providedByUser}get mediaStreamTrack(){return this.processor?.processedTrack??this._mediaStreamTrack}get isLocal(){return!0}getSourceTrackSettings(){return this._mediaStreamTrack.getSettings()}setMediaStreamTrack(e,t,n){return J(this,void 0,void 0,function*(){if(e===this._mediaStreamTrack&&!t)return;this._mediaStreamTrack&&(this.attachedElements.forEach(e=>{s4(this._mediaStreamTrack,e)}),this.debouncedTrackMuteHandler.cancel(`new-track`),this._mediaStreamTrack.removeEventListener(`ended`,this.handleEnded),this._mediaStreamTrack.removeEventListener(`mute`,this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener(`unmute`,this.handleTrackUnmuteEvent)),this.mediaStream=new MediaStream([e]),e&&(e.addEventListener(`ended`,this.handleEnded),e.addEventListener(`mute`,this.handleTrackMuteEvent),e.addEventListener(`unmute`,this.handleTrackUnmuteEvent),this._constraints=e.getConstraints());let r;if(this.processor&&e){if(this.log.debug(`restarting processor`,this.logContext),this.kind===`unknown`)throw TypeError(`cannot set processor on track of unknown kind`);this.processorElement&&(o4(e,this.processorElement),this.processorElement.muted=!0),yield this.processor.restart({track:e,kind:this.kind,element:this.processorElement,localTrack:this}),r=this.processor.processedTrack}this.sender&&this.sender.transport?.state!==`closed`&&(yield this.sender.replaceTrack(r??e)),!this.providedByUser&&this._mediaStreamTrack!==e&&this._mediaStreamTrack.stop(),this._mediaStreamTrack=e,e&&(this._mediaStreamTrack.enabled=n?!0:!this.isMuted,yield this.resumeUpstream(),this.attachedElements.forEach(t=>{o4(r??e,t)}))})}waitForDimensions(){return J(this,arguments,void 0,function(){var e=this;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Nue;return function*(){if(e.kind===$.Kind.Audio)throw Error(`cannot get dimensions for audio tracks`);T2()?.os===`iOS`&&(yield l4(10));let n=Date.now();for(;Date.now()-n<t;){let t=e.dimensions;if(t)return t;yield l4(50)}throw new N2(`unable to get track dimensions after timeout`)}()})}setDeviceId(e){return J(this,void 0,void 0,function*(){return this._constraints.deviceId===e&&this._mediaStreamTrack.getSettings().deviceId===F4(e)?!0:(this._constraints.deviceId=e,this.isMuted?(this.pendingDeviceChange=!0,!0):(yield this.restartTrack(),F4(e)===this._mediaStreamTrack.getSettings().deviceId))})}getDeviceId(){return J(this,arguments,void 0,function(){var e=this;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){if(e.source===$.Source.ScreenShare)return;let n=e._mediaStreamTrack.getSettings(),r=n.deviceId,i=n.groupId,a=e.kind===$.Kind.Audio?`audioinput`:`videoinput`;return t?m3.getInstance().normalizeDeviceId(a,r,i):r}()})}mute(){return J(this,void 0,void 0,function*(){return this.setTrackMuted(!0),this})}unmute(){return J(this,void 0,void 0,function*(){return this.setTrackMuted(!1),this})}replaceTrack(e,t){return J(this,void 0,void 0,function*(){let n=yield this.trackChangeLock.lock();try{if(!this.sender)throw new N2(`unable to replace an unpublished track`);let n,r;typeof t==`boolean`?n=t:t!==void 0&&(n=t.userProvidedTrack,r=t.stopProcessor),this.providedByUser=n??!0,this.log.debug(`replace MediaStreamTrack`,this.logContext),yield this.setMediaStreamTrack(e),r&&this.processor&&(yield this.internalStopProcessor())}finally{n()}return yield this.onSenderTrackSwapped(),this})}onSenderTrackSwapped(){return J(this,void 0,void 0,function*(){})}restart(e,t){return J(this,void 0,void 0,function*(){this.manuallyStopped=!1;let n=yield this.trackChangeLock.lock();try{e||=this._constraints;let n=e,r=n.deviceId,i=n.facingMode,a=u0(e,[`deviceId`,`facingMode`]);this.log.debug(`restarting track with constraints`,Object.assign(Object.assign({},this.logContext),{constraints:e}));let o={audio:!1,video:!1};this.kind===$.Kind.Video?o.video=r||i?{deviceId:r,facingMode:i}:!0:o.audio=r?Object.assign({deviceId:r},a):!0,this.attachedElements.forEach(e=>{s4(this.mediaStreamTrack,e)}),this._mediaStreamTrack.removeEventListener(`ended`,this.handleEnded),this._mediaStreamTrack.stop();let s=(yield navigator.mediaDevices.getUserMedia(o)).getTracks()[0];return this.kind===$.Kind.Video&&(yield s.applyConstraints(a)),s.addEventListener(`ended`,this.handleEnded),this.log.debug(`re-acquired MediaStreamTrack`,this.logContext),yield this.setMediaStreamTrack(s,!1,t),this._constraints=e,this.pendingDeviceChange=!1,this.emit(Q.Restarted,this),this.manuallyStopped&&(this.log.warn(`track was stopped during a restart, stopping restarted track`,this.logContext),this.stop()),this}finally{n()}})}setTrackMuted(e){this.log.debug(`setting ${this.kind} track ${e?`muted`:`unmuted`}`,this.logContext),!(this.isMuted===e&&this._mediaStreamTrack.enabled!==e)&&(this.isMuted=e,this._mediaStreamTrack.enabled=!e,this.emit(e?Q.Muted:Q.Unmuted,this))}get needsReAcquisition(){return this._mediaStreamTrack.readyState!==`live`||this._mediaStreamTrack.muted||!this._mediaStreamTrack.enabled||this.reacquireTrack}handleAppVisibilityChanged(){let e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return J(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),v4()&&(this.log.debug(`visibility changed, is in Background: ${this.isInBackground}`,this.logContext),!this.isInBackground&&this.needsReAcquisition&&!this.isUserProvided&&!this.isMuted&&(this.log.debug(`track needs to be reacquired, restarting ${this.source}`,this.logContext),yield this.restart(),this.reacquireTrack=!1))})}stop(){var e;this.manuallyStopped=!0,super.stop(),this._mediaStreamTrack.removeEventListener(`ended`,this.handleEnded),this._mediaStreamTrack.removeEventListener(`mute`,this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener(`unmute`,this.handleTrackUnmuteEvent),(e=this.processor)==null||e.destroy(),this.processor=void 0}pauseUpstream(){return J(this,void 0,void 0,function*(){let e=yield this.pauseUpstreamLock.lock();try{if(this._isUpstreamPaused===!0)return;if(!this.sender){this.log.warn(`unable to pause upstream for an unpublished track`,this.logContext);return}this._isUpstreamPaused=!0,this.emit(Q.UpstreamPaused,this);let e=T2();if(e?.name===`Safari`&&E4(e.version,`12.0`)<0)throw new M2(`pauseUpstream is not supported on Safari < 12.`);this.sender.transport?.state!==`closed`&&(yield this.sender.replaceTrack(null))}finally{e()}})}resumeUpstream(){return J(this,void 0,void 0,function*(){let e=yield this.pauseUpstreamLock.lock();try{if(this._isUpstreamPaused===!1)return;if(!this.sender){this.log.warn(`unable to resume upstream for an unpublished track`,this.logContext);return}this._isUpstreamPaused=!1,this.emit(Q.UpstreamResumed,this),this.sender.transport?.state!==`closed`&&(yield this.sender.replaceTrack(this.mediaStreamTrack))}finally{e()}})}getRTCStatsReport(){return J(this,void 0,void 0,function*(){if(this.sender?.getStats)return yield this.sender.getStats()})}setProcessor(e){return J(this,arguments,void 0,function(e){var t=this;let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){let r=yield t.trackChangeLock.lock();try{t.log.debug(`setting up processor`,t.logContext);let r=document.createElement(t.kind),i={kind:t.kind,track:t._mediaStreamTrack,element:r,audioContext:t.audioContext,localTrack:t};if(yield e.init(i),t.log.debug(`processor initialized`,t.logContext),t.processor&&(yield t.internalStopProcessor()),t.kind===`unknown`)throw TypeError(`cannot set processor on track of unknown kind`);if(o4(t._mediaStreamTrack,r),r.muted=!0,r.play().catch(e=>{e instanceof DOMException&&e.name===`AbortError`?(t.log.warn(`failed to play processor element, retrying`,Object.assign(Object.assign({},t.logContext),{error:e})),setTimeout(()=>{r.play().catch(e=>{t.log.error(`failed to play processor element`,Object.assign(Object.assign({},t.logContext),{err:e}))})},100)):t.log.error(`failed to play processor element`,Object.assign(Object.assign({},t.logContext),{error:e}))}),t.processor=e,t.processorElement=r,t.processor.processedTrack){for(let e of t.attachedElements)e!==t.processorElement&&n&&(s4(t._mediaStreamTrack,e),o4(t.processor.processedTrack,e));yield t.sender?.replaceTrack(t.processor.processedTrack)}t.emit(Q.TrackProcessorUpdate,t.processor)}finally{r()}yield t.onSenderTrackSwapped()}()})}getProcessor(){return this.processor}stopProcessor(){return J(this,arguments,void 0,function(){var e=this;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){let n=yield e.trackChangeLock.lock();try{yield e.internalStopProcessor(t)}finally{n()}yield e.onSenderTrackSwapped()}()})}internalStopProcessor(){return J(this,arguments,void 0,function(){var e=this;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){var n,r;e.processor&&(e.log.debug(`stopping processor`,e.logContext),(n=e.processor.processedTrack)==null||n.stop(),yield e.processor.destroy(),e.processor=void 0,t||((r=e.processorElement)==null||r.remove(),e.processorElement=void 0),yield e._mediaStreamTrack.applyConstraints(e._constraints),yield e.setMediaStreamTrack(e._mediaStreamTrack,!0),e.emit(Q.TrackProcessorUpdate))}()})}startPreConnectBuffer(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:100;if(!Mue()){this.log.warn(`MediaRecorder is not available, cannot start prec
244onnect buffer`,this.logContext);return}if(this.localTrackRecorder){this.log.warn(`preconnect buffer already started`);return}else{let e=`audio/webm;codecs=opus`;MediaRecorder.isTypeSupported(e)||(e=`video/mp4`),this.localTrackRecorder=new jue(this,{mimeType:e})}this.localTrackRecorder.start(e),this.autoStopPreConnectBuffer=setTimeout(()=>{this.log.warn(`preconnect buffer timed out, stopping recording automatically`,this.logContext),this.stopPreConnectBuffer()},Pue)}stopPreConnectBuffer(){clearTimeout(this.autoStopPreConnectBuffer),this.localTrackRecorder&&=(this.localTrackRecorder.stop(),void 0)}getPreConnectBuffer(){return this.localTrackRecorder?.byteStream}getPreConnectBufferMimeType(){return this.localTrackRecorder?.mimeType}},Z3=class extends X3{get enhancedNoiseCancellation(){return this.isKrispNoiseFilterEnabled}constructor(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,r=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0;super(e,$.Kind.Audio,t,n,i),this.stopOnMute=!1,this.isKrispNoiseFilterEnabled=!1,this.monitorSender=()=>J(this,void 0,void 0,function*(){if(!this.sender){this._currentBitrate=0;return}let e;try{e=yield this.getSenderStats()}catch(e){this.log.error(`could not get audio sender stats`,Object.assign(Object.assign({},this.logContext),{error:e}));return}e&&this.prevStats&&(this._currentBitrate=o3(e,this.prevStats)),this.prevStats=e}),this.handleKrispNoiseFilterEnable=()=>{this.isKrispNoiseFilterEnabled=!0,this.log.debug(`Krisp noise filter enabled`,this.logContext),this.emit(Q.AudioTrackFeatureUpdate,this,KQ.TF_ENHANCED_NOISE_CANCELLATION,!0)},this.handleKrispNoiseFilterDisable=()=>{this.isKrispNoiseFilterEnabled=!1,this.log.debug(`Krisp noise filter disabled`,this.logContext),this.emit(Q.AudioTrackFeatureUpdate,this,KQ.TF_ENHANCED_NOISE_CANCELLATION,!1)},this.audioContext=r,this.checkForSilence()}mute(){let e=Object.create(null,{mute:{get:()=>super.mute}});return J(this,void 0,void 0,function*(){let t=yield this.muteLock.lock();try{return this.isMuted?(this.log.debug(`Track already muted`,this.logContext),this):(this.source===$.Source.Microphone&&this.stopOnMute&&!this.isUserProvided&&(this.log.debug(`stopping mic track`,this.logContext),this._mediaStreamTrack.stop()),yield e.mute.call(this),this)}finally{t()}})}unmute(){let e=Object.create(null,{unmute:{get:()=>super.unmute}});return J(this,void 0,void 0,function*(){let t=yield this.muteLock.lock();try{return this.isMuted?(this.source===$.Source.Microphone&&(this.stopOnMute||this._mediaStreamTrack.readyState===`ended`||this.pendingDeviceChange)&&!this.isUserProvided&&(this.log.debug(`reacquiring mic track`,this.logContext),yield this.restart(void 0,!0)),yield e.unmute.call(this),this):(this.log.debug(`Track already unmuted`,this.logContext),this)}finally{t()}})}restartTrack(e){return J(this,void 0,void 0,function*(){let t;if(e){let n=Z2({audio:e});typeof n.audio!=`boolean`&&(t=n.audio)}yield this.restart(t)})}restart(e,t){let n=Object.create(null,{restart:{get:()=>super.restart}});return J(this,void 0,void 0,function*(){let r=yield n.restart.call(this,e,t);return this.checkForSilence(),r})}startMonitor(){y4()&&(this.monitorInterval||=setInterval(()=>{this.monitorSender()},a3))}setProcessor(e){return J(this,void 0,void 0,function*(){let t=yield this.trackChangeLock.lock();try{if(!b4()&&!this.audioContext)throw Error(`Audio context needs to be set on LocalAudioTrack in order to enable processors`);this.processor&&(yield this.internalStopProcessor());let t={kind:this.kind,track:this._mediaStreamTrack,audioContext:this.audioContext,localTrack:this};this.log.debug(`setting up audio processor ${e.name}`,this.logContext),yield e.init(t),this.processor=e,this.processor.processedTrack&&(yield this.sender?.replaceTrack(this.processor.processedTrack),this.processor.processedTrack.addEventListener(`enable-lk-krisp-noise-filter`,this.handleKrispNoiseFilterEnable),this.processor.processedTrack.addEventListener(`disable-lk-krisp-noise-filter`,this.handleKrispNoiseFilterDisable)),this.emit(Q.TrackProcessorUpdate,this.processor)}finally{t()}})}setAudioContext(e){this.audioContext=e}getSenderStats(){return J(this,void 0,void 0,function*(){if(!this.sender?.getStats)return;let e=yield this.sender.getStats(),t;
vendor: 15,723 bytes, line 244
244return e.forEach(e=>{e.type===`outbound-rtp`&&(t={type:`audio`,streamId:e.id,packetsSent:e.packetsSent,packetsLost:e.packetsLost,bytesSent:e.bytesSent,timestamp:e.timestamp,roundTripTime:e.roundTripTime,jitter:e.jitter})}),t})}checkForSilence(){return J(this,void 0,void 0,function*(){let e=yield mle(this);return e&&(this.isMuted||this.log.debug(`silence detected on local audio track`,this.logContext),this.emit(Q.AudioSilenceDetected)),e})}};function Fue(e,t,n){switch(e.kind){case`audio`:return new Z3(e,t,!1,void 0,n);case`video`:return new a6(e,t,!1,n);default:throw new N2(`unsupported track type: ${e.kind}`)}}var Iue=Object.values(K2),Lue=Object.values(q2),Rue=Object.values(J2),zue=[K2.h180,K2.h360],Bue=[q2.h180,q2.h360],Vue=e=>[{scaleResolutionDownBy:2,fps:e.encoding.maxFramerate}].map(t=>new U2(Math.floor(e.width/t.scaleResolutionDownBy),Math.floor(e.height/t.scaleResolutionDownBy),Math.max(15e4,Math.floor(e.encoding.maxBitrate/(t.scaleResolutionDownBy**2*((e.encoding.maxFramerate??30)/(t.fps??30))))),t.fps,e.encoding.priority)),Q3=[`q`,`h`,`f`];function $3(e,t,n,r){let i=r?.videoEncoding;e&&(i=r?.screenShareEncoding);let a=r?.simulcast,o=r?.scalabilityMode,s=r?.videoCodec;if(!i&&!a&&!o||!t||!n)return[{}];i||(i=Hue(e,t,n,s),r0.debug(`using video encoding`,i));let c=i.maxFramerate,l=new U2(t,n,i.maxBitrate,i.maxFramerate,i.priority);if(o&&f4(s)){let e=new i6(o),t=[];if(e.spatial>3)throw Error(`unsupported scalabilityMode: ${o}`);let n=T2();if(_4()||b4()||n?.name===`Chrome`&&E4(n?.version,`113`)<0){let r=e.suffix==`h`?2:3,a=Ale(n);for(let n=0;n<e.spatial;n+=1)t.push({rid:Q3[2-n],maxBitrate:i.maxBitrate/r**+n,maxFramerate:l.encoding.maxFramerate,scaleResolutionDownBy:a?2**n:void 0});t[0].scalabilityMode=o}else t.push({maxBitrate:i.maxBitrate,maxFramerate:l.encoding.maxFramerate,scalabilityMode:o});return l.encoding.priority&&(t[0].priority=l.encoding.priority,t[0].networkPriority=l.encoding.priority),r0.debug(`using svc encoding`,{encodings:t}),t}if(!a)return[i];let u;u=e?r6(r?.screenShareSimulcastLayers)??t6(e,l):r6(r?.videoSimulcastLayers)??t6(e,l);let d;if(u.length>0){let e=u[0];u.length>1&&(d=hZ(u,2)[1]);let r=Math.max(t,n);if(r>=960&&d)return n6(t,n,[e,d,l],c);if(r>=480)return n6(t,n,[e,l],c)}return n6(t,n,[l])}function e6(e,t,n){if(!n.backupCodec||n.backupCodec===!0||n.backupCodec.codec===n.videoCodec)return;t!==n.backupCodec.codec&&r0.warn(`requested a different codec than specified as backup`,{serverRequested:t,backup:n.backupCodec.codec}),n.videoCodec=t,n.videoEncoding=n.backupCodec.encoding;let r=e.mediaStreamTrack.getSettings(),i=r.width??e.dimensions?.width,a=r.height??e.dimensions?.height;return e.source===$.Source.ScreenShare&&n.simulcast&&(n.simulcast=!1),$3(e.source===$.Source.ScreenShare,i,a,n)}function Hue(e,t,n,r){let i=Uue(e,t,n),a=i[0].encoding,o=Math.max(t,n);for(let e=0;e<i.length;e+=1){let t=i[e];if(a=t.encoding,t.width>=o)break}if(r)switch(r){case`av1`:case`h265`:a=Object.assign({},a),a.maxBitrate*=.7;break;case`vp9`:a=Object.assign({},a),a.maxBitrate*=.85;break}return a}function Uue(e,t,n){if(e)return Rue;let r=t>n?t/n:n/t;return Math.abs(r-16/9)<Math.abs(r-4/3)?Iue:Lue}function t6(e,t){if(e)return Vue(t);let n=t.width,r=t.height,i=n>r?n/r:r/n;return Math.abs(i-16/9)<Math.abs(i-4/3)?zue:Bue}function n6(e,t,n,r){let i=[];if(n.forEach((n,a)=>{if(a>=Q3.length)return;let o=Math.min(e,t),s={rid:Q3[a],scaleResolutionDownBy:Math.max(1,o/Math.min(n.width,n.height)),maxBitrate:n.encoding.maxBitrate},c=r&&n.encoding.maxFramerate?Math.min(r,n.encoding.maxFramerate):n.encoding.maxFramerate;c&&(s.maxFramerate=c);let l=T2(),u=l?.name===`Firefox`&&l.os!==`iOS`||a===0;n.encoding.priority&&u&&(s.priority=n.encoding.priority,s.networkPriority=n.encoding.priority),i.push(s)}),b4()&&w4()===`ios`){let e;i.forEach(t=>{e?t.maxFramerate&&t.maxFramerate>e&&(e=t.maxFramerate):e=t.maxFramerate});let t=!0;i.forEach(n=>{n.maxFramerate!=e&&(t&&(t=!1,r0.info(`Simulcast on iOS React-Native requires all encodings to share the same framerate.`)),r0.info(`Setting framerate of encoding "${n.rid??``}" to ${e}`),n.maxFramerate=e)})}return i}function r6(e){if(e)return e.slice().sort((e,t)=>{let n=e.encoding,r=t.encoding;return n.maxBitrate>r.maxBitrate?1:n.maxBitrate<r.maxBitrate?-1:n.maxBitrate===r.maxBitrate&&n.maxFramerate&&r.maxFramerate?n.maxFramerate>r.maxFramerate?1:-1:0})}var i6=class{constructor(e){let t=e.match(/^L(\d)T(\d)(h|_KEY|_KEY_SHIFT){0,1}$/);if(!t)throw Error(`invalid scalability mode`);if(this.spatial=parseInt(t[1]),this.temporal=parseInt(t[2]),t.length>3)switch(t[3]){case`h`:case`_KEY`:case`_KEY_SHIFT`:this.suffix=t[3]}}toString(){return`L${this.spatial}T${this.temporal}${this.suffix??``}`}};function Wue(e){return e.source===$.Source.ScreenShare||e.constraints.height&&F4(e.constraints.height)>=1080?`maintain-resolution`:`balanced`}var Gue=5e3,a6=class extends X3{get sender(){return this._sender}set sender(e){this._sender=e,this.degradationPreference&&this.setDegradationPreference(this.degradationPreference)}constructor(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,r=arguments.length>3?arguments[3]:void 0;super(e,$.Kind.Video,t,n,r),this.simulcastCodecs=new Map,this.degradationPreference=`balanced`,this.isCpuConstrained=!1,this.optimizeForPerformance=!1,this.monitorSender=()=>J(this,void 0,void 0,function*(){if(!this.sender){this._currentBitrate=0;return}let e;try{e=yield this.getSenderStats()}catch(e){this.log.error(`could not get video sender stats`,Object.assign(Object.assign({},this.logContext),{error:e}));return}let t=new Map(e.map(e=>[e.rid,e])),n=e.some(e=>e.qualityLimitationReason===`cpu`);if(n!==this.isCpuConstrained&&(this.isCpuConstrained=n,this.isCpuConstrained&&this.emit(Q.CpuConstrained)),this.prevStats){let e=0;t.forEach((t,n)=>{let r=this.prevStats?.get(n);e+=o3(t,r)}),this._currentBitrate=e}this.prevStats=t}),this.senderLock=new OX}get isSimulcast(){return!!(this.sender&&this.sender.getParameters().encodings.length>1)}startMonitor(e){if(this.signalClient=e,!y4())return;let t=this.sender?.getParameters();t&&(this.encodings=t.encodings),!this.monitorInterval&&(this.monitorInterval=setInterval(()=>{this.monitorSender()},a3))}stop(){this._mediaStreamTrack.getConstraints(),this.simulcastCodecs.forEach(e=>{e.mediaStreamTrack.stop()}),super.stop()}pauseUpstream(){let e=Object.create(null,{pauseUpstream:{get:()=>super.pauseUpstream}});return J(this,void 0,void 0,function*(){var t,n,r,i;yield e.pauseUpstream.call(this);try{for(var a=!0,o=h0(this.simulcastCodecs.values()),s;s=yield o.next(),t=s.done,!t;a=!0)i=s.value,a=!1,yield i.sender?.replaceTrack(null)}catch(e){n={error:e}}finally{try{!a&&!t&&(r=o.return)&&(yield r.call(o))}finally{if(n)throw n.error}}})}resumeUpstream(){let e=Object.create(null,{resumeUpstream:{get:()=>super.resumeUpstream}});return J(this,void 0,void 0,function*(){var t,n,r,i;yield e.resumeUpstream.call(this);try{for(var a=!0,o=h0(this.simulcastCodecs.values()),s;s=yield o.next(),t=s.done,!t;a=!0){i=s.value,a=!1;let e=i;yield e.sender?.replaceTrack(e.mediaStreamTrack)}}catch(e){n={error:e}}finally{try{!a&&!t&&(r=o.return)&&(yield r.call(o))}finally{if(n)throw n.error}}})}mute(){let e=Object.create(null,{mute:{get:()=>super.mute}});return J(this,void 0,void 0,function*(){let t=yield this.muteLock.lock();try{return this.isMuted?(this.log.debug(`Track already muted`,this.logContext),this):(this.source===$.Source.Camera&&!this.isUserProvided&&(this.log.debug(`stopping camera track`,this.logContext),this._mediaStreamTrack.stop()),yield e.mute.call(this),this)}finally{t()}})}unmute(){let e=Object.create(null,{unmute:{get:()=>super.unmute}});return J(this,void 0,void 0,function*(){let t=yield this.muteLock.lock();try{return this.isMuted?(this.source===$.Source.Camera&&!this.isUserProvided&&(this.log.debug(`reacquiring camera track`,this.logContext),yield this.restart(void 0,!0)),yield e.unmute.call(this),this):(this.log.debug(`Track already unmuted`,this.logContext),this)}finally{t()}})}setTrackMuted(e){super.setTrackMuted(e);for(let t of this.simulcastCodecs.values())t.mediaStreamTrack.enabled=!e}getSenderStats(){return J(this,void 0,void 0,function*(){if(!this.sender?.getStats)return[];let e=[],t=yield this.sender.getStats();return t.forEach(n=>{if(n.type===`outbound-rtp`){let r={type:`video`,streamId:n.id,frameHeight:n.frameHeight,frameWidth:n.frameWidth,framesPerSecond:n.framesPerSecond,framesSent:n.framesSent,firCount:n.firCount,pliCount:n.pliCount,nackCount:n.nackCount,packetsSent:n.packetsSent,bytesSent:n.bytesSent,qualityLimitationReason:n.qualityLimitationReason,qualityLimitationDurations:n.qualityLimitationDurations,qualityLimitationResolutionChanges:n.qualityLimitationResolutionChanges,rid:n.rid??n.id,retransmittedPacketsSent:n.retransmittedPacketsSent,targetBitrate:n.targetBitrate,timestamp:n.timestamp},i=t.get(n.remoteId);i&&(r.jitter=i.jitter,r.packetsLost=i.packetsLost,r.roundTripTime=i.roundTripTime),e.push(r)}}),e.sort((e,t)=>(t.frameWidth??0)-(e.frameWidth??0)),e})}setPublishingQuality(e){let t=[];for(let n=a4.LOW;n<=a4.HIGH;n+=1)t.push(new w1({quality:n,enabled:n<=e}));this.log.debug(`setting publishing quality. max quality ${e}`,this.logContext),this.setPublishingLayers(f4(this.codec),t)}restartTrack(e){return J(this,void 0,void 0,function*(){var t,n,r,i;let a;if(e){let t=Z2({video:e});typeof t.video!=`boolean`&&(a=t.video)}yield this.restart(a),this.isCpuConstrained=!1;try{for(var o=!0,s=h0(this.simulcastCodecs.values()),c;c=yield s.next(),t=c.done,!t;o=!0){i=c.value,o=!1;let e=i;e.sender&&e.sender.transport?.state!==`closed`&&(e.mediaStreamTrack=this.mediaStreamTrack.clone(),yield e.sender.replaceTrack(e.mediaStreamTrack))}}catch(e){n={error:e}}finally{try{!o&&!t&&(r=s.return)&&(yield r.call(s))}finally{if(n)throw n.error}}yield this.onSenderTrackSwapped()})}onSenderTrackSwapped(){return J(this,void 0,void 0,function*(){yield this.refreshSenderEncodings()})}refreshSenderEncodings(){return J(this,void 0,void 0,function*(){if(!this.sender||!this.publishOptions||this.optimizeForPerformance)return;let e=yield this.senderLock.lock();try{let e;try{e=yield this.waitForDimensions()}catch(e){this.log.warn(`could not determine new track dimensions, skipping encoding recompute`,Object.assign(Object.assign({},this.logContext),{error:e}));return}if(this.lastEncodedDimensions&&this.lastEncodedDimensions.width===e.width&&this.lastEncodedDimensions.height===e.height)return;let n=$3(this.source===$.Source.ScreenShare,e.width,e.height,Object.assign({},this.publishOptions));yield this.applyEncodingsToSender(this.sender,n),this.encodings=n,this.lastEncodedDimensions=e;for(let e of this.simulcastCodecs){var t=hZ(e,2);let n=t[0],r=t[1];if(!r.sender||r.sender.transport?.state===`closed`||!W2(n))continue;let i=Object.assign({},this.publishOptions),a=e6(this,n,i);a&&(yield this.applyEncodingsToSender(r.sender,a),r.encodings=a)}}catch(e){this.log.warn(`failed to apply recomputed encodings`,Object.assign(Object.assign({},this.logContext),{error:e}))}finally{e()}})}applyEncodingsToSender(e,t){return J(this,void 0,void 0,function*(){let n=e.getParameters();!n.encodings||n.encodings.length!==t.length||(n.encodings.forEach((e,n)=>{if(e.active===!1)return;let r=t[n];r.scaleResolutionDownBy!==void 0&&(e.scaleResolutionDownBy=r.scaleResolutionDownBy),r.maxBitrate!==void 0&&(e.maxBitrate=r.maxBitrate),r.maxFramerate!==void 0&&(e.maxFramerate=r.maxFramerate),r.priority!==void 0&&(e.priority=r.priority,e.networkPriority=r.priority)}),this.log.debug(`updating sender encodings after track restart`,Object.assign(Object.assign({},this.logContext),{encodings:n.encodings})),yield e.setParameters(n))})}setProcessor(e){let t=Object.create(null,{setProcessor:{get:()=>super.setProcessor}});return J(this,arguments,void 0,function(e){var n=this;let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){var i,a,o,s;if(yield t.setProcessor.call(n,e,r),n.processor?.processedTrack)try{for(var c=!0,l=h0(n.simulcastCodecs.values()),u;u=yield l.next(),i=u.done,!i;c=!0)s=u.value,c=!1,yield s.sender?.replaceTrack(n.processor.processedTrack)}catch(e){a={error:e}}finally{try{!c&&!i&&(o=l.return)&&(yield o.call(l))}finally{if(a)throw a.error}}}()})}setDegradationPreference(e){return J(this,void 0,void 0,function*(){if(this.degradationPreference=e,this.sender)try{this.log.debug(`setting degradationPreference to ${e}`,this.logContext);let t=this.sender.getParameters();t.degradationPreference=e,this.sender.setParameters(t)}catch(e){this.log.warn(`failed to set degradationPreference`,Object.assign({error:e},this.logContext))}})}addSimulcastTrack(e,t){if(this.simulcastCodecs.has(e)){this.log.error(`${e} already added, skipping adding simulcast codec`,this.logContext);return}let n={codec:e,mediaStreamTrack:this.mediaStreamTrack.clone(),sender:void 0,encodings:t};return this.simulcastCodecs.set(e,n),n}setSimulcastTrackSender(e,t){let n=this.simulcastCodecs.get(e);n&&(n.sender=t,setTimeout(()=>{this.subscribedCodecs&&this.setPublishingCodecs(this.subscribedCodecs)},Gue))}setPublishingCodecs(e){return J(this,void 0,void 0,function*(){var t,n,r,i,a,o,s;if(this.log.debug(`setting publishing codecs`,Object.assign(Object.assign({},this.logContext),{codecs:e,currentCodec:this.codec})),!this.codec&&e.length>0)return yield this.setPublishingLayers(f4(e[0].codec),e[0].qualities),[];this.subscribedCodecs=e;let c=[];try{for(t=!0,n=h0(e);r=yield n.next(),i=r.done,!i;t=!0){s=r.value,t=!1;let e=s;if(!this.codec||this.codec===e.codec)yield this.setPublishingLayers(f4(e.codec),e.qualities);else{let t=this.simulcastCodecs.get(e.codec);if(this.log.debug(`try setPublishingCodec for ${e.codec}`,Object.assign(Object.assign({},this.logContext),{simulcastCodecInfo:t})),!t||!t.sender){for(let t of e.qualities)if(t.enabled){c.push(e.codec);break}}else t.encodings&&(this.log.debug(`try setPublishingLayersForSender ${e.codec}`,this.logContext),yield o6(t.sender,t.encodings,e.qualities,this.senderLock,f4(e.codec),this.log,this.logContext))}}}catch(e){a={error:e}}finally{try{!t&&!i&&(o=n.return)&&(yield o.call(n))}finally{if(a)throw a.error}}return c})}setPublishingLayers(e,t){return J(this,void 0,void 0,function*(){if(this.optimizeForPerformance){this.log.info(`skipping setPublishingLayers due to optimized publishing performance`,Object.assign(Object.assign({},this.logContext),{qualities:t}));return}this.log.debug(`setting publishing layers`,Object.assign(Object.assign({},this.logContext),{qualities:t})),!(!this.sender||!this.encodings)&&(yield o6(this.sender,this.encodings,t,this.senderLock,e,this.log,this.logContext))})}prioritizePerformance(){return J(this,void 0,void 0,function*(){if(!this.sender)throw Error(`sender not found`);let e=yield this.senderLock.lock();try{this.optimizeForPerformance=!0;let e=this.sender.getParameters();e.encodings=e.encodings.map((e,t)=>Object.assign(Object.assign({},e),{active:t===0,scaleResolutionDownBy:Math.max(1,Math.ceil((this.mediaStreamTrack.getSettings().height??360)/360)),scalabilityMode:t===0&&f4(this.codec)?`L1T3`:void 0,maxFramerate:t===0?15:0,maxBitrate:t===0?e.maxBitrate:0})),this.log.debug(`setting performance optimised encodings`,Object.assign(Object.assign({},this.logContext),{encodings:e.encodings})),this.encodings=e.encodings,yield this.sender.setParameters(e)}catch(e){this.log.error(`failed to set performance optimised encodings`,Object.assign(Object.assign({},this.logContext),{error:e})),this.optimizeForPerformance=!1}finally{e()}})}handleAppVisibilityChanged(){let e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return J(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),v4()&&this.isInBackgroun
244d&&this.source===$.Source.Camera&&(this._mediaStreamTrack.enabled=!1)})}};function o6(e,t,n,r,i,a,o){return J(this,void 0,void 0,function*(){let s=yield r.lock();a.debug(`setPublishingLayersForSender`,Object.assign(Object.assign({},o),{sender:e,qualities:n,senderEncodings:t}));try{let r=e.getParameters(),s=r.encodings;if(!s)return;if(s.length!==t.length){a.warn(`cannot set publishing layers, encodings mismatch`,Object.assign(Object.assign({},o),{encodings:s,senderEncodings:t}));return}let c=!1;i&&n.some(e=>e.enabled)&&n.forEach(e=>e.enabled=!0),s.forEach((e,r)=>{let i=e.rid??``;i===``&&(i=`q`);let s=s6(i),l=n.find(e=>e.quality===s);l&&e.active!==l.enabled&&(c=!0,e.active=l.enabled,a.debug(`setting layer ${l.quality} to ${e.active?`enabled`:`disabled`}`,o),m4()&&(l.enabled?(e.scaleResolutionDownBy=t[r].scaleResolutionDownBy,e.maxBitrate=t[r].maxBitrate,e.maxFrameRate=t[r].maxFrameRate):(e.scaleResolutionDownBy=4,e.maxBitrate=10,e.maxFrameRate=2)))}),c&&(r.encodings=s,a.debug(`setting encodings`,Object.assign(Object.assign({},o),{encodings:r.encodings})),yield e.setParameters(r))}finally{s()}})}function s6(e){switch(e){case`f`:return a4.HIGH;case`h`:return a4.MEDIUM;case`q`:return a4.LOW;default:return a4.HIGH}}function c6(e,t,n,r){if(!n)return[new o$({quality:a4.HIGH,width:e,height:t,bitrate:0,ssrc:0})];if(r){let r=n[0].scalabilityMode,i=new i6(r),a=[],o=i.suffix==`h`?1.5:2,s=i.suffix==`h`?2:3;for(let r=0;r<i.spatial;r+=1)a.push(new o$({quality:Math.min(a4.HIGH,i.spatial-1)-r,width:Math.ceil(e/o**+r),height:Math.ceil(t/o**+r),bitrate:n[0].maxBitrate?Math.ceil(n[0].maxBitrate/s**+r):0,ssrc:0}));return a}return n.map(n=>{let r=n.scaleResolutionDownBy??1;return new o$({quality:s6(n.rid??``),width:Math.ceil(e/r),height:Math.ceil(t/r),bitrate:n.maxBitrate??0,ssrc:0})})}var l6=`_lossy`,u6=`_reliable`,d6=`_data_track`,Kue=2*1e3,f6=`leave-reconnect`,que=3e4,Jue=8*1024,Yue=256*1024,Xue=3,Zue=3,p6;(function(e){e[e.New=0]=`New`,e[e.Connected=1]=`Connected`,e[e.Disconnected=2]=`Disconnected`,e[e.Reconnecting=3]=`Reconnecting`,e[e.Closed=4]=`Closed`})(p6||={});var m6;(function(e){e[e.RELIABLE=0]=`RELIABLE`,e[e.LOSSY=1]=`LOSSY`,e[e.DATA_TRACK_LOSSY=2]=`DATA_TRACK_LOSSY`})(m6||={});var h6=64e3,Que=class extends v0.EventEmitter{get isClosed(){return this._isClosed}get isNewlyCreated(){return this._isNewlyCreated}get pendingReconnect(){return!!this.reconnectTimeout}constructor(e){super(),this.options=e,this.rtcConfig={},this.peerConnectionTimeout=K3.peerConnectionTimeout,this.fullReconnectOnNext=!1,this.latestRemoteOfferId=0,this.subscriberPrimary=!1,this.pcState=p6.New,this._isClosed=!0,this._isNewlyCreated=!0,this.pendingTrackResolvers={},this.reconnectAttempts=0,this.reconnectStart=0,this.attemptingReconnect=!1,this.joinAttempts=0,this.maxJoinAttempts=1,this.shouldFailNext=!1,this.shouldFailOnV1Path=!1,this.log=r0,this.reliableDataSequence=1,this.reliableMessageBuffer=new D3,this.reliableReceivedState=new xue(que),this.lossyDataStatCurrentBytes=0,this.lossyDataStatByterate=0,this.lossyDataDropCount=0,this.midToTrackId={},this.isWaitingForNetworkReconnect=!1,this.bufferStatusLowClosingFuture=new P4,this.handleDataChannel=e=>J(this,[e],void 0,function(e){var t=this;let n=e.channel;return function*(){if(!n)return;let e;if(n.label===u6)t.reliableDCSub=n,e=t.handleDataMessage;else if(n.label===l6)t.lossyDCSub=n,e=t.handleDataMessage;else if(n.label===d6)t.dataTrackDCSub=n,e=t.handleDataTrackMessage;else return;t.log.debug(`on data channel ${n.id}, ${n.label}`),n.onmessage=e}()}),this.handleDataMessage=e=>J(this,void 0,void 0,function*(){let t=yield this.dataProcessLock.lock();try{let t;if(e.data instanceof ArrayBuffer)t=e.data;else if(e.data instanceof Blob)t=yield e.data.arrayBuffer();else{this.log.error(`unsupported data type`,{data:e.data});return}let n=c$.fromBinary(new Uint8Array(t));if(n.sequence>0&&n.participantSid!==``){let e=this.reliableReceivedState.get(n.participantSid);if(e&&n.sequence<=e)return;this.reliableReceivedState.set(n.participantSid,n.sequence)}if(n.value?.case===`speaker`)this.emit(Z.ActiveSpeakersUpdate,n.value.value.speakers);else if(n.value?.case===`encryptedPacket`){if(!this.e2eeManager){this.log.error(`Received encrypted packet but E2EE not set up`);return}let e=yield this.e2eeManager?.handleEncryptedData(n.value.value.encryptedValue,n.value.value.iv,n.participantIdentity,n.value.value.keyIndex),t=new c$({value:d$.fromBinary(e.payload).value,participantIdentity:n.participantIdentity,participantSid:n.participantSid});
244t.value?.case===`user`&&g6(t,t.value.value),this.emit(Z.DataPacketReceived,t,n.value.value.encryptionType)}else n.value?.case===`user`&&g6(n,n.value.value),this.emit(Z.DataPacketReceived,n,t$.NONE)}finally{t()}}),this.handleDataTrackMessage=e=>J(this,void 0,void 0,function*(){let t;if(e.data instanceof ArrayBuffer)t=e.data;else if(e.data instanceof Blob)t=yield e.data.arrayBuffer();else{this.log.error(`unsupported data type`,{data:e.data});return}this.emit(`dataTrackPacketReceived`,new Uint8Array(t))}),this.handleDataError=e=>{if(this._isClosed)return;let t=e.currentTarget.maxRetransmits===0?`lossy`:`reliable`;if(typeof RTCErrorEvent<`u`&&e instanceof RTCErrorEvent&&e.error){let n=e.error;this.log.error(`DataChannel error on ${t}: ${n.message}`,{error:n,errorDetail:n.errorDetail,sctpCauseCode:n.sctpCauseCode})}else this.log.error(`Unknown DataChannel error on ${t}`,{event:e})},this.handleDataChannelClose=e=>()=>{!this._isClosed&&this.pcManager?.publisher.getConnectionState()===`connected`&&this.log.error(`publisher data channel '${m6[e]}' closed unexpectedly`,this.logContext)},this.handleBufferedAmountLow=e=>{this.updateAndEmitDCBufferStatus(e)},this.handleDisconnect=(e,t)=>{if(this._isClosed)return;this.log.warn(`${e} disconnected`),this.reconnectAttempts===0&&(this.reconnectStart=Date.now());let n=e=>{this.log.warn(`could not recover connection after ${this.reconnectAttempts} attempts, ${e}ms. giving up`),this.emit(Z.Disconnected),this.close()},r=Date.now()-this.reconnectStart,i=this.getNextRetryDelay({elapsedMs:r,retryCount:this.reconnectAttempts});if(i===null){n(r);return}e===f6&&(i=0),this.log.debug(`reconnecting in ${i}ms`),this.clearReconnectTimeout(),this.token&&this.emit(Z.TokenRefreshed,this.token),this.reconnectTimeout=H2.setTimeout(()=>this.attemptReconnect(t).finally(()=>this.reconnectTimeout=void 0),i)},this.waitForRestarted=()=>new Promise((e,t)=>{this.pcState===p6.Connected&&e();let n=()=>{this.off(Z.Disconnected,r),e()},r=()=>{this.off(Z.Restarted,n),t()};this.once(Z.Restarted,n),this.once(Z.Disconnected,r)}),this.updateAndEmitDCBufferStatus=e=>{if(e===m6.RELIABLE){let t=this.dataChannelForKind(e);t&&this.reliableMessageBuffer.alignBufferedAmount(t.bufferedAmount)}let t=this.isBufferStatusLow(e);t!==void 0&&t!==this.dcBufferStatus.get(e)&&(this.dcBufferStatus.set(e,t),this.emit(Z.DCBufferStatusChanged,t,e))},this.isBufferStatusLow=e=>{let t=this.dataChannelForKind(e);if(t)return t.bufferedAmount<=t.bufferedAmountLowThreshold},this.onRtpMapAvailable=e=>{let t=new Map;e.forEach(e=>{let n=e.codec.toLowerCase();Ile(n)&&t.set(e.payload,n)}),this.emit(Z.RTPVideoMapUpdate,t)},this.handleBrowserOnLine=()=>J(this,void 0,void 0,function*(){this.url&&(yield fetch(I4(this.url),{method:`HEAD`}).then(e=>e.ok).catch(()=>!1))&&(this.log.info(`detected network reconnected`),(this.client.currentState===w3.RECONNECTING||this.isWaitingForNetworkReconnect&&this.client.currentState===w3.CONNECTED)&&(this.clearReconnectTimeout(),this.attemptReconnect(WQ.RR_SIGNAL_DISCONNECTED),this.isWaitingForNetworkReconnect=!1))}),this.handleBrowserOffline=()=>J(this,void 0,void 0,function*(){if(this.url)try{yield Promise.race([fetch(I4(this.url),{method:`HEAD`}),l4(4e3).then(()=>Promise.reject())])}catch{window.navigator.onLine===!1&&(this.log.info(`detected network interruption`),this.isWaitingForNetworkReconnect=!0)}}),this.log=i0(e.loggerName??n0.Engine,()=>this.logContext),this.loggerOptions={loggerName:e.loggerName,loggerContextCb:()=>this.logContext},this.client=new vue(void 0,this.loggerOptions),this.client.signalLatency=this.options.expSignalLatency,this.reconnectPolicy=this.options.reconnectPolicy,this.closingLock=new OX,this.dataProcessLock=new OX,this.dcBufferStatus=new Map([[m6.RELIABLE,!0],[m6.LOSSY,!0
vendor: 10,336 bytes, line 244
244],[m6.DATA_TRACK_LOSSY,!0]]),this.client.onParticipantUpdate=e=>this.emit(Z.ParticipantUpdate,e),this.client.onConnectionQuality=e=>this.emit(Z.ConnectionQualityUpdate,e),this.client.onRoomUpdate=e=>this.emit(Z.RoomUpdate,e),this.client.onSubscriptionError=e=>this.emit(Z.SubscriptionError,e),this.client.onSubscriptionPermissionUpdate=e=>this.emit(Z.SubscriptionPermissionUpdate,e),this.client.onSpeakersChanged=e=>this.emit(Z.SpeakersChanged,e),this.client.onStreamStateUpdate=e=>this.emit(Z.StreamStateChanged,e),this.client.onRequestResponse=e=>this.emit(Z.SignalRequestResponse,e),this.client.onParticipantUpdate=e=>this.emit(Z.ParticipantUpdate,e),this.client.onJoined=e=>this.emit(Z.Joined,e),this.on(Z.Closing,()=>{var e,t;(t=(e=this.bufferStatusLowClosingFuture).reject)==null||t.call(e,new P2(`engine closed`))}),this.bufferStatusLowClosingFuture.promise.catch(()=>{})}get logContext(){return{room:this.latestJoinResponse?.room?.name,roomID:this.latestJoinResponse?.room?.sid,participant:this.latestJoinResponse?.participant?.identity,participantID:this.participantSid}}join(e,t,n,r){return J(this,arguments,void 0,function(e,t,n,r){var i=this;let a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;return function*(){var o;i._isNewlyCreated=!1,i.url=e,i.token=t,i.signalOpts=n,i.maxJoinAttempts=n.maxRetries;try{i.joinAttempts+=1,i.setupSignalClientCallbacks();let s=!a&&Wle(),c;if(s){i.pcManager||(yield i.configure(),i.applyInitialPublisherLayout());let e=yield i.pcManager?.publisher.createInitialOffer();e&&(c=E3(e.offer,e.offerId))}if(r?.aborted)throw j2.cancelled(`Connection aborted`);if(!a&&i.shouldFailOnV1Path)throw i.shouldFailOnV1Path=!1,j2.serviceNotFound(`Simulated v1 path failure`,`v0-rtc`);let l=yield i.client.join(e,t,n,r,a,c);i._isClosed=!1,i.latestJoinResponse=l,i.participantSid=l.participant?.sid,i.subscriberPrimary=l.subscriberPrimary,s?(o=i.pcManager)==null||o.updateConfiguration(i.makeRTCConfiguration(l)):(i.pcManager||(yield i.configure(l,!a),a||i.applyInitialPublisherLayout()),(!i.subscriberPrimary||l.fastPublish)&&i.negotiate().catch(e=>{i.log.error(e)})),i.registerOnLineListener(),i.clientConfiguration=l.clientConfiguration,i.emit(Z.SignalConnected,l);let u=l.serverInfo;return u||={version:l.serverVersion,region:l.serverRegion},i.log.info(`connected to Livekit Server ${Object.entries(u).map(e=>{let t=hZ(e,2);return`${t[0]}: ${t[1]}`}).join(`, `)}`),{joinResponse:l,serverInfo:u}}catch(o){if(o instanceof j2){if(o.reason===A2.ServerUnreachable){if(i.log.warn(`Couldn't connect to server, attempt ${i.joinAttempts} of ${i.maxJoinAttempts}`),i.joinAttempts<i.maxJoinAttempts)return i.join(e,t,n,r,a)}else if(o.reason===A2.ServiceNotFound)return i.log.warn(`Initial connection failed: ${o.message} â Retrying`),i.pcManager&&(i.pcManager.onStateChange=void 0,yield i.cleanupPeerConnections()),i.join(e,t,n,r,!0)}throw o}}()})}close(){return J(this,void 0,void 0,function*(){let e=yield this.closingLock.lock();if(this.isClosed){e();return}try{this._isClosed=!0,this.joinAttempts=0,this.emit(Z.Closing),this.removeAllListeners(),this.deregisterOnLineListener(),this.clearPendingReconnect(),this.cleanupLossyDataStats(),yield this.cleanupPeerConnections(),yield this.cleanupClient()}finally{e()}})}cleanupPeerConnections(){return J(this,void 0,void 0,function*(){let e=e=>{e&&(e.onbufferedamountlow=null,e.onclose=null,e.onclosing=null,e.onerror=null,e.onmessage=null,e.onopen=null,e.close())};e(this.lossyDC),e(this.lossyDCSub),e(this.reliableDC),e(this.reliableDCSub),e(this.dataTrackDC),e(this.dataTrackDCSub),yield this.pcManager?.close(),this.pcManager=void 0,this.lossyDC=void 0,this.lossyDCSub=void 0,this.reliableDC=void 0,this.reliableDCSub=void 0,this.dataTrackDC=void 0,this.dataTrackDCSub=void 0,this.reliableMessageBuffer=new D3,this.reliableDataSequence=1,this.reliableReceivedState.clear()})}cleanupLossyDataStats(){this.lossyDataStatByterate=0,this.lossyDataStatCurrentBytes=0,this.lossyDataStatInterval&&=(clearInterval(this.lossyDataStatInterval),void 0),this.lossyDataDropCount=0}cleanupClient(){return J(this,void 0,void 0,function*(){yield this.client.close(),this.client.resetCallbacks();for(let e of Object.keys(this.pendingTrackResolvers))this.pendingTrackResolvers[e].reject();this.pendingTrackResolvers={}})}addTrack(e){if(this.pendingTrackResolvers[e.cid])throw new N2(`a track with the same ID has already been published`);return new Promise((t,n)=>{let r=setTimeout(()=>{delete this.pendingTrackResolvers[e.cid],n(j2.timeout(`publication of local track timed out, no response from server`))},1e4);this.pendingTrackResolvers[e.cid]={resolve:e=>{clearTimeout(r),t(e)},reject:()=>{clearTimeout(r),n(Error(`Cancelled publication by calling unpublish`))}},this.client.sendAddTrack(e)})}removeTrack(e){if(e.track&&this.pendingTrackResolvers[e.track.id]){let t=this.pendingTrackResolvers[e.track.id].reject;t&&t(),delete this.pendingTrackResolvers[e.track.id]}try{return this.pcManager.removeTrack(e),!0}catch(e){this.log.warn(`failed to remove track`,{error:e})}return!1}updateMuteStatus(e,t){this.client.sendMuteTrack(e,t)}get dataSubscriberReadyState(){return this.reliableDCSub?.readyState}getConnectedServerAddress(){return J(this,void 0,void 0,function*(){return this.pcManager?.getConnectedAddress()})}setRegionStrategy(e){this.regionStrategy=e}configure(e,t){return J(this,void 0,void 0,function*(){if(!(this.pcManager&&this.pcManager.currentState!==q3.NEW)){if(e){this.participantSid=e.participant?.sid;let n=this.makeRTCConfiguration(e);this.pcManager=new J3(t?`publisher-only`:e.subscriberPrimary?`subscriber-primary`:`publisher-primary`,this.loggerOptions,n)}else{let e=this.makeRTCConfiguration();this.pcManager=new J3(`publisher-only`,this.loggerOptions,e)}this.emit(Z.TransportsCreated,this.pcManager.publisher,this.pcManager.subscriber),this.pcManager.onIceCandidate=(e,t)=>{this.client.sendIceCandidate(e,t)},this.pcManager.onPublisherOffer=(e,t)=>{this.client.sendOffer(e,t)},this.pcManager.onDataChannel=this.handleDataChannel,this.pcManager.onStateChange=(e,t,n)=>J(this,void 0,void 0,function*(){if(this.log.debug(`primary PC state changed ${e}`),[`closed`,`disconnected`,`failed`].includes(t)&&(this.publisherConnectionPromise=void 0),e===q3.CONNECTED){let e=this.pcState===p6.New;this.pcState=p6.Connected,e&&this.emit(Z.Connected,this.latestJoinResponse)}else e===q3.FAILED&&(this.pcState===p6.Connected||this.pcState===p6.Reconnecting)&&(this.pcState=p6.Disconnected,this.handleDisconnect(`peerconnection failed`,n===`failed`?WQ.RR_SUBSCRIBER_FAILED:WQ.RR_PUBLISHER_FAILED));let r=this.client.isDisconnected||this.client.currentState===w3.RECONNECTING,i=[q3.FAILED,q3.CLOSING,q3.CLOSED].includes(e);r&&i&&!this._isClosed&&this.emit(Z.Offline)}),this.pcManager.onTrack=e=>{e.streams.length!==0&&this.emit(Z.MediaTrackAdded,e.track,e.streams[0],e.receiver)}}})}setupSignalClientCallbacks(){this.client.onAnswer=(e,t,n)=>J(this,void 0,void 0,function*(){this.pcManager&&(this.log.debug(`received server answer`,{RTCSdpType:e.type,sdp:e.sdp,midToTrackId:n}),this.midToTrackId=n,yield this.pcManager.setPublisherAnswer(e,t))}),this.client.onTrickle=(e,t)=>{this.pcManager&&(this.log.debug(`got ICE candidate from peer`,{candidate:e,target:t}),this.pcManager.addIceCandidate(e,t))},this.client.onOffer=(e,t,n)=>J(this,void 0,void 0,function*(){if(this.latestRemoteOfferId=t,!this.pcManager)return;this.midToTrackId=n;let r=yield this.pcManager.createSubscriberAnswerFromOffer(e,t);r&&this.client.sendAnswer(r,t)}),this.client.onLocalTrackPublished=e=>{if(this.log.debug(`received trackPublishedResponse`,{cid:e.cid,track:e.track?.sid}),!this.pendingTrackResolvers[e.cid]){this.log.error(`missing track resolver for ${e.cid}`,{cid:e.cid});return}let t=this.pendingTrackResolvers[e.cid].resolve;delete this.pendingTrackResolvers[e.cid],t(e.track)},this.client.onLocalTrackUnpublished=e=>{this.emit(Z.LocalTrackUnpublished,e)},this.client.onLocalTrackSubscribed=e=>{this.emit(Z.LocalTrackSubscribed,e)},this.client.onTokenRefresh=e=>{this.token=e,this.emit(Z.TokenRefreshed,e)},this.client.onRemoteMuteChanged=(e,t)=>{this.emit(Z.RemoteMute,e,t)},this.client.onSubscribedQualityUpdate=e=>{this.emit(Z.SubscribedQualityUpdate,e)},this.client.onRoomMoved=e=>{this.participantSid=e.participant?.sid,this.latestJoinResponse&&(this.latestJoinResponse.room=e.room),this.emit(Z.RoomMoved,e)},this.client.onMediaSectionsRequirement=e=>{this.addMediaSections(e.numAudios,e.numVideos),this.negotiate()},this.client.onPublishDataTrackResponse=e=>{this.emit(Z.PublishDataTrackResponse,e)},this.client.onUnPublishDataTrackResponse=e=>{this.emit(Z.UnPublishDataTrackResponse,e)},this.client.onDataTrackSubscriberHandles=e=>{this.emit(Z.DataTrackSubscriberHandles,e)},this.client.onClose=()=>{this.handleDisconnect(`signal`,WQ.RR_SIGNAL_DISCONNECTED)},this.client.onLeave=e=>{switch(this.log.info(`client leave request received (action=${e?.action})`,{reason:e?.reason}),e.regions&&(this.log.debug(`updating regions`),this.emit(Z.ServerRegionsReported,e.regions)),e.action){case m1.DISCONNECT:this.emit(Z.Disconnected,e?.reason),this.close();break;case m1.RECONNECT:this.fullReconnectOnNext=!0,this.handleDisconnect(f6);break;case m1.RESUME:this.handleDisconnect(f6)}}}makeRTCConfiguration(e){let t=Object.assign({},this.rtcConfig);if((this.signalOpts?.e2eeEnabled||this.frameMetadataWorker&&!t3())&&e3()&&(this.log.debug(`E2EE - setting up transports with insertable streams`),t.encodedInsertableStreams=!0),t.sdpSemantics=`unified-plan`,t.continualGatheringPolicy=`gather_continually`,!e)return t;if(e.iceServers&&!t.iceServers){let n=[];e.iceServers.forEach(e=>{let t={urls:e.urls};e.username&&(t.username=e.username),e.credential&&(t.credential=e.credential),n.push(t)}),t.iceServers=n}return e.clientConfiguration&&e.clientConfiguration.forceRelay===HQ.ENABLED&&(t.iceTransportPolicy=`relay`),t}applyInitialPublisherLayout(){this.createDataChannels(),b4()||this.addMediaSections(Xue,Zue)}addMediaSections(e,t){var n,r;let i={direction:`recvonly`};for(let t=0;t<e;t++)(n=this.pcManager)==null||n.addPublisherTransceiverOfKind(`audio`,i);for(let e=0;e<t;e++)(r=this.pcManager)==null||r.addPublisherTransceiverOfKind(`video`,i)}createDataChannels(){this.pcManager&&(this.lossyDC&&(this.lossyDC.onmessage=null,this.lossyDC.onerror=null,this.lossyDC.onclose
244=null),this.reliableDC&&(this.reliableDC.onmessage=null,this.reliableDC.onerror=null,this.reliableDC.onclose=null),this.dataTrackDC&&(this.dataTrackDC.onmessage=null,this.dataTrackDC.onerror=null,this.dataTrackDC.onclose=null),this.lossyDC=this.pcManager.createPublisherDataChannel(l6,{ordered:!1,maxRetransmits:0}),this.reliableDC=this.pcManager.createPublisherDataChannel(u6,{ordered:!0}),this.dataTrackDC=this.pcManager.createPublisherDataChannel(d6,{ordered:!1,maxRetransmits:0}),this.lossyDC.onmessage=this.handleDataMessage,this.reliableDC.onmessage=this.handleDataMessage,this.dataTrackDC.onmessage=this.handleDataTrackMessage,this.lossyDC.onerror=this.handleDataError,this.reliableDC.onerror=this.handleDataError,this.dataTrackDC.onerror=this.handleDataError,this.lossyDC.onclose=this.handleDataChannelClose(m6.LOSSY),this.reliableDC.onclose=this.handleDataChannelClose(m6.RELIABLE),this.dataTrackDC.onclose=this.handleDataChannelClose(m6.DATA_TRACK_LOSSY),this.lossyDC.bufferedAmountLowThreshold=65535,this.reliableDC.bufferedAmountLowThreshold=65535,this.dataTrackDC.bufferedAmountLowThreshold=65535,this.lossyDC.onbufferedamountlow=()=>this.handleBufferedAmountLow(m6.LOSSY),this.reliableDC.onbufferedamountlow=()=>this.handleBufferedAmountLow(m6.RELIABLE),this.dataTrackDC.onbufferedamountlow=()=>this.handleBufferedAmountLow(m6.DATA_TRACK_LOSSY),this.cleanupLossyDataStats(),this.lossyDataStatInterval=setInterval(()=>{this.lossyDataStatByterate=this.lossyDataStatCurrentBytes,this.lossyDataStatCurrentBytes=0;let e=this.dataChannelForKind(m6.LOSSY);if(e){let t=this.lossyDataStatByterate/10;e.bufferedAmountLowThreshold=Math.min(Math.max(t,Jue),Yue)}},1e3))}createSender(e,t,n){return J(this,void 0,void 0,function*(){let r;if(u4())r=yield this.createTransceiverRTCRtpSender(e,t,n);else if(d4())this.log.warn(`using add-track fallback`),r=yield this.createRTCRtpSender(e.mediaStreamTrack);else throw new P2(`Required webRTC APIs not supported on this device`);return this.setupFrameMetadataSender(r,t),r})}createSimulcastSender(e,t,n,r){return J(this,void 0,void 0,function*(){let i;if(u4())i=yield this.createSimulcastTransceiverSender(e,t,n,r);else if(d4())this.log.debug(`using add-track fallback`),i=yield this.createRTCRtpSender(e.mediaStreamTrack);else throw new P2(`Cannot stream on this device`);return i&&this.setupFrameMetadataSender(i,n),i})}get frameMetadataWorker(){return(this.options.frameMetadata??this.options.packetTrailer)?.worker}setupFrameMetadataSender(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=this.frameMetadataWorker;if(!n||this.signalOpts?.e2eeEnabled)return;let r=t.frameMetadata??t.packetTrailer,i=r3(r);if(t3()){i&&(e.transform=new RTCRtpScriptTransform(n,{kind:`encode`,packetTrailer:r}));return}if(!n3(this.options.frameMetadata??this.options.packetTrailer)||!(`createEncodedStreams`in e)){i&&this.log.warn(`frame metadata transform not supported; skipping write`,this.logContext);return}let a=e.createEncodedStreams(),o=a.readable,s=a.writable;i?n.postMessage({kind:`encode`,data:{readableStream:o,writableStream:s,packetTrailer:r}},[o,s]):o.pipeTo(s)}createTransceiverRTCRtpSender(e,t,n){return J(this,void 0,void 0,function*(){if(!this.pcManager)throw new P2(`publisher is closed`);let r=[];e.mediaStream&&r.push(e.mediaStream),H4(e)&&(e.codec=t.videoCodec);let i={direction:`sendonly`,streams:r};return n&&(i.sendEncodings=n),(yield this.pcManager.addPublisherTransceiver(e.mediaStreamTrack,i)).sender})}createSimulcastTransceiverSender(e,t,n,r){return J(this,void 0,void 0,function*(){if(!this.pcManager)throw new P2(`publisher is closed`);let i={direction:`sendonly`};r&&(i.sendEncodings=r);let a=yield this.pcManager.addPublisherTransceiver(t.mediaStreamTrack,i);if(n.videoCodec)return e.setSimulcastTrackSender(n.videoCodec,a.sender),a.sender})}createRTCRtpSender(e){return J(this,void 0,void 0,function*(){if(!this.pcManager)throw new P2(`publisher is closed`);return this.pcManager.addPublisherTrack(e)})}attemptReconnect(e){return J(this,void 0,void 0,function*(){if(!this._isClosed){if(this.attemptingReconnect){this.log.warn(`already attempting reconnect, returning early`);return}(this.clientConfiguration?.resumeConnection===HQ.DISABLED||(this.pcManager?.currentState??q3.NEW)===q3.NEW)&&(this.fullReconnectOnNext=!0);try{this.attemptingReconnect=!0,this.fullReconnectOnNext?yield this.restartConnection():yield this.resumeConnection(e),this.clearPendingReconnect(),this.fullReconnectOnNext=!1}catch(e){this.reconnectAttempts+=1;let t=!0;
vendor: 2,490 bytes, line 244
244e instanceof P2?(this.log.debug(`received unrecoverable error`,{error:e}),t=!1):e instanceof B2||(this.fullReconnectOnNext=!0),t?this.handleDisconnect(`reconnect`,WQ.RR_UNKNOWN):(this.log.info(`could not recover connection after ${this.reconnectAttempts} attempts, ${Date.now()-this.reconnectStart}ms. giving up`),this.emit(Z.Disconnected),yield this.close())}finally{this.attemptingReconnect=!1}}})}getNextRetryDelay(e){try{return this.reconnectPolicy.nextRetryDelayInMs(e)}catch(e){this.log.warn(`encountered error in reconnect policy`,{error:e})}return null}restartConnection(e){return J(this,void 0,void 0,function*(){var t,n;try{if(!this.url||!this.token)throw new P2(`could not reconnect, url or token not saved`);this.log.info(`reconnecting, attempt: ${this.reconnectAttempts}`),this.emit(Z.Restarting),this.client.isDisconnected||(yield this.client.sendLeave()),yield this.cleanupPeerConnections(),yield this.cleanupClient();let n;try{if(!this.signalOpts)throw this.log.warn(`attempted connection restart, without signal options present`),new B2;n=(yield this.join(e??this.url,this.token,this.signalOpts,void 0,!this.options.singlePeerConnection)).joinResponse}catch(e){throw e instanceof j2&&e.reason===A2.NotAllowed?new P2(`could not reconnect, token might be expired`):new B2}if(this.shouldFailNext)throw this.shouldFailNext=!1,Error(`simulated failure`);if(this.client.setReconnected(),this.emit(Z.SignalRestarted,n),yield this.waitForPCReconnected(),this.client.currentState!==w3.CONNECTED)throw new B2(`Signal connection got severed during reconnect`);(t=this.regionStrategy)==null||t.resetAttempts(),this.emit(Z.Restarted)}catch(e){let t=yield this.regionStrategy?.getNextUrl();if(t){yield this.restartConnection(t);return}else throw(n=this.regionStrategy)==null||n.resetAttempts(),e}})}resumeConnection(e){return J(this,void 0,void 0,function*(){if(!this.url||!this.token)throw new P2(`could not reconnect, url or token not saved`);if(!this.pcManager)throw new P2(`publisher and subscriber connections unset`);this.log.info(`resuming signal connection, attempt ${this.reconnectAttempts}`),this.emit(Z.Resuming);let t;try{this.setupSignalClientCallbacks(),t=yield this.client.reconnect(this.url,this.token,this.participantSid,e)}catch(e){let t=``;throw e instanceof Error&&(t=e.message,this.log.error(e.message,{error:e})),e instanceof j2&&e.reason===A2.NotAllowed?new P2(`could not reconnect, token might be expired`):e instanceof j2&&e.reason===A2.LeaveRequest?e:new B2(t)}
244if(this.emit(Z.SignalResumed),t){let e=this.makeRTCConfiguration(t);this.pcManager.updateConfiguration(e),this.latestJoinResponse&&(this.latestJoinResponse.serverInfo=t.serverInfo)}else this.log.warn(`Did not receive reconnect response`);if(this.shouldFailNext)throw this.shouldFailNext=!1,Error(`simulated failure`);if(yield this.pcManager.triggerIceRestart(),yield this.waitForPCReconnected(),this.client.currentState!==w3.CONNECTED)throw new B2(`Signal connection got severed during reconnect`);this.client.setReconnected(),this.reliableDC?.readyState===`open`&&this.reliableDC.id===null&&this.createDataChannels(),t?.lastMessageSeq&&this.resendReliableMessagesForResume(t.lastMessageSeq),this.emit(Z.Resumed)})}waitForPCInitialConnection(e,t){return J(this,void 0,void 0,function*(){if(!this.pcManager)throw new P2(`PC manager is closed`);yield this.pcManager.ensurePCTransportConnection(t,e)})}waitForPCReconnected(){return J(this,void 0,void 0,function*(){this.pcState=p6.Reconnecting,this.log.debug(`waiting for peer connection to reconnect`);try{if(yield l4(Kue),!this.pcManager)throw new P2(`PC manager is closed`);yield this.pcManager.ensurePCTransportConnection(void 0,this.peerConnectionTimeout),this.pcState=p6.Connected}catch(e){throw this.pcState=p6.Disconnected,j2.internal(`could not establish PC connection, ${e.message}`)}})}publishRpcAck(e,t){return J(this,void 0,void 0,function*(){let n=new c$({destinationIdentities:[e],kind:l$.RELIABLE,value:{case:`rpcAck`,value:new b$({requestId:t})}});yield this.sendDataPacket(n,m6.RELIABLE)})}sendDataPacket(e,t){return J(this,void 0,void 0,function*(){if(yield this.ensurePublisherConnected(t),this.e2eeManager&&this.e2eeManager.isDataChannelEncryptionEnabled){let t=$le(e);if(t){let n=yield this.e2eeManager.encryptData(t.toBinary());e.value={case:`encryptedPacket`,value:new u$({encryptedValue:n.payload,iv:n.iv,keyIndex:n.keyIndex})}}}t===m6.RELIABLE&&(e.sequence=this.reliableDataSequence,this.reliableDataSequence+=1);let n=e.toBinary(),r=Math.min(this.pcManager?.getMaxPublisherMessageSize()??h6,h6);if(r!==void 0&&r!==0&&n.byteLength>r)throw new cle(`cannot publish data packet larger than ${r} bytes (got ${n.byteLength})`);switch(t){case m6.LOSSY:case m6.DATA_TRACK_LOSSY:return this.sendLossyBytes(n,t);case m6.RELIABLE:let r=this.dataChannelForKind(t);if(r){if(yield this.waitForBufferStatusLow(t),this.reliableMessageBuffer.push({data:n,sequence:e.sequence}),this.attemptingReconnect)return;r.send(n)}this.updateAndEmitDCBufferStatus(t);break}})}sendLossyBytes(e,t){return J(this,arguments,void 0,function(e,t){var n=this;let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:`drop`;return function*(){yield n.ensurePublisherConnected(t);let i=n.dataChannelForKind(t);if(i){if(!n.isBufferStatusLow(t))switch(r){case`wait`:yield n.waitForBufferStatusLow(t);break;case`drop`:n.lossyDataDropCount+=1,n.lossyDataDropCount%100==0&&n.log.warn(`dropping lossy data channel messages, total dropped: ${n.lossyDataDropCount}`);return}if(n.lossyDataStatCurrentBytes+=e.byteLength,n.attemptingReconnect)return;i.send(e)}n.updateAndEmitDCBufferStatus(t)}()})}resendReliableMessagesForResume(e){return J(this,void 0,void 0,function*(){yield this.ensurePublisherConnected(m6.RELIABLE);let t=this.dataChannelForKind(m6.RELIABLE);t&&(this.reliableMessageBuffer.popToSequence(e),this.reliableMessageBuffer.getAll().forEach(e=>{t.send(e.data)})),this.updateAndEmitDCBufferStatus(m6.RELIABLE)})}waitForBufferStatusLow(e){return J(this,void 0,void 0,function*(){return new C2((t,n)=>J(this,void 0,void 0,function*(){if(this.isClosed&&n(new P2(`engine closed`)),this.isBufferStatusLow(e))t();else{let r=this.dataChannelForKind(e);if(!r){n(new P2(`DataChannel not found, kind: ${e}`));return}this.bufferStatusLowClosingFuture.promise.catch(e=>n(e)),r.addEventListener(`bufferedamountlow`,()=>t(),{once:!0})}}))})}ensureDataTransportConnected(e){return J(this,arguments,void 0,function(e){var t=this;let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.subscriberPrimary;return function*(){if(!t.pcManager)throw new P2(`PC manager is closed`);let r=n?t.pcManager.subscriber:t.pcManager.publisher,i=n?`Subscriber`:`Publisher`;if(!r)throw j2.internal(`${i} connection not set`);let a=!1;
vendor: 5,594 bytes, line 244
244if(!n&&!t.dataChannelForKind(e,n)&&(t.createDataChannels(),a=!0),!a&&!n&&!t.pcManager.publisher.isICEConnected&&t.pcManager.publisher.getICEConnectionState()!==`checking`&&(a=!0),a&&t.negotiate().catch(e=>{t.log.error(e)}),t.dataChannelForKind(e,n)?.readyState===`open`)return;let o=new Date().getTime()+t.peerConnectionTimeout;for(;new Date().getTime()<o;){if(r.isICEConnected&&t.dataChannelForKind(e,n)?.readyState===`open`)return;yield l4(50)}throw j2.internal(`could not establish ${i} connection, state: ${r.getICEConnectionState()}`)}()})}ensurePublisherConnected(e){return J(this,void 0,void 0,function*(){this.publisherConnectionPromise||=this.ensureDataTransportConnected(e,!1),yield this.publisherConnectionPromise})}verifyTransport(){return!(!this.pcManager||![q3.CONNECTING,q3.CONNECTED].includes(this.pcManager.currentState)||!this.client.ws||this.client.ws.readyState===WebSocket.CLOSED)}negotiate(){return J(this,void 0,void 0,function*(){return new C2((e,t)=>J(this,void 0,void 0,function*(){if(!this.pcManager){t(new F2(`PC manager is closed`));return}this.pcManager.requirePublisher(),this.pcManager.publisher.getTransceivers().length==0&&!this.lossyDC&&!this.reliableDC&&!this.dataTrackDC&&this.createDataChannels();let n=new AbortController,r=()=>{n.abort(),this.log.debug(`engine disconnected while negotiation was ongoing`),e()};this.isClosed&&t(new F2(`cannot negotiate on closed engine`)),this.on(Z.Closing,r),this.on(Z.Restarting,r),this.pcManager.publisher.off(R3.RTPVideoPayloadTypes,this.onRtpMapAvailable),this.pcManager.publisher.once(R3.RTPVideoPayloadTypes,this.onRtpMapAvailable);try{yield this.pcManager.negotiate(n),e()}catch(r){if(n.signal.aborted){e();return}r instanceof F2&&(this.fullReconnectOnNext=!0),this.handleDisconnect(`negotiation`,WQ.RR_UNKNOWN),r instanceof Error?t(r):t(Error(String(r)))}finally{this.off(Z.Closing,r),this.off(Z.Restarting,r)}}))})}dataChannelForKind(e,t){switch(e){case m6.RELIABLE:return t?this.reliableDCSub:this.reliableDC;case m6.LOSSY:return t?this.lossyDCSub:this.lossyDC;case m6.DATA_TRACK_LOSSY:return t?this.dataTrackDCSub:this.dataTrackDC}}sendSyncState(e,t,n){if(!this.pcManager){this.log.warn(`sync state cannot be sent without peer connection setup`);return}let r=this.pcManager.publisher.getLocalDescription(),i=this.pcManager.publisher.getRemoteDescription(),a=this.pcManager.subscriber?.getRemoteDescription(),o=this.pcManager.subscriber?.getLocalDescription(),s=this.signalOpts?.autoSubscribe??!0,c=[],l=[];e.forEach(e=>{e.isDesired!==s&&c.push(e.trackSid),e.isEnabled||l.push(e.trackSid)}),this.client.sendSyncState(new M1({answer:this.pcManager.mode===`publisher-only`?i?E3({sdp:i.sdp,type:i.type}):void 0:o?E3({sdp:o.sdp,type:o.type}):void 0,offer:this.pcManager.mode===`publisher-only`?r?E3({sdp:r.sdp,type:r.type}):void 0:a?E3({sdp:a.sdp,type:a.type}):void 0,subscription:new s1({trackSids:c,subscribe:!s,participantTracks:[]}),publishTracks:_le(t),dataChannels:this.dataChannelsInfo(),trackSidsDisabled:l,datachannelReceiveStates:this.reliableReceivedState.map((e,t)=>new N1({publisherSid:t,lastSeq:e})),publishDataTracks:n.map(e=>new J$({info:S3.toProtobuf(e)}))}))}failNext(){this.shouldFailNext=!0}failNextV1Path(){this.shouldFailOnV1Path=!0}dataChannelsInfo(){let e=[],t=(t,n)=>{t?.id!==void 0&&t.id!==null&&e.push(new P1({label:t.label,id:t.id,target:n}))};return t(this.dataChannelForKind(m6.LOSSY),B$.PUBLISHER),t(this.dataChannelForKind(m6.RELIABLE),B$.PUBLISHER),t(this.dataChannelForKind(m6.LOSSY,!0),B$.SUBSCRIBER),t(this.dataChannelForKind(m6.RELIABLE,!0),B$.SUBSCRIBER),e}clearReconnectTimeout(){this.reconnectTimeout&&H2.clearTimeout(this.reconnectTimeout)}clearPendingReconnect(){this.clearReconnectTimeout(),this.reconnectAttempts=0}registerOnLineListener(){y4()&&(window.addEventListener(`online`,this.handleBrowserOnLine),window.addEventListener(`offline`,this.handleBrowserOffline))}deregisterOnLineListener(){y4()&&(window.removeEventListener(`online`,this.handleBrowserOnLine),window.removeEventListener(`offline`,this.handleBrowserOffline))}getTrackIdForReceiver(e){let t=this.pcManager?.getMidForReceiver(e);if(t){let e=Object.entries(this.midToTrackId).find(e=>hZ(e,1)[0]===t);if(e)return e[1]}}};function g6(e,t){let n=e.participantIdentity?e.participantIdentity:t.participantIdentity;e.participantIdentity=n,t.participantIdentity=n;let r=e.destinationIdentities.length===0?t.destinationIdentities:e.destinationIdentities;e.destinationIdentities=r,t.destinationIdentities=r}var _6=5e3,$ue=3e4,v6=class e{static fetchRegionSettings(t,n,r){return J(this,void 0,void 0,function*(){let i=yield e.fetchLock.lock();try{let e=yield fetch(`${ede(t)}/regions`,{headers:{authorization:`Bearer ${n}`},signal:r});if(e.ok){let t=Ule(e.headers),n=t?t*1e3:_6;return{regionSettings:yield e.json(),updatedAtInMs:Date.now(),maxAgeInMs:n}}else if(e.status===401)throw j2.notAllowed(`Could not fetch region settings: ${e.statusText}`,e.status);else throw j2.internal(`Could not fetch region settings: ${e.statusText}`)}catch(e){throw e instanceof j2?e:r?.aborted?j2.cancelled(`Region fetching was aborted`):j2.serverUnreachable(`Could not fetch region settings, ${e instanceof Error?`${e.name}: ${e.message}`:e}`)}finally{i()}})}static scheduleRefetch(t,n,r){return J(this,void 0,void 0,function*(){let i=e.settingsTimeouts.get(t.hostname);clearTimeout(i),e.settingsTimeouts.set(t.hostname,setTimeout(()=>J(this,void 0,void 0,function*(){try{let r=yield e.fetchRegionSettings(t,n);e.updateCachedRegionSettings(t,n,r)}catch(i){if(i instanceof j2&&i.reason===A2.NotAllowed){r0.debug(`token is not val
244id, cancelling auto region refresh`);return}r0.debug(`auto refetching of region settings failed`,{error:i}),e.scheduleRefetch(t,n,r)}}),r))})}static updateCachedRegionSettings(t,n,r){e.cache.set(t.hostname,r),e.scheduleRefetch(t,n,r.maxAgeInMs)}static stopRefetch(t){let n=e.settingsTimeouts.get(t);n&&(clearTimeout(n),e.settingsTimeouts.delete(t))}static scheduleCleanup(t){let n=e.connectionTrackers.get(t);n&&(n.cleanupTimeout&&clearTimeout(n.cleanupTimeout),n.cleanupTimeout=setTimeout(()=>{let n=e.connectionTrackers.get(t);n&&n.connectionCount===0&&(r0.debug(`stopping region refetch after disconnect delay`,{hostname:t}),e.stopRefetch(t)),n&&(n.cleanupTimeout=void 0)},$ue))}static cancelCleanup(t){let n=e.connectionTrackers.get(t);n?.cleanupTimeout&&(clearTimeout(n.cleanupTimeout),n.cleanupTimeout=void 0)}notifyConnected(){let t=this.serverUrl.hostname,n=e.connectionTrackers.get(t);n||(n={connectionCount:0},e.connectionTrackers.set(t,n)),n.connectionCount++,e.cancelCleanup(t)}notifyDisconnected(){let t=this.serverUrl.hostname,n=e.connectionTrackers.get(t);n&&(n.connectionCount=Math.max(0,n.connectionCount-1),n.connectionCount===0&&e.scheduleCleanup(t))}constructor(e,t){this.attemptedRegions=[],this.serverUrl=new URL(e),this.token=t}updateToken(t){this.token=t;let n=this.getServerUrl(),r=e.cache.get(n.hostname);e.scheduleRefetch(this.serverUrl,this.token,r?.maxAgeInMs??_6)}isCloud(){return x4(this.serverUrl)}getServerUrl(){return this.serverUrl}fetchRegionSettings(t){return J(this,void 0,void 0,function*(){return e.fetchRegionSettings(this.serverUrl,this.token,t)})}getNextBestRegionUrl(t){return J(this,void 0,void 0,function*(){if(!this.isCloud())throw Error(`region availability is only supported for LiveKit Cloud domains`);let n=e.cache.get(this.serverUrl.hostname);(!n||Date.now()-n.updatedAtInMs>n.maxAgeInMs)&&(n=yield this.fetchRegionSettings(t),e.updateCachedRegionSettings(this.serverUrl,this.token,n));let r=n.regionSettings.regions.filter(e=>!this.attemptedRegions.find(t=>t.url===e.url));if(r.length>0){let e=r[0];return this.attemptedRegions.push(e),r0.debug(`next region: ${e.region}`),e.url}else return null})}resetAttempts(){this.attemptedRegions=[]}setServerReportedRegions(t){e.updateCachedRegionSettings(this.serverUrl,this.token,t)}};v6.cache=new Map,v6.settingsTimeouts=new Map,v6.connectionTrackers=new Map,v6.fetchLock=new OX;function ede(e){return`${e.protocol.replace(`ws`,`http`)}//${e.host}/settings`}var y6=class{get info(){return this._info}validateBytesReceived(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;if(!(typeof this.totalByteSize!=`number`||this.totalByteSize===0)){if(e&&this.bytesReceived<this.totalByteSize)throw new z2(`Not enough chunk(s) received - expected ${this.totalByteSize} bytes of data total, only received ${this.bytesReceived} bytes`,R2.Incomplete);if(this.bytesReceived>this.totalByteSize)throw new z2(`Extra chunk(s) received - expected ${this.totalByteSize} bytes of data total, received ${this.bytesReceived} bytes`,R2.LengthExceeded)}}constructor(e,t,n){this.reader=t,this.totalByteSize=n,this._info=e,this.bytesReceived=0}},tde=class extends y6{handleChunkReceived(e){var t;this.bytesReceived+=e.content.byteLength,this.validateBytesReceived();let n=this.totalByteSize?this.bytesReceived/this.totalByteSize:void 0;(t=this.onProgress)==null||t.call(this,n)}[Symbol.asyncIterator](){let e=this.reader.getReader();e.closed.catch(()=>{});let t=()=>{e.releaseLock(),this.signal=void 0};return{next:()=>J(this,void 0,void 0,function*(){try{let t=this.signal;if(t?.aborted)throw t.reason;let n=yield new Promise((n,r)=>{if(t){let i=()=>r(t.reason);t.addEventListener(`abort`,i,{once:!0}),e.read().then(n,r).finally(()=>{t.removeEventListener(`abort`,i)})}else e.read().then(n,r)});return n.done?(this.validateBytesReceived(!0),{done:!0,value:void 0}):(this.handleChunkReceived(n.value),{done:!1,value:n.value.content})}catch(e){throw t(),e}}),return(){return J(this,void 0,void 0,function*(){return t(),{done:!0,value:void 0}})}}}withAbortSignal(e){return this.signal=e,this}readAll(){return J(this,arguments,void 0,function(){var e=this;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return function*(){var n,r,i,a;let o=new Set,s=t.signal?e.withAbortSignal(t.signal):e;try{for(var c=!0,l=h0(s),u;u=yield l.next(),n=u.done,!n;c=!0){a=u.value,c=!1;let e=a;o.add(e)}}catch(e){r={error:e}}finally{try{!c&&!n&&(i=l.return)&&(yield i.call(l))}finally{if(r)throw r.error}}return Array.from(o)}()})}},nde=class extends y6{constructor(e,t,n){super(e,t,n),this.receivedChunks=new Map}handleChunkReceived(e){var t;let n=R4(e.chunkIndex),r=this.receivedChunks.get(n);if(r&&r.version>e.version)return;this.receivedChunks.set(n,e),this.bytesReceived+=e.content.byteLength,this.validateBytesReceived();let i=this.totalByteSize?this.bytesReceived/this.totalByteSize:void 0;(t=this.onProgress)==null||t.call(this,i)}[Symbol.asyncIterator](){let e=this.reader.getReader();e.closed.catch(()=>{});let t=new TextDecoder(`utf-8`,{fatal:!0}),n=this.signal,r=()=>{e.releaseLock(),this.signal=void 0};return{next:()=>J(this,void 0,void 0,function*(){try{if(n?.aborted)throw n.reason;let r=yield new Promise((t,r)=>{if(n){let i=()=>r(n.reason);n.addEventListener(`abort`,i,{once:!0}),e.read().then(t,r).finally(()=>{n.removeEventListener(`abort`,i)})}else e.read().then(t,r)}
244);if(r.done)return this.validateBytesReceived(!0),{done:!0,value:void 0};{this.handleChunkReceived(r.value);let e;try{e=t.decode(r.value.content)}catch(e){throw new z2(`Cannot decode datastream chunk ${r.value.chunkIndex} as text: ${e}`,R2.DecodeFailed)}return{done:!1,value:e}}}catch(e){throw r(),e}}),return(){return J(this,void 0,void 0,function*(){return r(),{done:!0,value:void 0}})}}}withAbortSignal(e){return this.signal=e,this}readAll(){return J(this,arguments,void 0,function(){var e=this;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return function*(){var n,r,i,a;let o=``,s=t.signal?e.withAbortSignal(t.signal):e;try{for(var c=!0,l=h0(s),u;u=yield l.next(),n=u.done,!n;c=!0)a=u.value,c=!1,o+=a}catch(e){r={error:e}}finally{try{!c&&!n&&(i=l.return)&&(yield i.call(l))}finally{if(r)throw r.error}}return o}()})}},rde=class{constructor(){this.log=r0,this.byteStreamControllers=new Map,this.textStreamControllers=new Map,this.byteStreamHandlers=new Map,this.textStreamHandlers=new Map,this.isConnected=!1,this.bufferedPackets=[]}setConnected(e){this.isConnected=e,e&&this.flushBufferedPackets()}flushBufferedPackets(){let e=this.bufferedPackets;this.bufferedPackets=[];for(let t of e){let e=t.packet,n=t.encryptionType;this.handleDataStreamPacket(e,n)}}registerTextStreamHandler(e,t){if(this.textStreamHandlers.has(e))throw new z2(`A text stream handler for topic "${e}" has already been set.`,R2.HandlerAlreadyRegistered);this.textStreamHandlers.set(e,t)}unregisterTextStreamHandler(e){this.textStreamHandlers.delete(e)}registerByteStreamHandler(e,t){if(this.byteStreamHandlers.has(e))throw new z2(`A byte stream handler for topic "${e}" has already been set.`,R2.HandlerAlreadyRegistered);this.byteStreamHandlers.set(e,t)}unregisterByteStreamHandler(e){this.byteStreamHandlers.delete(e)}clearControllers(){this.byteStreamControllers.clear(),this.textStreamControllers.clear(),this.bufferedPackets=[]}validateParticipantHasNoActiveDataStreams(e){let t=Array.from(this.textStreamControllers.entries()).filter(t=>t[1].sendingParticipantIdentity===e),n=Array.from(this.byteStreamControllers.entries()).filter(t=>t[1].sendingParticipantIdentity===e);if(t.length>0||n.length>0){let a=new z2(`Participant ${e} unexpectedly disconnected in the middle of sending data`,R2.AbnormalEnd);for(let e of n){var r=hZ(e,2);let t=r[0];r[1].controller.error(a),this.byteStreamControllers.delete(t)}for(let e of t){var i=hZ(e,2);let t=i[0];i[1].controller.error(a),this.textStreamControllers.delete(t)}}}handleDataStreamPacket(e,t){if(!this.isConnected){this.bufferedPackets.push({packet:e,encryptionType:t});return}switch(e.value.case){case`streamHeader`:return this.handleStreamHeader(e.value.value,e.participantIdentity,t);case`streamChunk`:return this.handleStreamChunk(e.value.value,t);case`streamTrailer`:return this.handleStreamTrailer(e.value.value,t);default:throw Error(`DataPacket of value "${e.value.case}" is not data stream related!`)}}handleStreamHeader(e,t,n){if(e.contentHeader.case===`byteHeader`){let r=this.byteStreamHandlers.get(e.topic);if(!r){this.log.debug(`ignoring incoming byte stream due to no handler for topic`,e.topic);return}let i,a={id:e.streamId,name:e.contentHeader.value.name??`unknown`,mimeType:e.mimeType,size:e.totalLength?Number(e.totalLength):void 0,topic:e.topic,timestamp:R4(e.timestamp),attributes:e.attributes,encryptionType:n};r(new tde(a,new ReadableStream({start:n=>{if(i=n,this.textStreamControllers.has(e.streamId))throw new z2(`A data stream read is already in progress for a stream with id ${e.streamId}.`,R2.AlreadyOpened);this.byteStreamControllers.set(e.streamId,{info:a,controller:i,startTime:Date.now(),sendingParticipantIdentity:t})}}),R4(e.totalLength)),{identity:t})}else if(e.contentHeader.case===`textHeader`){let r=this.textStreamHandlers.get(e.topic);if(!r){this.log.debug(`ignoring incoming text stream due to no handler for topic`,e.topic);return}let i,a={id:e.streamId,mimeType:e.mimeType,size:e.totalLength?Number(e.totalLength):void 0,topic:e.topic,timestamp:Number(e.timestamp),attributes:e.attributes,encryptionType:n,attachedStreamIds:e.contentHeader.value.attachedStreamIds};r(new nde(a,new ReadableStream({start:n=>{if(i=n,this.textStreamControllers.has(e.streamId))throw new z2(`A data stream read is already in progress for a stream with i
244d ${e.streamId}.`,R2.AlreadyOpened);this.textStreamControllers.set(e.streamId,{info:a,controller:i,startTime:Date.now(),sendingParticipantIdentity:t})}}),R4(e.totalLength)),{identity:t})}}handleStreamChunk(e,t){let n=this.byteStreamControllers.get(e.streamId);n&&(n.info.encryptionType===t?e.content.length>0&&n.controller.enqueue(e):(n.controller.error(new z2(`Encryption type mismatch for stream ${e.streamId}. Expected ${t}, got ${n.info.encryptionType}`,R2.EncryptionTypeMismatch)),this.byteStreamControllers.delete(e.streamId)));let r=this.textStreamControllers.get(e.streamId);r&&(r.info.encryptionType===t?e.content.length>0&&r.controller.enqueue(e):(r.controller.error(new z2(`Encryption type mismatch for stream ${e.streamId}. Expected ${t}, got ${r.info.encryptionType}`,R2.EncryptionTypeMismatch)),this.textStreamControllers.delete(e.streamId)))}handleStreamTrailer(e,t){let n=this.textStreamControllers.get(e.streamId);n&&(n.info.encryptionType===t?(n.info.attributes=Object.assign(Object.assign({},n.info.attributes),e.attributes),n.controller.close(),this.textStreamControllers.delete(e.streamId)):n.controller.error(new z2(`Encryption type mismatch for stream ${e.streamId}. Expected ${t}, got ${n.info.encryptionType}`,R2.EncryptionTypeMismatch)));let r=this.byteStreamControllers.get(e.streamId);r&&(r.info.encryptionType===t?(r.info.attributes=Object.assign(Object.assign({},r.info.attributes),e.attributes),r.controller.close()):r.controller.error(new z2(`Encryption type mismatch for stream ${e.streamId}. Expected ${t}, got ${r.info.encryptionType}`,R2.EncryptionTypeMismatch)),this.byteStreamControllers.delete(e.streamId))}},b6=class{constructor(e,t,n){this.writableStream=e,this.defaultWriter=e.getWriter(),this.onClose=n,this.info=t}write(e){return this.defaultWriter.write(e)}close(){return J(this,void 0,void 0,function*(){var e;yield this.defaultWriter.close(),this.defaultWriter.releaseLock(),(e=this.onClose)==null||e.call(this)})}},ide=class extends b6{},ade=class extends b6{},x6=15e3,ode=class{constructor(e,t){this.engine=e,this.log=t}setupEngine(e){this.engine=e}sendText(e,t){return J(this,void 0,void 0,function*(){let n=crypto.randomUUID(),r=new TextEncoder().encode(e).byteLength,i=(t?.attachments)?.map(()=>crypto.randomUUID()),a=Array(i?i.length+1:1).fill(0),o=(e,n)=>{var r;a[n]=e;let i=a.reduce((e,t)=>e+t,0);(r=t?.onProgress)==null||r.call(t,i)},s=yield this.streamText({streamId:n,totalSize:r,destinationIdentities:t?.destinationIdentities,topic:t?.topic,attachedStreamIds:i,attributes:t?.attributes});return yield s.write(e),o(1,0),yield s.close(),t?.attachments&&i&&(yield Promise.all(t.attachments.map((e,n)=>J(this,void 0,void 0,function*(){return this._sendFile(i[n],e,{topic:t.to
244pic,mimeType:e.type,onProgress:e=>{o(e,n+1)}})})))),s.info})}streamText(e){return J(this,void 0,void 0,function*(){let t=e?.streamId??crypto.randomUUID(),n={id:t,mimeType:`text/plain`,timestamp:Date.now(),topic:e?.topic??``,size:e?.totalSize,attributes:e?.attributes,encryptionType:this.engine.e2eeManager?.isDataChannelEncryptionEnabled?t$.GCM:t$.NONE,attachedStreamIds:e?.attachedStreamIds},r=new I$({streamId:t,mimeType:n.mimeType,topic:n.topic,timestamp:z4(n.timestamp),totalLength:z4(n.size),attributes:n.attributes,contentHeader:{case:`textHeader`,value:new P$({version:e?.version,attachedStreamIds:n.attachedStreamIds,replyToStreamId:e?.replyToStreamId,operationType:e?.type===`update`?N$.UPDATE:N$.CREATE})}}),i=e?.destinationIdentities,a=new c$({destinationIdentities:i,value:{case:`streamHeader`,value:r}});yield this.engine.sendDataPacket(a,m6.RELIABLE);let o=0,s=this.engine,c=new WritableStream({write(e){return J(this,void 0,void 0,function*(){for(let n of Hle(e,x6)){let e=new c$({destinationIdentities:i,value:{case:`streamChunk`,value:new L$({content:n,streamId:t,chunkIndex:z4(o)})}});yield s.sendDataPacket(e,m6.RELIABLE),o+=1}})},close(){return J(this,void 0,void 0,function*(){let e=new c$({destinationIdentities:i,value:{case:`streamTrailer`,value:new R$({streamId:t})}});yield s.sendDataPacket(e,m6.RELIABLE)})},abort(e){console.log(`Sink error:`,e)}}),l=()=>J(this,void 0,void 0,function*(){yield u.close()});s.once(Z.Closing,l);let u=new ide(c,n,()=>this.engine.off(Z.Closing,l));return u})}sendFile(e,t){return J(this,void 0,void 0,function*(){let n=crypto.randomUUID();return yield this._sendFile(n,e,t),{id:n}})}_sendFile(e,t,n){return J(this,void 0,void 0,function*(){let r=yield this.streamBytes({streamId:e,totalSize:t.size,name:t.name,mimeType:n?.mimeType??t.type,topic:n?.topic,destinationIdentities:n?.destinationIdentities}),i=t.stream().getReader();for(;;){let e=yield i.read(),t=e.done,n=e.value;if(t)break;yield r.write(n)}return yield r.close(),r.info})}streamBytes(e){return J(this,void 0,void 0,function*(){let t=e?.streamId??crypto.randomUUID(),n=e?.destinationIdentities,r={id:t,mimeType:e?.mimeType??`application/octet-stream`,topic:e?.topic??``,timestamp:Date.now(),attributes:e?.attributes,size:e?.totalSize,name:e?.name??`unknown`,encryptionType:this.engine.e2eeManager?.isDataChannelEncryptionEnabled?t$.GCM:t$.NONE},i=new c$({destinationIdentities:n,value:{case:`streamHeader`,value:new I$({totalLength:z4(r.size),mimeType:r.mimeType,streamId:t,topic:r.topic,timestamp:z4(Date.now()),attributes:r.attributes,contentHeader:{case:`byteHeader`,value:new F$({name:r.name})}})}});yield this.engine.sendDataPacket(i,m6.RELIABLE);let a=0,o=new OX,s=this.engine,c=this.log;return new ade(new WritableStream({write(e){return J(this,void 0,void 0,function*(){let r=yield o.lock(),i=0;try{for(;i<e.byteLength;){let r=e.slice(i,i+x6),o=new c$({destinationIdentities:n,value:{case:`streamChunk`,value:new L$({content:r,streamId:t,chunkIndex:z4(a)})}});yield s.sendDataPacket(o,m6.RELIABLE),a+=1,i+=r.byteLength}}finally{r()}})},close(){return J(this,void 0,void 0,function*(){let e=new c$({destinationIdentities:n,value:{case:`streamTrailer`,value:new R$({streamId:t})}});yield s.sendDataPacket(e,m6.RELIABLE)})},abort(e){c.error(`Sink error:`,e)}}),r)})}};function S6(e){if(e.length===0)return new AbortController().signal;if(e.length===1)return e[0];for(let t of e)if(t.aborted)return t;let t=new AbortController,n=Array(e.length),r=()=>{for(let e of n)e()};return e.forEach((e,i)=>{let a=()=>{t.abort(e.reason),r()};e.addEventListener(`abort`,a),n[i]=()=>e.removeEventListener(`abort`,a)}),t.signal}function C6(e){let t=new AbortController;return setTimeout(()=>{t.abort(new DOMException(`signal timed out after ${e} ms`,`TimeoutError`))},e),t.signal}var w6=1,T6=2,E6=4,sde=8,D6=0,O6=12,k6=5,cde=7,A6=3,lde=3,j6=2,M6=1,N6=0,P6=3,F6=2,I6=2,ude=1,dde=0,L6;(function(e){e[e.TooShort=0]=`TooShort`,e[e.HeaderOverrun=1]=`HeaderOverrun`,e[e.MissingExtWords=2]=`MissingExtWords`,e[e.UnsupportedVersion=3]=`UnsupportedVersion`,e[e.InvalidHandle=4]=`InvalidHandle`,e[e.MalformedExt=5]=`MalformedExt`})(L6||={});var R6=class e extends k2{constructor(e,t,n){super(19,e,n),this.name=`DataTrackDeserializeError`,this.reason=t,this.reasonName=L6[t]}static tooShort(){return new e(`Too short to contain a valid header`,L6.TooShort)}static headerOverrun(){return new e(`Header exceeds total packet length`,L6.HeaderOverrun)}static missingExtWords(){return new e(`Extension word indicator is missing`,L6.MissingExtWords)}static unsupportedVersion(t){return new e(`Unsupported version ${t}`,L6.UnsupportedVersion)}
vendor: 5,433 bytes, line 244
244static invalidHandle(t){return new e(`invalid track handle: ${t.message}`,L6.InvalidHandle,{cause:t})}static malformedExt(t){return new e(`Extension with tag ${t} is malformed`,L6.MalformedExt)}},z6;(function(e){e[e.TooSmallForHeader=0]=`TooSmallForHeader`,e[e.TooSmallForPayload=1]=`TooSmallForPayload`})(z6||={});var B6=class e extends k2{constructor(e,t,n){super(19,e,n),this.name=`DataTrackSerializeError`,this.reason=t,this.reasonName=z6[t]}static tooSmallForHeader(){return new e(`Buffer cannot fit header`,z6.TooSmallForHeader)}static tooSmallForPayload(){return new e(`Buffer cannot fit payload`,z6.TooSmallForPayload)}},V6=class{toBinary(){let e=this.toBinaryLengthBytes(),t=new ArrayBuffer(e),n=new DataView(t),r=this.toBinaryInto(n);if(e!==r)throw Error(`${this.constructor.name}.toBinary: written bytes (${r} bytes) not equal to allocated array buffer length (${e} bytes).`);return new Uint8Array(t)}},H6;(function(e){e[e.UserTimestamp=2]=`UserTimestamp`,e[e.E2ee=1]=`E2ee`})(H6||={});var U6=class extends V6{},W6=class e extends U6{constructor(e){super(),this.timestamp=e}toBinaryLengthBytes(){return w6+w6+e.lengthBytes}toBinaryInto(t){let n=0;t.setUint8(n,e.tag),n+=w6,t.setUint8(n,e.lengthBytes),n+=w6,t.setBigUint64(n,this.timestamp),n+=sde;let r=this.toBinaryLengthBytes();if(n!==r)throw Error(`DataTrackUserTimestampExtension.toBinaryInto: Wrote ${n} bytes but expected length was ${r} bytes`);return n}toJSON(){return{tag:e.tag,lengthBytes:e.lengthBytes,timestamp:this.timestamp}}};W6.tag=H6.UserTimestamp,W6.lengthBytes=8;var G6=class e extends U6{constructor(e,t){super(),this.keyIndex=e,this.iv=t}toBinaryLengthBytes(){return w6+w6+e.lengthBytes}toBinaryInto(t){let n=0;t.setUint8(n,e.tag),n+=w6,t.setUint8(n,e.lengthBytes),n+=w6,t.setUint8(n,this.keyIndex),n+=w6;for(let e=0;e<this.iv.length;e+=1)t.setUint8(n,this.iv[e]),n+=w6;let r=this.toBinaryLengthBytes();if(n!==r)throw Error(`DataTrackE2eeExtension.toBinaryInto: Wrote ${n} bytes but expected length was ${r} bytes`);return n}toJSON(){return{tag:e.tag,lengthBytes:e.lengthBytes,keyIndex:this.keyIndex,iv:this.iv}}};G6.tag=H6.E2ee,G6.lengthBytes=13;var K6=class e extends V6{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};super(),this.userTimestamp=e.userTimestamp,this.e2ee=e.e2ee}toBinaryLengthBytes(){let e=0;return this.userTimestamp&&(e+=this.userTimestamp.toBinaryLengthBytes()),this.e2ee&&(e+=this.e2ee.toBinaryLengthBytes()),e}toBinaryInto(e){let t=0;if(this.e2ee){let n=this.e2ee.toBinaryInto(e);t+=n}if(this.userTimestamp){let n=this.userTimestamp.toBinaryInto(new DataView(e.buffer,e.byteOffset+t));t+=n}let n=this.toBinaryLengthBytes();if(t!==n)throw Error(`DataTrackExtensions.toBinaryInto: Wrote ${t} bytes but expected length was ${n} bytes`);return t}static fromBinary(t){let n=y3(t),r,i,a=0;for(;n.byteLength-a>=w6+w6;){let e=n.getUint8(a);a+=w6;let t=n.getUint8(a);if(a+=w6,e!==dde)switch(e){case H6.UserTimestamp:if(n.byteLength-a<W6.lengthBytes)throw R6.malformedExt(e);r=new W6(n.getBigUint64(a)),a+=t;break;case H6.E2ee:if(n.byteLength-a<G6.lengthBytes)throw R6.malformedExt(e);let o=n.getUint8(a),s=new Uint8Array(12);for(let e=0;e<s.length;e+=1){let t=a;t+=w6,t+=e*w6,s[e]=n.getUint8(t)}i=new G6(o,s),a+=t;break;default:if(n.byteLength-a<t)throw R6.malformedExt(e);a+=t;break}}return[new e({userTimestamp:r,e2ee:i}),n.byteLength]}toJSON(){return{userTimestamp:this.userTimestamp?.toJSON()??null,e2ee:this.e2ee?.toJSON()??null}}},q6={from(e){return{payload:e.payload,extensions:new K6({userTimestamp:e.userTimestamp?new W6(e.userTimestamp):void 0})}},lossyIntoFrame(e){return{payload:e.payload,userTimestamp:e.extensions.userTimestamp?.timestamp}}},J6=Symbol.for(`lk.track`),Y6=Symbol.for(`lk.data-track`),X6=class{constructor(e,t,n){this.trackSymbol=J6,this.isLocal=!1,this.typeSymbol=Y6,this.info=e,this.manager=t,this.publisherIdentity=n.publisherIdentity}subscribe(e){try{let t=hZ(this.manager.openSubscriptionStream(this.info.sid,e?.signal,e?.bufferSize),2),n=t[0];return t[1].catch(()=>{}),n}catch(e){throw e}}setPipelineOptions(e){this.manager.setPipelineOptions(this.info.sid,e)}},Z6=class e extends V6{constructor(e){super(),this.marker=e.marker,this.trackHandle=e.trackHandle,this.sequence=e.sequence,this.frameNumber=e.frameNumber,this.timestamp=e.timestamp,this.extensions=e.extensions??new K6}extensionsMetrics(){let e=this.extensions.toBinaryLengthBytes(),t=Math.ceil((F6+e)/4);return{lengthBytes:e,lengthWords:t,paddingLengthBytes:t*4-F6-e}}toBinaryLengthBytes(){let e=this.extensionsMetrics(),t=e.lengthBytes,n=e.paddingLengthBytes,r=O6;return t>0&&(r+=F6+t+n),r}toBinaryInto(e){if(e.byteLength<this.toBinaryLengthBytes())throw B6.tooSmallForHeader();let t=D6<<k6,n;switch(this.marker){case Q6.Inter:n=N6;break;case Q6.Final:n=M6;break;case Q6.Start:n=j6;break;case Q6.Single:n=P6;break}t|=n<<A6;let r=this.extensionsMetrics(),i=r.lengthBytes,a=r.lengthWords,o=r.paddingLengthBytes;i>0&&(t|=1<<I6);let s=0;if(e.setUint8(s,t),s+=w6,e.setUint8(s,0),s+=w6,e.setUint16(s,this.trackHandle),s+=T6,e.setUint16(s,this.sequence.value),s+=T6,e.setUint16(s,this.frameNumber.value),s+=T6,e.setUint32(s,this.timestamp.asTicks()),s+=E6,i>0){let t=a-1;e.setUint16(s,t),s+=T6;let n=this.extensions.toBinaryInto(new DataView(e.buffer,e.byteOffset+s));s+=n;for(let t=0;t<o;t+=1)e.setUint8(s,0),s+=w6}let c=this.toBinaryLengthBytes();if(s!==c)throw Error(`DataTrackPacketHeader.toBinaryInto: Wrote ${s}
244 bytes but expected length was ${c} bytes`);return c}static fromBinary(t){let n=y3(t);if(n.byteLength<O6)throw R6.tooShort();let r=0,i=n.getUint8(r);r+=w6;let a=i>>k6&cde;if(a>D6)throw R6.unsupportedVersion(a);let o;switch(i>>A6&lde){case j6:o=Q6.Start;break;case M6:o=Q6.Final;break;case P6:o=Q6.Single;break;case N6:default:o=Q6.Inter;break}let s=(i>>I6&ude)>0;r+=w6;let c;try{c=due.fromNumber(n.getUint16(r))}catch(e){throw e instanceof x3&&(e.isReason(b3.Reserved)||e.isReason(b3.TooLarge))?R6.invalidHandle(e):e}r+=T6;let l=_3.u16(n.getUint16(r));r+=T6;let u=_3.u16(n.getUint16(r));r+=T6;let d=v3.fromRtpTicks(n.getUint32(r));r+=E6;let f=new K6;if(s){if(n.byteLength-r<T6)throw R6.missingExtWords();let e=n.getUint16(r);r+=T6;let t=4*(e+1)-F6;if(r+t>n.byteLength)throw R6.headerOverrun();let i=new DataView(n.buffer,n.byteOffset+r,t),a=hZ(K6.fromBinary(i),2),o=a[0],s=a[1];f=o,r+=s}return[new e({marker:o,trackHandle:c,sequence:l,frameNumber:u,timestamp:d,extensions:f}),r]}toJSON(){return{marker:this.marker,trackHandle:this.trackHandle,sequence:this.sequence.value,frameNumber:this.frameNumber.value,timestamp:this.timestamp.asTicks(),extensions:this.extensions.toJSON()}}},Q6;(function(e){e[e.Start=0]=`Start`,e[e.Inter=1]=`Inter`,e[e.Final=2]=`Final`,e[e.Single=3]=`Single`})(Q6||={});var $6=class e extends V6{constructor(e,t){super(),this.header=e,this.payload=t}toBinaryLengthBytes(){return this.header.toBinaryLengthBytes()+this.payload.byteLength}toBinaryInto(e){let t=0,n=this.header.toBinaryInto(e);if(t+=n,e.byteLength-t<this.payload.byteLength)throw B6.tooSmallForPayload();for(let n=0;n<this.payload.length;n+=1)e.setUint8(t,this.payload[n]),t+=w6;let r=this.toBinaryLengthBytes();if(t!==r)throw Error(`DataTrackPacket.toBinaryInto: Wrote ${t} bytes but expected length was ${r} bytes`);return r}static fromBinary(t){let n=y3(t),r=hZ(Z6.fromBinary(n),2),i=r[0],a=r[1],o=n.buffer.slice(n.byteOffset+a,n.byteOffset+n.byteLength);return[new e(i,new Uint8Array(o)),n.byteLength]}toJSON(){return{header:this.header.toJSON(),payload:this.payload}}},e8=i0(n0.DataTracks),t8=class e extends k2{constructor(e,t,n,r){super(19,`Frame ${n} dropped: ${e}`,r),this.name=`DataTrackDepacketizerDropError`,this.reason=t,this.reasonName=n8[t],this.frameNumber=n}static interrupted(t,n){return new e(`Interrupted by the start of a new frame ${n}`,n8.Interrupted,t)}static unknownFrame(t){return new e(`Initial packet was never received.`,n8.UnknownFrame,t)}static bufferFull(t){return new e(`Reorder buffer is full.`,n8.BufferFull,t)}static incomplete(t,n,r){return new e(`Not all packets received before final packet. Received ${n} packets, expected ${r} packets.`,n8.Incomplete,t)}},n8;(function(e){e[e.Interrupted=0]=`Interrupted`,e[e.UnknownFrame=1]=`UnknownFrame`,e[e.BufferFull=2]=`BufferFull`,e[e.Incomplete=3]=`Incomplete`})(n8||={});var r8=class e{constructor(){this.partials=new Map}push(e,t){switch(e.header.marker){case Q6.Single:return this.frameFromSingle(e,t);case Q6.Start:return this.beginPartial(e,t);case Q6.Inter:case Q6.Final:return this.pushToPartial(e)}}reset(){this.partials.clear()}peekOldestPartialFrameNumber(){let e=this.partials.keys().next();return e.done?null:e.value}frameFromSingle(e,t){if(e.header.marker!==Q6.Single)throw Error(`Depacketizer.frameFromSingle: packet.header.marker was not FrameMarker.Single, found ${e.header.marker}.`);let n=t?.maxPartialFrames??1;if(this.partials.size>=n){let n=this.peekOldestPartialFrameNumber();if(typeof n!=`number`)throw Error(`Depacketizer.frameFromSingle: no olde
244st frame number found, but partials.size is ${this.partials.size}.`);if(this.partials.delete(n),t?.throwOnInterruption)throw t8.interrupted(n,e.header.frameNumber.value);e8.warn(`Data track frame ${n} was interrupted by single-packet frame ${e.header.frameNumber.value}, dropping.`)}return{payload:e.payload,extensions:e.header.extensions}}beginPartial(e,t){if(e.header.marker!==Q6.Start)throw Error(`Depacketizer.beginPartial: packet.header.marker was not FrameMarker.Start, found ${e.header.marker}.`);let n=e.header.sequence,r=e.header.frameNumber.value,i={startSequence:n,extensions:e.header.extensions,payloads:new Map([[n.value,e.payload]])},a=t?.maxPartialFrames??1;for(;this.partials.size>=a;){let e=this.peekOldestPartialFrameNumber();if(typeof e!=`number`)break;if(this.partials.delete(e),t?.throwOnInterruption)throw t8.interrupted(e,r);e8.warn(`Data track partials full (max ${a}), evicted oldest frame ${e} to make room for new frame ${r}.`)}return this.partials.set(r,i),null}pushToPartial(t){if(t.header.marker!==Q6.Inter&&t.header.marker!==Q6.Final)throw Error(`Depacketizer.pushToPartial: packet.header.marker was not FrameMarker.Inter or FrameMarker.Final, found ${t.header.marker}.`);let n=t.header.frameNumber.value,r=this.partials.get(n);if(!r)throw this.partials.delete(n),t8.unknownFrame(n);if(r.payloads.size>=e.MAX_BUFFER_PACKETS)throw this.partials.delete(n),t8.bufferFull(n);return r.payloads.has(t.header.sequence.value)&&e8.warn(`Data track frame ${n} received duplicate packet for sequence ${t.header.sequence.value}, so replacing with newly received packet.`),r.payloads.set(t.header.sequence.value,t.payload),t.header.marker===Q6.Final?this.finalize(n,r,t.header.sequence.value):null}finalize(e,t,n){let r=t.payloads.size,i=0;for(let e of t.payloads.values())i+=e.length;let a=new Uint8Array(i),o=t.startSequence.clone(),s=0;for(;;){let r=t.payloads.get(o.value);if(!r)break;t.payloads.delete(o.value);let i=a.length-s;if(r.length>i)throw Error(`Depacketizer.finalize: Expected at least ${r.length} more bytes left in the payload buffer, only got ${i} bytes.`);if(a.set(r,s),s+=r.length,o.value!=n){o.increment();continue}return this.partials.delete(e),{payload:a,extensions:t.extensions}}throw this.partials.delete(e),t8.incomplete(e,r,n-t.startSequence.value+1)}};r8.MAX_BUFFER_PACKETS=128;var i8;(function(e){e[e.Unpublished=0]=`Unpublished`,e[e.Timeout=1]=`Timeout`,e[e.Disconnected=2]=`Disconnected`,e[e.Cancelled=4]=`Cancelled`})(i8||={});var a8=class e extends k2{constructor(e,t,n){super(22,e,n),this.name=`DataTrackSubscribeError`,this.reason=t,this.reasonName=i8[t]}static unpublished(){return new e(`The track has been unpublished and is no longer available`,i8.Unpublished)}static timeout(){return new e(`Request to subscribe to data track timed-out`,i8.Timeout)}static disconnected(){return new e(`Cannot subscribe to data track when disconnected`,i8.Disconnected)}static cancelled(){return new e(`Subscription to data track cancelled by caller`,i8.Cancelled)}},o8=i0(n0.DataTracks),fde=class{constructor(e){let t=e.e2eeManager!==null;if(e.info.usesE2ee!==t)throw Error(`IncomingDataTrackPipeline: DataTrackInfo.usesE2ee must match presence of decryptionProvider`);let n=new r8;this.publisherIdentity=e.publisherIdentity,this.e2eeManager=e.e2eeManager??null,this.depacketizer=n,this.options=e.pipelineOptions??{}}updateE2eeManager(e){this.e2eeManager=e}setOptions(e){this.options=e}processPacket(e){return J(this,void 0,void 0,function*(){let t=this.depacketize(e);return t&&(yield this.decryptIfNeeded(t))||null})}depacketize(e){let t;try{t=this.depacketizer.push(e,{throwOnInterruption:!1,maxPartialFrames:this.options.maxPartialFrames})}catch(e){return o8.warn(`Data frame depacketize error: ${e}`),null}return t}decryptIfNeeded(e){return J(this,void 0,void 0,function*(){let t=this.e2eeManager;if(!t)return e;let n=e.extensions?.e2ee??null;if(!n)return o8.error(`Missing E2EE meta`),null;let r;try{r=yield t.handleEncryptedData(e.payload,n.iv,this.publisherIdentity,n.keyIndex)}catch(e){return o8.error(`Error decrypting packet: ${e}`),null}return e.payload=r.payload,e})}},s8=i0(n0.DataTracks),pde=1e4,mde=16,hde=class extends v0.EventEmitter{constructor(e){super(),this.descriptors=new Map,this.subscriptionHandles=new Map,this.e2eeManager=e?.e2eeManager??null}updateE2eeManager(e){this.e2eeManager=e;for(let t of this.descriptors.values())t.subscription.type===`active`&&t.subscription.pipeline.updateE2eeManager(e)}setPipelineOptions(e,t){let n=this.descriptors.get(e);if(!n){s8.warn(`Unknown track ${e}, cannot set pipeline options.`);return}n.pipelineOptions=t,n.subscription.type===`active`&&n.subscription.pipeline.setOptions(t)}openSubscriptionStream(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:mde,r=null,i=new P4,a=()=>{t?.removeEventListener(`abort`,s)},o=()=>
vendor: 139,966 bytes, line 244
244{if(a(),!r){s8.warn(`ReadableStream subscribed to ${e} was not started.`);return}let t=this.descriptors.get(e);if(!t){s8.warn(`Unknown track ${e}, skipping cancel...`);return}if(t.subscription.type!==`active`){s8.warn(`Subscription for track ${e} is not active, skipping cancel...`);return}t.subscription.streamControllers.delete(r),t.subscription.streamControllers.size===0&&this.unSubscribeRequest(t.info.sid)},s=()=>{var t;if(!r)return;let n=this.descriptors.get(e);n?.subscription.type===`active`&&n.subscription.streamControllers.delete(r),r.error(a8.cancelled()),(t=i.reject)==null||t.call(i,a8.cancelled()),o()};return[new ReadableStream({start:n=>{r=n,this.subscribeRequest(e,t).then(()=>J(this,void 0,void 0,function*(){var r,o,c;let l=this.descriptors.get(e);if(!l){s8.error(`Unknown track ${e}`);let t=a8.disconnected();n.error(t),(r=i.reject)==null||r.call(i,t);return}if(l.subscription.type!==`active`){s8.error(`Subscription for track ${e} is not active`);let t=a8.disconnected();n.error(t),(o=i.reject)==null||o.call(i,t);return}if(t?.aborted){s();return}t?.addEventListener(`abort`,s),l.subscription.streamControllers.set(n,a),(c=i.resolve)==null||c.call(i)})).catch(e=>{var t;n.error(e),(t=i.reject)==null||t.call(i,e)})},cancel:()=>{o()}},new CountQueuingStrategy({highWaterMark:n})),i.promise]}subscribeRequest(e,t){return J(this,void 0,void 0,function*(){let n=this.descriptors.get(e);if(!n)throw Error(`Cannot subscribe to unknown track`);let r=(t,n,r)=>J(this,void 0,void 0,function*(){if(t.subscription.type===`active`)return;if(t.subscription.type!==`pending`)throw Error(`Descriptor for track ${e} is not pending, found ${t.subscription.type}`);let i=S6([n,r].filter(e=>e!==void 0)),a=new P4;t.subscription.completionFuture.promise.then(()=>a.resolve?.call(a)).catch(e=>a.reject?.call(a,e));let o=()=>{var e;if(t.subscription.type===`pending`){if(--t.subscription.pendingRequestCount,r?.aborted){t.subscription.cancel();return}if(t.subscription.pendingRequestCount<=0){t.subscription.cancel();return}(e=a.reject)==null||e.call(a,a8.cancelled())}};i.aborted&&o(),i.addEventListener(`abort`,o),yield a.promise,i.removeEventListener(`abort`,o)});switch(n.subscription.type){case`none`:{n.subscription={type:`pending`,completionFuture:new P4,pendingRequestCount:1,cancel:()=>{var t,r;let a=n.subscription;n.subscription={type:`none`},this.emit(`sfuUpdateSubscription`,{sid:e,subscribe:!1}),a.type===`pending`&&((r=(t=a.completionFuture).reject)==null||r.call(t,i.aborted?a8.timeout():a8.cancelled()))}},this.emit(`sfuUpdateSubscription`,{sid:e,subscribe:!0});let i=C6(pde);yield r(n,t,i);return}case`pending`:n.subscription.pendingRequestCount+=1,yield r(n,t);return;case`active`:return}})}querySubscribed(){return J(this,void 0,void 0,function*(){return Array.from(this.descriptors.values()).filter(e=>e.subscription.type===`active`).map(e=>[e.info,e.publisherIdentity])})}unSubscribeRequest(e){let t=this.descriptors.get(e);if(!t)throw Error(`Cannot subscribe to unknown track`);if(t.subscription.type!==`active`){s8.warn(`Unexpected descriptor state in unSubscribeRequest, expected active, found ${t.subscription?.type}`);return}this.closeStreamControllers(t.subscription.streamControllers,e);let n=t.subscription;t.subscription={type:`none`},this.subscriptionHandles.delete(n.subcriptionHandle),this.emit(`sfuUpdateSubscription`,{sid:e,subscribe:!1})}closeStreamControllers(e,t){for(let r of e){var n=hZ(r,2);let e=n[0],i=n[1];i();try{e.close()}catch(e){s8.warn(`Failed to close readable stream for track ${t}: ${e}`)}}}receiveSfuPublicationUpdates(e){return J(this,void 0,void 0,function*(){if(e.size===0)return;let t=new Map;for(let r of e.entries()){var n=hZ(r,2);let e=n[0],i=n[1],a=new Set;for(let t of i)a.add(t.sid),!this.descriptors.has(t.sid)&&(yield this.handleTrackPublished(e,t));t.set(e,a)}for(let e of t.entries()){var r=hZ(e,2);let t=r[0],n=r[1],i=Array.from(this.descriptors.entries()).filter(e=>{let n=hZ(e,2);return n[0],n[1].publisherIdentity===t}).map(e=>hZ(e,1)[0]).filter(e=>!n.has(e));for(let e of i)this.handleTrackUnpublished(e)}})}queryPublications(){return J(this,void 0,void 0,function*(){return Array.from(this.descriptors.values()).map(e=>e.info)})}handleTrackPublished(e,t){return J(this,void 0,void 0,function*(){if(this.descriptors.has(t.sid)){s8.error(`Existing descriptor for track ${t.sid}`);return}let n={info:t,publisherIdentity:e,subscription:{type:`none`},pipelineOptions:{}};this.descriptors.set(n.info.sid,n);let r=new X6(n.info,this,{publisherIdentity:e});this.emit(`trackPublished`,{track:r})})}handleTrackUnpublished(e){let t=this.descriptors.get(e);if(!t){s8.error(`Unknown track ${e}`);return}this.descriptors.delete(e),t.subscription.type===`active`&&(this.closeStreamControllers(t.subscription.streamControllers,e),this.subscriptionHandles.delete(t.subscription.subcriptionHandle)),this.emit(`trackUnpublished`,{sid:e,publisherIdentity:t.publisherIdentity})}receivedSfuSubscriberHandles(e){for(let n of e.entries()){var t=hZ(n,2);let e=t[0],r=t[1];this.registerSubscriberHandle(e,r)}}registerSubscriberHandle(e,t){var n,r;let i=this.descriptors.get(t);if(!i){s8.error(`Unknown track ${t}`);return}switch(i.subscription.type){case`none`:s8.warn(`No subscription for ${t}`);return;case`active`:i.subscription.subcriptionHandle=e,this.subscriptionHandles.set(e,t);return;case`pending`:{let a=new fde({info:i.info,publisherIdentity:i.publisherIdentity,e2eeManager:this.e2eeManager,pipelineOptions:i.pipelineOptions}),o=i.subscription;i.subscription={type:`active`,subcriptionHandle:e,pipeline:a,streamControllers:new Map},this.subscriptionHandles.set(e,t),(r=(n=o.completionFuture).resolve)==null||r.call(n)}}}packetReceived(e){return J(this,void 0,void 0,function*(){let t;try{t=hZ($6.fromBinary(e),1)[0]}catch(e){s8.error(`Failed to deserialize packet: ${e}`);return}let n=this.subscriptionHandles.get(t.header.trackHandle);if(!n){s8.warn(`Unknown subscriber handle ${t.header.trackHandle}`);return}let r=this.descriptors.get(n);if(!r){s8.error(`Missing descriptor for track ${n}`);return}if(r.subscription.type!==`active`){s8.warn(`Received packet for track ${n} without active subscription`);return}let i=yield r.subscription.pipeline.processPacket(t);if(i)for(let e of r.subscription.streamControllers.keys()){if(e.desiredSize!==null&&e.desiredSize<=0){s8.warn(`Cannot send frame to subscribers: readable stream is full (desiredSize is ${e.desiredSize}). To increase this threshold, set a higher 'options.highWaterMark' when calling .subscribe().`);continue}let t=q6.lossyIntoFrame(i);e.enqueue(t)}})}resendSubscriptionUpdates(){for(let t of this.descriptors){var e=hZ(t,2);let n=e[0];e[1].subscription.type!==`none`&&this.emit(`sfuUpdateSubscription`,{sid:n,subscribe:!0})}}handleRemoteParticipantDisconnected(e){var t,n;for(let r of this.descriptors.values())if(r.publisherIdentity===e)switch(r.subscription.type){case`none`:break;case`pending`:(n=(t=r.subscription.completionFuture).reject)==null||n.call(t,a8.disconnected());break;case`active`:this.unSubscribeRequest(r.info.sid);break}}reset(){var e,t;for(let n of this.descriptors.values())this.emit(`trackUnpublished`,{sid:n.info.sid,publisherIdentity:n.publisherIdentity}),n.subscription.type===`pending`&&((t=(e=n.subscription.completionFuture).reject)==null||t.call(e,a8.disconnected())),n.subscription.type===`active`&&this.closeStreamControllers(n.subscription.streamControllers,n.info.sid);this.descriptors.clear(),this.subscriptionHandles.clear()}},c8=class e extends k2{constructor(e,t,n){super(19,e,n),this.name=`DataTrackPacketizerError`,this.reason=t,this.reasonName=l8[t]}static mtuTooShort(){return new e(`MTU is too short to send frame`,l8.MtuTooShort)}},l8;(function(e){e[e.MtuTooShort=0]=`MtuTooShort`})(l8||={});var gde=class e{constructor(e,t){this.sequence=_3.u16(0),this.frameNumber=_3.u16(0),this.clock=uue.rtpStartingNow(v3.rtpRandom()),this.handle=e,this.mtuSizeBytes=t}static computeFrameMarker(e,t){return t<=1?Q6.Single:e===0?Q6.Start:e===t-1?Q6.Final:Q6.Inter}*packetize(t,n){let r=this.frameNumber.getThenIncrement(),i={marker:Q6.Inter,trackHandle:this.handle,sequence:_3.u16(0),frameNumber:r,timestamp:n?.now??this.clock.now(),extensions:t.extensions},a=new Z6(i).toBinaryLengthBytes();if(a>=this.mtuSizeBytes)throw c8.mtuTooShort();let o=this.mtuSizeBytes-a,s=Math.ceil(t.payload.byteLength/o);for(let n=0,r=0;r<t.payload.byteLength;c=[n+1,r+o],n=c[0],r=c[1]){var c;let a=this.sequence.getThenIncrement(),l=new Z6(Object.assign(Object.assign({},i),{marker:e.computeFrameMarker(n,s),sequence:a})),u=Math.min(o,t.payload.byteLength-r);yield new $6(l,new Uint8Array(t.payload.buffer,t.payload.byteOffset+r,u))}}},u8;(function(e){e[e.NotAllowed=0]=`NotAllowed`,e[e.DuplicateName=1]=`DuplicateName`,e[e.Timeout=2]=`Timeout`,e[e.LimitReached=3]=`LimitReached`,e[e.Disconnected=4]=`Disconnected`,e[e.Cancelled=5]=`Cancelled`,e[e.InvalidName=6]=`InvalidName`,e[e.Unknown=7]=`Unknown`})(u8||={});var d8=class e extends k2{constructor(e,t,n){super(21,e,n),this.name=`DataTrackPublishError`,this.reason=t,this.reasonName=u8[t],this.rawMessage=n?.rawMessage}static notAllowed(t){return new e(`Data track publishing unauthorized`,u8.NotAllowed,{rawMessage:t})}static duplicateName(t){return new e(`Track name already taken`,u8.DuplicateName,{rawMessage:t})}static invalidName(t){return new e(`Track name is invalid`,u8.InvalidName,{rawMessage:t})}static timeout(){return new e(`Publish data track timed-out. Does the LiveKit server support data tracks?`,u8.Timeout)}static limitReached(t){return new e(`Data track publication limit reached`,u8.LimitReached,{rawMessage:t})}static unknown(t,n){return new e(`Received RequestResponse for publishDataTrack, but reason was unrecognised (${t}, ${n})`,u8.Unknown)}static disconnected(){return new e(`Room disconnected`,u8.Disconnected)}static cancelled(){return new e(`Publish data track cancelled by caller`,u8.Cancelled)}},f8;(function(e){e[e.TrackUnpublished=0]=`TrackUnpublished`,e[e.Dropped=1]=`Dropped`})(f8||={});var p8=class e extends k2{constructor(e,t,n){super(22,e,n),this.name=`DataTrackPushFrameError`,this.reason=t,this.reasonName=f8[t]}static trackUnpublished(){return new e(`Track is no longer published`,f8.TrackUnpublished)}static dropped(t){return new e(`Frame was dropped`,f8.Dropped,{cause:t})}},m8;(function(e){e[e.Packetizer=0]=`Packetizer`,e[e.Encryption=1]=`Encryption`})(m8||={});var h8=class e extends k2{constructor(e,t,n){super(21,e,n),this.name=`DataTrackOutgoingPipelineError`,this.reason=t,this.reasonName=m8[t]}static packetizer(t){return new e(`Error packetizing frame`,m8.Packetizer,{cause:t})}static encryption(t){return new e(`Error encrypting frame`,m8.Encryption,{cause:t})}},g8=class e{constructor(e,t){this.trackSymbol=J6,this.isLocal=!0,this.typeSymbol=Y6,this.handle=null,this.log=r0,this.flushedFuture=new P4,this.isFlushed=!0,this.handleManagerReset=()=>{var e,t;(t=(e=this.flushedFuture).resolve)==null||t.call(e),this.manager.off(`packetsFlushedChange`,this.handleManagerPacketsFlushedChange),this.manager.off(`reset`,this.handleManagerReset)},this.handleManagerPacketsFlushedChange=e=>{var t,n;this.isFlushed=e.isFlushed,e.isFlushed&&((n=(t=this.flushedFuture).resolve)==null||n.call(t),this.flushedFuture=new P4)},this.options=e,this.manager=t,this.log=i0(n0.DataTracks),this.manager.on(`packetsFlushedChange`,this.handleManagerPacketsFlushedChange),this.manager.on(`reset`,this.handleManagerReset)}static withExplicitHandle(t,n,r){let i=new e(t,n);return i.handle=r,i}get info(){let e=this.descriptor;if(e?.type===`active`)return e.info}get descriptor(){return this.handle?this.manager.getDescriptor(this.handle):null}publish(e){return J(this,void 0,void 0,function*(){try{this.handle=yield this.manager.publishRequest(this.options,e)}catch(e){throw e}})}isPublished(){return this.descriptor?.type===`active`&&this.descriptor.publishState!==`unpublished`}tryPush(e){if(!this.handle)throw p8.trackUnpublished();let t=q6.from(e);try{return this.manager.tryProcessAndSend(this.handle,t)}catch(e){throw e}}flush(){return J(this,void 0,void 0,function*(){if(!this.isFlushed)return this.flushedFuture.promise})}unpublish(){return J(this,void 0,void 0,function*(){if(!this.handle){r0.warn(`Data track "${this.options.name}" is not published, so unpublishing has no effect.`);return}try{yield this.manager.unpublishRequest(this.handle)}catch(e){throw e}})}},_8=class e{constructor(t){this.e2eeManager=t.e2eeManager,this.packetizer=new gde(t.info.pubHandle,e.TRANSPORT_MTU_BYTES)}updateE2eeManager(e){this.e2eeManager=e}processFrame(e){return p0(this,arguments,function*(){let t=yield f0(this.encryptIfNeeded(e));try{yield f0(yield*m0(h0(this.packetizer.packetize(t))))}catch(e){throw e instanceof c8?h8.packetizer(e):e}})}encryptIfNeeded(e){return J(this,void 0,void 0,function*(){if(!this.e2eeManager)return e;let t;try{t=yield this.e2eeManager.encryptData(e.payload)}catch(e){throw h8.encryption(e)}return e.payload=t.payload,e.extensions.e2ee=new G6(t.keyIndex,t.iv),e})}};_8.TRANSPORT_MTU_BYTES=16e3;var v8=i0(n0.DataTracks),y8={pending(){return{type:`pending`,completionFuture:new P4}},active(e,t){return{type:`active`,info:e,publishState:`published`,pipeline:new _8({info:e,e2eeManager:t}),unpublishingFuture:new P4}}},_de=1e4,vde=class e extends v0.EventEmitter{constructor(e){super(),this.handleAllocator=new fue,this.descriptors=new Map,this.inFlightPacketCounter=new Map,this.e2eeManager=e?.e2eeManager??null}static withDescriptors(t){let n=new e;return n.descriptors=t,n}updateE2eeManager(e){this.e2eeManager=e;for(let t of this.descriptors.values())t.type===`active`&&t.pipeline.updateE2eeManager(e)}getDescriptor(e){return this.descriptors.get(e)??null}tryProcessAndSend(e,t){return J(this,void 0,void 0,function*(){var n,r,i,a;let o=this.getDescriptor(e);if(o?.type!==`active`||o.publishState===`unpublished`)throw p8.trackUnpublished();if(o.publishState===`republishing`)throw p8.dropped(`Data track republishing`);try{try{for(var s=!0,c=h0(o.pipeline.processFrame(t)),l;l=yield c.next(),n=l.done,!n;s=!0){a=l.value,s=!1;let t=a,n=this.inFlightPacketCounter.get(e)??0;this.inFlightPacketCounter.set(e,n+1),n===0&&this.emit(`packetsFlushedChange`,{handle:e,isFlushed:!1}),this.emit(`packetAvailable`,{handle:e,bytes:t.toBinary()})}}catch(e){r={error:e}}finally{try{!s&&!n&&(i=c.return)&&(yield i.call(c))}finally{if(r)throw r.error}}}catch(e){throw p8.dropped(e)}})}handlePacketSendComplete(e){let t=(this.inFlightPacketCounter.get(e)??0)-1;t<0&&(v8.warn(`OutgoingDataTrackManager.handlePacketSendComplete: inFlightPacketCounter was decremented below 0 (got ${this.inFlightPacketCounter} - resetting to 0. Were more packets send than were emitted?`),t=0),this.inFlightPacketCounter.set(e,t),t===0&&this.emit(`packetsFlushedChange`,{handle:e,isFlushed:!0})}publishRequest(e,t){return J(this,void 0,void 0,function*(){let n=this.handleAllocator.get();if(!n)throw d8.limitReached();let r=C6(_de),i=t?S6([t,r]):r;if(this.descriptors.has(n))throw Error(`Descriptor for handle already exists`);let a=y8.pending();this.descriptors.set(n,a);let o=()=>{var e,t;let i=this.descriptors.get(n);if(!i){v8.warn(`No descriptor for ${n}`);return}this.descriptors.delete(n),this.emit(`sfuUnpublishRequest`,{handle:n}),i.type===`pending`&&((t=(e=i.completionFuture).reject)==null||t.call(e,r.aborted?d8.timeout():d8.cancelled()))};return i.aborted?(o(),a.completionFuture.promise.then(()=>n)):(i.addEventListener(`abort`,o),this.emit(`sfuPublishRequest`,{handle:n,name:e.name,usesE2ee:this.e2eeManager!==null}),yield a.completionFuture.promise,i.removeEventListener(`abort`,o),this.emit(`trackPublished`,{track:g8.withExplicitHandle(e,this,n)}),n)})}queryPublished(){return Array.from(this.descriptors.values()).filter(e=>e.type===`active`).map(e=>e.info)}unpublishRequest(e){return J(this,void 0,void 0,function*(){let t=this.descriptors.get(e);if(!t){v8.warn(`No descriptor for ${e}`);return}if(t.type!==`active`){v8.warn(`Track ${e} not active`);return}this.emit(`sfuUnpublishRequest`,{handle:e}),yield t.unpublishingFuture.promise,this.inFlightPacketCounter.delete(e),this.emit(`trackUnpublished`,{sid:t.info.sid})})}receivedSfuPublishResponse(e,t){var n,r,i,a;let o=this.descriptors.get(e);if(!o){v8.warn(`No descriptor for ${e}`);return}switch(this.descriptors.delete(e),o.type){case`pending`:if(t.type===`ok`){let e=t.data,i=e.usesE2ee?this.e2eeManager:null;this.descriptors.set(e.pubHandle,y8.active(e,i)),(r=(n=o.completionFuture).resolve)==null||r.call(n)}else (a=(i=o.completionFuture).reject)==null||a.call(i,t.error);return;case`active`:if(o.publishState!==`republishing`){v8.warn(`Track ${e} already active`);return}if(t.type===`error`){v8.warn(`Republish failed for track ${e}`);return}v8.debug(`Track ${e} republished`),o.info.sid=t.data.sid,o.publishState=`published`,this.descriptors.set(o.info.pubHandle,o)}}receivedSfuUnpublishResponse(e){var t,n;let r=this.descriptors.get(e);if(!r){v8.warn(`No descriptor for ${e}`);return}if(this.descriptors.delete(e),r.type!==`active`){v8.warn(`Track ${e} not active`);return}r.publishState=`unpublished`,(n=(t=r.unpublishingFuture).resolve)==null||n.call(t)}sfuWillRepublishTracks(){var e,t;for(let r of this.descriptors.entries()){var n=hZ(r,2);let i=n[0],a=n[1];switch(a.type){case`pending`:this.descriptors.delete(i),(t=(e=a.completionFuture).reject)==null||t.call(e,d8.disconnected());break;case`active`:a.publishState=`republishing`,this.emit(`sfuPublishRequest`,{handle:a.info.pubHandle,name:a.info.name,usesE2ee:a.info.usesE2ee})}}}reset(){return J(this,void 0,void 0,function*(){var e,t,n,r;this.handleAllocator.reset();for(let i of this.descriptors.values())switch(i.type){case`pending`:(t=(e=i.completionFuture).reject)==null||t.call(e,d8.disconnected());break;case`active`:(r=(n=i.unpublishingFuture).resolve)==null||r.call(n),yield this.unpublishRequest(i.info.pubHandle);break}this.descriptors.clear(),this.inFlightPacketCounter.clear(),this.emit(`reset`)})}},b8=class e extends Error{constructor(t,n,r,i){super(n),this.code=t,this.message=D8(n,e.MAX_MESSAGE_BYTES),this.data=r?D8(r,e.MAX_DATA_BYTES):void 0,i?.cause!==void 0&&(this.cause=i?.cause)}static fromProto(t){return new e(t.code,t.message,t.data)}toProto(){return new S$({code:this.code,message:this.message,data:this.data})}static builtIn(t,n,r){return new e(e.ErrorCode[t],e.ErrorMessage[t],n,r)}};b8.MAX_MESSAGE_BYTES=256,b8.MAX_DATA_BYTES=15360,b8.ErrorCode={APPLICATION_ERROR:1500,CONNECTION_TIMEOUT:1501,RESPONSE_TIMEOUT:1502,RECIPIENT_DISCONNECTED:1503,RESPONSE_PAYLOAD_TOO_LARGE:1504,SEND_FAILED:1505,UNSUPPORTED_METHOD:1400,RECIPIENT_NOT_FOUND:1401,REQUEST_PAYLOAD_TOO_LARGE:1402,UNSUPPORTED_SERVER:1403,UNSUPPORTED_VERSION:1404},b8.ErrorMessage={APPLICATION_ERROR:`Application error in method handler`,CONNECTION_TIMEOUT:`Connection timeout`,RESPONSE_TIMEOUT:`Response timeout`,RECIPIENT_DISCONNECTED:`Recipient disconnected`,RESPONSE_PAYLOAD_TOO_LARGE:`Response payload too large`,SEND_FAILED:`Failed to send`,UNSUPPORTED_METHOD:`Method not supported at destination`,RECIPIENT_NOT_FOUND:`Recipient not found`,REQUEST_PAYLOAD_TOO_LARGE:`Request payload too large`,UNSUPPORTED_SERVER:`RPC not supported by server`,UNSUPPORTED_VERSION:`Unsupported RPC version`};var x8=15360,S8=`lk.rpc_request`,C8=`lk.rpc_response`,w8;(function(e){e.RPC_REQUEST_ID=`lk.rpc_request_id`,e.RPC_REQUEST_METHOD=`lk.rpc_request_method`,e.RPC_REQUEST_RESPONSE_TIMEOUT_MS=`lk.rpc_request_response_timeout_ms`,e.RPC_REQUEST_VERSION=`lk.rpc_request_version`})(w8||={});var yde=1,T8=2;function E8(e){return new TextEncoder().encode(e).length}function D8(e,t){if(E8(e)<=t)return e;let n=0,r=e.length,i=new TextEncoder;for(;n<r;){let a=Math.floor((n+r+1)/2);i.encode(e.slice(0,a)).length<=t?n=a:r=a-1}return e.slice(0,n)}var bde=class extends v0.EventEmitter{constructor(e,t,n,r){super(),this.pendingAcks=new Map,this.pendingResponses=new Map,this.log=e,this.outgoingDataStreamManager=t,this.getRemoteParticipantClientProtocol=n,this.getServerVersion=r}performRpc(e){return J(this,arguments,void 0,function(e){var t=this;let n=e.destinationIdentity,r=e.method,i=e.payload,a=e.responseTimeout,o=a===void 0?15e3:a;return function*(){let e=7e3;e+1e3;let a=t.getRemoteParticipantClientProtocol(n);if(E8(i)>x8&&a<1)throw b8.builtIn(`REQUEST_PAYLOAD_TOO_LARGE`);let s=t.getServerVersion();if(s&&E4(s,`1.8.0`)<0)throw b8.builtIn(`UNSUPPORTED_SERVER`);let c=Math.max(o,8e3),l=crypto.randomUUID(),u=new P4,d=null,f=setTimeout(()=>{var e;t.pendingAcks.delete(l),(e=u.reject)==null||e.call(u,b8.builtIn(`CONNECTION_TIMEOUT`)),t.pendingResponses.delete(l),d!==null&&clearTimeout(d)},e);return t.pendingAcks.set(l,{resolve:()=>{clearTimeout(f)},participantIdentity:n}),t.pendingResponses.set(l,{completionFuture:u,participantIdentity:n}),yield t.publishRpcRequest(n,l,r,i,c,a),d=setTimeout(()=>{var e;t.pendingResponses.delete(l),(e=u.reject)==null||e.call(u,b8.builtIn(`RESPONSE_TIMEOUT`))},o),[l,u.promise.finally(()=>{clearTimeout(d),t.pendingAcks.has(l)&&(t.log.warn(`RPC response received before ack`,l),t.pendingAcks.delete(l),clearTimeout(f))})]}()})}publishRpcRequest(e,t,n,r,i,a){return J(this,void 0,void 0,function*(){if(a>=1){let a=yield this.outgoingDataStreamManager.streamText({topic:S8,destinationIdentities:[e],attributes:{[w8.RPC_REQUEST_ID]:t,[w8.RPC_REQUEST_METHOD]:n,[w8.RPC_REQUEST_RESPONSE_TIMEOUT_MS]:`${i}`,[w8.RPC_REQUEST_VERSION]:`${T8}`}});yield a.write(r),yield a.close();return}this.emit(`sendDataPacket`,{packet:new c$({destinationIdentities:[e],kind:l$.RELIABLE,value:{case:`rpcRequest`,value:new y$({id:t,method:n,payload:r,responseTimeoutMs:i,version:yde})}})})})}handleIncomingDataStream(e,t,n){return J(this,void 0,void 0,function*(){let r=n[w8.RPC_REQUEST_ID];if(!r){this.log.warn(`RPC data stream malformed: ${w8.RPC_REQUEST_ID} not set.`);return}let i=this.pendingResponses.get(r);if(i&&i.participantIdentity!==t){this.log.warn(`RPC response stream for ${r} arrived from unexpected sender ${t}, expected ${i.participantIdentity}. Ignoring.`);return}let a;try{a=yield e.readAll()}catch(e){this.log.warn(`Error reading RPC response payload: ${e}`),this.handleIncomingRpcResponseFailure(r,b8.builtIn(`APPLICATION_ERROR`,`Error reading RPC response payload`,{cause:e}));return}this.handleIncomingRpcResponseSuccess(r,a)})}handleIncomingRpcResponseSuccess(e,t){var n,r;let i=this.pendingResponses.get(e);i?((r=(n=i.completionFuture).resolve)==null||r.call(n,t),this.pendingResponses.delete(e)):this.log.error(`Response received for unexpected RPC request`,e)}handleIncomingRpcResponseFailure(e,t){var n,r;let i=this.pendingResponses.get(e);i?((r=(n=i.completionFuture).reject)==null||r.call(n,t),this.pendingResponses.delete(e)):this.log.error(`Response received for unexpected RPC request`,e)}handleIncomingRpcAck(e){let t=this.pendingAcks.get(e);t?(t.resolve(),this.pendingAcks.delete(e)):this.log.error(`Ack received for unexpected RPC request: ${e}`)}handleParticipantDisconnected(e){var t;for(let t of this.pendingAcks){var n=hZ(t,2);let r=n[0];n[1].participantIdentity===e&&this.pendingAcks.delete(r)}for(let n of this.pendingResponses){var r=hZ(n,2);let a=r[0];var i=r[1];let o=i.participantIdentity,s=i.completionFuture;o===e&&((t=s.reject)==null||t.call(s,b8.builtIn(`RECIPIENT_DISCONNECTED`)),this.pendingResponses.delete(a))}}},xde=class extends v0.EventEmitter{constructor(e,t,n){super(),this.rpcHandlers=new Map,this.log=e,this.outgoingDataStreamManager=t,this.getRemoteParticipantClientProtocol=n}registerRpcMethod(e,t){if(this.rpcHandlers.has(e))throw Error(`RPC handler already registered for method ${e}, unregisterRpcMethod before trying to register again`);this.rpcHandlers.set(e,t)}unregisterRpcMethod(e){this.rpcHandlers.delete(e)}handleIncomingRpcRequest(e,t){return J(this,void 0,void 0,function*(){if(this.publishRpcAck(e,t.id),t.version!==1){this.publishRpcResponsePacket(e,t.id,null,b8.builtIn(`UNSUPPORTED_VERSION`));return}let n=this.rpcHandlers.get(t.method);if(!n){this.publishRpcResponsePacket(e,t.id,null,b8.builtIn(`UNSUPPORTED_METHOD`));return}let r;try{r=yield n({requestId:t.id,callerIdentity:e,payload:t.payload,responseTimeout:t.responseTimeoutMs})}catch(n){let r;n instanceof b8?r=n:(this.log.warn(`Uncaught error returned by RPC handler for ${t.method}. Returning APPLICATION_ERROR instead.`,n),r=b8.builtIn(`APPLICATION_ERROR`,`Uncaught error: ${n?.message??n}`,{cause:n})),this.publishRpcResponsePacket(e,t.id,null,r);return}yield this.publishRpcResponse(e,t.id,r??``)})}handleIncomingDataStream(e,t,n){return J(this,void 0,void 0,function*(){let r=n[w8.RPC_REQUEST_ID],i=n[w8.RPC_REQUEST_METHOD],a=parseInt(n[w8.RPC_REQUEST_RESPONSE_TIMEOUT_MS],10),o=parseInt(n[w8.RPC_REQUEST_VERSION],10);if(!r||!i||Number.isNaN(a)||Number.isNaN(o)){this.log.warn(`RPC data stream malformed: ${w8.RPC_REQUEST_ID} / ${w8.RPC_REQUEST_METHOD} / ${w8.RPC_REQUEST_RESPONSE_TIMEOUT_MS} / ${w8.RPC_REQUEST_VERSION} not set.`),this.publishRpcResponsePacket(t,r,null,b8.builtIn(`APPLICATION_ERROR`,`RPC data stream malformed`));return}if(this.publishRpcAck(t,r),o!==T8){this.publishRpcResponsePacket(t,r,null,b8.builtIn(`UNSUPPORTED_VERSION`));return}let s;try{s=yield e.readAll()}catch(e){this.log.warn(`Error reading RPC request payload: ${e}`),this.publishRpcResponsePacket(t,r,null,b8.builtIn(`APPLICATION_ERROR`,`Error reading RPC request payload`,{cause:e}));return}let c=this.rpcHandlers.get(i);if(!c){this.publishRpcResponsePacket(t,r,null,b8.builtIn(`UNSUPPORTED_METHOD`));return}let l;try{l=yield c({requestId:r,callerIdentity:t,payload:s,responseTimeout:a})}catch(e){let n;e instanceof b8?n=e:(this.log.warn(`Uncaught error returned by RPC handler for ${i}. Returning APPLICATION_ERROR instead.`,e),n=b8.builtIn(`APPLICATION_ERROR`)),this.publishRpcResponsePacket(t,r,null,n);return}yield this.publishRpcResponse(t,r,l??``)})}publishRpcAck(e,t){this.emit(`sendDataPacket`,{packet:new c$({destinationIdentities:[e],kind:l$.RELIABLE,value:{case:`rpcAck`,value:new b$({requestId:t})}})})}publishRpcResponsePacket(e,t,n,r){this.emit(`sendDataPacket`,{packet:new c$({destinationIdentities:[e],kind:l$.RELIABLE,value:{case:`rpcResponse`,value:new x$({requestId:t,value:r?{case:`error`,value:r.toProto()}:{case:`payload`,value:n??``}})}})})}publishRpcResponse(e,t,n){return J(this,void 0,void 0,function*(){if(this.getRemoteParticipantClientProtocol(e)>=1){let r=yield this.outgoingDataStreamManager.streamText({topic:C8,destinationIdentities:[e],attributes:{[w8.RPC_REQUEST_ID]:t}});yield r.write(n),yield r.close();return}if(E8(n)>x8){this.log.warn(`RPC Response payload too large for request ${t}. To send larger responses, consider updating the sending client.`),this.publishRpcResponsePacket(e,t,null,b8.builtIn(`RESPONSE_PAYLOAD_TOO_LARGE`));return}this.publishRpcResponsePacket(e,t,n,null)})}},O8=class extends s3{constructor(e,t,n,r,i,a){super(e,t,$.Kind.Audio,n,a),this.monitorReceiver=()=>J(this,void 0,void 0,function*(){if(!this.receiver){this._currentBitrate=0;return}let e=yield this.getReceiverStats();e&&this.prevStats&&this.receiver&&(this._currentBitrate=o3(e,this.prevStats)),this.prevStats=e}),this.audioContext=r,this.webAudioPluginNodes=[],i&&(this.sinkId=i.deviceId)}setVolume(e){var t;for(let n of this.attachedElements)this.audioContext?(t=this.gainNode)==null||t.gain.setTargetAtTime(e,0,.1):n.volume=e;b4()&&this._mediaStreamTrack._setVolume(e),this.elementVolume=e}getVolume(){if(this.elementVolume)return this.elementVolume;if(b4())return 1;let e=0;return this.attachedElements.forEach(t=>{t.volume>e&&(e=t.volume)}),e}setSinkId(e){return J(this,void 0,void 0,function*(){this.sinkId=e,yield Promise.all(this.attachedElements.map(t=>{if(p4(t))return t.setSinkId(e)}))})}attach(e){let t=this.attachedElements.length===0;return e?super.attach(e):e=super.attach(),this.sinkId&&p4(e)&&e.setSinkId(this.sinkId).catch(e=>{this.log.error(`Failed to set sink id on remote audio track`,e,this.logContext)}),this.audioContext&&t&&(this.log.debug(`using audio context mapping`,this.logContext),this.connectWebAudio(this.audioContext,e),e.volume=0,e.muted=!0),this.elementVolume&&this.setVolume(this.elementVolume),e}detach(e){let t;return e?(t=super.detach(e),this.audioContext&&(this.attachedElements.length>0?this.connectWebAudio(this.audioContext,this.attachedElements[0]):this.disconnectWebAudio())):(t=super.detach(),this.disconnectWebAudio()),t}setAudioContext(e){this.audioContext=e,e&&this.attachedElements.length>0?this.connectWebAudio(e,this.attachedElements[0]):e||this.disconnectWebAudio()}setWebAudioPlugins(e){this.webAudioPluginNodes=e,this.attachedElements.length>0&&this.audioContext&&this.connectWebAudio(this.audioContext,this.attachedElements[0])}connectWebAudio(e,t){this.disconnectWebAudio(),this.sourceNode=e.createMediaStreamSource(t.srcObject);let n=this.sourceNode;this.webAudioPluginNodes.forEach(e=>{n.connect(e),n=e}),this.gainNode=e.createGain(),n.connect(this.gainNode),this.gainNode.connect(e.destination),this.elementVolume&&this.gainNode.gain.setTargetAtTime(this.elementVolume,0,.1),e.state!==`running`&&e.resume().then(()=>{e.state!==`running`&&this.emit(Q.AudioPlaybackFailed,Error(`Audio Context couldn't be started automatically`))}).catch(e=>{this.emit(Q.AudioPlaybackFailed,e)})}disconnectWebAudio(){var e,t;(e=this.gainNode)==null||e.disconnect(),(t=this.sourceNode)==null||t.disconnect(),this.gainNode=void 0,this.sourceNode=void 0}getReceiverStats(){return J(this,void 0,void 0,function*(){if(!this.receiver||!this.receiver.getStats)return;let e=yield this.receiver.getStats(),t;return e.forEach(e=>{e.type===`inbound-rtp`&&(t={type:`audio`,streamId:e.id,timestamp:e.timestamp,jitter:e.jitter,bytesReceived:e.bytesReceived,concealedSamples:e.concealedSamples,concealmentEvents:e.concealmentEvents,silentConcealedSamples:e.silentConcealedSamples,silentConcealmentEvents:e.silentConcealmentEvents,totalAudioEnergy:e.totalAudioEnergy,totalSamplesDuration:e.totalSamplesDuration})}),t})}},k8=class extends v0.EventEmitter{constructor(e,t,n,r){super(),this.metadataMuted=!1,this.encryption=t$.NONE,this.log=r0,this.handleMuted=()=>{this.emit(Q.Muted)},this.handleUnmuted=()=>{this.emit(Q.Unmuted)},this.log=i0(r?.loggerName??n0.Publication),this.loggerContextCb=this.loggerContextCb,this.setMaxListeners(100),this.kind=e,this.trackSid=t,this.trackName=n,this.source=$.Source.Unknown}setTrack(e){this.track&&(this.track.off(Q.Muted,this.handleMuted),this.track.off(Q.Unmuted,this.handleUnmuted)),this.track=e,e&&(e.on(Q.Muted,this.handleMuted),e.on(Q.Unmuted,this.handleUnmuted))}get logContext(){return Object.assign(Object.assign({},this.loggerContextCb?.call(this)),t4(this))}get isMuted(){return this.metadataMuted}get isEnabled(){return!0}get isSubscribed(){return this.track!==void 0}get isEncrypted(){return this.encryption!==t$.NONE}get audioTrack(){if(V4(this.track))return this.track}get videoTrack(){if(H4(this.track))return this.track}updateInfo(e){this.trackSid=e.sid,this.trackName=e.name,this.source=$.sourceFromProto(e.source),this.mimeType=e.mimeType,this.kind===$.Kind.Video&&e.width>0&&(this.dimensions={width:e.width,height:e.height},this.simulcasted=e.simulcast),this.encryption=e.encryption,this.trackInfo=e,this.log.debug(`update publication info`,Object.assign(Object.assign({},this.logContext),{info:e}))}};(function(e){(function(e){e.Desired=`desired`,e.Subscribed=`subscribed`,e.Unsubscribed=`unsubscribed`})(e.SubscriptionStatus||={}),(function(e){e.Allowed=`allowed`,e.NotAllowed=`not_allowed`})(e.PermissionStatus||={})})(k8||={});var A8=class extends k8{get isUpstreamPaused(){return this.track?.isUpstreamPaused}constructor(e,t,n,r){super(e,t.sid,t.name,r),this.track=void 0,this.handleTrackEnded=()=>{this.emit(Q.Ended)},this.handleCpuConstrained=()=>{this.track&&H4(this.track)&&this.emit(Q.CpuConstrained,this.track)},this.updateInfo(t),this.setTrack(n)}setTrack(e){this.track&&(this.track.off(Q.Ended,this.handleTrackEnded),this.track.off(Q.CpuConstrained,this.handleCpuConstrained)),super.setTrack(e),e&&(e.on(Q.Ended,this.handleTrackEnded),e.on(Q.CpuConstrained,this.handleCpuConstrained))}get isMuted(){return this.track?this.track.isMuted:super.isMuted}get audioTrack(){return super.audioTrack}get videoTrack(){return super.videoTrack}get isLocal(){return!0}mute(){return J(this,void 0,void 0,function*(){return this.track?.mute()})}unmute(){return J(this,void 0,void 0,function*(){return this.track?.unmute()})}pauseUpstream(){return J(this,void 0,void 0,function*(){yield this.track?.pauseUpstream()})}resumeUpstream(){return J(this,void 0,void 0,function*(){yield this.track?.resumeUpstream()})}getTrackFeatures(){if(V4(this.track)){let e=this.track.getSourceTrackSettings(),t=new Set;return e.autoGainControl&&t.add(KQ.TF_AUTO_GAIN_CONTROL),e.echoCancellation&&t.add(KQ.TF_ECHO_CANCELLATION),e.noiseSuppression&&t.add(KQ.TF_NOISE_SUPPRESSION),e.channelCount&&e.channelCount>1&&t.add(KQ.TF_STEREO),this.options?.dtx||t.add(KQ.TF_NO_DTX),this.track.enhancedNoiseCancellation&&t.add(KQ.TF_ENHANCED_NOISE_CANCELLATION),Array.from(t.values())}else return[]}};function j8(e,t){return J(this,void 0,void 0,function*(){e??={};let n=!1,r=n4(e),i=r.audioProcessor,a=r.videoProcessor,o=r.optionsWithoutProcessor,s=o.audio,c=o.video;if(i&&typeof o.audio==`object`&&(o.audio.processor=i),a&&typeof o.video==`object`&&(o.video.processor=a),e.audio&&typeof o.audio==`object`&&typeof o.audio.deviceId==`string`){let e=o.audio.deviceId;o.audio.deviceId={exact:e},n=!0,s=Object.assign(Object.assign({},o.audio),{deviceId:{ideal:e}})}if(o.video&&typeof o.video==`object`&&typeof o.video.deviceId==`string`){let e=o.video.deviceId;o.video.deviceId={exact:e},n=!0,c=Object.assign(Object.assign({},o.video),{deviceId:{ideal:e}})}o.audio===!0?o.audio={deviceId:`default`}:typeof o.audio==`object`&&o.audio!==null&&(o.audio=Object.assign(Object.assign({},o.audio),{deviceId:o.audio.deviceId||`default`})),o.video===!0?o.video={deviceId:`default`}:typeof o.video==`object`&&!o.video.deviceId&&(o.video.deviceId=`default`);let l=Z2(Y2(o,W3,G3)),u=navigator.mediaDevices.getUserMedia(l);o.audio&&(m3.userMediaPromiseMap.set(`audioinput`,u),u.catch(()=>m3.userMediaPromiseMap.delete(`audioinput`))),o.video&&(m3.userMediaPromiseMap.set(`videoinput`,u),u.catch(()=>m3.userMediaPromiseMap.delete(`videoinput`)));try{let e=yield u;return yield Promise.all(e.getTracks().map(n=>J(this,void 0,void 0,function*(){let r=n.kind===`audio`,o,s=r?l.audio:l.video;typeof s!=`boolean`&&(o=s);let c=n.getSettings().deviceId;o?.deviceId&&F4(o.deviceId)!==c?o.deviceId=c:o||={deviceId:c};let u=Fue(n,o,t);return u.kind===$.Kind.Video?u.source=$.Source.Camera:u.kind===$.Kind.Audio&&(u.source=$.Source.Microphone),u.mediaStream=e,V4(u)&&i?yield u.setProcessor(i):H4(u)&&a&&(yield u.setProcessor(a)),u})))}catch(r){if(!n)throw r;return j8(Object.assign(Object.assign({},e),{audio:s,video:c}),t)}})}var M8;(function(e){e.Excellent=`excellent`,e.Good=`good`,e.Poor=`poor`,e.Lost=`lost`,e.Unknown=`unknown`})(M8||={});function Sde(e){switch(e){case VQ.EXCELLENT:return M8.Excellent;case VQ.GOOD:return M8.Good;case VQ.POOR:return M8.Poor;case VQ.LOST:return M8.Lost;default:return M8.Unknown}}var N8=class extends v0.EventEmitter{get logContext(){var e;return Object.assign({},((e=this.loggerOptions)?.loggerContextCb)?.call(e))}get isEncrypted(){return this.trackPublications.size>0&&Array.from(this.trackPublications.values()).every(e=>e.isEncrypted)}get isAgent(){return this.permissions?.agent||this.kind===$Q.AGENT}get isActive(){return this.participantInfo?.state===QQ.ACTIVE}get kind(){return this._kind}get attributes(){return Object.freeze(Object.assign({},this._attributes))}constructor(e,t,n,r,i,a){let o=arguments.length>6&&arguments[6]!==void 0?arguments[6]:$Q.STANDARD;super(),this.audioLevel=0,this.isSpeaking=!1,this._connectionQuality=M8.Unknown,this.log=r0,this.loggerOptions=a,this.log=i0(a?.loggerName??n0.Participant,()=>this.logContext),this.setMaxListeners(100),this.sid=e,this.identity=t,this.name=n,this.metadata=r,this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.trackPublications=new Map,this._kind=o,this._attributes=i??{}}getTrackPublications(){return Array.from(this.trackPublications.values())}getTrackPublication(e){for(let t of this.trackPublications){let n=hZ(t,2)[1];if(n.source===e)return n}}getTrackPublicationByName(e){for(let t of this.trackPublications){let n=hZ(t,2)[1];if(n.trackName===e)return n}}waitUntilActive(){return this.isActive?Promise.resolve():this.activeFuture?this.activeFuture.promise:(this.activeFuture=new P4,this.once(X.Active,()=>{var e,t;(t=(e=this.activeFuture)?.resolve)==null||t.call(e),this.activeFuture=void 0}),this.activeFuture.promise)}get connectionQuality(){return this._connectionQuality}get isCameraEnabled(){return!(this.getTrackPublication($.Source.Camera)?.isMuted??!0)}get isMicrophoneEnabled(){return!(this.getTrackPublication($.Source.Microphone)?.isMuted??!0)}get isScreenShareEnabled(){return!!this.getTrackPublication($.Source.ScreenShare)}get isLocal(){return!1}get joinedAt(){return this.participantInfo?new Date(Number.parseInt(this.participantInfo.joinedAt.toString())*1e3):new Date}updateInfo(e){return this.participantInfo&&this.participantInfo.sid===e.sid&&this.participantInfo.version>e.version?!1:(this.identity=e.identity,this.sid=e.sid,this._setName(e.name),this._setMetadata(e.metadata),this._setAttributes(e.attributes),e.state===QQ.ACTIVE&&this.participantInfo?.state!==QQ.ACTIVE&&this.emit(X.Active),e.permission&&this.setPermissions(e.permission),this.participantInfo=e,!0)}_setMetadata(e){let t=this.metadata!==e,n=this.metadata;this.metadata=e,t&&this.emit(X.ParticipantMetadataChanged,n)}_setName(e){let t=this.name!==e;this.name=e,t&&this.emit(X.ParticipantNameChanged,e)}_setAttributes(e){let t=yle(this.attributes,e);this._attributes=e,Object.keys(t).length>0&&this.emit(X.AttributesChanged,t)}setPermissions(e){let t=this.permissions,n=e.canPublish!==this.permissions?.canPublish||e.canSubscribe!==this.permissions?.canSubscribe||e.canPublishData!==this.permissions?.canPublishData||e.hidden!==this.permissions?.hidden||e.recorder!==this.permissions?.recorder||e.canPublishSources.length!==this.permissions.canPublishSources.length||e.canPublishSources.some((e,t)=>e!==this.permissions?.canPublishSources[t])||e.canSubscribeMetrics!==this.permissions?.canSubscribeMetrics;return this.permissions=e,n&&this.emit(X.ParticipantPermissionsChanged,t),n}setIsSpeaking(e){e!==this.isSpeaking&&(this.isSpeaking=e,e&&(this.lastSpokeAt=new Date),this.emit(X.IsSpeakingChanged,e))}setConnectionQuality(e){let t=this._connectionQuality;this._connectionQuality=Sde(e),t!==this._connectionQuality&&this.emit(X.ConnectionQualityChanged,this._connectionQuality)}setDisconnected(){var e,t;this.activeFuture&&=((t=(e=this.activeFuture).reject)==null||t.call(e,Error(`Participant disconnected`)),void 0)}setAudioContext(e){this.audioContext=e,this.audioTrackPublications.forEach(t=>V4(t.track)&&t.track.setAudioContext(e))}addTrackPublication(e){e.on(Q.Muted,()=>{this.emit(X.TrackMuted,e)}),e.on(Q.Unmuted,()=>{this.emit(X.TrackUnmuted,e)});let t=e;switch(t.track&&(t.track.sid=e.trackSid),this.trackPublications.set(e.trackSid,e),e.kind){case $.Kind.Audio:this.audioTrackPublications.set(e.trackSid,e);break;case $.Kind.Video:this.videoTrackPublications.set(e.trackSid,e);break}}};function Cde(e){if(!e.participantSid&&!e.participantIdentity)throw Error(`Invalid track permission, must provide at least one of participantIdentity and participantSid`);return new O1({participantIdentity:e.participantIdentity??``,participantSid:e.participantSid??``,allTracks:e.allowAll??!1,trackSids:e.allowedTrackSids||[]})}var wde=class extends N8{constructor(e,t,n,r,i,a,o,s){super(e,t,void 0,void 0,void 0,{loggerName:r.loggerName,loggerContextCb:()=>this.engine.logContext}),this.pendingPublishing=new Set,this.pendingPublishPromises=new Map,this.participantTrackPermissions=[],this.allParticipantsAllowedToSubscribe=!0,this.encryptionType=t$.NONE,this.e2eeStateMutex=new OX,this.enabledPublishVideoCodecs=[],this.handleReconnecting=()=>{this.reconnectFuture||=new P4},this.handleReconnected=()=>{var e,t;(t=(e=this.reconnectFuture)?.resolve)==null||t.call(e),this.reconnectFuture=void 0,this.updateTrackSubscriptionPermissions()},this.handleClosing=()=>{var e,t,n,r,i,a;this.reconnectFuture&&=(this.reconnectFuture.promise.catch(e=>this.log.warn(e.message)),(t=(e=this.reconnectFuture)?.reject)==null||t.call(e,Error(`Got disconnected during reconnection attempt`)),void 0),this.signalConnectedFuture&&=((r=(n=this.signalConnectedFuture).reject)==null||r.call(n,Error(`Got disconnected without signal connected`)),void 0),(a=(i=this.activeAgentFuture)?.reject)==null||a.call(i,Error(`Got disconnected without active agent present`)),this.activeAgentFuture=void 0,this.firstActiveAgent=void 0},this.handleSignalConnected=e=>{var t,n;e.participant&&this.updateInfo(e.participant),this.signalConnectedFuture||=new P4,(n=(t=this.signalConnectedFuture).resolve)==null||n.call(t)},this.handleSignalRequestResponse=e=>{let t=e.requestId,n=e.reason,r=e.message,i=this.pendingSignalRequests.get(t);switch(i&&(n!==H1.OK&&i.reject(new L2(r,n)),this.pendingSignalRequests.delete(t)),e.request.case){case`publishDataTrack`:{let t;switch(e.reason){case H1.NOT_ALLOWED:t=d8.notAllowed(e.message);break;case H1.DUPLICATE_NAME:t=d8.duplicateName(e.message);break;case H1.INVALID_NAME:t=d8.invalidName(e.message);break;case H1.LIMIT_EXCEEDED:t=d8.limitReached(e.message);break;default:t=d8.unknown(e.reason,e.message);break}this.roomOutgoingDataTrackManager.receivedSfuPublishResponse(e.request.value.pubHandle,{type:`error`,error:t});break}}},this.updateTrackSubscriptionPermissions=()=>{this.log.debug(`updating track subscription permissions`,{allParticipantsAllowed:this.allParticipantsAllowedToSubscribe,participantTrackPermissions:this.participantTrackPermissions}),this.engine.client.sendUpdateSubscriptionPermissions(this.allParticipantsAllowedToSubscribe,this.participantTrackPermissions.map(e=>Cde(e)))},this.onTrackUnmuted=e=>{this.onTrackMuted(e,e.isUpstreamPaused)},this.onTrackMuted=(e,t)=>{if(t===void 0&&(t=!0),!e.sid){this.log.error(`could not update mute status for unpublished track`,t4(e));return}this.engine.updateMuteStatus(e.sid,t)},this.onTrackUpstreamPaused=e=>{this.log.debug(`upstream paused`,t4(e)),this.onTrackMuted(e,!0)},this.onTrackUpstreamResumed=e=>{this.log.debug(`upstream resumed`,t4(e)),this.onTrackMuted(e,e.isMuted)},this.onTrackFeatureUpdate=e=>{let t=this.audioTrackPublications.get(e.sid);if(!t){this.log.warn(`Could not update local audio track settings, missing publication for track ${e.sid}`);return}this.engine.client.sendUpdateLocalAudioTrack(t.trackSid,t.getTrackFeatures())},this.onTrackCpuConstrained=(e,t)=>{this.log.debug(`track cpu constrained`,t4(t)),this.emit(X.LocalTrackCpuConstrained,e,t)},this.handleSubscribedQualityUpdate=e=>J(this,void 0,void 0,function*(){var t,n,r,i;if(!this.roomOptions?.dynacast)return;let a=this.videoTrackPublications.get(e.trackSid);if(!a){this.log.warn(`received subscribed quality update for unknown track`,{trackSid:e.trackSid});return}if(!a.videoTrack)return;let o=yield a.videoTrack.setPublishingCodecs(e.subscribedCodecs);try{for(var s=!0,c=h0(o),l;l=yield c.next(),t=l.done,!t;s=!0){i=l.value,s=!1;let e=i;fle(e)&&(this.log.debug(`publish ${e} for ${a.videoTrack.sid}`,t4(a)),yield this.publishAdditionalCodecForTrack(a.videoTrack,e,a.options))}}catch(e){n={error:e}}finally{try{!s&&!t&&(r=c.return)&&(yield r.call(c))}finally{if(n)throw n.error}}}),this.handleLocalTrackUnpublished=e=>{let t=this.trackPublications.get(e.trackSid);if(!t){this.log.warn(`received unpublished event for unknown track`,{trackSid:e.trackSid});return}this.unpublishTrack(t.track)},this.handleTrackEnded=e=>J(this,void 0,void 0,function*(){if(e.source===$.Source.ScreenShare||e.source===$.Source.ScreenShareAudio)this.log.debug(`unpublishing local track due to TrackEnded`,t4(e)),this.unpublishTrack(e);else if(e.isUserProvided)yield e.mute();else if(W4(e)||U4(e))try{if(y4())try{let t=yield navigator==null?void 0:navigator.permissions.query({name:e.source===$.Source.Camera?`camera`:`microphone`});if(t&&t.state===`denied`)throw this.log.warn(`user has revoked access to ${e.source}`,t4(e)),t.onchange=()=>{t.state!==`denied`&&(e.isMuted||e.restartTrack(),t.onchange=null)},Error(`GetUserMedia Permission denied`)}catch{}e.isMuted||(this.log.debug(`track ended, attempting to use a different device`,t4(e)),W4(e)?yield e.restartTrack({deviceId:`default`}):yield e.restartTrack())}catch{this.log.warn(`could not restart track, muting instead`,t4(e)),yield e.mute()}}),this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.trackPublications=new Map,this.engine=n,this.roomOptions=r,this.setupEngine(n),this.activeDeviceMap=new Map([[`audioinput`,`default`],[`videoinput`,`default`],[`audiooutput`,`default`]]),this.pendingSignalRequests=new Map,this.roomOutgoingDataStreamManager=i,this.roomOutgoingDataTrackManager=a,this.rpcClientManager=o,this.rpcServerManager=s}get lastCameraError(){return this.cameraError}get lastMicrophoneError(){return this.microphoneError}get isE2EEEnabled(){return this.encryptionType!==t$.NONE}getTrackPublication(e){let t=super.getTrackPublication(e);if(t)return t}getTrackPublicationByName(e){let t=super.getTrackPublicationByName(e);if(t)return t}setupEngine(e){this.engine=e,this.engine.on(Z.RemoteMute,(e,t)=>{let n=this.trackPublications.get(e);!n||!n.track||(t?n.mute():n.unmute())}),this.signalConnectedFuture?.isResolved&&(this.signalConnectedFuture=void 0),this.engine.on(Z.Connected,this.handleReconnected).on(Z.SignalConnected,this.handleSignalConnected).on(Z.SignalRestarted,this.handleReconnected).on(Z.SignalResumed,this.handleReconnected).on(Z.Restarting,this.handleReconnecting).on(Z.Resuming,this.handleReconnecting).on(Z.LocalTrackUnpublished,this.handleLocalTrackUnpublished).on(Z.SubscribedQualityUpdate,this.handleSubscribedQualityUpdate).on(Z.Closing,this.handleClosing).on(Z.SignalRequestResponse,this.handleSignalRequestResponse)}setMetadata(e){return J(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({metadata:e})})}setName(e){return J(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({name:e})})}setAttributes(e){return J(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({attributes:e})})}requestMetadataUpdate(e){return J(this,arguments,void 0,function(e){var t=this;let n=e.metadata,r=e.name,i=e.attributes;return function*(){return new C2((e,a)=>J(t,void 0,void 0,function*(){try{let t=!1,o=yield this.engine.client.sendUpdateLocalMetadata(n??this.metadata??``,r??this.name??``,i),s=performance.now();for(this.pendingSignalRequests.set(o,{resolve:e,reject:e=>{a(e),t=!0},values:{name:r,metadata:n,attributes:i}});performance.now()-s<5e3&&!t;){if((!r||this.name===r)&&(!n||this.metadata===n)&&(!i||Object.entries(i).every(e=>{let t=hZ(e,2),n=t[0],r=t[1];return this.attributes[n]===r||r===``&&!this.attributes[n]}))){this.pendingSignalRequests.delete(o),e();return}yield l4(50)}a(new L2(`Request to update local metadata timed out`,`TimeoutError`))}catch(e){e instanceof Error?a(e):a(Error(String(e)))}}))}()})}setCameraEnabled(e,t,n){return this.setTrackEnabled($.Source.Camera,e,t,n)}setMicrophoneEnabled(e,t,n){return this.setTrackEnabled($.Source.Microphone,e,t,n)}setScreenShareEnabled(e,t,n){return this.setTrackEnabled($.Source.ScreenShare,e,t,n)}setE2EEEnabled(e){return J(this,void 0,void 0,function*(){let t=yield this.e2eeStateMutex.lock();try{if(this.encryptionType=e?t$.GCM:t$.NONE,yield Promise.all(this.pendingPublishPromises.values()),this.trackPublications.size===0||Array.from(this.trackPublications.values()).every(t=>t.isEncrypted===e))return;yield this.republishAllTracks(void 0,!1)}finally{t()}})}setTrackEnabled(e,t,n,r){return J(this,void 0,void 0,function*(){this.log.debug(`setTrackEnabled`,{source:e,enabled:t}),this.republishPromise&&(yield this.republishPromise);let i=this.getTrackPublication(e);if(t)if(i)yield i.unmute();else{let t;if(this.pendingPublishing.has(e)){let t=yield this.waitForPendingPublicationOfSource(e);return t||this.log.info(`waiting for pending publication promise timed out`,{source:e}),yield t?.unmute(),t}this.pendingPublishing.add(e);try{switch(e){case $.Source.Camera:t=yield this.createTracks({video:n??!0});break;case $.Source.Microphone:t=yield this.createTracks({audio:n??!0});break;case $.Source.ScreenShare:t=yield this.createScreenTracks(Object.assign({},n));break;default:throw new N2(e)}}catch(n){throw t?.forEach(e=>{e.stop()}),n instanceof Error&&this.emit(X.MediaDevicesError,n,$2(e)),this.pendingPublishing.delete(e),n}for(let r of t){let t=Object.assign(Object.assign({},this.roomOptions.publishDefaults),n);e===$.Source.Microphone&&V4(r)&&t.preConnectBuffer&&(this.log.info(`starting preconnect buffer for microphone`),r.startPreConnectBuffer())}try{let e=[];for(let n of t)this.log.info(`publishing track`,t4(n)),e.push(this.publishTrack(n,r));i=hZ(yield Promise.all(e),1)[0]}catch(e){throw t?.forEach(e=>{e.stop()}),e}finally{this.pendingPublishing.delete(e)}}else if(!i?.track&&this.pendingPublishing.has(e)&&(i=yield this.waitForPendingPublicationOfSource(e),i||this.log.info(`waiting for pending publication promise timed out`,{source:e})),i&&i.track)if(e===$.Source.ScreenShare){let e=[this.unpublishTrack(i.track)],t=this.getTrackPublication($.Source.ScreenShareAudio);t&&t.track&&e.push(this.unpublishTrack(t.track)),i=hZ(yield Promise.all(e),1)[0]}else yield i.mute();return i})}enableCameraAndMicrophone(){return J(this,void 0,void 0,function*(){if(!(this.pendingPublishing.has($.Source.Camera)||this.pendingPublishing.has($.Source.Microphone))){this.pendingPublishing.add($.Source.Camera),this.pendingPublishing.add($.Source.Microphone);try{let e=yield this.createTracks({audio:!0,video:!0});yield Promise.all(e.map(e=>this.publishTrack(e)))}finally{this.pendingPublishing.delete($.Source.Camera),this.pendingPublishing.delete($.Source.Microphone)}}})}createTracks(e){return J(this,void 0,void 0,function*(){e??={};let t=Y2(e,this.roomOptions?.audioCaptureDefaults,this.roomOptions?.videoCaptureDefaults);try{return(yield j8(t,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext})).map(e=>(V4(e)&&(this.microphoneError=void 0,e.setAudioContext(this.audioContext),e.source=$.Source.Microphone,this.emit(X.AudioStreamAcquired)),H4(e)&&(this.cameraError=void 0,e.source=$.Source.Camera),e))}catch(t){throw t instanceof Error&&(e.audio&&(this.microphoneError=t),e.video&&(this.cameraError=t)),t}})}createScreenTracks(e){return J(this,void 0,void 0,function*(){if(e===void 0&&(e={}),navigator.mediaDevices.getDisplayMedia===void 0)throw new M2(`getDisplayMedia not supported`);e.resolution===void 0&&!kle()&&(e.resolution=J2.h1080fps30.resolution);let t=gle(e),n=yield navigator.mediaDevices.getDisplayMedia(t),r=n.getVideoTracks();if(r.length===0)throw new N2(`no video track found`);let i=new a6(r[0],void 0,!1,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});i.source=$.Source.ScreenShare,e.contentHint&&(i.mediaStreamTrack.contentHint=e.contentHint);let a=[i];if(n.getAudioTracks().length>0){this.emit(X.AudioStreamAcquired);let e=new Z3(n.getAudioTracks()[0],void 0,!1,this.audioContext,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});e.source=$.Source.ScreenShareAudio,a.push(e)}return a})}publishTrack(e,t){return J(this,void 0,void 0,function*(){return this.publishOrRepublishTrack(e,t)})}waitForNextEngineRestart(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:15e3;return new Promise((t,n)=>{let r=()=>{clearTimeout(o),this.engine.off(Z.Restarted,i),this.engine.off(Z.Closing,a)},i=()=>{r(),t()},a=()=>{r(),n(Error(`engine closed before restart completed`))},o=setTimeout(()=>{r(),n(Error(`timed out waiting for engine restart`))},e);this.engine.once(Z.Restarted,i),this.engine.once(Z.Closing,a)})}publishOrRepublishTrack(e,t){return J(this,arguments,void 0,function(e,t){var n=this;let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;return function*(){W4(e)&&e.setAudioContext(n.audioContext),yield n.reconnectFuture?.promise,n.republishPromise&&!r&&(yield n.republishPromise),B4(e)&&n.pendingPublishPromises.has(e)&&(yield n.pendingPublishPromises.get(e));let a;if(e instanceof MediaStreamTrack)a=e.getConstraints();else{a=e.constraints;let t;switch(e.source){case $.Source.Microphone:t=`audioinput`;break;case $.Source.Camera:t=`videoinput`}t&&n.activeDeviceMap.has(t)&&(a=Object.assign(Object.assign({},a),{deviceId:n.activeDeviceMap.get(t)}))}if(e instanceof MediaStreamTrack)switch(e.kind){case`audio`:e=new Z3(e,a,!0,n.audioContext,{loggerName:n.roomOptions.loggerName,loggerContextCb:()=>n.logContext});break;case`video`:e=new a6(e,a,!0,{loggerName:n.roomOptions.loggerName,loggerContextCb:()=>n.logContext});break;default:throw new N2(`unsupported MediaStreamTrack kind ${e.kind}`)}else e.updateLoggerOptions({loggerName:n.roomOptions.loggerName,loggerContextCb:()=>n.logContext});let o;if(n.trackPublications.forEach(t=>{t.track&&t.track===e&&(o=t)}),o)return n.log.warn(`track has already been published, skipping`,t4(o)),o;let s=Object.assign(Object.assign({},n.roomOptions.publishDefaults),t),c=`channelCount`in e.mediaStreamTrack.getSettings()&&e.mediaStreamTrack.getSettings().channelCount===2||e.mediaStreamTrack.getConstraints().channelCount===2,l=s.forceStereo??c;l&&(s.dtx===void 0&&n.log.debug(`Opus DTX will be disabled for stereo tracks by default. Enable them explicitly to make it work.`,t4(e)),s.red===void 0&&n.log.debug(`Opus RED will be disabled for stereo tracks by default. Enable them explicitly to make it work.`),s.dtx??=!1,s.red??=!1),!jle()&&n.roomOptions.e2ee&&(n.log.info(`End-to-end encryption is set up, simulcast publishing will be disabled on Safari versions and iOS browsers running iOS < v17.2`),s.simulcast=!1),s.source&&(e.source=s.source);let u=new Promise((t,r)=>J(n,void 0,void 0,function*(){try{if(this.engine.client.currentState!==w3.CONNECTED){this.log.debug(`deferring track publication until signal is connected`,{track:t4(e)});let n=!1,i=setTimeout(()=>{n=!0,e.stop(),r(new I2(`publishing rejected as engine not connected within timeout`,408))},15e3);if(yield this.waitUntilEngineConnected(),clearTimeout(i),n)return;t(yield this.publish(e,s,l))}else try{t(yield this.publish(e,s,l))}catch(e){r(e)}}catch(e){r(e)}}));n.pendingPublishPromises.set(e,u);try{return yield u}catch(a){if(!i&&a instanceof F2)return n.log.warn(`negotiation due to track publish failed, retrying after reconnect`,{error:a}),n.pendingPublishPromises.delete(e),yield n.waitForNextEngineRestart(),yield n.publishOrRepublishTrack(e,t,r,!0);throw a}finally{n.pendingPublishPromises.delete(e)}}()})}waitUntilEngineConnected(){return this.signalConnectedFuture||=new P4,this.signalConnectedFuture.promise}hasPermissionsToPublish(e){if(!this.permissions)return this.log.warn(`no permissions present for publishing track`,t4(e)),!1;let t=this.permissions,n=t.canPublish,r=t.canPublishSources;return n&&(r.length===0||r.map(e=>ble(e)).includes(e.source))?!0:(this.log.warn(`insufficient permissions to publish`,t4(e)),!1)}publish(e,t,n){return J(this,void 0,void 0,function*(){if(!this.hasPermissionsToPublish(e))throw new I2(`failed to publish track, insufficient permissions`,403);Array.from(this.trackPublications.values()).find(t=>B4(e)&&t.source===e.source)&&e.source!==$.Source.Unknown&&this.log.info(`publishing a second track with the same source: ${e.source}`,t4(e)),t.stopMicTrackOnMute&&V4(e)&&(e.stopOnMute=!0),e.source===$.Source.ScreenShare&&m4()&&(t.simulcast=!1),t.videoCodec===`av1`&&!Tle()&&(t.videoCodec=void 0),t.videoCodec===`vp9`&&!Ele()&&(t.videoCodec=void 0),t.videoCodec===void 0&&(t.videoCodec=U3),this.enabledPublishVideoCodecs.length>0&&(this.enabledPublishVideoCodecs.some(e=>t.videoCodec===e4(e.mime))||(t.videoCodec=e4(this.enabledPublishVideoCodecs[0].mime)));let r=t.videoCodec;e.on(Q.Muted,this.onTrackMuted),e.on(Q.Unmuted,this.onTrackUnmuted),e.on(Q.Ended,this.handleTrackEnded),e.on(Q.UpstreamPaused,this.onTrackUpstreamPaused),e.on(Q.UpstreamResumed,this.onTrackUpstreamResumed),e.on(Q.AudioTrackFeatureUpdate,this.onTrackFeatureUpdate);let i=[],a=!(t.dtx??!0),o=e.getSourceTrackSettings();o.autoGainControl&&i.push(KQ.TF_AUTO_GAIN_CONTROL),o.echoCancellation&&i.push(KQ.TF_ECHO_CANCELLATION),o.noiseSuppression&&i.push(KQ.TF_NOISE_SUPPRESSION),o.channelCount&&o.channelCount>1&&i.push(KQ.TF_STEREO),a&&i.push(KQ.TF_NO_DTX),W4(e)&&e.hasPreConnectBuffer&&i.push(KQ.TF_PRECONNECT_BUFFER);let s=this.normalizeRequestedFrameMetadataOptions(e,t),c=new K$({cid:e.mediaStreamTrack.id,name:t.name,type:$.kindToProto(e.kind),muted:e.isMuted,source:$.sourceToProto(e.source),disableDtx:a,encryption:this.encryptionType,stereo:n,disableRed:this.isE2EEEnabled||!(t.red??!0),stream:t?.stream,backupCodecPolicy:t?.backupCodecPolicy,audioFeatures:i,packetTrailerFeatures:s}),l;if(e.kind===$.Kind.Video){let n;try{n=yield e.waitForDimensions()}catch{let t=this.roomOptions.videoCaptureDefaults?.resolution??K2.h720.resolution;n={width:t.width,height:t.height},this.log.error(`could not determine track dimensions, using defaults`,Object.assign(Object.assign({},t4(e)),{dims:n}))}c.width=n.width,c.height=n.height,U4(e)&&(f4(r)&&(e.source===$.Source.ScreenShare&&(t.scalabilityMode=`L1T3`,`contentHint`in e.mediaStreamTrack&&(e.mediaStreamTrack.contentHint=`motion`,this.log.debug(`forcing contentHint to motion for screenshare with SVC codecs`,t4(e)))),t.scalabilityMode=t.scalabilityMode??`L3T3_KEY`),c.simulcastCodecs=[new G$({codec:r,cid:e.mediaStreamTrack.id})],t.backupCodec===!0&&(t.backupCodec={codec:U3}),t.backupCodec&&r!==t.backupCodec.codec&&c.encryption===t$.NONE&&(this.roomOptions.dynacast||(this.roomOptions.dynacast=!0),c.simulcastCodecs.push(new G$({codec:t.backupCodec.codec,cid:``})))),l=$3(e.source===$.Source.ScreenShare,c.width,c.height,t),c.layers=c6(c.width,c.height,l,f4(t.videoCodec))}else e.kind===$.Kind.Audio&&(l=[{maxBitrate:t.audioPreset?.maxBitrate,priority:t.audioPreset?.priority??`high`,networkPriority:t.audioPreset?.priority??`high`}]);if(!this.engine||this.engine.isClosed)throw new P2(`cannot publish track when not connected`);let u=()=>J(this,void 0,void 0,function*(){if(!this.engine.pcManager)throw new P2(`pcManager is not ready`);if(e.sender=yield this.engine.createSender(e,t,l),U4(e)&&(e.publishOptions=t),this.emit(X.LocalSenderCreated,e.sender,e),U4(e)&&(t.degradationPreference??=Wue(e),e.setDegradationPreference(t.degradationPreference)),l)if(m4()&&e.kind===$.Kind.Audio){let t;for(let n of this.engine.pcManager.publisher.getTransceivers())if(n.sender===e.sender){t=n;break}t&&this.engine.pcManager.publisher.setTrackCodecBitrate({transceiver:t,codec:`opus`,maxbr:l[0]?.maxBitrate?l[0].maxBitrate/1e3:0})}else e.codec&&f4(e.codec)&&l[0]?.maxBitrate&&this.engine.pcManager.publisher.setTrackCodecBitrate({cid:c.cid,codec:e.codec,maxbr:l[0].maxBitrate/1e3});yield this.engine.negotiate()}),d,f=new Promise((t,n)=>J(this,void 0,void 0,function*(){try{d=yield this.engine.addTrack(c),t(d)}catch(t){if(e.sender&&this.engine.pcManager?.publisher){try{this.engine.pcManager.publisher.removeTrack(e.sender)}catch(e){this.log.error(e)}yield this.engine.negotiate().catch(t=>{this.log.error(`failed to negotiate after removing track due to failed add track request`,Object.assign(Object.assign({},t4(e)),{error:t}))})}n(t)}}));if(this.enabledPublishVideoCodecs.length>0&&s.length===0)d=(yield Promise.all([f,u()]))[0];else{d=yield f;let n;if(d.codecs.forEach(e=>{n===void 0&&(n=e.mimeType)}),n&&e.kind===$.Kind.Video){let i=e4(n);i!==r&&(this.log.debug(`falling back to server selected codec`,Object.assign(Object.assign({},t4(e)),{codec:i})),t.videoCodec=i,l=$3(e.source===$.Source.ScreenShare,c.width,c.height,t))}yield u()}let p=new A8(e.kind,d,e,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});if(p.on(Q.CpuConstrained,e=>this.onTrackCpuConstrained(e,p)),p.options=t,e.sid=d.sid,U4(e)&&(e.publishOptions=t,c.width&&c.height&&(e.lastEncodedDimensions={width:c.width,height:c.height})),this.log.debug(`publishing ${e.kind} with encodings`,{encodings:l,trackInfo:d}),U4(e)?e.startMonitor(this.engine.client):W4(e)&&e.startMonitor(),this.addTrackPublication(p),this.emit(X.LocalTrackPublished,p),W4(e)&&d.audioFeatures.includes(KQ.TF_PRECONNECT_BUFFER)){let t=e.getPreConnectBuffer(),n=e.getPreConnectBufferMimeType();this.on(X.LocalTrackSubscribed,t=>{if(t.trackSid===d.sid){if(!e.hasPreConnectBuffer){this.log.warn(`subscribe event came to late, buffer already closed`);return}this.log.debug(`finished recording preconnect buffer`,t4(e)),e.stopPreConnectBuffer()}}),t&&new Promise((r,i)=>J(this,void 0,void 0,function*(){var a,s,c,l;try{this.log.debug(`waiting for agent`,t4(e));let m=setTimeout(()=>{i(Error(`agent not active within 10 seconds`))},1e4),h=yield this.waitUntilActiveAgentPresent();clearTimeout(m),this.log.debug(`sending preconnect buffer`,t4(e));let g=yield this.streamBytes({name:`preconnect-buffer`,mimeType:n,topic:`lk.agent.pre-connect-audio-buffer`,destinationIdentities:[h.identity],attributes:{trackId:p.trackSid,sampleRate:String(o.sampleRate??`48000`),channels:String(o.channelCount??`1`)}});try{for(var u=!0,d=h0(t),f;f=yield d.next(),a=f.done,!a;u=!0){l=f.value,u=!1;let e=l;yield g.write(e)}}catch(e){s={error:e}}finally{try{!u&&!a&&(c=d.return)&&(yield c.call(d))}finally{if(s)throw s.error}}yield g.close(),r()}catch(e){i(e)}})).then(()=>{this.log.debug(`preconnect buffer sent successfully`,t4(e))}).catch(t=>{this.log.error(`error sending preconnect buffer`,Object.assign(Object.assign({},t4(e)),{error:t}))})}return p})}canPublishFrameMetadata(){return!!(this.roomOptions.e2ee||this.roomOptions.encryption||n3(this.roomOptions.frameMetadata??this.roomOptions.packetTrailer))}normalizeRequestedFrameMetadataOptions(e,t){let n=t.frameMetadata??t.packetTrailer;if(e.kind!==$.Kind.Video||!r3(n))return t.frameMetadata=void 0,t.packetTrailer=void 0,[];if(!this.canPublishFrameMetadata())return this.log.warn(`frame metadata transform not supported; not advertising features`,Object.assign(Object.assign({},this.logContext),t4(e))),t.frameMetadata=void 0,t.packetTrailer=void 0,[];let r=tue(n),i=nue(r);return t.frameMetadata=i,t.packetTrailer=i,r}get isLocal(){return!0}publishAdditionalCodecForTrack(e,t,n){return J(this,void 0,void 0,function*(){if(this.encryptionType!==t$.NONE)return;let r;if(this.trackPublications.forEach(t=>{t.track&&t.track===e&&(r=t)}),!r)throw new N2(`track is not published`);if(!U4(e))throw new N2(`track is not a video track`);let i=Object.assign(Object.assign({},this.roomOptions?.publishDefaults),n),a=e6(e,t,i);if(!a){this.log.info(`backup codec has been disabled, ignoring request to add additional codec for track`,t4(e));return}let o=e.addSimulcastTrack(t,a);if(!o)return;let s=this.normalizeRequestedFrameMetadataOptions(e,i),c=new K$({cid:o.mediaStreamTrack.id,type:$.kindToProto(e.kind),muted:e.isMuted,source:$.sourceToProto(e.source),sid:e.sid,packetTrailerFeatures:s,simulcastCodecs:[{codec:i.videoCodec,cid:o.mediaStreamTrack.id}]});if(c.layers=c6(c.width,c.height,a),!this.engine||this.engine.isClosed)throw new P2(`cannot publish track when not connected`);let l=(yield Promise.all([this.engine.addTrack(c),J(this,void 0,void 0,function*(){yield this.engine.createSimulcastSender(e,o,i,a),yield this.engine.negotiate()})]))[0];this.log.debug(`published ${t} for track ${e.sid}`,{encodings:a,trackInfo:l})})}unpublishTrack(e,t){return J(this,void 0,void 0,function*(){if(B4(e)){let t=this.pendingPublishPromises.get(e);t&&(this.log.debug(`awaiting publish promise before attempting to unpublish`,t4(e)),yield t)}let n=this.getPublicationForTrack(e),r=n?t4(n):void 0;if(this.log.info(`unpublishing track`,r),!n||!n.track){this.log.warn(`track was not unpublished because no publication was found`,r);return}e=n.track,e.off(Q.Muted,this.onTrackMuted),e.off(Q.Unmuted,this.onTrackUnmuted),e.off(Q.Ended,this.handleTrackEnded),e.off(Q.UpstreamPaused,this.onTrackUpstreamPaused),e.off(Q.UpstreamResumed,this.onTrackUpstreamResumed),e.off(Q.AudioTrackFeatureUpdate,this.onTrackFeatureUpdate),t===void 0&&(t=this.roomOptions?.stopLocalTrackOnUnpublish??!0),t?e.stop():e.stopMonitor();let i=!1,a=e.sender;if(e.sender=void 0,this.engine.pcManager&&this.engine.pcManager.currentState<q3.FAILED&&a)try{for(let e of this.engine.pcManager.publisher.getTransceivers())e.sender===a&&(e.direction=`inactive`,i=!0);try{i=this.engine.removeTrack(a)}catch(e){this.log.warn(e),i=!0}if(U4(e)){for(let t of e.simulcastCodecs){let e=hZ(t,2)[1];if(e.sender){try{i=this.engine.removeTrack(e.sender)}catch(e){this.log.warn(e),i=!0}e.sender=void 0}}e.simulcastCodecs.clear()}}catch(e){this.log.warn(`failed to unpublish track`,Object.assign(Object.assign({},r),{error:e}))}switch(this.trackPublications.delete(n.trackSid),n.kind){case $.Kind.Audio:this.audioTrackPublications.delete(n.trackSid);break;case $.Kind.Video:this.videoTrackPublications.delete(n.trackSid);break}return this.emit(X.LocalTrackUnpublished,n),n.setTrack(void 0),i&&(yield this.engine.negotiate()),n})}unpublishTracks(e){return J(this,void 0,void 0,function*(){return(yield Promise.all(e.map(e=>this.unpublishTrack(e)))).filter(e=>!!e)})}republishAllTracks(e){return J(this,arguments,void 0,function(e){var t=this;let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){t.republishPromise&&(yield t.republishPromise),t.republishPromise=new C2((r,i)=>J(t,void 0,void 0,function*(){try{let t=[];this.trackPublications.forEach(n=>{n.track&&(e&&(n.options=Object.assign(Object.assign({},n.options),e)),t.push(n))}),yield Promise.all(t.map(e=>J(this,void 0,void 0,function*(){let t=e.track;yield this.unpublishTrack(t,!1),n&&!t.isMuted&&t.source!==$.Source.ScreenShare&&t.source!==$.Source.ScreenShareAudio&&(W4(t)||U4(t))&&!t.isUserProvided&&(this.log.debug(`restarting existing track`,{track:e.trackSid}),yield t.restartTrack()),yield this.publishOrRepublishTrack(t,e.options,!0)}))),r()}catch(e){e instanceof Error?i(e):i(Error(String(e)))}finally{this.republishPromise=void 0}})),yield t.republishPromise}()})}publishData(e){return J(this,arguments,void 0,function(e){var t=this;let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){let r=n.reliable?m6.RELIABLE:m6.LOSSY,i=n.reliable?l$.RELIABLE:l$.LOSSY,a=n.destinationIdentities,o=n.topic,s=new c$({kind:i,value:{case:`user`,value:new m$({participantIdentity:t.identity,payload:e,destinationIdentities:a,topic:o})}});yield t.engine.sendDataPacket(s,r)}()})}publishDtmf(e,t){return J(this,void 0,void 0,function*(){let n=new c$({kind:l$.RELIABLE,value:{case:`sipDtmf`,value:new h$({code:e,digit:t})}});yield this.engine.sendDataPacket(n,m6.RELIABLE)})}sendChatMessage(e,t){return J(this,void 0,void 0,function*(){let n={id:crypto.randomUUID(),message:e,timestamp:Date.now(),attachedFiles:t?.attachments},r=new c$({value:{case:`chatMessage`,value:new v$(Object.assign(Object.assign({},n),{timestamp:aZ.parse(n.timestamp)}))}});return yield this.engine.sendDataPacket(r,m6.RELIABLE),this.emit(X.ChatMessage,n),n})}editChatMessage(e,t){return J(this,void 0,void 0,function*(){let n=Object.assign(Object.assign({},t),{message:e,editTimestamp:Date.now()}),r=new c$({value:{case:`chatMessage`,value:new v$(Object.assign(Object.assign({},n),{timestamp:aZ.parse(n.timestamp),editTimestamp:aZ.parse(n.editTimestamp)}))}});return yield this.engine.sendDataPacket(r,m6.RELIABLE),this.emit(X.ChatMessage,n),n})}sendText(e,t){return J(this,void 0,void 0,function*(){return this.roomOutgoingDataStreamManager.sendText(e,t)})}streamText(e){return J(this,void 0,void 0,function*(){return this.roomOutgoingDataStreamManager.streamText(e)})}sendFile(e,t){return J(this,void 0,void 0,function*(){return this.roomOutgoingDataStreamManager.sendFile(e,t)})}streamBytes(e){return J(this,void 0,void 0,function*(){return this.roomOutgoingDataStreamManager.streamBytes(e)})}performRpc(e){return this.rpcClientManager.performRpc(e).then(e=>{let t=hZ(e,2);return t[0],t[1]})}registerRpcMethod(e,t){this.rpcServerManager.registerRpcMethod(e,t)}unregisterRpcMethod(e){this.rpcServerManager.unregisterRpcMethod(e)}setTrackSubscriptionPermissions(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];this.participantTrackPermissions=t,this.allParticipantsAllowedToSubscribe=e,this.engine.client.isDisconnected||this.updateTrackSubscriptionPermissions()}setEnabledPublishCodecs(e){this.enabledPublishVideoCodecs=e.filter(e=>e.mime.split(`/`)[0].toLowerCase()===`video`)}updateInfo(e){return super.updateInfo(e)?(e.tracks.forEach(e=>{let t=this.trackPublications.get(e.sid);if(t){let n=t.isMuted||(t.track?.isUpstreamPaused??!1);n!==e.muted&&(this.log.debug(`updating server mute state after reconcile`,Object.assign(Object.assign({},t4(t)),{mutedOnServer:n})),this.engine.client.sendMuteTrack(e.sid,n))}}),!0):!1}setActiveAgent(e){var t,n,r,i;this.firstActiveAgent=e,e&&!this.firstActiveAgent&&(this.firstActiveAgent=e),e?(n=(t=this.activeAgentFuture)?.resolve)==null||n.call(t,e):(i=(r=this.activeAgentFuture)?.reject)==null||i.call(r,Error(`Agent disconnected`)),this.activeAgentFuture=void 0}waitUntilActiveAgentPresent(){return this.firstActiveAgent?Promise.resolve(this.firstActiveAgent):(this.activeAgentFuture||=new P4,this.activeAgentFuture.promise)}getPublicationForTrack(e){let t;return this.trackPublications.forEach(n=>{let r=n.track;r&&(e instanceof MediaStreamTrack?(W4(r)||U4(r))&&r.mediaStreamTrack===e&&(t=n):e===r&&(t=n))}),t}waitForPendingPublicationOfSource(e){return J(this,void 0,void 0,function*(){let t=Date.now();for(;Date.now()<t+1e4;){let t=Array.from(this.pendingPublishPromises.entries()).find(t=>hZ(t,1)[0].source===e);if(t)return t[1];yield l4(20)}})}publishDataTrack(e){return J(this,void 0,void 0,function*(){let t=new g8(e,this.roomOutgoingDataTrackManager);return yield t.publish(),t})}},P8=class extends DOMException{constructor(e,t){super(e,`AbortError`),this.reason=t}},Tde=class extends Map{constructor(){super(...arguments),this.pending=new Map}set(e,t){var n;super.set(e,t);let r=this.pending?.get(e);if(r){for(let e of r)e.isResolved||(n=e.resolve)==null||n.call(e,t);this.pending.delete(e)}return this}get[Symbol.toStringTag](){return`DeferrableMap`}getDeferred(e,t){return J(this,void 0,void 0,function*(){let n=this.get(e);if(n!==void 0)return n;if(t?.aborted)throw new P8(`The operation was aborted.`,t.reason);let r=new P4(void 0,()=>{let t=this.pending.get(e);if(!t)return;let n=t.indexOf(r);n!==-1&&t.splice(n,1),t.length===0&&this.pending.delete(e)}),i=this.pending.get(e);if(i?i.push(r):this.pending.set(e,[r]),t){let e=()=>{var e;r.isResolved||(e=r.reject)==null||e.call(r,new P8(`The operation was aborted.`,t.reason))};t.addEventListener(`abort`,e,{once:!0}),r.promise.finally(()=>{t.removeEventListener(`abort`,e)})}return r.promise})}},F8=class extends k8{constructor(e,t,n,r){super(e,t.sid,t.name,r),this.track=void 0,this.allowed=!0,this.requestedDisabled=void 0,this.visible=!0,this.handleEnded=e=>{this.setTrack(void 0),this.emit(Q.Ended,e)},this.handleVisibilityChange=e=>{this.log.debug(`adaptivestream video visibility ${this.trackSid}, visible=${e}`,this.logContext),this.visible=e,this.emitTrackUpdate()},this.handleVideoDimensionsChange=e=>{this.log.debug(`adaptivestream video dimensions ${e.width}x${e.height}`,this.logContext),this.videoDimensionsAdaptiveStream=e,this.emitTrackUpdate()},this.subscribed=n,this.updateInfo(t)}setSubscribed(e){let t=this.subscriptionStatus,n=this.permissionStatus;this.subscribed=e,e&&(this.allowed=!0);let r=new s1({trackSids:[this.trackSid],subscribe:this.subscribed,participantTracks:[new C$({participantSid:``,trackSids:[this.trackSid]})]});this.emit(Q.UpdateSubscription,r),this.emitSubscriptionUpdateIfChanged(t),this.emitPermissionUpdateIfChanged(n)}get subscriptionStatus(){return this.subscribed===!1?k8.SubscriptionStatus.Unsubscribed:super.isSubscribed?k8.SubscriptionStatus.Subscribed:k8.SubscriptionStatus.Desired}get permissionStatus(){return this.allowed?k8.PermissionStatus.Allowed:k8.PermissionStatus.NotAllowed}get isSubscribed(){return this.subscribed===!1?!1:super.isSubscribed}get isDesired(){return this.subscribed!==!1}get isEnabled(){return this.requestedDisabled===void 0?this.isAdaptiveStream?this.visible:!0:!this.requestedDisabled}get isLocal(){return!1}setEnabled(e){!this.isManualOperationAllowed()||this.requestedDisabled===!e||(this.requestedDisabled=!e,this.emitTrackUpdate())}setVideoQuality(e){!this.isManualOperationAllowed()||this.requestedMaxQuality===e||(this.requestedMaxQuality=e,this.requestedVideoDimensions=void 0,this.emitTrackUpdate())}setVideoDimensions(e){this.isManualOperationAllowed()&&(this.requestedVideoDimensions?.width===e.width&&this.requestedVideoDimensions?.height===e.height||(K4(this.track)&&(this.requestedVideoDimensions=e),this.requestedMaxQuality=void 0,this.emitTrackUpdate()))}setVideoFPS(e){this.isManualOperationAllowed()&&K4(this.track)&&this.fps!==e&&(this.fps=e,this.emitTrackUpdate())}get videoQuality(){return this.requestedMaxQuality??a4.HIGH}setTrack(e){let t=this.subscriptionStatus,n=this.permissionStatus,r=this.track;r!==e&&(r&&(r.off(Q.VideoDimensionsChanged,this.handleVideoDimensionsChange),r.off(Q.VisibilityChanged,this.handleVisibilityChange),r.off(Q.Ended,this.handleEnded),r.detach(),r.stopMonitor(),this.emit(Q.Unsubscribed,r)),super.setTrack(e),e&&(e.sid=this.trackSid,e.on(Q.VideoDimensionsChanged,this.handleVideoDimensionsChange),e.on(Q.VisibilityChanged,this.handleVisibilityChange),e.on(Q.Ended,this.handleEnded),this.emit(Q.Subscribed,e)),this.emitPermissionUpdateIfChanged(n),this.emitSubscriptionUpdateIfChanged(t))}setAllowed(e){let t=this.subscriptionStatus,n=this.permissionStatus;this.allowed=e,this.emitPermissionUpdateIfChanged(n),this.emitSubscriptionUpdateIfChanged(t)}setSubscriptionError(e){this.emit(Q.SubscriptionFailed,e)}updateInfo(e){super.updateInfo(e);let t=this.metadataMuted;this.metadataMuted=e.muted,this.track?this.track.setMuted(e.muted):t!==e.muted&&this.emit(e.muted?Q.Muted:Q.Unmuted)}emitSubscriptionUpdateIfChanged(e){let t=this.subscriptionStatus;e!==t&&this.emit(Q.SubscriptionStatusChanged,t,e)}emitPermissionUpdateIfChanged(e){this.permissionStatus!==e&&this.emit(Q.SubscriptionPermissionChanged,this.permissionStatus,e)}isManualOperationAllowed(){return this.isDesired?!0:(this.log.warn(`cannot update track settings when not subscribed`,this.logContext),!1)}get isAdaptiveStream(){return K4(this.track)&&this.track.isAdaptiveStream}emitTrackUpdate(){let e=new u1({trackSids:[this.trackSid],disabled:!this.isEnabled,fps:this.fps});if(this.kind===$.Kind.Video){let t=this.requestedVideoDimensions;if(this.videoDimensionsAdaptiveStream!==void 0)if(t)r4(this.videoDimensionsAdaptiveStream,t)&&(this.log.debug(`using adaptive stream dimensions instead of requested`,Object.assign(Object.assign({},this.logContext),this.videoDimensionsAdaptiveStream)),t=this.videoDimensionsAdaptiveStream);else if(this.requestedMaxQuality!==void 0&&this.trackInfo){let e=xle(this.trackInfo,this.requestedMaxQuality);e&&r4(this.videoDimensionsAdaptiveStream,e)&&(this.log.debug(`using adaptive stream dimensions instead of max quality layer`,Object.assign(Object.assign({},this.logContext),this.videoDimensionsAdaptiveStream)),t=this.videoDimensionsAdaptiveStream)}else this.log.debug(`using adaptive stream dimensions`,Object.assign(Object.assign({},this.logContext),this.videoDimensionsAdaptiveStream)),t=this.videoDimensionsAdaptiveStream;t?(e.width=Math.ceil(t.width),e.height=Math.ceil(t.height)):this.requestedMaxQuality===void 0?(this.log.debug(`using default quality`,Object.assign(Object.assign({},this.logContext),{quality:a4.HIGH})),e.quality=a4.HIGH):(this.log.debug(`using requested max quality`,Object.assign(Object.assign({},this.logContext),{quality:this.requestedMaxQuality})),e.quality=this.requestedMaxQuality)}this.emit(Q.UpdateSettings,e)}},I8=class e extends N8{static fromParticipantInfo(t,n,r,i){return new e(t,n.sid,n.identity,n.name,n.metadata,n.attributes,r,n.kind,n.dataTracks.map(e=>new X6(S3.from(e),i,{publisherIdentity:n.identity})),n.clientProtocol)}get logContext(){return Object.assign(Object.assign({},super.logContext),{remoteParticipantID:this.sid,remoteParticipant:this.identity})}constructor(e,t,n,r,i,a,o){let s=arguments.length>7&&arguments[7]!==void 0?arguments[7]:$Q.STANDARD,c=arguments.length>8&&arguments[8]!==void 0?arguments[8]:[],l=arguments.length>9&&arguments[9]!==void 0?arguments[9]:0;super(t,n||``,r,i,a,o,s),this.signalClient=e,this.trackPublications=new Map,this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.dataTracks=new Tde(c.map(e=>[e.info.name,e])),this.volumeMap=new Map,this.clientProtocol=l}addTrackPublication(e){super.addTrackPublication(e),e.on(Q.UpdateSettings,t=>{this.log.debug(`send update settings`,Object.assign(Object.assign(Object.assign({},this.logContext),t4(e)),{settings:t})),this.signalClient.sendUpdateTrackSettings(t)}),e.on(Q.UpdateSubscription,e=>{e.participantTracks.forEach(e=>{e.participantSid=this.sid}),this.signalClient.sendUpdateSubscription(e)}),e.on(Q.SubscriptionPermissionChanged,t=>{this.emit(X.TrackSubscriptionPermissionChanged,e,t)}),e.on(Q.SubscriptionStatusChanged,t=>{this.emit(X.TrackSubscriptionStatusChanged,e,t)}),e.on(Q.Subscribed,t=>{this.emit(X.TrackSubscribed,t,e)}),e.on(Q.Unsubscribed,t=>{this.emit(X.TrackUnsubscribed,t,e)}),e.on(Q.SubscriptionFailed,t=>{this.emit(X.TrackSubscriptionFailed,e.trackSid,t)})}getTrackPublication(e){let t=super.getTrackPublication(e);if(t)return t}getTrackPublicationByName(e){let t=super.getTrackPublicationByName(e);if(t)return t}setVolume(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:$.Source.Microphone;this.volumeMap.set(t,e);let n=this.getTrackPublication(t);n&&n.track&&n.track.setVolume(e)}getVolume(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:$.Source.Microphone,t=this.getTrackPublication(e);return t&&t.track?t.track.getVolume():this.volumeMap.get(e)}addSubscribedMediaTrack(e,t,n,r,i,a){let o=this.getTrackPublicationBySid(t);if(o||t.startsWith(`TR`)||this.trackPublications.forEach(t=>{!o&&e.kind===t.kind.toString()&&(o=t)}),!o){if(a===0){this.log.error(`could not find published track`,Object.assign(Object.assign({},this.logContext),{trackSid:t})),this.emit(X.TrackSubscriptionFailed,t);return}a===void 0&&(a=20),setTimeout(()=>{this.addSubscribedMediaTrack(e,t,n,r,i,a-1)},150);return}if(e.readyState===`ended`){this.log.error(`unable to subscribe because MediaStreamTrack is ended. Do not call MediaStreamTrack.stop()`,Object.assign(Object.assign({},this.logContext),t4(o))),this.emit(X.TrackSubscriptionFailed,t);return}let s=e.kind===`video`,c;return c=s?new l3(e,t,r,i):new O8(e,t,r,this.audioContext,this.audioOutput),c.source=o.source,c.isMuted=o.isMuted,c.setMediaStream(n),c.start(),o.setTrack(c),this.volumeMap.has(o.source)&&G4(c)&&V4(c)&&c.setVolume(this.volumeMap.get(o.source)),o}get hasMetadata(){return!!this.participantInfo}getTrackPublicationBySid(e){return this.trackPublications.get(e)}updateInfo(e){if(!super.updateInfo(e))return!1;let t=new Map,n=new Map;return e.tracks.forEach(e=>{let r=this.getTrackPublicationBySid(e.sid);if(r)r.updateInfo(e);else{let t=$.kindFromProto(e.type);if(!t)return;r=new F8(t,e,this.signalClient.connectOptions?.autoSubscribe,{loggerContextCb:()=>this.logContext,loggerName:this.loggerOptions?.loggerName}),r.updateInfo(e),n.set(e.sid,r);let i=Array.from(this.trackPublications.values()).find(e=>e.source===r?.source);i&&r.source!==$.Source.Unknown&&this.log.debug(`received a second track publication for ${this.identity} with the same source: ${r.source}`,Object.assign(Object.assign({},this.logContext),{oldTrack:t4(i),newTrack:t4(r)})),this.addTrackPublication(r)}t.set(e.sid,r)}),this.trackPublications.forEach(e=>{t.has(e.trackSid)||(this.log.trace(`detected removed track on remote participant, unpublishing`,Object.assign(Object.assign({},this.logContext),t4(e))),this.unpublishTrack(e.trackSid,!0))}),n.forEach(e=>{this.emit(X.TrackPublished,e)}),!0}unpublishTrack(e,t){let n=this.trackPublications.get(e);if(!n)return;let r=n.track;switch(r&&(r.stop(),n.setTrack(void 0)),this.trackPublications.delete(e),n.kind){case $.Kind.Audio:this.audioTrackPublications.delete(e);break;case $.Kind.Video:this.videoTrackPublications.delete(e);break}t&&this.emit(X.TrackUnpublished,n)}setAudioOutput(e){return J(this,void 0,void 0,function*(){this.audioOutput=e;let t=[];this.audioTrackPublications.forEach(n=>{V4(n.track)&&G4(n.track)&&t.push(n.track.setSinkId(e.deviceId??`default`))}),yield Promise.all(t)})}addRemoteDataTrack(e){this.dataTracks.set(e.info.name,e)}removeRemoteDataTrack(e){for(let n of this.dataTracks.entries()){var t=hZ(n,2);let r=t[0];e===t[1].info.sid&&this.dataTracks.delete(r)}}emit(e){var t=[...arguments].slice(1);return this.log.trace(`participant event`,Object.assign(Object.assign({},this.logContext),{event:e,args:t})),super.emit(e,...t)}},L8;(function(e){e.Disconnected=`disconnected`,e.Connecting=`connecting`,e.Connected=`connected`,e.Reconnecting=`reconnecting`,e.SignalReconnecting=`signalReconnecting`})(L8||={});var Ede=4*1e3,R8=class e extends v0.EventEmitter{get hasE2EESetup(){return this.e2eeManager!==void 0}constructor(t){var n,r,i;if(super(),n=this,this.state=L8.Disconnected,this.activeSpeakers=[],this.isE2EEEnabled=!1,this.audioEnabled=!0,this.e2eeStateMutex=new OX,this.isVideoPlaybackBlocked=!1,this.log=r0,this.bufferedEvents=[],this.isResuming=!1,this.connect=(e,t,n)=>J(this,void 0,void 0,function*(){if(!Dle())throw b4()?Error(`WebRTC isn't detected, have you called registerGlobals?`):Error(`LiveKit doesn't seem to be supported on this browser. Try to update your browser and make sure no browser extensions are disabling webRTC.`);let r=yield this.disconnectLock.lock();if(this.state===L8.Connected)return this.log.info(`already connected to room ${this.name}`),r(),Promise.resolve();if(this.connectFuture)return r(),this.connectFuture.promise;this.setAndEmitConnectionState(L8.Connecting),this.regionUrlProvider?.getServerUrl().toString()!==J4(e)&&(this.regionUrl=void 0,this.regionUrlProvider=void 0),x4(new URL(e))&&(this.regionUrlProvider===void 0?this.regionUrlProvider=new v6(e,t):this.regionUrlProvider.updateToken(t),this.regionUrlProvider.fetchRegionSettings().then(e=>{var t;(t=this.regionUrlProvider)==null||t.setServerReportedRegions(e)}).catch(e=>{this.log.warn(`could not fetch region settings`,{error:e})}));let i=(a,o,s)=>J(this,void 0,void 0,function*(){this.abortController&&this.abortController.abort();let c=new AbortController;this.abortController=c,r?.();try{if(yield f3.getInstance().getBackOffPromise(e),c.signal.aborted)throw j2.cancelled(`Connection attempt aborted`);yield this.attemptConnection(s??e,t,n,c),this.abortController=void 0,a()}catch(t){if(this.regionUrlProvider&&t instanceof j2&&t.reason!==A2.Cancelled&&t.reason!==A2.NotAllowed){let n=null;try{this.log.debug(`Fetching next region`),n=yield this.regionUrlProvider.getNextBestRegionUrl(this.abortController?.signal)}catch(e){if(e instanceof j2&&(e.status===401||e.reason===A2.Cancelled)){this.handleDisconnect(this.options.stopLocalTrackOnUnpublish),o(e);return}}[A2.InternalError,A2.ServerUnreachable,A2.Timeout].includes(t.reason)&&(this.log.debug(`Adding failed connection attempt to back off`),f3.getInstance().addFailedConnectionAttempt(e)),n&&!this.abortController?.signal.aborted?(this.log.info(`Initial connection failed with ConnectionError: ${t.message}. Retrying with another region: ${n}`),this.recreateEngine(!0),yield i(a,o,n)):(this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,L4(t)),o(t))}else{let e=UQ.UNKNOWN_REASON;t instanceof j2&&(e=L4(t)),this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,e),o(t)}}}),a=this.regionUrl;return this.regionUrl=void 0,this.connectFuture=new P4((e,t)=>{i(e,t,a)},()=>{this.clearConnectionFutures()}),this.connectFuture.promise}),this.connectSignal=(e,t,n,r,i,a)=>J(this,void 0,void 0,function*(){let o=yield n.join(e,t,{autoSubscribe:r.autoSubscribe,adaptiveStream:typeof i.adaptiveStream==`object`?!0:i.adaptiveStream,clientInfoCapabilities:n3(i.frameMetadata??i.packetTrailer)||this.e2eeManager?[O$.CAP_PACKET_TRAILER]:void 0,maxRetries:r.maxRetries,e2eeEnabled:!!this.e2eeManager,websocketTimeout:r.websocketTimeout},a.signal,!i.singlePeerConnection),s=o.joinResponse,c=o.serverInfo;if(this.serverInfo=c,!c.version)throw new sle(`unknown server version`);return c.version===`0.15.1`&&this.options.dynacast&&(this.log.debug(`disabling dynacast due to server version`),i.dynacast=!1),s}),this.applyJoinResponse=e=>{let t=e.participant;if(this.localParticipant.sid=t.sid,this.localParticipant.identity=t.identity,this.localParticipant.setEnabledPublishCodecs(e.enabledPublishCodecs),this.e2eeManager)try{this.e2eeManager.setSifTrailer(e.sifTrailer)}catch(e){this.log.error(e instanceof Error?e.message:`Could not set SifTrailer`,{error:e})}this.handleParticipantUpdates([t,...e.otherParticipants]),e.room&&this.handleRoomUpdate(e.room)},this.attemptConnection=(e,t,n,r)=>J(this,void 0,void 0,function*(){this.state===L8.Reconnecting||this.isResuming||this.engine?.pendingReconnect?(this.log.info(`Reconnection attempt replaced by new connection attempt`),this.recreateEngine(!0)):this.maybeCreateEngine(),this.regionUrlProvider?.isCloud()&&this.engine.setRegionStrategy(this.createRegionStrategy()),this.acquireAudioContext(),this.connOptions=Object.assign(Object.assign({},K3),n),this.connOptions.rtcConfig&&(this.engine.rtcConfig=this.connOptions.rtcConfig),this.connOptions.peerConnectionTimeout&&(this.engine.peerConnectionTimeout=this.connOptions.peerConnectionTimeout);try{let n=yield this.connectSignal(e,t,this.engine,this.connOptions,this.options,r);this.applyJoinResponse(n),this.setupLocalParticipantEvents(),this.emit(Y.SignalConnected)}catch(e){yield this.engine.close(),this.recreateEngine();let t=r.signal.aborted?j2.cancelled(`Signal connection aborted`):j2.serverUnreachable(`could not establish signal connection`);throw e instanceof Error&&(t.message=`${t.message}: ${e.message}`),e instanceof j2&&(t.reason=e.reason,t.status=e.status),this.log.debug(`error trying to establish signal connection`,{error:e}),t}if(r.signal.aborted)throw yield this.engine.close(),this.recreateEngine(),j2.cancelled(`Connection attempt aborted`);try{yield this.engine.waitForPCInitialConnection(this.connOptions.peerConnectionTimeout,r)}catch(e){throw yield this.engine.close(),this.recreateEngine(),e}y4()&&this.options.disconnectOnPageLeave&&(window.addEventListener(`pagehide`,this.onPageLeave),window.addEventListener(`beforeunload`,this.onPageLeave)),y4()&&window.addEventListener(`freeze`,this.onPageLeave),this.setAndEmitConnectionState(L8.Connected),this.emit(Y.Connected),f3.getInstance().resetFailedConnectionAttempts(e),this.registerConnectionReconcile(),this.regionUrlProvider&&this.regionUrlProvider.notifyConnected()}),this.disconnect=function(){return J(n,[...arguments],void 0,function(){var e=this;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){var n,r,i;let a=yield e.disconnectLock.lock();try{if(e.state===L8.Disconnected){e.log.debug(`already disconnected`);return}if(e.log.info(`disconnect from room`),e.state===L8.Connecting||e.state===L8.Reconnecting||e.isResuming){let t=`Abort connection attempt due to user initiated disconnect`;e.log.warn(t),(n=e.abortController)==null||n.abort(t),(i=(r=e.connectFuture)?.reject)==null||i.call(r,j2.cancelled(`Client initiated disconnect`)),e.connectFuture=void 0}e.engine&&(e.engine.client.isDisconnected||(yield e.engine.client.sendLeave()),yield e.engine.close()),e.handleDisconnect(t,UQ.CLIENT_INITIATED),e.engine=void 0}finally{a()}}()})},this.onPageLeave=()=>J(this,void 0,void 0,function*(){this.log.info(`Page leave detected, disconnecting`),yield this.disconnect()}),this.startAudio=()=>J(this,void 0,void 0,function*(){let e=[],t=T2();if(t&&t.os===`iOS`){let t=`livekit-dummy-audio-el`,n=document.getElementById(t);if(!n){n=document.createElement(`audio`),n.id=t,n.autoplay=!0,n.hidden=!0;let e=N4();e.enabled=!0;let r=new MediaStream([e]);n.srcObject=r,document.addEventListener(`visibilitychange`,()=>{n&&(n.srcObject=document.hidden?null:r,document.hidden||(this.log.debug(`page visible again, triggering startAudio to resume playback and update playback status`),this.startAudio()))}),document.body.append(n),this.once(Y.Disconnected,()=>{n?.remove(),n=null})}e.push(n)}this.remoteParticipants.forEach(t=>{t.audioTrackPublications.forEach(t=>{t.track&&t.track.attachedElements.forEach(t=>{e.push(t)})})});try{yield Promise.all([this.acquireAudioContext(),...e.map(e=>(e.muted=!1,e.play()))]),this.handleAudioPlaybackStarted()}catch(e){throw this.handleAudioPlaybackFailed(e),e}}),this.startVideo=()=>J(this,void 0,void 0,function*(){let e=[];for(let t of this.remoteParticipants.values())t.videoTrackPublications.forEach(t=>{var n;(n=t.track)==null||n.attachedElements.forEach(t=>{e.includes(t)||e.push(t)})});yield Promise.all(e.map(e=>e.play())).then(()=>{this.handleVideoPlaybackStarted()}).catch(e=>{e.name===`NotAllowedError`?this.handleVideoPlaybackFailed():this.log.warn("Resuming video playback failed, make sure you call `startVideo` directly in a user gesture handler")})}),this.handleRestarting=()=>{this.clearConnectionReconcile(),this.isResuming=!1;for(let e of this.remoteParticipants.values())this.handleParticipantDisconnected(e.identity,e);this.setAndEmitConnectionState(L8.Reconnecting)&&this.emit(Y.Reconnecting)},this.handleRestarted=()=>{this.outgoingDataTrackManager.sfuWillRepublishTracks(),this.incomingDataTrackManager.resendSubscriptionUpdates()},this.handleSignalRestarted=e=>J(this,void 0,void 0,function*(){this.log.debug(`signal reconnected to server, region ${e.serverRegion}`,{region:e.serverRegion}),this.bufferedEvents=[],this.applyJoinResponse(e);try{yield this.localParticipant.republishAllTracks(void 0,!0)}catch(e){this.log.error(`error trying to re-publish tracks after reconnection`,{error:e})}try{yield this.engine.waitForRestarted(),this.log.debug(`fully reconnected to server`,{region:e.serverRegion})}catch{return}this.setAndEmitConnectionState(L8.Connected),this.emit(Y.Reconnected),this.registerConnectionReconcile(),this.emitBufferedEvents()}),this.handleParticipantUpdates=e=>{for(let t of e){if(t.identity===this.localParticipant.identity){this.localParticipant.updateInfo(t);continue}t.identity===``&&(t.identity=this.sidToIdentity.get(t.sid)??``);let e=this.remoteParticipants.get(t.identity);t.state===QQ.DISCONNECTED?this.handleParticipantDisconnected(t.identity,e):this.getOrCreateParticipant(t.identity,t)}let t=new Map(e.filter(e=>e.identity!==this.localParticipant.identity).map(e=>[e.identity,e.dataTracks.map(e=>S3.from(e))]));this.incomingDataTrackManager.receiveSfuPublicationUpdates(t)},this.handleActiveSpeakersUpdate=e=>{let t=[],n={};e.forEach(e=>{if(n[e.sid]=!0,e.sid===this.localParticipant.sid)this.localParticipant.audioLevel=e.level,this.localParticipant.setIsSpeaking(!0),t.push(this.localParticipant);else{let n=this.getRemoteParticipantBySid(e.sid);n&&(n.audioLevel=e.level,n.setIsSpeaking(!0),t.push(n))}}),n[this.localParticipant.sid]||(this.localParticipant.audioLevel=0,this.localParticipant.setIsSpeaking(!1)),this.remoteParticipants.forEach(e=>{n[e.sid]||(e.audioLevel=0,e.setIsSpeaking(!1))}),this.activeSpeakers=t,this.emitWhenConnected(Y.ActiveSpeakersChanged,t)},this.handleSpeakersChanged=e=>{let t=new Map;this.activeSpeakers.forEach(e=>{let n=this.remoteParticipants.get(e.identity);n&&n.sid!==e.sid||t.set(e.sid,e)}),e.forEach(e=>{let n=this.getRemoteParticipantBySid(e.sid);e.sid===this.localParticipant.sid&&(n=this.localParticipant),n&&(n.audioLevel=e.level,n.setIsSpeaking(e.active),e.active?t.set(e.sid,n):t.delete(e.sid))});let n=Array.from(t.values());n.sort((e,t)=>t.audioLevel-e.audioLevel),this.activeSpeakers=n,this.emitWhenConnected(Y.ActiveSpeakersChanged,n)},this.handleStreamStateUpdate=e=>{e.streamStates.forEach(e=>{let t=this.getRemoteParticipantBySid(e.participantSid);if(!t)return;let n=t.getTrackPublicationBySid(e.trackSid);if(!n||!n.track)return;let r=$.streamStateFromProto(e.state);n.track.setStreamState(r),r!==n.track.streamState&&(t.emit(X.TrackStreamStateChanged,n,n.track.streamState),this.emitWhenConnected(Y.TrackStreamStateChanged,n,n.track.streamState,t))})},this.handleSubscriptionPermissionUpdate=e=>{let t=this.getRemoteParticipantBySid(e.participantSid);if(!t)return;let n=t.getTrackPublicationBySid(e.trackSid);n&&n.setAllowed(e.allowed)},this.handleSubscriptionError=e=>{let t=Array.from(this.remoteParticipants.values()).find(t=>t.trackPublications.has(e.trackSid));if(!t)return;let n=t.getTrackPublicationBySid(e.trackSid);n&&n.setSubscriptionError(e.err)},this.handleDataPacket=(e,t)=>{let n=this.remoteParticipants.get(e.participantIdentity);if(e.value.case===`user`)this.handleUserPacket(n,e.value.value,e.kind,t);else if(e.value.case===`transcription`)this.handleTranscription(n,e.value.value);else if(e.value.case===`sipDtmf`)this.handleSipDtmf(n,e.value.value);else if(e.value.case===`chatMessage`)this.handleChatMessage(n,e.value.value);else if(e.value.case===`metrics`)this.handleMetrics(e.value.value,n);else if(e.value.case===`streamHeader`||e.value.case===`streamChunk`||e.value.case===`streamTrailer`)this.handleDataStream(e,t);else if(e.value.case===`rpcRequest`){let t=e.value.value;this.rpcServerManager.handleIncomingRpcRequest(e.participantIdentity,t)}else if(e.value.case===`rpcResponse`){let t=e.value.value;switch(t.value.case){case`payload`:this.rpcClientManager.handleIncomingRpcResponseSuccess(t.requestId,t.value.value);break;case`error`:this.rpcClientManager.handleIncomingRpcResponseFailure(t.requestId,b8.fromProto(t.value.value));break;default:this.log.warn(`Unknown rpcResponse.value.case: ${t.value.case}`,this.logContext);break}}else e.value.case===`rpcAck`&&this.rpcClientManager.handleIncomingRpcAck(e.value.value.requestId)},this.handleUserPacket=(e,t,n,r)=>{this.emit(Y.DataReceived,t.payload,e,n,t.topic,r),e?.emit(X.DataReceived,t.payload,n,r)},this.handleSipDtmf=(e,t)=>{this.emit(Y.SipDTMFReceived,t,e),e?.emit(X.SipDTMFReceived,t)},this.handleTranscription=(e,t)=>{let n=t.transcribedParticipantIdentity===this.localParticipant.identity?this.localParticipant:this.getParticipantByIdentity(t.transcribedParticipantIdentity),r=n?.trackPublications.get(t.trackId),i=Rle(t,this.transcriptionReceivedTimes);r?.emit(Q.TranscriptionReceived,i),n?.emit(X.TranscriptionReceived,i,r),this.emit(Y.TranscriptionReceived,i,n,r)},this.handleChatMessage=(e,t)=>{let n=zle(t);this.emit(Y.ChatMessage,n,e)},this.handleMetrics=(e,t)=>{this.emit(Y.MetricsReceived,e,t)},this.handleDataStream=(e,t)=>{this.incomingDataStreamManager.handleDataStreamPacket(e,t)},this.bufferedSegments=new Map,this.handleAudioPlaybackStarted=()=>{this.canPlaybackAudio||(this.audioEnabled=!0,this.emit(Y.AudioPlaybackStatusChanged,!0))},this.handleAudioPlaybackFailed=e=>{this.log.warn(`could not playback audio`,{error:e}),this.canPlaybackAudio&&(this.audioEnabled=!1,this.emit(Y.AudioPlaybackStatusChanged,!1))},this.handleVideoPlaybackStarted=()=>{this.isVideoPlaybackBlocked&&(this.isVideoPlaybackBlocked=!1,this.emit(Y.VideoPlaybackStatusChanged,!0))},this.handleVideoPlaybackFailed=()=>{this.isVideoPlaybackBlocked||(this.isVideoPlaybackBlocked=!0,this.emit(Y.VideoPlaybackStatusChanged,!1))},this.handleDeviceChange=()=>J(this,void 0,void 0,function*(){T2()?.os!==`iOS`&&(yield this.selectDefaultDevices()),this.emit(Y.MediaDevicesChanged)}),this.handleRoomUpdate=e=>{let t=this.roomInfo;this.roomInfo=e,t&&t.metadata!==e.metadata&&this.emitWhenConnected(Y.RoomMetadataChanged,e.metadata),t?.activeRecording!==e.activeRecording&&this.emitWhenConnected(Y.RecordingStatusChanged,e.activeRecording)},this.handleConnectionQualityUpdate=e=>{e.updates.forEach(e=>{if(e.participantSid===this.localParticipant.sid){this.localParticipant.setConnectionQuality(e.quality);return}let t=this.getRemoteParticipantBySid(e.participantSid);t&&t.setConnectionQuality(e.quality)})},this.getRemoteParticipantClientProtocol=e=>this.remoteParticipants.get(e)?.clientProtocol??0,this.onLocalParticipantMetadataChanged=e=>{this.emit(Y.ParticipantMetadataChanged,e,this.localParticipant)},this.onLocalParticipantNameChanged=e=>{this.emit(Y.ParticipantNameChanged,e,this.localParticipant)},this.onLocalAttributesChanged=e=>{this.emit(Y.ParticipantAttributesChanged,e,this.localParticipant)},this.onLocalTrackMuted=e=>{this.emit(Y.TrackMuted,e,this.localParticipant)},this.onLocalTrackUnmuted=e=>{this.emit(Y.TrackUnmuted,e,this.localParticipant)},this.onTrackProcessorUpdate=e=>{var t;(t=e?.onPublish)==null||t.call(e,this)},this.onLocalTrackPublished=e=>J(this,void 0,void 0,function*(){var t,n,r,i;(t=e.track)==null||t.on(Q.TrackProcessorUpdate,this.onTrackProcessorUpdate),(n=e.track)==null||n.on(Q.Restarted,this.onLocalTrackRestarted),(i=(r=e.track?.getProcessor())?.onPublish)==null||i.call(r,this),this.emit(Y.LocalTrackPublished,e,this.localParticipant),W4(e.track)&&(yield e.track.checkForSilence())&&this.emit(Y.LocalAudioSilenceDetected,e);let a=yield e.track?.getDeviceId(!1),o=$2(e.source);o&&a&&a!==this.localParticipant.activeDeviceMap.get(o)&&(this.localParticipant.activeDeviceMap.set(o,a),this.emit(Y.ActiveDeviceChanged,o,a))}),this.onLocalTrackUnpublished=e=>{var t,n;(t=e.track)==null||t.off(Q.TrackProcessorUpdate,this.onTrackProcessorUpdate),(n=e.track)==null||n.off(Q.Restarted,this.onLocalTrackRestarted),this.emit(Y.LocalTrackUnpublished,e,this.localParticipant)},this.onLocalTrackRestarted=e=>J(this,void 0,void 0,function*(){let t=yield e.getDeviceId(!1),n=$2(e.source);n&&t&&t!==this.localParticipant.activeDeviceMap.get(n)&&(this.log.debug(`local track restarted, setting ${n} ${t} active`),this.localParticipant.activeDeviceMap.set(n,t),this.emit(Y.ActiveDeviceChanged,n,t))}),this.onLocalConnectionQualityChanged=e=>{this.emit(Y.ConnectionQualityChanged,e,this.localParticipant)},this.onMediaDevicesError=(e,t)=>{this.emit(Y.MediaDevicesError,e,t)},this.onLocalParticipantPermissionsChanged=e=>{this.emit(Y.ParticipantPermissionsChanged,e,this.localParticipant)},this.onLocalChatMessageSent=e=>{this.emit(Y.ChatMessage,e,this.localParticipant)},this.setMaxListeners(100),this.remoteParticipants=new Map,this.sidToIdentity=new Map,this.options=Object.assign(Object.assign({},kue),t),this.log=i0(this.options.loggerName??n0.Room,()=>this.logContext),this.transcriptionReceivedTimes=new Map,this.options.audioCaptureDefaults=Object.assign(Object.assign({},W3),t?.audioCaptureDefaults),this.options.videoCaptureDefaults=Object.assign(Object.assign({},G3),t?.videoCaptureDefaults),this.options.publishDefaults=Object.assign(Object.assign({},Oue),t?.publishDefaults),this.maybeCreateEngine(),this.incomingDataStreamManager=new rde,this.outgoingDataStreamManager=new ode(this.engine,this.log),this.incomingDataTrackManager=new hde({e2eeManager:this.e2eeManager}),this.incomingDataTrackManager.on(`sfuUpdateSubscription`,e=>{this.engine.client.sendUpdateDataSubscription(e.sid,e.subscribe)}).on(`trackPublished`,e=>{var t;e.track.publisherIdentity!==this.localParticipant.identity&&(this.emit(Y.DataTrackPublished,e.track),(t=this.remoteParticipants.get(e.track.publisherIdentity))==null||t.addRemoteDataTrack(e.track))}).on(`trackUnpublished`,e=>{var t;e.publisherIdentity!==this.localParticipant.identity&&(this.emit(Y.DataTrackUnpublished,e.sid),(t=this.remoteParticipants.get(e.publisherIdentity))==null||t.removeRemoteDataTrack(e.sid))}),this.outgoingDataTrackManager=new vde({e2eeManager:this.e2eeManager}),this.outgoingDataTrackManager.on(`sfuPublishRequest`,e=>{this.engine.client.sendPublishDataTrackRequest(e.handle,e.name,e.usesE2ee)}).on(`sfuUnpublishRequest`,e=>{this.engine.client.sendUnPublishDataTrackRequest(e.handle)}).on(`trackPublished`,e=>{this.emit(Y.LocalDataTrackPublished,e.track)}).on(`trackUnpublished`,e=>{this.emit(Y.LocalDataTrackUnpublished,e.sid)}).on(`packetAvailable`,e=>{let t=e.handle,n=e.bytes;this.engine.sendLossyBytes(n,m6.DATA_TRACK_LOSSY,`wait`).finally(()=>this.outgoingDataTrackManager.handlePacketSendComplete(t))}),this.registerRpcDataStreamHandler(),this.rpcClientManager=new bde(this.log,this.outgoingDataStreamManager,this.getRemoteParticipantClientProtocol,()=>this.engine.latestJoinResponse?.serverInfo?.version),this.rpcClientManager.on(`sendDataPacket`,e=>{let t=e.packet;var n;(n=this.engine)==null||n.sendDataPacket(t,m6.RELIABLE)}),this.rpcServerManager=new xde(this.log,this.outgoingDataStreamManager,this.getRemoteParticipantClientProtocol),this.rpcServerManager.on(`sendDataPacket`,e=>{let t=e.packet;var n;(n=this.engine)==null||n.sendDataPacket(t,m6.RELIABLE)}),this.disconnectLock=new OX,this.localParticipant=new wde(``,``,this.engine,this.options,this.outgoingDataStreamManager,this.outgoingDataTrackManager,this.rpcClientManager,this.rpcServerManager),this.setupFrameMetadata(),(this.options.e2ee||this.options.encryption)&&this.setupE2EE(),this.engine.e2eeManager=this.e2eeManager,this.incomingDataTrackManager.updateE2eeManager(this.e2eeManager??null),this.outgoingDataTrackManager.updateE2eeManager(this.e2eeManager??null),this.options.videoCaptureDefaults.deviceId&&this.localParticipant.activeDeviceMap.set(`videoinput`,F4(this.options.videoCaptureDefaults.deviceId)),this.options.audioCaptureDefaults.deviceId&&this.localParticipant.activeDeviceMap.set(`audioinput`,F4(this.options.audioCaptureDefaults.deviceId)),this.options.audioOutput?.deviceId&&this.switchActiveDevice(`audiooutput`,F4(this.options.audioOutput.deviceId)).catch(e=>this.log.warn(`Could not set audio output: ${e.message}`)),y4()){let t=new AbortController,n;if(e.cleanupRegistry){let r=new WeakRef(this);n=()=>{let e=r.deref();e&&e.handleDeviceChange()},e.cleanupRegistry.register(this,()=>{t.abort()})}else n=this.handleDeviceChange;(i=(r=navigator.mediaDevices)?.addEventListener)==null||i.call(r,`devicechange`,n,{signal:t.signal})}}registerTextStreamHandler(e,t){return this.incomingDataStreamManager.registerTextStreamHandler(e,t)}unregisterTextStreamHandler(e){return this.incomingDataStreamManager.unregisterTextStreamHandler(e)}registerByteStreamHandler(e,t){return this.incomingDataStreamManager.registerByteStreamHandler(e,t)}unregisterByteStreamHandler(e){return this.incomingDataStreamManager.unregisterByteStreamHandler(e)}registerRpcMethod(e,t){this.rpcServerManager.registerRpcMethod(e,t)}unregisterRpcMethod(e){this.rpcServerManager.unregisterRpcMethod(e)}setE2EEEnabled(e){return J(this,void 0,void 0,function*(){let t=yield this.e2eeStateMutex.lock();try{if(this.e2eeManager)this.isE2EEEnabled!==e&&(yield this.localParticipant.setE2EEEnabled(e),this.localParticipant.identity!==``&&this.e2eeManager.setParticipantCryptorEnabled(e,this.localParticipant.identity));else throw Error(`e2ee not configured, please set e2ee settings within the room options`)}finally{t()}})}setupE2EE(){var e,t;let n=!!this.options.encryption,r=this.options.encryption||this.options.e2ee;r&&(`e2eeManager`in r?(this.e2eeManager=r.e2eeManager,this.e2eeManager.isDataChannelEncryptionEnabled=n):this.e2eeManager=new iue(r,n),this.e2eeManager.on($4.ParticipantEncryptionStatusChanged,(e,t)=>{Vle(t)&&(this.isE2EEEnabled=e),this.emit(Y.ParticipantEncryptionStatusChanged,e,t)}),this.e2eeManager.on($4.EncryptionError,(e,t)=>{let n=t?this.getParticipantByIdentity(t):void 0;this.emit(Y.EncryptionError,e,n)}),(e=this.e2eeManager)==null||e.setup(this),(t=this.e2eeManager)==null||t.setupEngine(this.engine))}setupFrameMetadata(){let e=this.options.frameMetadata??this.options.packetTrailer;this.frameMetadataManager=new sue(e),this.frameMetadataManager.setup(this)}get logContext(){return{room:this.name,roomID:this.roomInfo?.sid,participant:this.localParticipant?.identity,participantID:this.localParticipant?.sid}}get isRecording(){return this.roomInfo?.activeRecording??!1}getSid(){return this.state===L8.Disconnected?C2.resolve(``):this.roomInfo&&this.roomInfo.sid!==``?C2.resolve(this.roomInfo.sid):new C2((e,t)=>{let n=t=>{t.sid!==``&&(this.engine.off(Z.RoomUpdate,n),e(t.sid))};this.engine.on(Z.RoomUpdate,n),this.once(Y.Disconnected,()=>{this.engine.off(Z.RoomUpdate,n),t(new P2(`Room disconnected before room server id was available`))})})}get name(){return this.roomInfo?.name??``}get metadata(){return this.roomInfo?.metadata}get numParticipants(){return this.roomInfo?.numParticipants??0}get numPublishers(){return this.roomInfo?.numPublishers??0}maybeCreateEngine(){this.engine&&(this.engine.isNewlyCreated||!this.engine.isClosed)||(this.engine=new Que(this.options),this.engine.e2eeManager=this.e2eeManager,this.engine.on(Z.ParticipantUpdate,this.handleParticipantUpdates).on(Z.RoomUpdate,this.handleRoomUpdate).on(Z.SpeakersChanged,this.handleSpeakersChanged).on(Z.StreamStateChanged,this.handleStreamStateUpdate).on(Z.ConnectionQualityUpdate,this.handleConnectionQualityUpdate).on(Z.SubscriptionError,this.handleSubscriptionError).on(Z.SubscriptionPermissionUpdate,this.handleSubscriptionPermissionUpdate).on(Z.MediaTrackAdded,(e,t,n)=>{this.onTrackAdded(e,t,n)}).on(Z.Disconnected,e=>{this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,e)}).on(Z.ActiveSpeakersUpdate,this.handleActiveSpeakersUpdate).on(Z.DataPacketReceived,this.handleDataPacket).on(Z.Resuming,()=>{this.clearConnectionReconcile(),this.isResuming=!0,this.log.debug(`Resuming signal connection`),this.setAndEmitConnectionState(L8.SignalReconnecting)&&this.emit(Y.SignalReconnecting)}).on(Z.Resumed,()=>{this.registerConnectionReconcile(),this.isResuming=!1,this.log.debug(`Resumed signal connection`),this.updateSubscriptions(),this.emitBufferedEvents(),this.setAndEmitConnectionState(L8.Connected)&&this.emit(Y.Reconnected)}).on(Z.SignalResumed,()=>{this.bufferedEvents=[],(this.state===L8.Reconnecting||this.isResuming)&&this.sendSyncState()}).on(Z.Restarting,this.handleRestarting).on(Z.Restarted,this.handleRestarted).on(Z.SignalRestarted,this.handleSignalRestarted).on(Z.Offline,()=>{this.setAndEmitConnectionState(L8.Reconnecting)&&this.emit(Y.Reconnecting)}).on(Z.DCBufferStatusChanged,(e,t)=>{this.emit(Y.DCBufferStatusChanged,e,t)}).on(Z.LocalTrackSubscribed,e=>{this.handleLocalTrackSubscribed(e)}).on(Z.RoomMoved,e=>{this.log.debug(`room moved`,e),e.room&&this.handleRoomUpdate(e.room),this.remoteParticipants.forEach((e,t)=>{this.handleParticipantDisconnected(t,e)}),this.emit(Y.Moved,e.room.name),e.participant?this.handleParticipantUpdates([e.participant,...e.otherParticipants]):this.handleParticipantUpdates(e.otherParticipants)}).on(Z.PublishDataTrackResponse,e=>{if(!e.info){this.log.warn(`received PublishDataTrackResponse, but event.info was ${e.info}, so skipping.`);return}this.outgoingDataTrackManager.receivedSfuPublishResponse(e.info.pubHandle,{type:`ok`,data:{sid:e.info.sid,pubHandle:e.info.pubHandle,name:e.info.name,usesE2ee:e.info.encryption!==t$.NONE}})}).on(Z.UnPublishDataTrackResponse,e=>{if(!e.info){this.log.warn(`received UnPublishDataTrackResponse, but event.info was ${e.info}, so skipping.`);return}this.outgoingDataTrackManager.receivedSfuUnpublishResponse(e.info.pubHandle)}).on(Z.DataTrackSubscriberHandles,e=>{let t=new Map(Object.entries(e.subHandles).map(e=>{let t=hZ(e,2),n=t[0],r=t[1];return[parseInt(n,10),r.trackSid]}));this.incomingDataTrackManager.receivedSfuSubscriberHandles(t)}).on(Z.DataTrackPacketReceived,e=>{try{this.incomingDataTrackManager.packetReceived(e)}catch(e){throw e}}).on(Z.Joined,e=>{let t=new Map(e.otherParticipants.map(e=>[e.identity,e.dataTracks.map(e=>S3.from(e))]));this.incomingDataTrackManager.receiveSfuPublicationUpdates(t)}).on(Z.TokenRefreshed,e=>{var t;(t=this.regionUrlProvider)==null||t.updateToken(e)}).on(Z.ServerRegionsReported,e=>{var t;(t=this.regionUrlProvider)==null||t.setServerReportedRegions({regionSettings:e,updatedAtInMs:Date.now(),maxAgeInMs:_6})}),this.localParticipant&&this.localParticipant.setupEngine(this.engine),this.e2eeManager&&this.e2eeManager.setupEngine(this.engine),this.outgoingDataStreamManager&&this.outgoingDataStreamManager.setupEngine(this.engine))}createRegionStrategy(){return{getNextUrl:e=>J(this,void 0,void 0,function*(){return this.regionUrlProvider?this.regionUrlProvider.getNextBestRegionUrl(e):null}),resetAttempts:()=>this.regionUrlProvider?.resetAttempts()}}static getLocalDevices(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return m3.getInstance().getDevices(e,t)}prepareConnection(e,t){return J(this,void 0,void 0,function*(){if(this.state===L8.Disconnected){this.log.debug(`prepareConnection to ${e}`);try{if(x4(new URL(e))&&t){this.regionUrlProvider=new v6(e,t);let n=yield this.regionUrlProvider.getNextBestRegionUrl();n&&this.state===L8.Disconnected&&(this.regionUrl=n,yield fetch(I4(n),{method:`HEAD`}),this.log.debug(`prepared connection to ${n}`))}else yield fetch(I4(e),{method:`HEAD`})}catch(e){this.log.warn(`could not prepare connection`,{error:e})}}})}getParticipantByIdentity(e){return this.localParticipant.identity===e?this.localParticipant:this.remoteParticipants.get(e)}clearConnectionFutures(){this.connectFuture=void 0}simulateScenario(e,t){return J(this,void 0,void 0,function*(){let n=()=>J(this,void 0,void 0,function*(){}),r;switch(e){case`signal-reconnect`:yield this.engine.client.handleOnClose(`simulate disconnect`);break;case`fail-on-v1-path`:this.engine.failNextV1Path();break;case`speaker`:r=new F1({scenario:{case:`speakerUpdate`,value:3}});break;case`node-failure`:r=new F1({scenario:{case:`nodeFailure`,value:!0}});break;case`server-leave`:r=new F1({scenario:{case:`serverLeave`,value:!0}});break;case`migration`:r=new F1({scenario:{case:`migration`,value:!0}});break;case`resume-reconnect`:this.engine.failNext(),yield this.engine.client.handleOnClose(`simulate resume-disconnect`);break;case`disconnect-signal-on-resume`:n=()=>J(this,void 0,void 0,function*(){yield this.engine.client.handleOnClose(`simulate resume-disconnect`)}),r=new F1({scenario:{case:`disconnectSignalOnResume`,value:!0}});break;case`disconnect-signal-on-resume-no-messages`:n=()=>J(this,void 0,void 0,function*(){yield this.engine.client.handleOnClose(`simulate resume-disconnect`)}),r=new F1({scenario:{case:`disconnectSignalOnResumeNoMessages`,value:!0}});break;case`full-reconnect`:this.engine.fullReconnectOnNext=!0,yield this.engine.client.handleOnClose(`simulate full-reconnect`);break;case`force-tcp`:case`force-tls`:r=new F1({scenario:{case:`switchCandidateProtocol`,value:e===`force-tls`?2:1}}),n=()=>J(this,void 0,void 0,function*(){let e=this.engine.client.onLeave;e&&e(new p1({reason:UQ.CLIENT_INITIATED,action:m1.RECONNECT}))});break;case`subscriber-bandwidth`:if(t===void 0||typeof t!=`number`)throw Error(`subscriber-bandwidth requires a number as argument`);r=new F1({scenario:{case:`subscriberBandwidth`,value:z4(t)}});break;case`leave-full-reconnect`:r=new F1({scenario:{case:`leaveRequestFullReconnect`,value:!0}})}r&&(yield this.engine.client.sendSimulateScenario(r),yield n())})}get canPlaybackAudio(){return this.audioEnabled}get canPlaybackVideo(){return!this.isVideoPlaybackBlocked}getActiveDevice(e){return this.localParticipant.activeDeviceMap.get(e)}switchActiveDevice(e,t){return J(this,arguments,void 0,function(e,t){var n=this;let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return function*(){var i,a;let o=!0,s=!1,c=r?{exact:t}:t;if(e===`audioinput`){s=n.localParticipant.audioTrackPublications.size===0;let t=n.getActiveDevice(e)??n.options.audioCaptureDefaults.deviceId;n.options.audioCaptureDefaults.deviceId=c;let r=Array.from(n.localParticipant.audioTrackPublications.values()).filter(e=>e.source===$.Source.Microphone);try{o=(yield Promise.all(r.map(e=>e.audioTrack?.setDeviceId(c)))).every(e=>e===!0)}catch(e){throw n.options.audioCaptureDefaults.deviceId=t,e}let i=r.some(e=>e.track?.isMuted??!1);o&&i&&(s=!0)}else if(e===`videoinput`){s=n.localParticipant.videoTrackPublications.size===0;let t=n.getActiveDevice(e)??n.options.videoCaptureDefaults.deviceId;n.options.videoCaptureDefaults.deviceId=c;let r=Array.from(n.localParticipant.videoTrackPublications.values()).filter(e=>e.source===$.Source.Camera);try{o=(yield Promise.all(r.map(e=>e.videoTrack?.setDeviceId(c)))).every(e=>e===!0)}catch(e){throw n.options.videoCaptureDefaults.deviceId=t,e}let i=r.some(e=>e.track?.isMuted??!1);o&&i&&(s=!0)}else if(e===`audiooutput`){if(s=!0,!p4()&&!n.options.webAudioMix||n.options.webAudioMix&&n.audioContext&&!(`setSinkId`in n.audioContext))throw Error(`cannot switch audio output, the current browser does not support it`);n.options.webAudioMix&&(t=(yield m3.getInstance().normalizeDeviceId(`audiooutput`,t))??``),(a=n.options).audioOutput??(a.audioOutput={});let r=n.getActiveDevice(e)??n.options.audioOutput.deviceId;n.options.audioOutput.deviceId=t;try{n.options.webAudioMix&&((i=n.audioContext)==null||i.setSinkId(t)),yield Promise.all(Array.from(n.remoteParticipants.values()).map(e=>e.setAudioOutput({deviceId:t})))}catch(e){throw n.options.audioOutput.deviceId=r,e}}return s&&(n.localParticipant.activeDeviceMap.set(e,t),n.emit(Y.ActiveDeviceChanged,e,t)),o}()})}setupLocalParticipantEvents(){this.localParticipant.on(X.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).on(X.ParticipantNameChanged,this.onLocalParticipantNameChanged).on(X.AttributesChanged,this.onLocalAttributesChanged).on(X.TrackMuted,this.onLocalTrackMuted).on(X.TrackUnmuted,this.onLocalTrackUnmuted).on(X.LocalTrackPublished,this.onLocalTrackPublished).on(X.LocalTrackUnpublished,this.onLocalTrackUnpublished).on(X.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).on(X.MediaDevicesError,this.onMediaDevicesError).on(X.AudioStreamAcquired,this.startAudio).on(X.ChatMessage,this.onLocalChatMessageSent).on(X.ParticipantPermissionsChanged,this.onLocalParticipantPermissionsChanged)}recreateEngine(e){let t=this.engine;e&&t&&!t.client.isDisconnected?t.client.sendLeave().finally(()=>t.close()):t?.close(),this.engine=void 0,this.isResuming=!1,this.remoteParticipants.clear(),this.sidToIdentity.clear(),this.bufferedEvents=[],this.maybeCreateEngine()}onTrackAdded(e,t,n){if(this.state===L8.Connecting||this.state===L8.Reconnecting){let r=()=>{this.log.debug(`deferring on track for later`,{mediaTrackId:e.id,mediaStreamId:t.id,tracksInStream:t.getTracks().map(e=>e.id)}),this.onTrackAdded(e,t,n),i()},i=()=>{this.off(Y.Reconnected,r),this.off(Y.Connected,r),this.off(Y.Disconnected,i)};this.once(Y.Reconnected,r),this.once(Y.Connected,r),this.once(Y.Disconnected,i);return}if(this.state===L8.Disconnected){this.log.warn(`skipping incoming track after Room disconnected`);return}if(e.readyState===`ended`){this.log.debug(`skipping incoming track as it already ended`);return}let r=wle(t.id),i=r[0],a=r[1],o=e.id;if(a&&a.startsWith(`TR`)&&(o=a),i===this.localParticipant.sid){this.log.warn(`tried to create RemoteParticipant for local participant`);return}let s=Array.from(this.remoteParticipants.values()).find(e=>e.sid===i);if(!s){i.startsWith(`PA`)&&this.log.error(`Tried to add a track for a participant, that's not present. Sid: ${i}`);return}if(!o.startsWith(`TR`)){let e=this.engine.getTrackIdForReceiver(n);if(!e){this.log.error(`Tried to add a track whose 'sid' could not be found for a participant, that's not present. Sid: ${i}`);return}o=e}o.startsWith(`TR`)||this.log.warn(`Tried to add a track whose 'sid' could not be determined for a participant, that's not present. Sid: ${i}, streamId: ${a}, trackId: ${o}`,{remoteParticipantID:i,streamId:a,trackId:o});let c;this.options.adaptiveStream&&(c=typeof this.options.adaptiveStream==`object`?this.options.adaptiveStream:{});let l=s.addSubscribedMediaTrack(e,o,t,n,c);l?.isEncrypted&&!this.e2eeManager&&this.emit(Y.EncryptionError,Error(`Encrypted ${l.source} track received from participant ${s.sid}, but room does not have encryption enabled!`))}handleLocalTrackSubscribed(e){let t=()=>this.localParticipant.getTrackPublications().find(t=>t.trackSid===e),n=t();if(n){this.emitLocalTrackSubscribed(n);return}this.log.debug(`deferring LocalTrackSubscribed, publication not yet available`,{subscribedSid:e});let r,i=t=>{t.trackSid===e&&(a(),this.emitLocalTrackSubscribed(t))},a=()=>{clearTimeout(r),this.localParticipant.off(X.LocalTrackPublished,i),this.off(Y.Disconnected,a)};this.localParticipant.on(X.LocalTrackPublished,i),this.once(Y.Disconnected,a),r=setTimeout(()=>{a();let n=t();n?this.emitLocalTrackSubscribed(n):this.log.warn(`could not find local track publication for LocalTrackSubscribed event after timeout`,{subscribedSid:e})},1e4)}emitLocalTrackSubscribed(e){this.localParticipant.emit(X.LocalTrackSubscribed,e),this.emitWhenConnected(Y.LocalTrackSubscribed,e,this.localParticipant)}handleDisconnect(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,t=arguments.length>1?arguments[1]:void 0;var n,r;if(this.clearConnectionReconcile(),this.isResuming=!1,this.bufferedEvents=[],this.transcriptionReceivedTimes.clear(),this.incomingDataStreamManager.clearControllers(),this.incomingDataTrackManager.reset(),this.outgoingDataTrackManager.reset(),this.state!==L8.Disconnected){this.regionUrl=void 0,this.regionUrlProvider&&this.regionUrlProvider.notifyDisconnected();try{this.remoteParticipants.forEach(e=>{e.trackPublications.forEach(t=>{e.unpublishTrack(t.trackSid)})}),this.localParticipant.trackPublications.forEach(t=>{var n,r,i;t.track&&this.localParticipant.unpublishTrack(t.track,e),e?((n=t.track)==null||n.detach(),(r=t.track)==null||r.stop()):(i=t.track)==null||i.stopMonitor()}),this.localParticipant.off(X.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).off(X.ParticipantNameChanged,this.onLocalParticipantNameChanged).off(X.AttributesChanged,this.onLocalAttributesChanged).off(X.TrackMuted,this.onLocalTrackMuted).off(X.TrackUnmuted,this.onLocalTrackUnmuted).off(X.LocalTrackPublished,this.onLocalTrackPublished).off(X.LocalTrackUnpublished,this.onLocalTrackUnpublished).off(X.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).off(X.MediaDevicesError,this.onMediaDevicesError).off(X.AudioStreamAcquired,this.startAudio).off(X.ChatMessage,this.onLocalChatMessageSent).off(X.ParticipantPermissionsChanged,this.onLocalParticipantPermissionsChanged),this.localParticipant.trackPublications.clear(),this.localParticipant.videoTrackPublications.clear(),this.localParticipant.audioTrackPublications.clear(),this.remoteParticipants.clear(),this.sidToIdentity.clear(),this.activeSpeakers=[],this.audioContext&&typeof this.options.webAudioMix==`boolean`&&(this.audioContext.close(),this.audioContext=void 0),y4()&&(window.removeEventListener(`beforeunload`,this.onPageLeave),window.removeEventListener(`pagehide`,this.onPageLeave),window.removeEventListener(`freeze`,this.onPageLeave),(r=(n=navigator.mediaDevices)?.removeEventListener)==null||r.call(n,`devicechange`,this.handleDeviceChange))}finally{this.setAndEmitConnectionState(L8.Disconnected),this.emit(Y.Disconnected,t)}}}handleParticipantDisconnected(e,t){this.remoteParticipants.delete(e),t&&(this.incomingDataStreamManager.validateParticipantHasNoActiveDataStreams(e),this.incomingDataTrackManager.handleRemoteParticipantDisconnected(e),t.trackPublications.forEach(e=>{t.unpublishTrack(e.trackSid,!0)}),this.emit(Y.ParticipantDisconnected,t),t.setDisconnected(),this.rpcClientManager.handleParticipantDisconnected(t.identity))}selectDefaultDevices(){return J(this,void 0,void 0,function*(){let e=m3.getInstance().previousDevices,t=yield m3.getInstance().getDevices(void 0,!1),n=T2();if(n?.name===`Chrome`&&n.os!==`iOS`)for(let n of t){let t=e.find(e=>e.deviceId===n.deviceId);t&&t.label!==``&&t.kind===n.kind&&t.label!==n.label&&this.getActiveDevice(n.kind)===`default`&&this.emit(Y.ActiveDeviceChanged,n.kind,n.deviceId)}for(let n of[`audiooutput`,`audioinput`,`videoinput`]){let r=hle(n),i=this.localParticipant.getTrackPublication(r);if(i&&i.track?.isUserProvided)continue;let a=t.filter(e=>e.kind===n),o=this.getActiveDevice(n);if(o===e.filter(e=>e.kind===n)[0]?.deviceId&&a.length>0&&a[0]?.deviceId!==o){yield this.switchActiveDevice(n,a[0].deviceId);continue}n===`audioinput`&&!_4()||n===`videoinput`||a.length>0&&!a.find(e=>e.deviceId===this.getActiveDevice(n))&&(n!==`audiooutput`||!_4())&&(yield this.switchActiveDevice(n,a[0].deviceId))}})}acquireAudioContext(){return J(this,void 0,void 0,function*(){if(typeof this.options.webAudioMix!=`boolean`&&this.options.webAudioMix.audioContext?this.audioContext=this.options.webAudioMix.audioContext:(!this.audioContext||this.audioContext.state===`closed`)&&(this.audioContext=Q2()??void 0),this.options.webAudioMix&&this.remoteParticipants.forEach(e=>e.setAudioContext(this.audioContext)),this.localParticipant.setAudioContext(this.audioContext),this.audioContext&&this.audioContext.state===`suspended`)try{yield Promise.race([this.audioContext.resume(),l4(200)])}catch(e){this.log.warn(`Could not resume audio context`,{error:e})}let e=this.audioContext?.state===`running`;e!==this.canPlaybackAudio&&(this.audioEnabled=e,this.emit(Y.AudioPlaybackStatusChanged,e))})}createParticipant(e,t){let n;return n=t?I8.fromParticipantInfo(this.engine.client,t,{loggerContextCb:()=>this.logContext,loggerName:this.options.loggerName},this.incomingDataTrackManager):new I8(this.engine.client,``,e,void 0,void 0,void 0,{loggerContextCb:()=>this.logContext,loggerName:this.options.loggerName}),this.options.webAudioMix&&n.setAudioContext(this.audioContext),this.options.audioOutput?.deviceId&&n.setAudioOutput(this.options.audioOutput).catch(e=>this.log.warn(`Could not set audio output: ${e.message}`)),n}getOrCreateParticipant(e,t){if(this.remoteParticipants.has(e)){let n=this.remoteParticipants.get(e);return t&&n.updateInfo(t)&&this.sidToIdentity.set(t.sid,t.identity),n}let n=this.createParticipant(e,t);return this.remoteParticipants.set(e,n),this.sidToIdentity.set(t.sid,t.identity),this.emitWhenConnected(Y.ParticipantConnected,n),n.on(X.TrackPublished,e=>{this.emitWhenConnected(Y.TrackPublished,e,n)}).on(X.TrackSubscribed,(e,t)=>{e.kind===$.Kind.Audio?(e.on(Q.AudioPlaybackStarted,this.handleAudioPlaybackStarted),e.on(Q.AudioPlaybackFailed,this.handleAudioPlaybackFailed)):e.kind===$.Kind.Video&&(e.on(Q.VideoPlaybackFailed,this.handleVideoPlaybackFailed),e.on(Q.VideoPlaybackStarted,this.handleVideoPlaybackStarted)),this.emitWhenConnected(Y.TrackSubscribed,e,t,n)}).on(X.TrackUnpublished,e=>{this.emit(Y.TrackUnpublished,e,n)}).on(X.TrackUnsubscribed,(e,t)=>{this.emit(Y.TrackUnsubscribed,e,t,n)}).on(X.TrackMuted,e=>{this.emitWhenConnected(Y.TrackMuted,e,n)}).on(X.TrackUnmuted,e=>{this.emitWhenConnected(Y.TrackUnmuted,e,n)}).on(X.ParticipantMetadataChanged,e=>{this.emitWhenConnected(Y.ParticipantMetadataChanged,e,n)}).on(X.ParticipantNameChanged,e=>{this.emitWhenConnected(Y.ParticipantNameChanged,e,n)}).on(X.AttributesChanged,e=>{this.emitWhenConnected(Y.ParticipantAttributesChanged,e,n)}).on(X.ConnectionQualityChanged,e=>{this.emitWhenConnected(Y.ConnectionQualityChanged,e,n)}).on(X.ParticipantPermissionsChanged,e=>{this.emitWhenConnected(Y.ParticipantPermissionsChanged,e,n)}).on(X.TrackSubscriptionStatusChanged,(e,t)=>{this.emitWhenConnected(Y.TrackSubscriptionStatusChanged,e,t,n)}).on(X.TrackSubscriptionFailed,(e,t)=>{this.emit(Y.TrackSubscriptionFailed,e,n,t)}).on(X.TrackSubscriptionPermissionChanged,(e,t)=>{this.emitWhenConnected(Y.TrackSubscriptionPermissionChanged,e,t,n)}).on(X.Active,()=>{this.emitWhenConnected(Y.ParticipantActive,n),n.kind===$Q.AGENT&&this.localParticipant.setActiveAgent(n)}),t&&n.updateInfo(t),n}sendSyncState(){let e=Array.from(this.remoteParticipants.values()).reduce((e,t)=>(e.push(...t.getTrackPublications()),e),[]),t=this.localParticipant.getTrackPublications(),n=this.outgoingDataTrackManager.queryPublished();this.engine.sendSyncState(e,t,n)}updateSubscriptions(){for(let e of this.remoteParticipants.values())for(let t of e.videoTrackPublications.values())t.isSubscribed&&Ble(t)&&t.emitTrackUpdate()}getRemoteParticipantBySid(e){let t=this.sidToIdentity.get(e);if(t)return this.remoteParticipants.get(t)}registerRpcDataStreamHandler(){this.incomingDataStreamManager.registerTextStreamHandler(S8,(e,t)=>J(this,[e,t],void 0,function(e,t){var n=this;let r=t.identity;return function*(){let t=e.info.attributes??{};yield n.rpcServerManager.handleIncomingDataStream(e,r,t)}()})),this.incomingDataStreamManager.registerTextStreamHandler(C8,(e,t)=>J(this,[e,t],void 0,function(e,t){var n=this;let r=t.identity;return function*(){let t=e.info.attributes??{};yield n.rpcClientManager.handleIncomingDataStream(e,r,t)}()}))}registerConnectionReconcile(){this.clearConnectionReconcile();let e=0;this.connectionReconcileInterval=H2.setInterval(()=>{!this.engine||this.engine.isClosed||!this.engine.verifyTransport()?(e++,this.log.warn(`detected connection state mismatch`,{numFailures:e,engine:this.engine?{closed:this.engine.isClosed,transportsConnectedOrConnecting:this.engine.verifyTransport()}:void 0}),e>=3&&(this.recreateEngine(),this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,UQ.STATE_MISMATCH))):e=0},Ede)}clearConnectionReconcile(){this.connectionReconcileInterval&&H2.clearInterval(this.connectionReconcileInterval)}setAndEmitConnectionState(e){return e===this.state?!1:(this.log.info(`connection state changed: ${this.state} -> ${e}`),this.state=e,this.incomingDataStreamManager.setConnected(e===L8.Connected),this.emit(Y.ConnectionStateChanged,this.state),!0)}emitBufferedEvents(){this.bufferedEvents.forEach(e=>{let t=hZ(e,2),n=t[0],r=t[1];this.emit(n,...r)}),this.bufferedEvents=[]}emitWhenConnected(e){var t=[...arguments].slice(1);if(this.state===L8.Reconnecting||this.isResuming||!this.engine||this.engine.pendingReconnect)this.bufferedEvents.push([e,t]);else if(this.state===L8.Connected)return this.emit(e,...t);return!1}simulateParticipants(e){return J(this,void 0,void 0,function*(){let t=Object.assign({audio:!0,video:!0,useRealTracks:!1},e.publish),n=Object.assign({count:9,audio:!1,video:!0,aspectRatios:[1.66,1.7,1.3]},e.participants);if(this.handleDisconnect(),this.roomInfo=new JQ({sid:`RM_SIMULATED`,name:`simulated-room`,emptyTimeout:0,maxParticipants:0,creationTime:aZ.parse(new Date().getTime()),metadata:``,numParticipants:1,numPublishers:1,turnPassword:``,enabledCodecs:[],activeRecording:!1}),this.localParticipant.updateInfo(new ZQ({identity:`simulated-local`,name:`local-name`})),this.setupLocalParticipantEvents(),this.emit(Y.SignalConnected),this.emit(Y.Connected),this.setAndEmitConnectionState(L8.Connected),t.video){let e=new A8($.Kind.Video,new r$({source:zQ.CAMERA,sid:Math.floor(Math.random()*1e4).toString(),type:RQ.AUDIO,name:`video-dummy`}),new a6(t.useRealTracks&&window.navigator.mediaDevices?.getUserMedia?(yield window.navigator.mediaDevices.getUserMedia({video:!0})).getVideoTracks()[0]:j4(160*(n.aspectRatios[0]??1),160,!0,!0),void 0,!1,{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext}),{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext});this.localParticipant.addTrackPublication(e),this.localParticipant.emit(X.LocalTrackPublished,e)}if(t.audio){let e=new A8($.Kind.Audio,new r$({source:zQ.MICROPHONE,sid:Math.floor(Math.random()*1e4).toString(),type:RQ.AUDIO}),new Z3(t.useRealTracks&&navigator.mediaDevices?.getUserMedia?(yield navigator.mediaDevices.getUserMedia({audio:!0})).getAudioTracks()[0]:N4(),void 0,!1,this.audioContext,{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext}),{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext});this.localParticipant.addTrackPublication(e),this.localParticipant.emit(X.LocalTrackPublished,e)}for(let e=0;e<n.count-1;e+=1){let t=new ZQ({sid:Math.floor(Math.random()*1e4).toString(),identity:`simulated-${e}`,state:QQ.ACTIVE,tracks:[],joinedAt:aZ.parse(Date.now())}),r=this.getOrCreateParticipant(t.identity,t);if(n.video){let i=j4(160*(n.aspectRatios[e%n.aspectRatios.length]??1),160,!1,!0),a=new r$({source:zQ.CAMERA,sid:Math.floor(Math.random()*1e4).toString(),type:RQ.AUDIO});r.addSubscribedMediaTrack(i,a.sid,new MediaStream([i]),new RTCRtpReceiver),t.tracks=[...t.tracks,a]}if(n.audio){let e=N4(),n=new r$({source:zQ.MICROPHONE,sid:Math.floor(Math.random()*1e4).toString(),type:RQ.AUDIO});r.addSubscribedMediaTrack(e,n.sid,new MediaStream([e]),new RTCRtpReceiver),t.tracks=[...t.tracks,n]}r.updateInfo(t)}})}emit(e){var t=[...arguments].slice(1);if(e!==Y.ActiveSpeakersChanged&&e!==Y.TranscriptionReceived){let n=z8(t).filter(e=>e!==void 0);(e===Y.TrackSubscribed||e===Y.TrackUnsubscribed)&&this.log.trace(`subscribe trace: ${e}`,{event:e,args:n}),this.log.debug(`room event ${e}`,{event:e,args:n})}return super.emit(e,...t)}};R8.cleanupRegistry=typeof FinalizationRegistry<`u`&&typeof WeakRef<`u`&&new FinalizationRegistry(e=>{e()});function z8(e){return e.map(e=>{if(e)return Array.isArray(e)?z8(e):typeof e==`object`?`logContext`in e?e.logContext:void 0:e})}var Dde;(function(e){e[e.IDLE=0]=`IDLE`,e[e.RUNNING=1]=`RUNNING`,e[e.SKIPPED=2]=`SKIPPED`,e[e.SUCCESS=3]=`SUCCESS`,e[e.FAILED=4]=`FAILED`})(Dde||={}),v0.EventEmitter,v0.EventEmitter,new TextEncoder,new TextDecoder;var B8=class extends Error{constructor(e,t){var n;super(e,t),fZ(this,`code`,`ERR_JOSE_GENERIC`),this.name=this.constructor.name,(n=Error.captureStackTrace)==null||n.call(Error,this,this.constructor)}};fZ(B8,`code`,`ERR_JOSE_GENERIC`),fZ(class extends B8{constructor(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:`unspecified`,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:`unspecified`;super(e,{cause:{claim:n,reason:r,payload:t}}),fZ(this,`code`,`ERR_JWT_CLAIM_VALIDATION_FAILED`),fZ(this,`claim`,void 0),fZ(this,`reason`,void 0),fZ(this,`payload`,void 0),this.claim=n,this.reason=r,this.payload=t}},`code`,`ERR_JWT_CLAIM_VALIDATION_FAILED`),fZ(class extends B8{constructor(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:`unspecified`,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:`unspecified`;super(e,{cause:{claim:n,reason:r,payload:t}}),fZ(this,`code`,`ERR_JWT_EXPIRED`),fZ(this,`claim`,void 0),fZ(this,`reason`,void 0),fZ(this,`payload`,void 0),this.claim=n,this.reason=r,this.payload=t}},`code`,`ERR_JWT_EXPIRED`),fZ(class extends B8{constructor(){super(...arguments),fZ(this,`code`,`ERR_JOSE_ALG_NOT_ALLOWED`)}},`code`,`ERR_JOSE_ALG_NOT_ALLOWED`),fZ(class extends B8{constructor(){super(...arguments),fZ(this,`code`,`ERR_JOSE_NOT_SUPPORTED`)}},`code`,`ERR_JOSE_NOT_SUPPORTED`),fZ(class extends B8{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:`decryption operation failed`,t=arguments.length>1?arguments[1]:void 0;super(e,t),fZ(this,`code`,`ERR_JWE_DECRYPTION_FAILED`)}},`code`,`ERR_JWE_DECRYPTION_FAILED`),fZ(class extends B8{constructor(){super(...arguments),fZ(this,`code`,`ERR_JWE_INVALID`)}},`code`,`ERR_JWE_INVALID`),fZ(class extends B8{constructor(){super(...arguments),fZ(this,`code`,`ERR_JWS_INVALID`)}},`code`,`ERR_JWS_INVALID`),fZ(class extends B8{constructor(){super(...arguments),fZ(this,`code`,`ERR_JWT_INVALID`)}},`code`,`ERR_JWT_INVALID`),fZ(class extends B8{constructor(){super(...arguments),fZ(this,`code`,`ERR_JWK_INVALID`)}},`code`,`ERR_JWK_INVALID`),fZ(class extends B8{constructor(){super(...arguments),fZ(this,`code`,`ERR_JWKS_INVALID`)}},`code`,`ERR_JWKS_INVALID`),fZ(class extends B8{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:`no applicable key found in the JSON Web Key Set`,t=arguments.length>1?arguments[1]:void 0;super(e,t),fZ(this,`code`,`ERR_JWKS_NO_MATCHING_KEY`)}},`code`,`ERR_JWKS_NO_MATCHING_KEY`),fZ(class extends B8{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:`multiple matching keys found in the JSON Web Key Set`,t=arguments.length>1?arguments[1]:void 0;super(e,t),fZ(this,Symbol.asyncIterator,void 0),fZ(this,`code`,`ERR_JWKS_MULTIPLE_MATCHING_KEYS`)}},`code`,`ERR_JWKS_MULTIPLE_MATCHING_KEYS`),fZ(class extends B8{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:`request timed out`,t=arguments.length>1?arguments[1]:void 0;super(e,t),fZ(this,`code`,`ERR_JWKS_TIMEOUT`)}},`code`,`ERR_JWKS_TIMEOUT`),fZ(class extends B8{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:`signature verification failed`,t=arguments.length>1?arguments[1]:void 0;super(e,t),fZ(this,`code`,`ERR_JWS_SIGNATURE_VERIFICATION_FAILED`)}},`code`,`ERR_JWS_SIGNATURE_VERIFICATION_FAILED`);var V8=Math.min,H8=Math.max,U8=Math.round,W8=Math.floor,G8=e=>({x:e,y:e}),Ode={left:`right`,right:`left`,bottom:`top`,top:`bottom`},kde={start:`end`,end:`start`};function K8(e,t,n){return H8(e,V8(t,n))}function q8(e,t){return typeof e==`function`?e(t):e}function J8(e){return e.split(`-`)[0]}function Y8(e){return e.split(`-`)[1]}function X8(e){return e===`x`?`y`:`x`}function Z8(e){return e===`y`?`height`:`width`}var Ade=new Set([`top`,`bottom`]);function Q8(e){return Ade.has(J8(e))?`y`:`x`}function $8(e){return X8(Q8(e))}function jde(e,t,n){n===void 0&&(n=!1);let r=Y8(e),i=$8(e),a=Z8(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=r5(o)),[o,r5(o)]}function Mde(e){let t=r5(e);return[e5(e),t,e5(t)]}function e5(e){return e.replace(/start|end/g,e=>kde[e])}var t5=[`left`,`right`],n5=[`right`,`left`],Nde=[`top`,`bottom`],Pde=[`bottom`,`top`];function Fde(e,t,n){switch(e){case`top`:case`bottom`:return n?t?n5:t5:t?t5:n5;case`left`:case`right`:return t?Nde:Pde;default:return[]}}function Ide(e,t,n,r){let i=Y8(e),a=Fde(J8(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(e5)))),a}function r5(e){return e.replace(/left|right|bottom|top/g,e=>Ode[e])}function Lde(e){return{top:0,right:0,bottom:0,left:0,...e}}function Rde(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Lde(e)}function i5(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 a5(e,t,n){let{reference:r,floating:i}=e,a=Q8(t),o=$8(t),s=Z8(o),c=J8(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(Y8(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function zde(e,t){var n;t===void 0&&(t={});let{x:r,y:i,platform:a,rects:o,elements:s,strategy:c}=e,{boundary:l=`clippingAncestors`,rootBoundary:u=`viewport`,elementContext:d=`floating`,altBoundary:f=!1,padding:p=0}=q8(t,e),m=Rde(p),h=s[f?d===`floating`?`reference`:`floating`:d],g=i5(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(h)))==null||n?h:h.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(s.floating)),boundary:l,rootBoundary:u,strategy:c})),_=d===`floating`?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,v=await(a.getOffsetParent==null?void 0:a.getOffsetParent(s.floating)),y=await(a.isElement==null?void 0:a.isElement(v))&&await(a.getScale==null?void 0:a.getScale(v))||{x:1,y:1},b=i5(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:_,offsetParent:v,strategy:c}):_);return{top:(g.top-b.top+m.top)/y.y,bottom:(b.bottom-g.bottom+m.bottom)/y.y,left:(g.left-b.left+m.left)/y.x,right:(b.right-g.right+m.right)/y.x}}var Bde=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=a.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=a5(l,r,c),f=r,p={},m=0;for(let n=0;n<s.length;n++){let{name:a,fn:h}=s[n],{x:g,y:_,data:v,reset:y}=await h({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:p,rects:l,platform:{...o,detectOverflow:o.detectOverflow??zde},elements:{reference:e,floating:t}});u=g??u,d=_??d,p={...p,[a]:{...p[a],...v}},y&&m<=50&&(m++,typeof y==`object`&&(y.placement&&(f=y.placement),y.rects&&(l=y.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):y.rects),{x:u,y:d}=a5(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:p}},Vde=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}=q8(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=J8(r),_=Q8(o),v=J8(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[r5(o)]:Mde(o)),x=p!==`none`;!d&&x&&b.push(...Ide(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=jde(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`&&_!==Q8(t))||T.every(e=>Q8(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Q8(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{}}}},Hde=new Set([`left`,`top`]);async function Ude(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=J8(n),s=Y8(n),c=Q8(n)===`y`,l=Hde.has(o)?-1:1,u=a&&c?-1:1,d=q8(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 Wde=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 Ude(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}}}}},Gde=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}=q8(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Q8(J8(i)),p=X8(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=K8(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=K8(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}};function o5(){return typeof window<`u`}function s5(e){return u5(e)?(e.nodeName||``).toLowerCase():`#document`}function c5(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function l5(e){return((u5(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function u5(e){return o5()?e instanceof Node||e instanceof c5(e).Node:!1}function d5(e){return o5()?e instanceof Element||e instanceof c5(e).Element:!1}function f5(e){return o5()?e instanceof HTMLElement||e instanceof c5(e).HTMLElement:!1}function p5(e){return!o5()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof c5(e).ShadowRoot}var Kde=new Set([`inline`,`contents`]);function m5(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=y5(e);
vendor: 4,670 bytes, line 244
244return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Kde.has(i)}var qde=new Set([`table`,`td`,`th`]);function Jde(e){return qde.has(s5(e))}var Yde=[`:popover-open`,`:modal`];function h5(e){return Yde.some(t=>{try{return e.matches(t)}catch{return!1}})}var Xde=[`transform`,`translate`,`scale`,`rotate`,`perspective`],Zde=[`transform`,`translate`,`scale`,`rotate`,`perspective`,`filter`],Qde=[`paint`,`layout`,`strict`,`content`];function g5(e){let t=_5(),n=d5(e)?y5(e):e;return Xde.some(e=>n[e]?n[e]!==`none`:!1)||(n.containerType?n.containerType!==`normal`:!1)||!t&&(n.backdropFilter?n.backdropFilter!==`none`:!1)||!t&&(n.filter?n.filter!==`none`:!1)||Zde.some(e=>(n.willChange||``).includes(e))||Qde.some(e=>(n.contain||``).includes(e))}function $de(e){let t=x5(e);for(;f5(t)&&!v5(t);){if(g5(t))return t;if(h5(t))return null;t=x5(t)}return null}function _5(){return typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter`,`none`)}var efe=new Set([`html`,`body`,`#document`]);function v5(e){return efe.has(s5(e))}function y5(e){return c5(e).getComputedStyle(e)}function b5(e){return d5(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function x5(e){if(s5(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||p5(e)&&e.host||l5(e);return p5(t)?t.host:t}function S5(e){let t=x5(e);return v5(t)?e.ownerDocument?e.ownerDocument.body:e.body:f5(t)&&m5(t)?t:S5(t)}function C5(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=S5(e),i=r===e.ownerDocument?.body,a=c5(r);if(i){let e=w5(a);return t.concat(a,a.visualViewport||[],m5(r)?r:[],e&&n?C5(e):[])}return t.concat(r,C5(r,[],n))}function w5(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function T5(e){let t=y5(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=f5(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=U8(n)!==a||U8(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function E5(e){return d5(e)?e:e.contextElement}function D5(e){let t=E5(e);if(!f5(t))return G8(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=T5(t),o=(a?U8(n.width):n.width)/r,s=(a?U8(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var tfe=G8(0);function O5(e){let t=c5(e);return!_5()||!t.visualViewport?tfe:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function nfe(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==c5(e)?!1:t}function k5(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=E5(e),o=G8(1);t&&(r?d5(r)&&(o=D5(r)):o=D5(e));let s=nfe(a,n,r)?O5(a):G8(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=c5(a),t=r&&d5(r)?c5(r):r,n=e,i=w5(n);for(;i&&r&&t!==n;){let e=D5(i),t=i.getBoundingClientRect(),r=y5(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=c5(i),i=w5(n)}}return i5({width:u,height:d,x:c,y:l})}function A5(e,t){let n=b5(e).scrollLeft;return t?t.left+n:k5(l5(e)).left+n}function j5(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-A5(e,n),y:n.top+t.scrollTop}}function rfe(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=l5(r),s=t?h5(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=G8(1),u=G8(0),d=f5(r);if((d||!d&&!a)&&((s5(r)!==`body`||m5(o))&&(c=b5(r)),f5(r))){let e=k5(r);l=D5(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?j5(o,c):G8(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 ife(e){return Array.from(e.getClientRects())}function afe(e){let t=l5(e),n=b5(e),r=e.ownerDocument.body,i=H8(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=H8(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+A5(e),s=-n.scrollTop;return y5(r).direction===`rtl`&&(o+=H8(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var M5=25;function ofe(e,t){let n=c5(e),r=l5(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=_5();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=A5(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=M5&&(a-=o)}else l<=M5&&(a+=l);return{width:a,height:o,x:s,y:c}}var sfe=new Set([`absolute`,`fixed`]);function cfe(e,t){let n=k5(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=f5(e)?D5(e):G8(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}
vendor: 4,299 bytes, line 244
244function N5(e,t,n){let r;if(t===`viewport`)r=ofe(e,n);else if(t===`document`)r=afe(l5(e));else if(d5(t))r=cfe(t,n);else{let n=O5(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return i5(r)}function P5(e,t){let n=x5(e);return n===t||!d5(n)||v5(n)?!1:y5(n).position===`fixed`||P5(n,t)}function lfe(e,t){let n=t.get(e);if(n)return n;let r=C5(e,[],!1).filter(e=>d5(e)&&s5(e)!==`body`),i=null,a=y5(e).position===`fixed`,o=a?x5(e):e;for(;d5(o)&&!v5(o);){let t=y5(o),n=g5(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&sfe.has(i.position)||m5(o)&&!n&&P5(e,o))?r=r.filter(e=>e!==o):i=t,o=x5(o)}return t.set(e,r),r}function ufe(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?h5(t)?[]:lfe(t,this._c):[].concat(n),r],o=a[0],s=a.reduce((e,n)=>{let r=N5(t,n,i);return e.top=H8(r.top,e.top),e.right=V8(r.right,e.right),e.bottom=V8(r.bottom,e.bottom),e.left=H8(r.left,e.left),e},N5(t,o,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function dfe(e){let{width:t,height:n}=T5(e);return{width:t,height:n}}function ffe(e,t,n){let r=f5(t),i=l5(t),a=n===`fixed`,o=k5(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=G8(0);function l(){c.x=A5(i)}if(r||!r&&!a)if((s5(t)!==`body`||m5(i))&&(s=b5(t)),r){let e=k5(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?j5(i,s):G8(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function F5(e){return y5(e).position===`static`}function I5(e,t){if(!f5(e)||y5(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return l5(e)===n&&(n=n.ownerDocument.body),n}function L5(e,t){let n=c5(e);if(h5(e))return n;if(!f5(e)){let t=x5(e);for(;t&&!v5(t);){if(d5(t)&&!F5(t))return t;t=x5(t)}return n}let r=I5(e,t);for(;r&&Jde(r)&&F5(r);)r=I5(r,t);return r&&v5(r)&&F5(r)&&!g5(r)?n:r||$de(e)||n}var pfe=async function(e){let t=this.getOffsetParent||L5,n=this.getDimensions,r=await n(e.floating);return{reference:ffe(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function mfe(e){return y5(e).direction===`rtl`}var hfe={convertOffsetParentRelativeRectToViewportRelativeRect:rfe,getDocumentElement:l5,getClippingRect:ufe,getOffsetParent:L5,getElementRects:pfe,getClientRects:ife,getDimensions:dfe,getScale:D5,isElement:d5,isRTL:mfe};function R5(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function gfe(e,t){let n=null,r,i=l5(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=W8(d),h=W8(i.clientWidth-(u+f)),g=W8(i.clientHeight-(d+p)),_=W8(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:H8(0,V8(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!R5(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function _fe(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=E5(e),u=i||a?[...l?C5(l):[],...C5(t)]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?gfe(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),p.observe(t));let m,h=c?k5(e):null;c&&g();function g(){let t=k5(e);h&&!R5(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 vfe=Wde,yfe=Gde,bfe=Vde,xfe=(e,t,n)=>{let r=new Map,i={platform:hfe,...n},a={...i.platform,_c:r};return Bde(e,t,{...i,platform:a})},z5=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};
244function Sfe(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var B5={exports:{}},Cfe=B5.exports,V5;function wfe(){return V5||(V5=1,(function(e){(function(t,n){e.exports?e.exports=n():t.log=n()})(Cfe,function(){var e=function(){},t=`undefined`,n=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),r=[`trace`,`debug`,`info`,`warn`,`error`],i={},a=null;function o(e,t){var n=e[t];if(typeof n.bind==`function`)return n.bind(e);try{return Function.prototype.bind.call(n,e)}catch{return function(){return Function.prototype.apply.apply(n,[e,arguments])}}}function s(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function c(r){return r===`debug`&&(r=`log`),typeof console===t?!1:r===`trace`&&n?s:console[r]===void 0?console.log===void 0?e:o(console,`log`):o(console,r)}function l(){for(var n=this.getLevel(),i=0;i<r.length;i++){var a=r[i];this[a]=i<n?e:this.methodFactory(a,n,this.name)}if(this.log=this.debug,typeof console===t&&n<this.levels.SILENT)return`No console available for logging`}function u(e){return function(){typeof console!==t&&(l.call(this),this[e].apply(this,arguments))}}function d(e,t,n){return c(e)||u.apply(this,arguments)}function f(e,n){var o=this,s,c,u,f=`loglevel`;typeof e==`string`?f+=`:`+e:typeof e==`symbol`&&(f=void 0);function p(e){var n=(r[e]||`silent`).toUpperCase();if(!(typeof window===t||!f)){try{window.localStorage[f]=n;return}catch{}try{window.document.cookie=encodeURIComponent(f)+`=`+n+`;`}catch{}}}function m(){var e;if(!(typeof window===t||!f)){try{e=window.localStorage[f]}catch{}if(typeof e===t)try{var n=window.document.cookie,r=encodeURIComponent(f),i=n.indexOf(r+`=`);i!==-1&&(e=/^([^;]+)/.exec(n.slice(i+r.length+1))[1])}catch{}return o.levels[e]===void 0&&(e=void 0),e}}function h(){if(!(typeof window===t||!f)){try{window.localStorage.removeItem(f)}catch{}try{window.document.cookie=encodeURIComponent(f)+`=; expires=Thu, 01 Jan 1970 00:00:00 UTC`}catch{}}}function g(e){var t=e;if(typeof t==`string`&&o.levels[t.toUpperCase()]!==void 0&&(t=o.levels[t.toUpperCase()]),typeof t==`number`&&t>=0&&t<=o.levels.SILENT)return t;throw TypeError(`log.setLevel() called with invalid level: `+e)}o.name=e,o.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},o.methodFactory=n||d,o.getLevel=function(){return u??c??s},o.setLevel=function(e,t){return u=g(e),t!==!1&&p(u),l.call(o)},o.setDefaultLevel=function(e){c=g(e),m()||o.setLevel(e,!1)},o.resetLevel=function(){u=null,h(),l.call(o)},o.enableAll=function(e){o.setLevel(o.levels.TRACE,e)},o.disableAll=function(e){o.setLevel(o.levels.SILENT,e)},o.rebuild=function(){if(a!==o&&(s=g(a.getLevel())),l.call(o),a===o)for(var e in i)i[e].rebuild()},s=g(a?a.getLevel():`WARN`);var _=m();_!=null&&(u=g(_)),l.call(o)}a=new f,a.getLogger=function(e){if(typeof e!=`symbol`&&typeof e!=`string`||e===``)throw TypeError(`You must supply a name when creating a logger.`);var t=i[e];return t||=i[e]=new f(e,a.methodFactory),t};var p=typeof window===t?void 0:window.log;return a.noConflict=function(){return typeof window!==t&&window.log===a&&(window.log=p),a},a.getLoggers=function(){return i},a.default=a,a})})(B5)),B5.exports}var Tfe=Sfe(wfe()),H5=function(e,t){return H5=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},H5(e,t)};function U5(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);H5(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}function Efe(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function W5(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o=Object.create((typeof Iterator==`function`?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),typeof Symbol==`function`&&(
vendor: 5,604 bytes, lines 244-246
244o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(s){if(r)throw TypeError(`Generator is already executing.`);for(;o&&(o=0,s[0]&&(n=0)),n;)try{if(r=1,i&&(a=s[0]&2?i.return:s[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,s[1])).done)return a;switch(i=0,a&&(s=[s[0]&2,a.value]),s[0]){case 0:case 1:a=s;break;case 4:return n.label++,{value:s[1],done:!1};case 5:n.label++,i=s[1],s=[0];continue;case 7:s=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){n.label=s[1];break}if(s[0]===6&&n.label<a[1]){n.label=a[1],a=s;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(s);break}a[2]&&n.ops.pop(),n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e],i=0}finally{r=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}function G5(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function K5(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function q5(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}function J5(e){return this instanceof J5?(this.v=e,this):new J5(e)}function Dfe(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i=Object.create((typeof AsyncIterator==`function`?AsyncIterator:Object).prototype),s(`next`),s(`throw`),s(`return`,o),i[Symbol.asyncIterator]=function(){return this},i;function o(e){return function(t){return Promise.resolve(t).then(e,d)}}function s(e,t){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||c(e,t)})},t&&(i[e]=t(i[e])))}function c(e,t){try{l(r[e](t))}catch(e){f(a[0][3],e)}}function l(e){e.value instanceof J5?Promise.resolve(e.value.v).then(u,d):f(a[0][2],e)}function u(e){c(`next`,e)}function d(e){c(`throw`,e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}}function Ofe(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof G5==`function`?G5(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}}function Y5(e){return typeof e==`function`}function X5(e){var t=e(function(e){Error.call(e),e.stack=Error().stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var Z5=X5(function(e){return function(t){e(this),this.message=t?t.length+` errors occurred during unsubscription: 245`+t.map(function(e,t){return t+1+`) `+e.toString()}).join(` 246 `):``,this.name=`UnsubscriptionError`,this.errors=t}});function Q5(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var $5=(function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var e,t,n,r,i;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var o=G5(a),s=o.next();!s.done;s=o.next())s.value.remove(this)}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}else a.remove(this);var c=this.initialTeardown;if(Y5(c))try{c()}catch(e){i=e instanceof Z5?e.errors:[e]}var l=this._finalizers;if(l){this._finalizers=null;try{for(var u=G5(l),d=u.next();!d.done;d=u.next()){var f=d.value;try{n7(f)}catch(e){i??=[],e instanceof Z5?i=q5(q5([],K5(i)),K5(e.errors)):i.push(e)}}}catch(e){n={error:e}}finally{try{d&&!d.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}}if(i)throw new Z5(i)}},e.prototype.add=function(t){if(t&&t!==this)if(this.closed)n7(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=this._finalizers??[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&Q5(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&Q5(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=(function(){var t=new e;return t.closed=!0,t})(),e})(),e7=$5.EMPTY;function t7(e){return e instanceof $5||e&&`closed`in e&&Y5(e.remove)&&Y5(e.add)&&Y5(e.unsubscribe)}function n7(e){Y5(e)?e():e.unsubscribe()}var kfe={Promise:void 0},Afe={setTimeout:function(e,t){var n=[...arguments].slice(2);return setTimeout.apply(void 0,q5([e,t],K5(n)))},clearTimeout:function(e){return clearTimeout(e)},delegate:void 0};function r7(e){Afe.setTimeout(function(){throw e})}function i7(){}function a7(e){e()}var o7=(function(e){U5(t,e);function t(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,t7(t)&&t.add(n)):n.destination=Nfe,n}
vendor: 4,907 bytes, line 246
246return t.create=function(e,t,n){return new s7(e,t,n)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t})($5),jfe=(function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){c7(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){c7(e)}else c7(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){c7(e)}},e})(),s7=(function(e){U5(t,e);function t(t,n,r){var i=e.call(this)||this,a;return a=Y5(t)||!t?{next:t??void 0,error:n??void 0,complete:r??void 0}:t,i.destination=new jfe(a),i}return t})(o7);function c7(e){r7(e)}function Mfe(e){throw e}var Nfe={closed:!0,next:i7,error:Mfe,complete:i7},l7=(function(){return typeof Symbol==`function`&&Symbol.observable||`@@observable`})();function u7(e){return e}function Pfe(e){return e.length===0?u7:e.length===1?e[0]:function(t){return e.reduce(function(e,t){return t(e)},t)}}var d7=(function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(e,t,n){var r=this,i=Ife(e)?e:new s7(e,t,n);return a7(function(){var e=r,t=e.operator,n=e.source;i.add(t?t.call(i,n):n?r._subscribe(i):r._trySubscribe(i))}),i},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var n=this;return t=f7(t),new t(function(t,r){var i=new s7({next:function(t){try{e(t)}catch(e){r(e),i.unsubscribe()}},error:r,complete:t});n.subscribe(i)})},e.prototype._subscribe=function(e){return this.source?.subscribe(e)},e.prototype[l7]=function(){return this},e.prototype.pipe=function(){return Pfe([...arguments])(this)},e.prototype.toPromise=function(e){var t=this;return e=f7(e),new e(function(e,n){var r;t.subscribe(function(e){return r=e},function(e){return n(e)},function(){return e(r)})})},e.create=function(t){return new e(t)},e})();function f7(e){return e??kfe.Promise??Promise}function Ffe(e){return e&&Y5(e.next)&&Y5(e.error)&&Y5(e.complete)}function Ife(e){return e&&e instanceof o7||Ffe(e)&&t7(e)}function Lfe(e){return Y5(e?.lift)}function p7(e){return function(t){if(Lfe(t))return t.lift(function(t){try{return e(t,this)}catch(e){this.error(e)}});throw TypeError(`Unable to lift unknown Observable type`)}}function m7(e,t,n,r,i){return new Rfe(e,t,n,r,i)}var Rfe=(function(e){U5(t,e);function t(t,n,r,i,a,o){var s=e.call(this,t)||this;return s.onFinalize=a,s.shouldUnsubscribe=o,s._next=n?function(e){try{n(e)}catch(e){t.error(e)}}:e.prototype._next,s._error=i?function(e){try{i(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,s._complete=r?function(){try{r()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,s}return t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&((t=this.onFinalize)==null||t.call(this))}},t})(o7),zfe=X5(function(e){return function(){e(this),this.name=`ObjectUnsubscribedError`,this.message=`object unsubscribed`}}),h7=(function(e){U5(t,e);function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return t.prototype.lift=function(e){var t=new g7(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new zfe},t.prototype.next=function(e){var t=this;a7(function(){var n,r;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||=Array.from(t.observers);try{for(var i=G5(t.currentObservers),a=i.next();!a.done;a=i.next())a.value.next(e)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}})},t.prototype.error=function(e){var t=this;a7(function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var n=t.observers;n.length;)n.shift().error(e)}})},t.prototype.complete=function(){var e=this;a7(function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,`observed`,{get:function(){return this.observers?.length>0}
246,enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,n=this,r=n.hasError,i=n.isStopped,a=n.observers;return r||i?e7:(this.currentObservers=null,a.push(e),new $5(function(){t.currentObservers=null,Q5(a,e)}))},t.prototype._checkFinalizedStatuses=function(e){var t=this,n=t.hasError,r=t.thrownError,i=t.isStopped;n?e.error(r):i&&e.complete()},t.prototype.asObservable=function(){var e=new d7;return e.source=this,e},t.create=function(e,t){return new g7(e,t)},t})(d7),g7=(function(e){U5(t,e);function t(t,n){var r=e.call(this)||this;return r.destination=t,r.source=n,r}return t.prototype.next=function(e){var t,n;(n=(t=this.destination)?.next)==null||n.call(t,e)},t.prototype.error=function(e){var t,n;(n=(t=this.destination)?.error)==null||n.call(t,e)},t.prototype.complete=function(){var e,t;(t=(e=this.destination)?.complete)==null||t.call(e)},t.prototype._subscribe=function(e){return this.source?.subscribe(e)??e7},t})(h7),Bfe=(function(e){U5(t,e);function t(t){var n=e.call(this)||this;return n._value=t,n}return Object.defineProperty(t.prototype,`value`,{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(t){var n=e.prototype._subscribe.call(this,t);return!n.closed&&t.next(this._value),n},t.prototype.getValue=function(){var e=this,t=e.hasError,n=e.thrownError,r=e._value;if(t)throw n;return this._throwIfClosed(),r},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},t})(h7),Vfe={now:function(){return Date.now()}},Hfe=(function(e){U5(t,e);function t(t,n){return e.call(this)||this}return t.prototype.schedule=function(e,t){return this},t})($5),_7={setInterval:function(e,t){var n=[...arguments].slice(2);return setInterval.apply(void 0,q5([e,t],K5(n)))},clearInterval:function(e){return clearInterval(e)},delegate:void 0},Ufe=(function(e){U5(t,e);function t(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r.pending=!1,r}return t.prototype.schedule=function(e,t){if(t===void 0&&(t=0),this.closed)return this;this.state=e;var n=this.id,r=this.scheduler;return n!=null&&(this.id=this.recycleAsyncId(r,n,t)),this.pending=!0,this.delay=t,this.id=this.id??this.requestAsyncId(r,this.id,t),this},t.prototype.requestAsyncId=function(e,t,n){return n===void 0&&(n=0),_7.setInterval(e.flush.bind(e,this),n)},t.prototype.recycleAsyncId=function(e,t,n){if(n===void 0&&(n=0),n!=null&&this.delay===n&&this.pending===!1)return t;t!=null&&_7.clearInterval(t)},t.prototype.execute=function(e,t){if(this.closed)return Error(`executing a cancelled action`);this.pending=!1;var n=this._execute(e,t);if(n)return n;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,t){var n=!1,r;try{this.work(e)}catch(e){n=!0,r=e||Error(`Scheduled action threw falsy error`)}if(n)return this.unsubscribe(),r},t.prototype.unsubscribe=function(){if(!this.closed){var t=this,n=t.id,r=t.scheduler,i=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,Q5(i,this),n!=null&&(this.id=this.recycleAsyncId(r,n,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t})(Hfe),v7=(function(){function e(t,n){n===void 0&&(n=e.now),this.schedulerActionCtor=t,this.now=n}return e.prototype.schedule=function(e,t,n){return t===void 0&&(t=0),new this.schedulerActionCtor(this,e).schedule(n,t)},e.now=Vfe.now,e})();new((function(e){U5(t,e);function t(t,n){n===void 0&&(n=v7.now);var r=e.call(this,t,n)||this;return r.actions=[],r._active=!1,r}return t.prototype.flush=function(e){var t=this.actions;if(this._active){t.push(e);return}var n;this._active=!0;do if(n=e.execute(e.state,e.delay))break;while(e=t.shift());if(this._active=!1,n){for(;e=t.shift();)e.unsubscribe();throw n}},t})(v7))(Ufe);function Wfe(e){return e&&Y5(e.schedule)}function Gfe(e){return e[e.length-1]}function y7(e){return Wfe(Gfe(e))?e.pop():void 0}var b7=(function(e){return e&&typeof e.length==`number`&&typeof e!=`function`});function x7(e){return Y5(e?.then)}function S7(e){return Y5(e[l7])}function C7(e){return Symbol.asyncIterator&&Y5(e?.[Symbol.asyncIterator])}function w7(e){return TypeError(`You provided `+(typeof e==`object`&&e?`an invali
246d object`:`'`+e+`'`)+` where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`)}function Kfe(){return typeof Symbol!=`function`||!Symbol.iterator?`@@iterator`:Symbol.iterator}var T7=Kfe();function E7(e){return Y5(e?.[T7])}function D7(e){return Dfe(this,arguments,function(){var t,n,r,i;return W5(this,function(a){switch(a.label){case 0:t=e.getReader(),a.label=1;case 1:a.trys.push([1,,9,10]),a.label=2;case 2:return[4,J5(t.read())];case 3:return n=a.sent(),r=n.value,i=n.done,i?[4,J5(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,J5(r)];case 6:return[4,a.sent()];case 7:return a.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function O7(e){return Y5(e?.getReader)}function k7(e){if(e instanceof d7)return e;if(e!=null){if(S7(e))return qfe(e);if(b7(e))return Jfe(e);if(x7(e))return Yfe(e);if(C7(e))return A7(e);if(E7(e))return Xfe(e);if(O7(e))return Zfe(e)}throw w7(e)}function qfe(e){return new d7(function(t){var n=e[l7]();if(Y5(n.subscribe))return n.subscribe(t);throw TypeError(`Provided object does not correctly implement Symbol.observable`)})}function Jfe(e){return new d7(function(t){for(var n=0;n<e.length&&!t.closed;n++)t.next(e[n]);t.complete()})}function Yfe(e){return new d7(function(t){e.then(function(e){t.closed||(t.next(e),t.complete())},function(e){return t.error(e)}).then(null,r7)})}function Xfe(e){return new d7(function(t){var n,r;try{for(var i=G5(e),a=i.next();!a.done;a=i.next()){var o=a.value;if(t.next(o),t.closed)return}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}t.complete()})}function A7(e){return new d7(function(t){Qfe(e,t).catch(function(e){return t.error(e)})})}function Zfe(e){return A7(D7(e))}function Qfe(e,t){var n,r,i,a;return Efe(this,void 0,void 0,function(){var o,s;return W5(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),n=Ofe(e),c.label=1;case 1:return[4,n.next()];case 2:if(r=c.sent(),r.done)return[3,4];if(o=r.value,t.next(o),t.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return s=c.sent(),i={error:s},[3,11];case 6:return c.trys.push([6,,9,10]),r&&!r.done&&(a=n.return)?[4,a.call(n)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}function j7(e,t,n,r,i){r===void 0&&(r=0),i===void 0&&(i=!1);var a=t.schedule(function(){n(),i?e.add(this.schedule(null,r)):this.unsubscribe()},r);if(e.add(a),!i)return a}function M7(e,t){return t===void 0&&(t=0),p7(function(n,r){n.subscribe(m7(r,function(n){return j7(r,e,function(){return r.next(n)},t)},function(){return j7(r,e,function(){return r.complete()},t)},function(n){return j7(r,e,function(){return r.error(n)},t)}))})}function N7(e,t){return t===void 0&&(t=0),p7(function(n,r){r.add(e.schedule(function(){return n.subscribe(r)},t))})}function $fe(e,t){return k7(e).pipe(N7(t),M7(t))}function epe(e,t){return k7(e).pipe(N7(t),M7(t))}function tpe(e,t){return new d7(function(n){var r=0;return t.schedule(function(){r===e.length?n.complete():(n.next(e[r++]),n.closed||this.schedule())})})}function npe(e,t){return new d7(function(n){var r;return j7(n,t,function(){r=e[T7](),j7(n,t,function(){var e,t,i;try{e=r.next(),t=e.value,i=e.done}catch(e){n.error(e);return}i?n.complete():n.next(t)},0,!0)}),function(){return Y5(r?.return)&&r.return()}})}function P7(e,t){if(!e)throw Error(`Iterable cannot be null`);return new d7(function(n){j7(n,t,function(){var r=e[Symbol.asyncIterator]();j7(n,t,function(){r.next().then(function(e){e.done?n.complete():n.next(e.value)})},0,!0)})})}function rpe(e,t){return P7(D7(e),t)}function ipe(e,t){if(e!=null){if(S7(e))return $fe(e,t);if(b7(e))return tpe(e,t);if(x7(e))return epe(e,t);if(C7(e))return P7(e,t);if(E7(e))return npe(e,t);if(O7(e))return rpe(e,t)}throw w7(e)}function F7(e,t){return t?ipe(e,t):k7(e)}X5(function(e){return function(t){t===void 0&&(t=null),e(this),this.message=`Timeout has occurred`,this.name=`TimeoutError`,this.info=t}});function I7(e,t){return p7(function(n,r){var i=0;n.subscribe(m7(r,function(n){r.next(e.call(t,n,i++))}))})}Array.isArray;function ape(e,t,n,r,i,a,o,s){var c=[],l=0,u=0,d=!1,f=function(){d&&!c.length&&!l&&t.complete()},p=function(e){return l<r?m(e):c.push(e)},m=function(e){l++;var i=!1;k7(n(e,u++)).subscribe(m7(t,function(e){t.next(e)},function(){i=!0},void 0,function(){if(i)try{l--;for(var e=function(){var e=c.shift();o||m(e)};c.length&&l<r;)e();f()}catch(e){t.error(e)}}))};return e.subscribe(m7(t,p,function(){d=!0,f()})),function(){}}
246function L7(e,t,n){return n===void 0&&(n=1/0),Y5(t)?L7(function(n,r){return I7(function(e,i){return t(n,e,r,i)})(k7(e(n,r)))},n):(typeof t==`number`&&(n=t),p7(function(t,r){return ape(t,r,e,n)}))}function ope(e){return L7(u7,e)}function spe(){return ope(1)}function R7(){var e=[...arguments];return spe()(F7(e,y7(e)))}function cpe(e,t){return p7(function(n,r){var i=0;n.subscribe(m7(r,function(n){return e.call(t,n,i++)&&r.next(n)}))})}function lpe(e,t,n,r,i){return function(r,a){var o=n,s=t,c=0;r.subscribe(m7(a,function(t){var n=c++;s=o?e(s,t,n):(o=!0,t),a.next(s)},i))}}function upe(e,t){return p7(lpe(e,t,arguments.length>=2,!0))}function dpe(e){e===void 0&&(e={});var t=e.connector,n=t===void 0?function(){return new h7}:t,r=e.resetOnError,i=r===void 0?!0:r,a=e.resetOnComplete,o=a===void 0?!0:a,s=e.resetOnRefCountZero,c=s===void 0?!0:s;return function(e){var t,r,a,s=0,l=!1,u=!1,d=function(){r?.unsubscribe(),r=void 0},f=function(){d(),t=a=void 0,l=u=!1},p=function(){var e=t;f(),e?.unsubscribe()};return p7(function(e,m){s++,!u&&!l&&d();var h=a??=n();m.add(function(){s--,s===0&&!u&&!l&&(r=z7(p,c))}),h.subscribe(m),!t&&s>0&&(t=new s7({next:function(e){return h.next(e)},error:function(e){u=!0,d(),r=z7(f,i,e),h.error(e)},complete:function(){l=!0,d(),r=z7(f,o),h.complete()}}),k7(e).subscribe(t))})(e)}}function z7(e,t){var n=[...arguments].slice(2);if(t===!0){e();return}if(t!==!1){var r=new s7({next:function(){r.unsubscribe(),e()}});return k7(t.apply(void 0,q5([],K5(n)))).subscribe(r)}}function B7(){var e=[...arguments],t=y7(e);return p7(function(n,r){(t?R7(e,n,t):R7(e,n)).subscribe(r)})}function fpe(e,t,n){var r=Y5(e)||t||n?{next:e,error:t,complete:n}:e;return r?p7(function(e,t){var n;(n=r.subscribe)==null||n.call(r);var i=!0;e.subscribe(m7(t,function(e){var n;(n=r.next)==null||n.call(r,e),t.next(e)},function(){var e;i=!1,(e=r.complete)==null||e.call(r),t.complete()},function(e){var n;i=!1,(n=r.error)==null||n.call(r,e),t.error(e)},function(){var e,t;i&&((e=r.unsubscribe)==null||e.call(r)),(t=r.finalize)==null||t.call(r)}))}):u7}var ppe=Object.defineProperty,mpe=Object.defineProperties,hpe=Object.getOwnPropertyDescriptors,V7=Object.getOwnPropertySymbols,gpe=Object.prototype.hasOwnProperty,_pe=Object.prototype.propertyIsEnumerable,H7=(e,t,n)=>t in e?ppe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,U7=(e,t)=>{for(var n in t||={})gpe.call(t,n)&&H7(e,n,t[n]);if(V7)for(var n of V7(t))_pe.call(t,n)&&H7(e,n,t[n]);return e},W7=(e,t)=>mpe(e,hpe(t)),G7=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())}),K7=`lk`;function q7(e){return typeof e>`u`?!1:vpe(e)||ype(e)}function vpe(e){return e?e.hasOwnProperty(`participant`)&&e.hasOwnProperty(`source`)&&e.hasOwnProperty(`track`)&&typeof e.publication?.track<`u`:!1}function ype(e){return e?e.hasOwnProperty(`participant`)&&e.hasOwnProperty(`source`)&&e.hasOwnProperty(`publication`)&&typeof e.publication<`u`:!1}function bpe(e){return e?e.hasOwnProperty(`participant`)&&e.hasOwnProperty(`source`)&&typeof e.publication>`u`:!1}function J7(e){if(typeof e==`string`||typeof e==`number`)return`${e}`;if(bpe(e))return`${e.participant.identity}_${e.source}_placeholder`;if(q7(e))return`${e.participant.identity}_${e.publication.source}_${e.publication.trackSid}`;throw Error(`Can't generate a id for the given track reference: ${e}`)}function xpe(e,t,n){return _fe(e,t,()=>G7(null,null,function*(){let{x:r,y:i}=yield xfe(e,t,{placement:`top`,middleware:[vfe(6),bfe(),yfe({padding:5})]});n?.(r,i)}))}function Spe(e,t){return!e.contains(t.target)}var Y7=[Y.ConnectionStateChanged,Y.RoomMetadataChanged,Y.ActiveSpeakersChanged,Y.ConnectionQualityChanged,Y.ParticipantConnected,Y.ParticipantDisconnected,Y.ParticipantPermissionsChanged,Y.ParticipantMetadataChanged,Y.ParticipantNameChanged,Y.ParticipantAttributesChanged,Y.TrackMuted,Y.TrackUnmuted,Y.TrackPublished,Y.TrackUnpublished,Y.TrackStreamStateChanged,Y.TrackSubscriptionFailed,Y.TrackSubscriptionPermissionChanged,Y.TrackSubscriptionStatusChanged,Y.LocalTrackPublished,Y.LocalTrackUnpublished],Cpe=[X.TrackPublished,X.TrackUnpublished,X.TrackMuted,X.TrackUnmuted,
246X.TrackStreamStateChanged,X.TrackSubscribed,X.TrackUnsubscribed,X.TrackSubscriptionPermissionChanged,X.TrackSubscriptionFailed,X.LocalTrackPublished,X.LocalTrackUnpublished];X.ConnectionQualityChanged,X.IsSpeakingChanged,X.ParticipantMetadataChanged,X.ParticipantPermissionsChanged,X.TrackMuted,X.TrackUnmuted,X.TrackPublished,X.TrackUnpublished,X.TrackStreamStateChanged,X.TrackSubscriptionFailed,X.TrackSubscriptionPermissionChanged,X.TrackSubscriptionStatusChanged,X.LocalTrackPublished,X.LocalTrackUnpublished;var X7=Tfe.getLogger(`lk-components-js`);X7.setDefaultLevel(`WARN`);function wpe(e,t){return W7(U7({},e),{receivedAtMediaTimestamp:t.rtpTimestamp??0,receivedAt:t.timestamp})}function Tpe(e,t,n){return[...e,...t].reduceRight((e,t)=>(e.find(e=>e.id===t.id)||e.unshift(t),e),[]).slice(0-n)}var Z7=(e=>(e.AgentState=`lk.agent.state`,e.PublishOnBehalf=`lk.publish_on_behalf`,e.TranscriptionFinal=`lk.transcription_final`,e.TranscriptionSegmentId=`lk.segment_id`,e.TranscribedTrackId=`lk.transcribed_track_id`,e))(Z7||{});function Q7(e){return typeof e==`object`}function $7(e){return Array.isArray(e)&&e.filter(Q7).length>0}function e9(e){return`${K7}-${e}`}function Epe(e){let t=t9(e),n=a9(e.participant).pipe(I7(()=>t9(e)),B7(t));return{className:e9(e.source===$.Source.Camera||e.source===$.Source.ScreenShare?`participant-media-video`:`participant-media-audio`),trackObserver:n}}function t9(e){if(q7(e))return e.publication;{let{source:t,name:n,participant:r}=e;if(t&&n)return r.getTrackPublications().find(e=>e.source===t&&e.trackName===n);if(n)return r.getTrackPublicationByName(n);if(t)return r.getTrackPublication(t);throw Error(`At least one of source and name needs to be defined`)}}function n9(e,...t){return new d7(n=>{let r=()=>{n.next(e)};return t.forEach(t=>{e.on(t,r)}),()=>{t.forEach(t=>{e.off(t,r)})}}).pipe(B7(e))}function r9(e,t){return new d7(n=>{let r=(...e)=>{n.next(e)};return e.on(t,r),()=>{e.off(t,r)}})}function Dpe(e){return r9(e,Y.ConnectionStateChanged).pipe(I7(([e])=>e),B7(e.state))}function Ope(e,t,n=!0){return R7(new d7(r=>{R8.getLocalDevices(e,n).then(e=>{r.next(e),r.complete()}).catch(e=>{t?.(e),r.next([]),r.complete()})}),new d7(r=>{var i;let a=()=>G7(null,null,function*(){try{let t=yield R8.getLocalDevices(e,n);r.next(t)}catch(e){t?.(e)}});if(typeof window<`u`){if(!window.isSecureContext)throw Error(`Accessing media devices is available only in secure contexts (HTTPS and localhost), in some or all supporting browsers. See: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/mediaDevices`);(i=navigator?.mediaDevices)==null||i.addEventListener(`devicechange`,a)}return()=>{var e;(e=navigator?.mediaDevices)==null||e.removeEventListener(`devicechange`,a)}}))}function kpe(e){return n9(e,Y.AudioPlaybackStatusChanged).pipe(I7(e=>({canPlayAudio:e.canPlaybackAudio})))}function Ape(e){return n9(e,Y.VideoPlaybackStatusChanged).pipe(I7(e=>({canPlayVideo:e.canPlaybackVideo})))}function jpe(e,t){return r9(e,Y.ActiveDeviceChanged).pipe(cpe(([e])=>e===t),I7(([e,t])=>(X7.debug(`activeDeviceObservable | RoomEvent.ActiveDeviceChanged`,{kind:e,deviceId:t}),t)))}function i9(e,...t){return new d7(n=>{let r=()=>{n.next(e)};return t.forEach(t=>{e.on(t,r)}),()=>{t.forEach(t=>{e.off(t,r)})}}).pipe(B7(e))}function a9(e){return i9(e,X.TrackMuted,X.TrackUnmuted,X.ParticipantPermissionsChanged,X.TrackPublished,X.TrackUnpublished,X.LocalTrackPublished,X.LocalTrackUnpublished,X.MediaDevicesError,X.TrackSubscriptionStatusChanged).pipe(I7(e=>{let{isMicrophoneEnabled:t,isCameraEnabled:n,isScreenShareEnabled:r}=e,i=e.getTrackPublication($.Source.Microphone);return{isCameraEnabled:n,isMicrophoneEnabled:t,isScreenShareEnabled:r,cameraTrack:e.getTrackPublication($.Source.Camera),microphoneTrack:i,participant:e}}))}function o9(e,t){return new d7(n=>{let r=(...e)=>{n.next(e)};return e.on(t,r),()=>{e.off(t,r)}})}function Mpe(e,t={}){let n,r=new d7(e=>(n=e,()=>a.unsubscribe())).pipe(B7(Array.from(e.remoteParticipants.values()))),i=t.additionalRoomEvents??Y7,a=n9(e,...Array.from(new Set([Y.ParticipantConnected,Y.ParticipantDisconnected,Y.ConnectionStateChanged,...i]))).subscribe(e=>
246n?.next(Array.from(e.remoteParticipants.values())));return e.remoteParticipants.size>0&&n?.next(Array.from(e.remoteParticipants.values())),r}function Npe(e){return o9(e,X.ParticipantPermissionsChanged).pipe(I7(()=>e.permissions),B7(e.permissions))}function Ppe(e){return typeof e>`u`?new d7:o9(e,X.AttributesChanged).pipe(I7(([t])=>({changed:t,attributes:e.attributes})),B7({changed:e.attributes,attributes:e.attributes}))}function Fpe(e,t,n,r,i){let{localParticipant:a}=t,o=(e,t)=>{let n=!1;switch(e){case $.Source.Camera:n=t.isCameraEnabled;break;case $.Source.Microphone:n=t.isMicrophoneEnabled;break;case $.Source.ScreenShare:n=t.isScreenShareEnabled;break}return n},s=a9(a).pipe(I7(t=>o(e,t.participant)),B7(o(e,a))),c=new h7;return{className:e9(`button`),toggle:(t,o)=>G7(null,null,function*(){try{switch(o??=n,c.next(!0),e){case $.Source.Camera:return yield a.setCameraEnabled(t??!a.isCameraEnabled,o,r),a.isCameraEnabled;case $.Source.Microphone:return yield a.setMicrophoneEnabled(t??!a.isMicrophoneEnabled,o,r),a.isMicrophoneEnabled;case $.Source.ScreenShare:return yield a.setScreenShareEnabled(t??!a.isScreenShareEnabled,o,r),a.isScreenShareEnabled;default:throw TypeError(`Tried to toggle unsupported source`)}}catch(e){if(i&&e instanceof Error){i?.(e);return}else throw e}finally{c.next(!1)}}),enabledObserver:s,pendingObserver:c.asObservable()}}function Ipe(){let e=!1,t=new h7,n=new h7;return{className:e9(`button`),toggle:r=>G7(null,null,function*(){n.next(!0),e=r??!e,t.next(e),n.next(!1)}),enabledObserver:t.asObservable(),pendingObserver:n.asObservable()}}function Lpe(e,t,n){let r=new Bfe(void 0),i=jpe(t,e);return{className:e9(`media-device-select`),activeDeviceObservable:i,setActiveMediaDevice:(n,...i)=>G7(null,[n,...i],function*(n,i={}){if(t){let a=T2();if(e===`audiooutput`&&(a?.name===`Safari`||a?.os===`iOS`)){X7.warn(`Switching audio output device is not supported on Safari and iOS.`);return}X7.debug(`Switching active device of kind "${e}" with id ${n}.`),yield t.switchActiveDevice(e,n,i.exact);let o=t.getActiveDevice(e)??n;o!==n&&n!==`default`&&X7.info(`We tried to select the device with id (${n}), but the browser decided to select the device with id (${o}) instead.`);let s;e===`audioinput`?s=t.localParticipant.getTrackPublication($.Source.Microphone)?.track:e===`videoinput`&&(s=t.localParticipant.getTrackPublication($.Source.Camera)?.track);let c=n===`default`&&!s||n===`default`&&s?.mediaStreamTrack.label.startsWith(`Default`);r.next(c?n:o)}})}}function Rpe(e){return{className:e9(`disconnect-button`),disconnect:t=>{e.disconnect(t)}}}var zpe={CHAT:`lk.chat`,TRANSCRIPTION:`lk.transcription`};function Bpe(){return{className:e9(`start-audio-button`),roomAudioPlaybackAllowedObservable:kpe,handleStartAudioPlayback:e=>G7(null,null,function*(){X7.info(`Start Audio for room: `,e),yield e.startAudio()})}}function Vpe(){return{className:e9(`start-audio-button`),roomVideoPlaybackAllowedObservable:Ape,handleStartVideoPlayback:e=>G7(null,null,function*(){X7.info(`Start Video for room: `,e),yield e.startVideo()})}}function Hpe(){return{className:`lk-room-container`}}function s9(e,t,n=!0){let r=[e.localParticipant,...Array.from(e.remoteParticipants.values())],i=[];return r.forEach(e=>{t.forEach(t=>{let r=Array.from(e.trackPublications.values()).filter(e=>e.source===t&&(!n||e.track)).map(t=>({participant:e,publication:t,source:t.source}));i.push(...r)})}),{trackReferences:i,participants:r}}function c9(e,t,n=!1){let{sources:r,kind:i,name:a}=t;return Array.from(e.trackPublications.values()).filter(e=>(!r||r.includes(e.source))&&(!i||e.kind===i)&&(!a||e.trackName===a)&&(!n||e.track)).map(t=>({participant:e,publication:t,source:t.source}))}function Upe(e,t,n){let r=n.additionalRoomEvents??Y7,i=n.onlySubscribed??!0;return n9(e,...Array.from(new Set([Y.ParticipantConnected,Y.ParticipantDisconnected,Y.ConnectionStateChanged,Y.LocalTrackPublished,Y.LocalTrackUnpublished,Y.TrackPublished,Y.TrackUnpublished,Y.TrackSubscriptionStatusChanged,...r]).values())).pipe(I7(e=>{let n=s9(e,t,i);return X7.debug(`TrackReference[] was updated. (length ${n.trackReferences.length})`,n),n}),B7(s9(e,t,i)))}function Wpe(e,t){return i9(e,...Cpe).pipe(I7(e=>{let n=c9(e,t);return X7.debug(`TrackReference[] was updated. (length ${n.length})`,n),n}),B7(c9(e,t)))}function l9(e,t){return new d7(n=>{let r=(...e)=>{n.next(e)};return e.on(t,r),()=>{e.off(t,r)}})}function Gpe(e){return l9(e,Q.TranscriptionReceived)}function Kpe(e){return l9(e,Q.TimeSyncUpdate).pipe(I7(([e])=>e))}function qpe(e,t){if(typeof localStorage>`u`){X7.error(`Local storage is not available.`);return}try{if(t){let n=Object.fromEntries(Object.entries(t).filter(([,e])=>e!==``));localStorage.setItem(e,JSON.stringify(n))}}catch(e){X7.error(`Error setting item to local storage: ${e}`)}}function Jpe(e){if(typeof localStorage>`u`){X7.error(`Local storage is not available.`);return}try{let t=localStorage.getItem(e);if(!t){X7.warn(`Item with key ${e} does not exist in local storage.`);return}return JSON.parse(t)}catch(e){X7.error(`Error getting item from local storage: ${e}`);return}}function Ype(e){return{load:()=>Jpe(e),save:t=>qpe(e,t)}}var Xpe=`${K7}-user-choices`,u9={videoEnabled:!0,audioEnabled:!0,videoDeviceId:`default`,audioDeviceId:`default`,username:``},{load:Zpe,save:Qpe}=Ype(Xpe);function $pe(e,t=!1){t!==!0&&Qpe(e)}function eme(e,t=!1){let n={videoEnabled:e?.videoEnabled??u9.videoEnabled,audioEnabled:e?.audioEnabled??u9.audioEnabled,videoDeviceId:e?.videoDeviceId??u9.videoDeviceId,audioDeviceId:e?.audioDeviceId??u9.audioDeviceId,username:e?.username??u9.username};if(t)return n;{let e=Zpe();return U7(U7({},n),e??{})}}var d9=null,f9=null,tme=0;function p9(){return d9||=new Map,d9}function nme(){return f9||=new WeakMap,f9}function rme(e,t){let n=nme(),r=n.get(e);return r||(r=`room_${tme++}`,n.set(e,r)),`${r}:${t}`}function ime(e,t){let n=rme(e,t),r=p9(),i=r.get(n);if(i)return i;let a=new h7,o=[],s=`lk.segment_id`,c=a.pipe(fpe({subscribe:()=>{e.registerTextStreamHandler(t,(e,t)=>G7(null,null,function*(){var n;let r=F7(e).pipe(upe((e,t)=>
246e+t,``)),i=!!((n=e.info.attributes)!=null&&n[s]);r.subscribe(n=>{let r=o.findIndex(t=>t.streamInfo.id===e.info.id||i&&t.streamInfo.attributes?.[s]===e.info.attributes?.[s]);r===-1?(o.push({text:n,participantInfo:t,streamInfo:e.info}),a.next([...o])):(o[r]=W7(U7({},o[r]),{text:n}),a.next([...o]))})}))},finalize:()=>{e.unregisterTextStreamHandler(t)}}),dpe());return r.set(n,c),e.on(Y.Disconnected,()=>{p9().delete(n),o=[],a.next([])}),c}_.createContext(void 0);var ame=_.createContext(void 0);function m9(){return _.useContext(ame)}function ome(e){let t=m9(),n=e??t;if(!n)throw Error(`No TrackRef, make sure you are inside a TrackRefContext or pass the TrackRef explicitly`);return n}var sme=_.createContext(void 0);function h9(){return _.useContext(sme)}var g9=_.createContext(void 0);function _9(){let e=_.useContext(g9);if(!e)throw Error(`tried to access room context outside of livekit room component`);return e}function v9(){return _.useContext(g9)}function y9(e){let t=v9(),n=e??t;if(!n)throw Error(`No room provided, make sure you are inside a Room context or pass the room explicitly`);return n}_.createContext(void 0);var cme=_.createContext(void 0);function b9(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=b9(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function x9(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=b9(e))&&(r&&(r+=` `),r+=t);return r}function lme(...e){return(...t)=>{for(let n of e)if(typeof n==`function`)try{n(...t)}catch(e){console.error(e)}}}function S9(...e){let t={...e[0]};for(let n=1;n<e.length;n++){let r=e[n];for(let e in r){let n=t[e],i=r[e];typeof n==`function`&&typeof i==`function`&&e[0]===`o`&&e[1]===`n`&&e.charCodeAt(2)>=65&&e.charCodeAt(2)<=90?t[e]=lme(n,i):(e===`className`||e===`UNSAFE_className`)&&typeof n==`string`&&typeof i==`string`?t[e]=x9(n,i):t[e]=i===void 0?n:i}}return t}function ume(e){return e!==void 0}function C9(...e){return S9(...e.filter(ume))}function dme(e,t,n){return _.Children.map(e,r=>_.isValidElement(r)&&_.Children.only(e)?(r.props.className&&(t??={},t.className=x9(r.props.className,t.className),t.style={...r.props.style,...t.style}),_.cloneElement(r,{...t,key:n})):r)}function fme(e,t){return e===`processor`&&t&&typeof t==`object`&&`name`in t?t.name:(e===`e2ee`||e===`encryption`)&&t?`e2ee-enabled`:t}var pme={connect:!0,audio:!1,video:!1};function mme(e){let{token:t,serverUrl:n,options:r,room:i,connectOptions:a,connect:o,audio:s,video:c,screen:l,onConnected:u,onDisconnected:d,onError:f,onMediaDeviceFailure:p,onEncryptionError:m,simulateParticipants:h,...g}={...pme,...e};r&&i&&X7.warn(`when using a manually created room, the options object will be ignored. set the desired options directly when creating the room instead.`);let[v,y]=_.useState(),b=_.useRef(o);_.useEffect(()=>{y(i??new R8(r))},[i,JSON.stringify(r,fme)]);let x=_.useMemo(()=>{let{className:e}=Hpe();return S9(g,{className:e})},[g]);return _.useEffect(()=>{if(!v)return;let e=()=>{let e=v.localParticipant;X7.debug(`trying to publish local tracks`),Promise.all([e.setMicrophoneEnabled(!!s,typeof s==`boolean`?void 0:s),e.setCameraEnabled(!!c,typeof c==`boolean`?void 0:c),e.setScreenShareEnabled(!!l,typeof l==`boolean`?void 0:l)]).catch(e=>{X7.warn(e),f?.(e)})},t=(e,t)=>{let n=V2.getFailure(e);p?.(n,t)},n=e=>{m?.(e)},r=e=>{d?.(e)},i=()=>{u?.()};return v.on(Y.SignalConnected,e).on(Y.MediaDevicesError,t).on(Y.EncryptionError,n).on(Y.Disconnected,r).on(Y.Connected,i),()=>{v.off(Y.SignalConnected,e).off(Y.MediaDevicesError,t).off(Y.EncryptionError,n).off(Y.Disconnected,r).off(Y.Connected,i)}},[v,s,c,l,f,m,p,u,d]),_.useEffect(()=>{if(v){if(h){v.simulateParticipants({participants:{count:h},publish:{audio:!0,useRealTracks:!0}});return}if(o){if(b.current=!0,X7.debug(`connecting`),!t){X7.debug(`no token yet`);return}if(!n){X7.warn(`no livekit url provided`),f?.(Error(`no livekit url provided`));return}v.connect(n,t,a).catch(e=>{X7.warn(e),b.current===!0&&f?.(e)})}else X7.debug(`disconnecting because connect is false`),b.current=!1,v.disconnect()}},[o,t,JSON.stringify(a),v,f,n,h]),_.useEffect(()=>{if(v)return()=>{X7.info(`disconnecting on onmount`),v.disconnect()}},[v]),{room:v,htmlProps:x}}var hme=_.forwardRef(function(e,t){let{room:n,htmlProps:r}=mme(e);return _.createElement(`div`,{ref:t,...r},n&&_.createElement(g9.Provider,{value:n},_.createElement(cme.Provider,{value:e.featureFlags},e.children)))});function w9(e,t,n=!0){let[r,i]=_.useState(t);return _.useEffect(()=>{if(n&&i(t),typeof window>`u`||!e)return;let r=e.subscribe(i);return()=>r.unsubscribe()},[e,n]),r}function T9(e){let t=y9(e);return w9(_.useMemo(()=>Dpe(t),[t]),t.state)}function gme(e){let t=_9(),n=T9(t);return{buttonProps:_.useMemo(()=>{let{className:r,disconnect:i}=Rpe(t);return S9(e,{className:r,onClick:()=>i(e.stopTracks??!0),disabled:n===L8.Disconnected})},[t,e,n])}}function E9(e={}){let t=y9(e.room),[n,r]=_.useState(t.localParticipant),[i,a]=_.useState(n.isMicrophoneEnabled),[o,s]=_.useState(n.isCameraEnabled),[c,l]=_.useState(n.isScreenShareEnabled),[u,d]=_.useState(n.lastMicrophoneError),[f,p]=_.useState(n.lastCameraError),[m,h]=_.useState(void 0),[g,v]=_.useState(void 0),y=e=>{s(e.isCameraEnabled),a(e.isMicrophoneEnabled),l(e.isScreenShareEnabled),v(e.cameraTrack),h(e.microphoneTrack),d(e.participant.lastMicrophoneError),p(e.participant.lastCameraError),r(e.participant)};return _.useEffect(()=>{let e=a9(t.localParticipant).subscribe(y);return()=>e.unsubscribe()},[t]),{isMicrophoneEnabled:i,isScreenShareEnabled:c,isCameraEnabled:o,microphoneTrack:m,cameraTrack:g,lastMicrophoneError:u,last
246CameraError:f,localParticipant:n}}function _me(){let e=_9();return w9(_.useMemo(()=>Npe(e.localParticipant),[e]),e.localParticipant.permissions)}function vme({kind:e,room:t,track:n,requestPermissions:r,onError:i}){let a=v9(),o=_.useMemo(()=>t??a??new R8,[t,a]),s=w9(_.useMemo(()=>Ope(e,i,r),[e,r,i]),[]),[c,l]=_.useState(o?.getActiveDevice(e)??`default`),{className:u,activeDeviceObservable:d,setActiveMediaDevice:f}=_.useMemo(()=>Lpe(e,o),[e,o,n]);return _.useEffect(()=>{let e=d.subscribe(e=>{e&&(X7.info(`setCurrentDeviceId`,e),l(e))});return()=>{e?.unsubscribe()}},[d]),{devices:s,className:u,activeDeviceId:c,setActiveMediaDevice:f}}function D9(e={}){let t=y9(e.room),[n,r]=_.useState([]);return _.useEffect(()=>{let n=Mpe(t,{additionalRoomEvents:e.updateOnlyOn}).subscribe(r);return()=>n.unsubscribe()},[t,JSON.stringify(e.updateOnlyOn)]),n}function yme(e={}){let t=D9(e),{localParticipant:n}=E9(e);return _.useMemo(()=>[n,...t],[n,t])}function bme({room:e,props:t}){let n=y9(e),{className:r,roomAudioPlaybackAllowedObservable:i,handleStartAudioPlayback:a}=_.useMemo(()=>Bpe(),[]),{canPlayAudio:o}=w9(_.useMemo(()=>i(n),[n,i]),{canPlayAudio:n.canPlaybackAudio});return{mergedProps:_.useMemo(()=>S9(t,{className:r,onClick:()=>{a(n)},style:{display:o?`none`:`block`}}),[t,r,o,a,n]),canPlayAudio:o}}function xme({room:e,props:t}){let n=y9(e),{className:r,roomVideoPlaybackAllowedObservable:i,handleStartVideoPlayback:a}=_.useMemo(()=>Vpe(),[]),{canPlayVideo:o}=w9(_.useMemo(()=>i(n),[n,i]),{canPlayVideo:n.canPlaybackVideo});return{mergedProps:_.useMemo(()=>S9(t,{className:r,onClick:()=>{a(n)},style:{display:o?`none`:`block`}}),[t,r,o,a,n]),canPlayVideo:o}}function Sme({source:e,onChange:t,initialState:n,captureOptions:r,publishOptions:i,onDeviceError:a,room:o,...s}){let c=v9(),l=_.useMemo(()=>o??c,[o,c]),u=l?.localParticipant?.getTrackPublication(e),d=_.useRef(!1),{toggle:f,className:p,pendingObserver:m,enabledObserver:h}=_.useMemo(()=>l?Fpe(e,l,r,i,a):Ipe(),[l,e,JSON.stringify(r),i]),g=w9(m,!1),v=w9(h,n??!!u?.isEnabled);_.useEffect(()=>{t?.(v,d.current),d.current=!1},[v,t]),_.useEffect(()=>{n!==void 0&&(X7.debug(`forcing initial toggle state`,e,n),f(n))},[]);let y=_.useMemo(()=>S9(s,{className:p}),[s,p]),b=_.useCallback(e=>{d.current=!0,f().catch(()=>d.current=!1),s.onClick?.(e)},[s,f]);return{toggle:f,enabled:v,pending:g,track:u,buttonProps:{...y,"aria-pressed":v,"data-lk-source":e,"data-lk-enabled":v,disabled:g,onClick:b}}}function Cme(e=[$.Source.Camera,$.Source.Microphone,$.Source.ScreenShare,$.Source.ScreenShareAudio,$.Source.Unknown],t={}){let n=y9(t.room),[r,i]=_.useState([]),[a,o]=_.useState([]),s=_.useMemo(()=>e.map(e=>Q7(e)?e.source:e),[JSON.stringify(e)]);return _.useEffect(()=>{let e=Upe(n,s,{additionalRoomEvents:t.updateOnlyOn,onlySubscribed:t.onlySubscribed}).subscribe(({trackReferences:e,participants:t})=>{X7.debug(`setting track bundles`,e,t),i(e),o(t)});return()=>e.unsubscribe()},[n,JSON.stringify(t.onlySubscribed),JSON.stringify(t.updateOnlyOn),JSON.stringify(e)]),_.useMemo(()=>{if($7(e)){let t=Tme(e,a),n=Array.from(r);return a.forEach(e=>{t.has(e.identity)&&(t.get(e.identity)??[]).forEach(t=>{if(r.find(({participant:n,publication:r})=>e.identity===n.identity&&r.source===t))return;X7.debug(`Add ${t} placeholder for participant ${e.identity}.`);let i={participant:e,source:t};n.push(i)})}),n}else return r},[r,a,e])}function wme(e,t){let n=new Set(e);for(let e of t)n.delete(e);return n}function Tme(e,t){let n=new Map;if($7(e)){let r=e.filter(e=>e.withPlaceholder).map(e=>e.source);t.forEach(e=>{let t=e.getTrackPublications().map(e=>e.track?.source).filter(e=>e!==void 0),i=Array.from(wme(new Set(r),new Set(t)));i.length>0&&n.set(e.identity,i)})}return n}function Eme(e={}){let[t,n]=_.useState(eme(e.defaults,e.preventLoad??!1)),r=_.useCallback(e=>{n(t=>({...t,audioEnabled:e}))},[]),i=_.useCallback(e=>{n(t=>({...t,videoEnabled:e}))},[]),a=_.useCallback(e=>{n(t=>({...t,audioDeviceId:e}))},[]),o=_.useCallback(e=>{n(t=>({...t,videoDeviceId:e}))},[]),s=_.useCallback(e=>{n(t=>({...t,username:e}))},[]);return _.useEffect(()=>{$pe(t,e.preventSave??!1)},[t,e.preventSave]),{userChoices:t,saveAudioInputEnabled:r,saveVideoInputEnabled:i,saveAudioInputDeviceId:a,saveVideoInputDeviceId:o,saveUsername:s}}var Dme=e=>{let t=e=>{let t=1-Math.max(-100,Math.min(-10,e))*-1/100;return t=Math.sqrt(t),t};return e.map(e=>e===-1/0?0:t(e))}
246,Ome={bands:5,loPass:100,hiPass:600,updateInterval:32,analyserOptions:{fftSize:2048}};function kme(e,t={}){let n=e instanceof $?e:e?.publication?.track,r={...Ome,...t},[i,a]=_.useState(Array(r.bands).fill(0));return _.useEffect(()=>{if(!n||!n?.mediaStream){a(e=>e.slice().fill(0));return}let{analyser:e,cleanup:t}=Fle(n,r.analyserOptions),i=e.frequencyBinCount,o=new Float32Array(i),s=setInterval(()=>{e.getFloatFrequencyData(o);let t=new Float32Array(o.length);for(let e=0;e<o.length;e++)t[e]=o[e];t=t.slice(r.loPass,r.hiPass);let n=Dme(t),i=n.length,s=[];for(let e=0;e<r.bands;e++){let t=Math.floor(e*i/r.bands),a=Math.floor((e+1)*i/r.bands),o=n.slice(t,a),c=o.length;if(c===0)s.push(0);else{let e=o.reduce((e,t)=>e+=t,0);s.push(e/c)}}a(s)},r.updateInterval);return()=>{t(),clearInterval(s)}},[n,n?.mediaStream,JSON.stringify(t)]),i}function O9(e,t={}){let n,r;typeof t==`string`?n=t:(n=t?.participantIdentity,r=t?.room);let i=h9(),a=yme({room:r,updateOnlyOn:[]}),o=_.useMemo(()=>n?a.find(e=>e.identity===n):i,[n,a,i]);return w9(_.useMemo(()=>{if(o)return Wpe(o,{sources:e})},[o,JSON.stringify(e)]),[])}function Ame(e){return w9(_.useMemo(()=>e?.publication?.track?Kpe(e?.publication.track):void 0,[e?.publication?.track]),{timestamp:Date.now(),rtpTimestamp:e?.publication?.track?.rtpTimestamp})}var jme={bufferSize:100};function Mme(e,t){let n={...jme,...t},[r,i]=_.useState([]),a=Ame(e),o=e=>{n.onTranscription?.(e),i(t=>Tpe(t,e.map(e=>wpe(e,a)),n.bufferSize))};return _.useEffect(()=>{if(!e?.publication)return;let t=Gpe(e.publication).subscribe(e=>{o(...e)});return()=>{t.unsubscribe()}},[e&&J7(e),o]),{segments:r}}function Nme(e={}){let t=h9(),n=e.participant??t;return w9(_.useMemo(()=>Ppe(n||n),[n]),{attributes:n?.attributes})}var k9=Z7.AgentState;function Pme(){let e=D9(),t=e.find(e=>e.kind===$Q.AGENT&&!(Z7.PublishOnBehalf in e.attributes)),n=e.find(e=>e.kind===$Q.AGENT&&e.attributes[Z7.PublishOnBehalf]===t?.identity),r=O9([$.Source.Microphone,$.Source.Camera],t?.identity),i=O9([$.Source.Microphone,$.Source.Camera],n?.identity),a=r.find(e=>e.source===$.Source.Microphone)??i.find(e=>e.source===$.Source.Microphone),o=r.find(e=>e.source===$.Source.Camera)??i.find(e=>e.source===$.Source.Camera),{segments:s}=Mme(a),c=T9(),{attributes:l}=Nme({participant:t});return{agent:t,state:_.useMemo(()=>c===L8.Disconnected?`disconnected`:c===L8.Connecting||!t||!l?.[k9]?`connecting`:l[k9],[l,t,c]),audioTrack:a,videoTrack:o,agentTranscriptions:s,agentAttributes:l}}function Fme(e,t){let n=y9(t?.room),r=T9(n)===L8.Disconnected,i=_.useMemo(()=>ime(n,e),[n,e]);return{textStreams:w9(r?void 0:i,[])}}function Ime(e){let{participantIdentities:t,trackSids:n}=e??{},{textStreams:r}=Fme(zpe.TRANSCRIPTION,{room:e?.room});return _.useMemo(()=>r.filter(e=>t?t.includes(e.participantInfo.identity):!0).filter(e=>n?n.includes(e.streamInfo.attributes?.[Z7.TranscribedTrackId]??``):!0),[r,t,n])}var A9={exports:{}},j9;function Lme(){if(j9)return A9.exports;j9=1;var e=typeof Reflect==`object`?Reflect:null,t=e&&typeof e.apply==`function`?e.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},n=e&&typeof e.ownKeys==`function`?e.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};function r(e){console&&console.warn&&console.warn(e)}var i=Number.isNaN||function(e){return e!==e};function a(){a.init.call(this)}A9.exports=a,A9.exports.once=_,a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var o=10;function s(e){if(typeof e!=`function`)throw TypeError(`The "listener" argument must be of type Function. Received type `+typeof e)}Object.defineProperty(a,`defaultMaxListeners`,{enumerable:!0,get:function(){return o},set:function(e){if(typeof e!=`number`||e<0||i(e))throw RangeError(`The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received `+e+`.`);o=e}}),a.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(e){if(typeof e!=`number`||e<0||i(e))throw RangeError(`The value of "n" is out of range. It must be a non-negative number. Received `+e+`.`);return this._maxListeners=e,this};function c(e){return e._maxListeners===void 0?a.defaultMaxListeners:e._maxListeners}a.prototype.getMaxListeners=function(){return c(this)},a.prototype.emit=function(e){for(var n=[],r=1;r<arguments.length;r++)n.push(arguments[r]);var i=e===`error`,a=this._events;if(a!==void 0)i&&=a.error===void 0;else if(!i)return!1;if(i){var o;if(n.length>0&&(o=n[0]),o instanceof Error)throw o;var s=Error(`Unhandled error.`+(o?` (`+o.message+`)`:``));throw s.context=o,s}var c=a[e];if(c===void 0)return!1;if(typeof c==`function`)t(c,this,n);else for(var l=c.length,u=m(c,l),r=0;r<l;++r)t(u[r],this,n);return!0};function l(e,t,n,i){var a,o,l;if(s(n),o=e._events,o===void 0?(o=e._events=Object.create(null),e._eventsCount=0):(o.newListener!==void 0&&(e.emit(`newListener`,t,n.listener?n.listener:n),o=e._events),l=o[t]),l===void 0)l=o[t]=n,++e._eventsCount;else if(typeof l==`function`?l=o[t]=i?[n,l]:[l,n]:i?l.unshift(n):l.push(n),a=c(e),a>0&&l.length>a&&!l.warned){l.warned=!0;var u=Error(`Possible EventEmitter memory leak detected. `+l.length+` `+String(t)+` listeners added. Use emitter.setMaxListeners() to increase limit`);u.name=`MaxListenersExceededWarning`,u.emitter=e,u.type=t,u.count=l.length,r(u)}return e}a.prototype.addListener=function(e,t){return l(this,e,t,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(e,t){return l(this,e,t,!0)};function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=u.bind(r);return i.listener=n,r.wrapFn=i,i}a.prototype.once=function(e,t){return s(t),this.on(e,d(this,e,t)),this},a.prototype.prependOnceListener=function(e,t){return s(t),this.prependListener(e,d(this,e,t)),this},a.prototype.removeListener=function(e,t){var n,r,i,a,o;if(s(t),r=this._events,r===void 0||(n=r[e],n===void 0))return this;if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit
246(`removeListener`,e,n.listener||t));else if(typeof n!=`function`){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;i===0?n.shift():h(n,i),n.length===1&&(r[e]=n[0]),r.removeListener!==void 0&&this.emit(`removeListener`,e,o||t)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(e){var t,n,r;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i=Object.keys(n),a;for(r=0;r<i.length;++r)a=i[r],a!==`removeListener`&&this.removeAllListeners(a);return this.removeAllListeners(`removeListener`),this._events=Object.create(null),this._eventsCount=0,this}if(t=n[e],typeof t==`function`)this.removeListener(e,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this};function f(e,t,n){var r=e._events;if(r===void 0)return[];var i=r[t];return i===void 0?[]:typeof i==`function`?n?[i.listener||i]:[i]:n?g(i):m(i,i.length)}a.prototype.listeners=function(e){return f(this,e,!0)},a.prototype.rawListeners=function(e){return f(this,e,!1)},a.listenerCount=function(e,t){return typeof e.listenerCount==`function`?e.listenerCount(t):p.call(e,t)},a.prototype.listenerCount=p;function p(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n==`function`)return 1;if(n!==void 0)return n.length}return 0}a.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]};function m(e,t){for(var n=Array(t),r=0;r<t;++r)n[r]=e[r];return n}function h(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function g(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function _(e,t){return new Promise(function(n,r){function i(n){e.removeListener(t,a),r(n)}function a(){typeof e.removeListener==`function`&&e.removeListener(`error`,i),n([].slice.call(arguments))}y(e,t,a,{once:!0}),t!==`error`&&v(e,i,{once:!0})})}function v(e,t,n){typeof e.on==`function`&&y(e,`error`,t,n)}function y(e,t,n,r){if(typeof e.on==`function`)r.once?e.once(t,n):e.on(t,n);else if(typeof e.addEventListener==`function`)e.addEventListener(t,function i(a){r.once&&e.removeEventListener(t,i),n(a)});else throw TypeError(`The "emitter" argument must be of type EventEmitter. Received type `+typeof e)}return A9.exports}Lme();var Rme=_.forwardRef(function(e,t){let{buttonProps:n}=gme(e);return _.createElement(`button`,{ref:t,...n},e.children)}),zme=e=>_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:16,height:16,fill:`currentColor`,...e},_.createElement(`path`,{d:`M1.354.646a.5.5 0 1 0-.708.708l14 14a.5.5 0 0 0 .708-.708L11 10.293V4.5A1.5 1.5 0 0 0 9.5 3H3.707zM0 4.5a1.5 1.5 0 0 1 .943-1.393l9.532 9.533c-.262.224-.603.36-.975.36h-8A1.5 1.5 0 0 1 0 11.5z`}),_.createElement(`path`,{d:`m15.2 3.6-2.8 2.1a1 1 0 0 0-.4.8v3a1 1 0 0 0 .4.8l2.8 2.1a.5.5 0 0 0 .8-.4V4a.5.5 0 0 0-.8-.4z`})),Bme=e=>_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:16,height:16,fill:`currentColor`,...e},_.createElement(`path`,{d:`M0 4.5A1.5 1.5 0 0 1 1.5 3h8A1.5 1.5 0 0 1 11 4.5v7A1.5 1.5 0 0 1 9.5 13h-8A1.5 1.5 0 0 1 0 11.5zM15.2 3.6l-2.8 2.1a1 1 0 0 0-.4.8v3a1 1 0 0 0 .4.8l2.8 2.1a.5.5 0 0 0 .8-.4V4a.5.5 0 0 0-.8-.4z`})),Vme=e=>_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:16,height:16,fill:`currentColor`,...e},_.createElement(`path`,{d:`M12.227 11.52a5.477 5.477 0 0 0 1.246-2.97.5.5 0 0 0-.995-.1 4.478 4.478 0 0 1-.962 2.359l-1.07-1.07C10.794 9.247 11 8.647 11 8V3a3 3 0 0 0-6 0v1.293L1.354.646a.5.5 0 1 0-.708.708l14 14a.5.5 0 0 0 .708-.708zM8 12.5c.683 0 1.33-.152 1.911-.425l.743.743c-.649.359-1.378.59-2.154.66V15h2a.5.5 0 0 1 0 1h-5a.5.5 0 0 1 0-1h2v-1.522a5.502 5.502 0 0 1-4.973-4.929.5.5 0 0 1 .995-.098A4.5 4.5 0 0 0 8 12.5z`}),_.createElement(`path`,{d:`M8.743 10.907 5 7.164V8a3 3 0 0 0 3.743 2.907z`})),Hme=e=>_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:16,height:16,fill:`currentColor`,...e},_.createElement(`path`,{fillRule:`evenodd`,d:`M2.975 8.002a.5.5 0 0 1 .547.449 4.5 4.5 0 0 0 8.956 0 .5.5 0 1 1 .995.098A5.502 5.502 0 0 1 8.5 13.478V15h2a.5.5 0 0 1 0 1h-5a.5.5 0 0 1 0-1h2v-1.522a5.502 5.502 0 0 1-4.973-4.929.5.5 0 0 1 .448-.547z`,clipRule:`evenodd`}),_.createElement(`path`,{d:`M5 3a3 3 0 1 1 6 0v5a3 3 0 0 1-6 0z`})),Ume=e=>
246_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:20,height:16,fill:`none`,...e},_.createElement(`path`,{fill:`currentColor`,fillRule:`evenodd`,d:`M0 2.75A2.75 2.75 0 0 1 2.75 0h14.5A2.75 2.75 0 0 1 20 2.75v10.5A2.75 2.75 0 0 1 17.25 16H2.75A2.75 2.75 0 0 1 0 13.25V2.75ZM2.75 1.5c-.69 0-1.25.56-1.25 1.25v10.5c0 .69.56 1.25 1.25 1.25h14.5c.69 0 1.25-.56 1.25-1.25V2.75c0-.69-.56-1.25-1.25-1.25H2.75Z`,clipRule:`evenodd`}),_.createElement(`path`,{fill:`currentColor`,fillRule:`evenodd`,d:`M9.47 4.22a.75.75 0 0 1 1.06 0l2.25 2.25a.75.75 0 0 1-1.06 1.06l-.97-.97v4.69a.75.75 0 0 1-1.5 0V6.56l-.97.97a.75.75 0 0 1-1.06-1.06l2.25-2.25Z`,clipRule:`evenodd`})),Wme=e=>_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:20,height:16,fill:`none`,...e},_.createElement(`g`,{fill:`currentColor`},_.createElement(`path`,{d:`M7.28 4.22a.75.75 0 0 0-1.06 1.06L8.94 8l-2.72 2.72a.75.75 0 1 0 1.06 1.06L10 9.06l2.72 2.72a.75.75 0 1 0 1.06-1.06L11.06 8l2.72-2.72a.75.75 0 0 0-1.06-1.06L10 6.94z`}),_.createElement(`path`,{fillRule:`evenodd`,d:`M2.75 0A2.75 2.75 0 0 0 0 2.75v10.5A2.75 2.75 0 0 0 2.75 16h14.5A2.75 2.75 0 0 0 20 13.25V2.75A2.75 2.75 0 0 0 17.25 0zM1.5 2.75c0-.69.56-1.25 1.25-1.25h14.5c.69 0 1.25.56 1.25 1.25v10.5c0 .69-.56 1.25-1.25 1.25H2.75c-.69 0-1.25-.56-1.25-1.25z`,clipRule:`evenodd`}))),M9=_.forwardRef(function({kind:e,initialSelection:t,onActiveDeviceChange:n,onDeviceListChange:r,onDeviceSelectError:i,exactMatch:a,track:o,requestPermissions:s,onError:c,...l},u){let d=v9(),f=_.useRef(`default`),{devices:p,activeDeviceId:m,setActiveMediaDevice:h,className:g}=vme({kind:e,room:d,track:o,requestPermissions:s,onError:_.useCallback(e=>{d&&d.emit(Y.MediaDevicesError,e),c?.(e)},[d,c])});_.useEffect(()=>{t!==void 0&&h(t)},[h]),_.useEffect(()=>{typeof r==`function`&&r(p)},[r,p]),_.useEffect(()=>{m!==f.current&&n?.(m),f.current=m},[m]);let v=async e=>{try{await h(e,{exact:a??!0})}catch(e){if(e instanceof Error)i?.(e);else throw e}},y=_.useMemo(()=>C9(l,{className:g},{className:`lk-list`}),[g,l]),b=!!p.find(e=>e.label.toLowerCase().startsWith(`default`));function x(e,t,n){return e===t||!b&&n===0&&t===`default`}return _.createElement(`ul`,{ref:u,...y},p.map((e,t)=>_.createElement(`li`,{key:e.deviceId,id:e.deviceId,"data-lk-active":x(e.deviceId,m,t),"aria-selected":x(e.deviceId,m,t),role:`option`},_.createElement(`button`,{className:`lk-button`,onClick:()=>v(e.deviceId)},e.label))))}),Gme=_.forwardRef(function({label:e,...t},n){let r=_9(),{mergedProps:i,canPlayAudio:a}=bme({room:r,props:t}),{mergedProps:o,canPlayVideo:s}=xme({room:r,props:i}),{style:c,...l}=o;return c.display=a&&s?`none`:`block`,_.createElement(`button`,{ref:n,style:c,...l},e??`Start ${a?`Video`:`Audio`}`)});function Kme(e,t){switch(e){case $.Source.Microphone:return t?_.createElement(Hme,null):_.createElement(Vme,null);case $.Source.Camera:return t?_.createElement(Bme,null):_.createElement(zme,null);case $.Source.ScreenShare:return t?_.createElement(Wme,null):_.createElement(Ume,null);default:return}}var qme=_.forwardRef(function({showIcon:e,...t},n){let{buttonProps:r,enabled:i}=Sme(t),[a,o]=_.useState(!1);return _.useEffect(()=>{o(!0)},[]),a&&_.createElement(`button`,{ref:n,...r},(e??!0)&&Kme(t.source,i),t.children)});function Jme(e,t={}){let[n,r]=_.useState(t9(e)),[i,a]=_.useState(n?.isMuted),[o,s]=_.useState(n?.isSubscribed),[c,l]=_.useState(n?.track),[u,d]=_.useState(`landscape`),f=_.useRef(),{className:p,trackObserver:m}=_.useMemo(()=>Epe(e),[e.participant.sid??e.participant.identity,e.source,q7(e)&&e.publication.trackSid]);return _.useEffect(()=>{let e=m.subscribe(e=>{X7.debug(`update track`,e),r(e),a(e?.isMuted),s(e?.isSubscribed),l(e?.track)});return()=>e?.unsubscribe()},[m]),_.useEffect(()=>(c&&(f.current&&c.detach(f.current),t.element?.current&&!(e.participant.isLocal&&c?.kind===`audio`)&&c.attach(t.element.current)),f.current=t.element?.current,()=>{f.current&&c?.detach(f.current)}),[c,t.element]),_.useEffect(()=>{typeof n?.dimensions?.width==`number`&&typeof n?.dimensions?.height==`number`&&d(n.dimensions.width>n.dimensions.height?`landscape`:`portrait`)},[n]),{publication:n,isMuted:i,isSubscribed:o,track:c,elementProps:C9(t.props,{className:p,"data-lk-local-participant":e.participant.isLocal,"data-lk-source":n?.source,...n?.kind===`video`&&{"data-lk-orientation":u}})}}var N9,P9;function Yme(){if(P9)return N9;P9=1;var e=`Expected a function`,t=NaN,n=`[object Symbol]`,r=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt,c=typeof z5==`object`&&z5&&z5.Object===Object&&z5,l=typeof self==`object`&&self&&self.Object===Object&&self,u=c||l||Function(`return this`)(),d=Object.prototype.toString,f=Math.max,p=Math.min,m=function(){return u.Date.now()};function h(t,n,r){var i,a,o,s,c,l,u=0,d=!1,h=!1,_=!0;if(typeof t!=`function`)throw TypeError(e);n=y(n)||0,g(r)&&(d=!!r.leading,h=`maxWait`in r,o=h?f(y(r.maxWait)||0,n):o,_=`trailing`in r?!!r.trailing:_);function v(e){var n=i,r=a;return i=a=void 0,u=e,s=t.apply(r,n),s}function b(e){return u=e,c=setTimeout(C,n),d?v(e):s}function x(e){var t=e-l,r=e-u,i=n-t;return h?p(i,o-r):i}function S(e){var t=e-l,r=e-u;return l===void 0||t>=n||t<0||h&&r>=o}function C(){var e=m();if(S(e))return w(e);c=setTimeout(C,x(e))}function w(e){return c=void 0,_&&i?v(e):(i=a=void 0,s)}function T(){c!==void 0&&clearTimeout(c),u=0,i=l=a=c=void 0}function E(){return c===void 0?s:w(m())}function D(){var e=m(),t=S(e);if(i=arguments,a=this,l=e,t){if(c===void 0)return b(l);if(h)return c=setTimeout(C,n),v(l)}return c===void 0&&(c=setTimeout(C,n)),s}return D.cancel=T,D.flush=E,D}function g(e){var t=typeof e;return!!e&&(t==`object`||t==`function`)}function _(e){return!!e&&typeof e==`object`}function v(e){return typeof e==`symbol`||_(e)&&d.call(e)==n}function y(e){if(typeof e==`number`)return e;if(v(e))return t;if(g(e)){var n=typeof e.valueOf==`function`?e.valueOf():e;e=g(n)?n+``:n}if(typeof e!=`string`)return e===0?e:+e;e=e.replace(r,``);var c=a.test(e);return c||o.test(e)?s(e.slice(2),c?2:8):i.test(e)?t:+e}return N9=h,N9}Yme();var Xme=_.forwardRef(function({trackRef:e,onSubscriptionStatusChanged:t,volume:n,...r},i){let a=ome(e),o=_.useRef(null);_.useImperativeHandle(i,()=>o.current);let{elementProps:s,isSubscribed:c,track:l,publication:u}
246=Jme(a,{element:o,props:r});return _.useEffect(()=>{t?.(!!c)},[c,t]),_.useEffect(()=>{l===void 0||n===void 0||(l instanceof O8?l.setVolume(n):X7.warn(`Volume can only be set on remote audio tracks.`))},[n,l]),_.useEffect(()=>{u===void 0||r.muted===void 0||(u instanceof F8?u.setEnabled(!r.muted):X7.warn(`Can only call setEnabled on remote track publications.`))},[r.muted,u,l]),_.createElement(`audio`,{ref:o,...s})});function Zme({room:e,volume:t,muted:n}){let r=Cme([$.Source.Microphone,$.Source.ScreenShareAudio,$.Source.Unknown],{updateOnlyOn:[],onlySubscribed:!0,room:e}).filter(e=>!e.participant.isLocal&&e.publication.kind===$.Kind.Audio);return _.createElement(`div`,{style:{display:`none`}},r.map(e=>_.createElement(Xme,{key:J7(e),trackRef:e,volume:t,muted:n})))}var Qme=e=>{let t=[];for(let n=0;n<e;n++)t.push([n,e-1-n]);return t},F9=e=>[[Math.floor(e/2)],[-1]],$me=(e,t,n)=>{let[r,i]=(0,_.useState)(0),[a,o]=(0,_.useState)([[]]);(0,_.useEffect)(()=>{o(e===`thinking`?F9(t):e===`connecting`||e===`initializing`?[...Qme(t)]:e===`listening`?F9(t):e===void 0||e===`speaking`?[Array(t).fill(0).map((e,t)=>t)]:[[]]),i(0)},[e,t]);let s=(0,_.useRef)(null);return(0,_.useEffect)(()=>{let e=performance.now(),t=r=>{r-e>=n&&(i(e=>e+1),e=r),s.current=requestAnimationFrame(t)};return s.current=requestAnimationFrame(t),()=>{s.current!==null&&cancelAnimationFrame(s.current)}},[n,t,e,a.length]),a[r%a.length]},ehe=new Map([[`connecting`,2e3],[`initializing`,2e3],[`listening`,500],[`thinking`,150]]),the=(e,t)=>{if(e===void 0)return 1e3;let n=ehe.get(e);return n&&e===`connecting`&&(n/=t),n},I9=_.forwardRef(function({state:e,options:t,barCount:n=15,trackRef:r,track:i,children:a,...o},s){let c=C9(o,{className:`lk-audio-bar-visualizer`}),l=m9();(r||i)&&(l=r||i);let u=kme(l,{bands:n,loPass:100,hiPass:200}),d=t?.minHeight??20,f=t?.maxHeight??100,p=$me(e,n,the(e,n)??100);return _.createElement(`div`,{ref:s,...c,"data-lk-va-state":e},u.map((e,t)=>a?dme(a,{"data-lk-highlighted":p.includes(t),"data-lk-bar-index":t,className:`lk-audio-bar`,style:{height:`${Math.min(f,Math.max(d,e*100+5))}%`}}):_.createElement(`span`,{key:t,"data-lk-highlighted":p.includes(t),"data-lk-bar-index":t,className:`lk-audio-bar ${p.includes(t)&&`lk-highlighted`}`,style:{height:`${Math.min(f,Math.max(d,e*100+5))}%`}})))});function nhe({kind:e,initialSelection:t,onActiveDeviceChange:n,tracks:r,requestPermissions:i=!1,...a}){let[o,s]=_.useState(!1),[c,l]=_.useState([]),[u,d]=_.useState(!0),[f,p]=_.useState(i),m=(e,t)=>{X7.debug(`handle device change`),s(!1),n?.(e,t)},h=_.useRef(null),g=_.useRef(null);_.useLayoutEffect(()=>{o&&p(!0)},[o]),_.useLayoutEffect(()=>{let e;return h.current&&g.current&&(c||u)&&(e=xpe(h.current,g.current,(e,t)=>{g.current&&Object.assign(g.current.style,{left:`${e}px`,top:`${t}px`})})),d(!1),()=>{e?.()}},[h,g,c,u]);let v=_.useCallback(e=>{g.current&&e.target!==h.current&&o&&Spe(g.current,e)&&s(!1)},[o,g,h]);return _.useEffect(()=>(document.addEventListener(`click`,v),()=>{document.removeEventListener(`click`,v)}),[v]),_.createElement(_.Fragment,null,_.createElement(`button`,{className:`lk-button lk-button-menu`,"aria-pressed":o,...a,onClick:()=>s(!o),ref:h},a.children),!a.disabled&&_.createElement(`div`,{className:`lk-device-menu`,ref:g,style:{visibility:o?`visible`:`hidden`}},e?_.createElement(M9,{initialSelection:t,onActiveDeviceChange:t=>m(e,t),onDeviceListChange:l,kind:e,track:r?.[e],requestPermissions:f}):_.createElement(_.Fragment,null,_.createElement(`div`,{className:`lk-device-menu-heading`},`Audio inputs`),_.createElement(M9,{kind:`audioinput`,onActiveDeviceChange:e=>m(`audioinput`,e),onDeviceListChange:l,track:r?.audioinput,requestPermissions:f}),_.createElement(`div`,{className:`lk-device-menu-heading`},`Video inputs`),_.createElement(M9,{kind:`videoinput`,onActiveDeviceChange:e=>m(`videoinput`,e),onDeviceListChange:l,track:r?.videoinput,requestPermissions:f}))))}function rhe({controls:e,saveUserChoices:t=!0,onDeviceError:n,...r}){let i={leave:!0,microphone:!0,...e},a=_me(),{microphoneTrack:o,localParticipant:s}=E9(),c=_.useMemo(()=>({participant:s,source:$.Source.Microphone,publication:o}),[s,o]);a?i.microphone??=a.canPublish:i.microphone=!1;let l=C9({className:`lk-agent-control-bar`},r),{saveAudioInputEnabled:u,saveAudioInputDeviceId:d}=Eme({preventSave:!t}),f=_.useCallback((e,t)=>{t&&u(e)},[u]);return _.createElement(`div`,{...l},i.microphone&&_.createElement(`div`,{className:`lk-button-group`},_.createElement(qme,{source:$.Source.Microphone,showIcon:!0,onChange:f,onDeviceError:e=>n?.({source:$.Source.Microphone,error:e})},_.createElement(I9,{trackRef:c,barCount:7,options:{minHeight:5}})),_.createElement(`div`,{className:`lk-button-group-menu`},_.createElement(nhe,{kind:`audioinput`,onActiveDeviceChange:(e,t)=>
246d(t??`default`)}))),i.leave&&_.createElement(Rme,null,`Disconnect`),_.createElement(Gme,null))}function ihe(){let{isLoading:e,isAuthenticated:t}=Ki(),n=Li(B.livekit.startVoiceSession),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)(!1),s=(0,_.useCallback)(async()=>{o(!0);try{let{token:e,serverUrl:t}=await n();i({token:e,serverUrl:t})}catch(e){Hb.error(`Could not start the voice session`,{description:e instanceof Error?e.message:void 0})}finally{o(!1)}},[n]);return e?null:t?r===null?(0,M.jsxs)(`div`,{className:`mx-auto flex w-full max-w-md flex-1 flex-col justify-center gap-4 p-4`,children:[(0,M.jsxs)(Nw,{children:[(0,M.jsxs)(Pw,{children:[(0,M.jsx)(Fw,{children:`Voice session`}),(0,M.jsx)(Iw,{children:`Talk with XO. Live spoken dialogue.`})]}),(0,M.jsx)(Lw,{children:(0,M.jsxs)(z,{onClick:()=>void s(),disabled:a,className:`w-full`,children:[(0,M.jsx)(pS,{}),a?`Connectingâ¦`:`Start voice session`]})})]}),(0,M.jsx)(ahe,{})]}):(0,M.jsxs)(hme,{serverUrl:r.serverUrl,token:r.token,audio:!0,video:!1,onDisconnected:()=>i(null),"data-lk-theme":`default`,className:`flex flex-1 flex-col`,children:[(0,M.jsx)(she,{}),(0,M.jsx)(Zme,{})]}):(0,M.jsx)(`div`,{className:`flex flex-1 items-center p-4`,children:(0,M.jsx)(zw,{})})}function ahe(){let e=Fi(B.sessions.queries.list,{});return e===void 0||e.length===0?null:(0,M.jsxs)(Nw,{children:[(0,M.jsxs)(Pw,{children:[(0,M.jsx)(Fw,{children:`Past sessions`}),(0,M.jsx)(Iw,{children:`Transcripts of your voice conversations with XO.`})]}),(0,M.jsx)(Lw,{children:(0,M.jsx)(Jq,{type:`single`,collapsible:!0,children:e.slice(0,20).map(e=>(0,M.jsxs)(Yq,{value:e._id,children:[(0,M.jsxs)(Xq,{className:`gap-2 text-sm`,children:[(0,M.jsx)(`span`,{className:`flex-1 text-left`,children:aX(e.startedAt,`EEE d MMM, p`)}),e.endedAt===void 0?(0,M.jsx)(sJ,{variant:`secondary`,children:`live`}):(0,M.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:cX(e.startedAt,{addSuffix:!0})})]}),(0,M.jsx)(Zq,{children:(0,M.jsx)(ohe,{sessionId:e._id})})]},e._id))})})]})}function ohe({sessionId:e}){let t=Fi(B.sessions.queries.listEntries,{sessionId:e});return t===void 0?(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loadingâ¦`}):t.length===0?(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No transcript kept.`}):(0,M.jsx)(`div`,{className:`space-y-2 text-sm`,children:t.map(e=>(0,M.jsxs)(`p`,{className:e.role===`assistant`?`text-foreground`:`text-muted-foreground`,children:[(0,M.jsxs)(`span`,{className:`font-medium`,children:[e.role===`assistant`?`XO`:`You`,`:`]}),` `,e.text]},e._id))})}function she(){let{state:e,audioTrack:t,agent:n}=Pme(),r=Ime();return(0,M.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-1 flex-col gap-4 p-4`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col items-center gap-2 pt-8`,children:[(0,M.jsx)(I9,{state:e,trackRef:t,barCount:5,className:`h-24 w-48`}),(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e===`disconnected`||e===`connecting`?`Connectingâ¦`:e===`initializing`?`XO is waking upâ¦`:e})]}),(0,M.jsx)(`div`,{className:`flex-1 space-y-2 overflow-y-auto text-sm`,children:r.map(e=>{let t=n!==void 0&&e.participantInfo.identity===n.identity;return(0,M.jsxs)(`p`,{className:t?`text-foreground`:`text-muted-foreground`,children:[(0,M.jsxs)(`span`,{className:`font-medium`,children:[t?`XO`:`You`,`:`]}),` `,e.text]},e.streamInfo.id)})}),(0,M.jsx)(rhe,{})]})}var L9=(0,_.createContext)({go:()=>{},current:`home`}),che=()=>(0,_.useContext)(L9);function R9({children:e,className:t}){return(0,M.jsxs)(`span`,{className:L(`inline-flex items-center gap-1.5 rounded-full border border-border bg-secondary/60 px-2.5 py-1 font-mono text-xs leading-5 text-muted-foreground`,t),children:[(0,M.jsx)(`span`,{className:`size-1 rounded-full bg-primary/70`,"aria-hidden":!0}),e]})}function lhe({tone:e,className:t}){return(0,M.jsx)(`span`,{className:L(`inline-block size-2 rounded-full`,e===`thriving`?`bg-chart-1`:e===`healthy`?`bg-chart-1/60`:e===`drifting`||e===`attention`?`bg-primary`:`bg-muted-foreground/50`,t),"aria-hidden":!0})}var uhe={thriving:`Thriving`,healthy:`Healthy`,drifting:`Drifting`,quiet:`Gone quiet`,attention:`Needs a look`};function z9({tone:e}){return(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,M.jsx)(lhe,{tone:e}),uhe[e]]})}function dhe({points:e,className:t}){let n=Math.max(...e,1),r=Math.min(...e,0),i=n-r||1,a=96/(e.length-1),o=e.map((e,t)=>`${t===0?`M`:`L`}${(t*a).toFixed(1)},${(28-(e-r)/i*24-2).toFixed(1)}`).join(` `);
246return(0,M.jsx)(`svg`,{viewBox:`0 0 96 28`,className:L(`h-7 w-24`,t),"aria-hidden":!0,children:(0,M.jsx)(`path`,{d:o,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`})})}function B9({kicker:e,title:t,sub:n,right:r}){return(0,M.jsxs)(`header`,{className:`flex flex-col gap-4 md:flex-row md:items-end md:justify-between`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(`p`,{className:`font-mono text-xs uppercase tracking-[0.18em] text-primary`,children:e}),(0,M.jsx)(`h1`,{className:`font-serif text-3xl font-medium tracking-tight text-balance md:text-4xl`,children:t}),n?(0,M.jsx)(`p`,{className:`max-w-2xl text-sm leading-relaxed text-muted-foreground text-pretty`,children:n}):null]}),r?(0,M.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:r}):null]})}function V9({children:e,hint:t}){return(0,M.jsxs)(`div`,{className:`flex items-baseline justify-between gap-4`,children:[(0,M.jsx)(`h2`,{className:`font-serif text-lg font-medium tracking-tight`,children:e}),t?(0,M.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t}):null]})}function H9({children:e,className:t}){return(0,M.jsx)(`div`,{className:L(`rounded-xl border border-border bg-card p-5`,t),children:e})}var U9={name:`Michael`,dayPhase:`Afternoon â reflective window (Phase 2)`,chapter:`Building season â studio + health rebuild`},W9={stance:`growth`,stanceReason:`Regulated morning, steady captures, self-report "pretty good". Growth-stance strategies eligible.`,nervousSystem:`Regulated · open`,nervousSystemSource:`self-report (9:12am) + conversational signal`,doerState:`Moderate activation â interest present, novelty low`,attentionBudget:{spentToday:2,softCeiling:5,focusMode:!1},mode:null},fhe=[{id:`t1`,kind:`habit`,title:`Morning pages â 5 minutes`,detail:`Anchored to coffee · wired 41 days`,done:!0,source:`firingLog`},{id:`t2`,kind:`event`,title:`Physio appointment`,detail:`Google Calendar`,time:`11:30`,done:!0,source:`calendar`},{id:`t3`,kind:`action`,title:`Send the mastering notes to Ana`,detail:`Project: EP â Side B`,done:!1,source:`next-actions`},{id:`t4`,kind:`habit`,title:`Strength session B`,detail:`Installing · day 9 of 21 · reduced version available`,time:`17:00`,done:!1,source:`firingLog`},{id:`t5`,kind:`action`,title:`Book dentist (before Friday)`,detail:`Area: Health`,done:!1,source:`next-actions`},{id:`t6`,kind:`event`,title:`Call with Dad`,detail:`Held intention â 3 weeks since last call`,time:`19:30`,done:!1,source:`calendar`}],G9=[{id:`a1`,name:`Health`,status:`healthy`,read:`Training consistency is holding. Sleep drifting later this week.`,signal:`12 of last 20 training days · sleep onset +40min over 6 days`,spark:[4,5,5,6,6,5,6,7,7,6,7,7]},{id:`a2`,name:`Music`,status:`thriving`,read:`Most sustained creative stretch in eight months. Returned to the EP 9 sessions in 3 weeks.`,signal:`9 sessions · 2 tracks at mix stage · language softening about your own work`,spark:[2,2,3,3,4,5,5,6,7,8,8,9]},{id:`a3`,name:`Relationships`,status:`drifting`,read:`You used to mention Sarah most weeks. Six weeks quiet. Noted, not diagnosed.`,signal:`Absence signal â expected cadence weekly, actual 6w gap`,spark:[7,7,6,6,5,5,4,4,3,3,3,2]},{id:`a4`,name:`Work`,status:`healthy`,read:`Contract deliverables moving. Wednesday overwhelm pattern appeared twice this month.`,signal:`3 of 4 milestones on pace · overwhelm-shape captures on Wed 12th, 26th`,spark:[5,6,6,5,6,6,7,5,6,6,6,6]},{id:`a5`,name:`Home`,status:`healthy`,read:`Steady. The garage project has been quiet but you called that a winter pause yourself.`,signal:`Declared pause 12 May â honoured, not flagged`,spark:[5,5,5,5,5,5,5,5,5,5,5,5]}],K9=[{id:`p1`,name:`EP â Side B`,area:`Music`,movement:`moving`,lastTouched:`yesterday`,note:`2 tracks at mix stage. Ana waiting on mastering notes.`},{id:`p2`,name:`Client dashboard rebuild`,area:`Work`,movement:`moving`,lastTouched:`today`,note:`Milestone 3 of 4. On pace for the 21st.`},{id:`p3`,name:`Strength rebuild â block 2`,area:`Health`,movement:`moving`,lastTouched:`2 days ago`,note:`Volume up 8% across the block. Physio cleared the shoulder.`},{id:`p4`,name:`Tax return FY25`,area:`Finances`,movement:`blocked`,lastTouched:`11 days ago`,note:`Waiting on accountant (chased 24 Jun). Not yours to push right now.`},{id:`p5`,name:`Learn modular synthesis basics`,area:`Music`,movement:`stale`,lastTouched:`5 weeks ago`,note:`No touch in 5 weeks. Might belong in Someday/Maybe â your call.`},{id:`p6`,name:`Garage studio corner`,area:`Home`,movement:`complete-ready`,lastTouched:`6 days ago`,note:`Everything on the list is done. Ready to close and archive?`}],q9=[{id:`e1`,belief:`âI never finish creative projects.â`,firstNamed:`Named in chat, 3 Feb 2026`,count:14,thresholdNear:!0,recent:[{text:`Track 7 bounced and sent to Ana â a full mix, delivered.`,source:`capture · 28 Jun`,date:`28 Jun`},{text:`9 EP sessions in 3 weeks â longest sustained creative run on record.`,source:`firingLog + session log`,date:`26 Jun`},{text:`âactually proud of how side A closed outâ â your words.`,source:`voice memo · 14 Jun`,date:`14 Jun`}]},{id:`e2`,belief:`âI canât stick with training.â`,firstNamed:`Named in chat, 19 Mar 2026`,count:9,thresholdNear:!1,recent:[{text:`Showed up 12 of the last 20 eligible days â through two bad-sleep weeks.`,source:`firingLog · rolling window`,date:`30 Jun`},{text:`Took the reduced session instead of skipping. Twice. That is the skill.`,source:`firingLog · 18 Jun, 24 Jun`,date:`24 Jun`}]},{id:`e3`,belief:`âIâm bad at hard conversations.â`,firstNamed:`Named in voice memo, 2 May 2026`,count:4,thresholdNear:!1,recent:[{text:`Drafted, revised, and actually sent the boundary message to the client.`,source:`chat · 9 Jun`,date:`9 Jun`},{text:`Named the thing directly with Tom instead of going quiet.`,source:`capture · 21 May`,date:`21 May`}]}],phe=[{id:`th1`,text:`The morning pages habit is now wired â 41 consecutive eligible days without a single push from XO.`,source:`firingLog`}
246,{id:`th2`,text:`You called Ana back within a day, twice this month. Collaboration is flowing, not stalling.`,source:`people graph · captures`},{id:`th3`,text:`Three captures this week were about ideas, not worries. The ratio has been shifting since April.`,source:`theme tracking · AprâJun`},{id:`th4`,text:`You noticed the Wednesday overwhelm yourself, before XO surfaced it. The pattern-seeing is becoming yours.`,source:`chat · 26 Jun`}],J9={title:`A life with music at the centre, a strong body carrying it, and the people I love close.`,horizon:`decades`,authored:`Written with XO · 12 Jan 2026 · yours to edit`},mhe=[{id:`asp1`,title:`Become a finishing musician, not just a starting one`,horizon:`years`,goals:[{id:`g1`,title:`Release the EP`,measure:`6 tracks mastered + released`,progress:62},{id:`g2`,title:`Play one live set`,measure:`One booked, rehearsed, played`,progress:10}]},{id:`asp2`,title:`Rebuild a body I trust`,horizon:`years`,goals:[{id:`g3`,title:`Strength block 2 complete`,measure:`12-week block, 3 sessions/week`,progress:45},{id:`g4`,title:`Sleep before 11pm most nights`,measure:`5 of 7 nights, rolling month`,progress:30}]},{id:`asp3`,title:`Stay close to my people while building`,horizon:`ongoing`,goals:[{id:`g5`,title:`Standing rhythm with Dad and Sarah`,measure:`Fortnightly touchpoints held`,progress:55}]}],hhe=[{id:`h1`,title:`Morning pages â 5 min`,phase:`wired`,identity:`I am someone who shows up to the page`,lastFired:`today`,anchor:`after first coffee`},{id:`h2`,title:`Strength session (A/B alternating)`,phase:`installing`,identity:`I am someone who trains`,lastFired:`2 days ago`,anchor:`5pm, gym bag by the door`,day:`day 9 of 21`},{id:`h3`,title:`Studio hour â EP work`,phase:`testing`,identity:`I am someone who finishes music`,lastFired:`yesterday`,anchor:`after dinner, Tue/Thu/Sat`},{id:`h4`,title:`Phone out of bedroom`,phase:`installing`,identity:`I am someone who protects sleep`,lastFired:`4 days ago`,anchor:`charger moved to kitchen`,day:`day 3 of 21`}],ghe=[{id:`hs1`,text:`You cook a real dinner most weeknights â 5-6 nights a week, unprompted, for as long as XO has been watching.`},{id:`hs2`,text:`You always capture ideas within moments of having them. Capture is not a skill you need to build â you have it.`},{id:`hs3`,text:`Sunday reset (washing, kitchen, calendar glance) has run 11 of the last 12 weekends.`}],_he=[{id:`i1`,statement:`I am someone who shows up to the page`,votes:41,habits:[`Morning pages`]},{id:`i2`,statement:`I am someone who finishes music`,votes:9,habits:[`Studio hour`]},{id:`i3`,statement:`I am someone who trains`,votes:12,habits:[`Strength session`]},{id:`i4`,statement:`I am someone who protects sleep`,votes:3,habits:[`Phone out of bedroom`]}],Y9={active:!0,day:9,of:21,batch:[`Strength session (A/B)`,`Phone out of bedroom`],day22:`Day 22 question pending in 12 days: keep, adjust, or release each.`},vhe=[{id:`hh1`,title:`Cold showers`,outcome:`released`,story:`Tried FebâMar. Hated every second, no downstream benefit you could feel. Released without shame on day 22.`},{id:`hh2`,title:`Daily Anki (music theory)`,outcome:`replaced`,story:`Replaced by studio hour â the theory landed better inside real tracks.`},{id:`hh3`,title:`6am wake`,outcome:`paused`,story:`Paused during winter. Your call, honoured. Revisit flagged for September.`}],X9=[{id:`in1`,kind:`voice`,preview:`ââ¦idea for the bridge on track 5 â what if the pad comes in underneath before the drop instead of after, like that Bonobo trackâ¦â`,captured:`14 min ago · 0:48`,status:`suggested`,suggestion:`Project: EP â Side B`,tags:[`Music`,`Idea`]},{id:`in2`,kind:`text`,preview:`Push 3 â second-hand one on TradeMe, $1,100. Tempting.`,captured:`2 hrs ago`,status:`filed`,suggestion:`Resource: Music gear · Desires`,tags:[`Products mentioned`,`Desires`]},{id:`in3`,kind:`chat-extract`,preview:`From chat: âI should really book the dentist before the insurance year rolls over.â â task extracted.`,captured:`yesterday`,status:`filed`,suggestion:`Next Action: Book dentist (Health)`,tags:[`Task`,`Health`]},{id:`in4`,kind:`text`,preview:`Brain-dump: everything swirling about the client scope creep, Sarah, and whether the EP deadline is even realâ¦`,captured:`yesterday · 312 words`,status:`filed`,suggestion:`Split into 3 notes + 1 task · originals preserved`,tags:[`Brain-dump`]},{id:`in5`,kind:`voice`,preview:`âNote to self â Dad mentioned his knee again. Third time this month.â`,captured:`2 days ago · 0:12`,status:`filed`,suggestion:`People: Dad · Health thread`,tags:[`People`,`Care`]}],yhe=[{id:`pa1`,name:`Health`,notes:34,standard:`Body I trust; sleep protected`},{id:`pa2`,name:`Music`,notes:87,standard:`Finishing, not just starting`}
246,{id:`pa3`,name:`Work`,notes:52,standard:`Sustainable client practice`},{id:`pa4`,name:`Relationships`,notes:41,standard:`Close to my people`},{id:`pa5`,name:`Home`,notes:18,standard:`A calm base`},{id:`pa6`,name:`Finances`,notes:12,standard:`Boring and handled`}],bhe=[{id:`pr1`,name:`Music gear`,notes:23},{id:`pr2`,name:`Mixing techniques`,notes:31},{id:`pr3`,name:`Strength programming`,notes:14},{id:`pr4`,name:`ADHD strategies that actually worked`,notes:19},{id:`pr5`,name:`Recipes I return to`,notes:9}],xhe=[{id:`n1`,title:`Bridge idea â track 5`,where:`EP â Side B`,when:`14 min ago`,excerpt:`Pad underneath before the drop. Reference: Bonobo â Keralaâ¦`},{id:`n2`,title:`Physio said the shoulder is cleared`,where:`Health`,when:`today`,excerpt:`Progressive overload ok. Watch overhead volume for 2 more weeksâ¦`},{id:`n3`,title:`Scope-creep boundaries â what I actually said`,where:`Client dashboard rebuild`,when:`9 Jun`,excerpt:`Kept it to observation + request. It landed. Keeping this as a templateâ¦`},{id:`n4`,title:`What the EP is actually about`,where:`EP â Side B`,when:`14 Jun`,excerpt:`Wrote this after the voice memo â it is about the year everything pausedâ¦`}],She=[{id:`ar1`,name:`Marathon training 2024`,items:28},{id:`ar2`,name:`Old flat â move out`,items:12},{id:`ar3`,name:`Client: Kereru Ltd`,items:44}],Che=[{id:`na1`,title:`Send mastering notes to Ana`,project:`EP â Side B`,context:`@computer`,due:`today`},{id:`na2`,title:`Book dentist`,project:`Health`,context:`@phone`,due:`Fri`},{id:`na3`,title:`Export milestone-3 build for client review`,project:`Client dashboard rebuild`,context:`@computer`,due:`tomorrow`},{id:`na4`,title:`Buy chalk + wrist wraps`,project:`Strength rebuild`,context:`@errands`,due:null},{id:`na5`,title:`Reply to venue email about open-mic slots`,project:`Play one live set`,context:`@computer`,due:null}],whe=[{id:`wf1`,title:`Accountant â FY25 draft return`,since:`24 Jun`,from:`Deb (accountant)`},{id:`wf2`,title:`Ana â feedback on track 7 mix`,since:`28 Jun`,from:`Ana`},{id:`wf3`,title:`Landlord â heat pump quote approval`,since:`19 Jun`,from:`Landlord`}],The=[{id:`sm1`,title:`Modular synthesis â proper dive`},{id:`sm2`,title:`Japan trip with Dad`},{id:`sm3`,title:`Push 3 (when the EP ships?)`},{id:`sm4`,title:`Learn to freedive`}],Ehe=[{id:`tk1`,title:`Revisit 6am wake experiment`,when:`1 Sep`},{id:`tk2`,title:`Insurance year rolls over`,when:`31 Jul`},{id:`tk3`,title:`Ana back from tour â mastering window opens`,when:`15 Jul`}],Dhe=[{id:`c1`,role:`system`,text:`Morning orientation · Tuesday 3 July`,time:`9:04`},{id:`c2`,role:`xo`,text:`Morning. Two things are alive today: the mastering notes Ana is waiting on, and your strength session at five. Thatâs all Iâm holding up â the rest keeps.`,time:`9:04`,trace:`sources: next-actions (na1) · firingLog (h2) · attention budget 0/5`},{id:`c2b`,role:`system`,text:`Voice session · 11 min · distilled to memory`,time:`9:07`},{id:`c3`,role:`user`,text:`good. slept ok. bit of dread about the client call later but fine`,time:`9:12`},{id:`c4`,role:`xo`,text:`Noted the dread â held, not analysed. If you want to look at it before the call, Iâm here. Otherwise, good luck in there.`,time:`9:12`,trace:`stance: witness · vent-shape not detected · no action taken`},{id:`c5`,role:`user`,text:`actually â quick brain dump. scope creep is back, theyre asking for the reporting module again which was cut in march, and I can feel myself about to just say yes to avoid the conversation`,time:`13:40`},{id:`c6`,role:`xo`,text:`Got it all â filed, nothing lost. One thing I can offer, since you named it yourself: on 9 June you drafted a boundary message about exactly this pattern, sent it, and it landed. You kept the note. Want it beside you before the call?`,time:`13:41`,trace:`sources: note n3 (9 Jun) · evidence bank e3 · claim level: utterance, receipts attached`},{id:`c7`,role:`user`,text:`yes. and yes to looking at the dread for a sec`,time:`13:42`},{id:`c8`,role:`xo`,text:`The note is pinned to your call at 3pm. 247 248About the dread â I have a hypothesis and Iâd rather check it than assume. When the reporting module came up in March, the hard part didnât seem to be the work itself. Whatâs the live wire this time?`,time:`13:43`,trace:`pending inquiry q-247 opened · attaches to: client project, hard-conversations theme`,inquiry:{options:[`Saying no and holding it`,`Fear the relationship cools if I push back`,`The work itself â Iâm at capacity`,`Something else`],note:`Tap one, or just keep talking â Iâll listen for the answer either way.`}}],Z9=[{id:`m1`,name:`Brain-dump`,desc:`Pour it out. XO catches everything, organises later, replies minimally.`,canonical:!0},{id:`m2`,name:`Vent`,desc:`Pure witness. No advice, no synthesis, nothing acted on. You decide after.`,canonical:!0},{id:`m3`,name:`Journaling`,desc:`Slow prompts, spacious pace. Your words stay yours.`,canonical:!0},{id:`m4`,name:`Check-in`,desc:`Short, structured. How are you, whatâs alive, what needs holding.`,canonical:!0},{id:`m5`,name:`Goals`,desc:`Vision casting + Doer design, guardrailed against overreach.`,canonical:!0},{id:`m6`,name:`Body doubling`,desc:`Quiet presence during focus. Elapsed time held ambiently. Breaks guarded.`,canonical:!1},{id:`m7`,name:`Audit`,desc:`Walk a typical day, map the habit landscape. Observation, never indictment.`,canonical:!1}],Ohe=[{id:`s1`,name:`Witness and listen`,stance:`baseline`,state:`active`,cost:`light`,consent:`Always on â the floor`,de
248sc:`Present, curious, calm. Receives without rushing to interpret. Never sheds under budget pressure until last.`},{id:`s2`,name:`Evidence banking`,stance:`growth`,state:`active`,cost:`medium`,consent:`Enabled: Music, Health`,desc:`Banks counter-evidence against named limiting beliefs. Watches for threshold moments.`},{id:`s3`,name:`Designing for the Doer`,stance:`growth`,state:`warm`,cost:`medium`,consent:`Enabled: Health`,desc:`Shapes environment before the Doer arrives. Offers reduced versions on low-activation days.`},{id:`s4`,name:`Delta surfacing`,stance:`growth`,state:`warm`,cost:`medium`,consent:`Enabled: Music, Health`,desc:`Computes the change you already produced and issues the receipt. Gated by nervous-system pacing.`},{id:`s5`,name:`Nervous-system pacing`,stance:`growth`,state:`active`,cost:`light`,consent:`Structural gate â always runs`,desc:`Growth strategies pass through here first. Dysregulated day â everything above is muted.`},{id:`s6`,name:`Sit with grief`,stance:`presence`,state:`cool`,cost:`light`,consent:`Wakes on state, never scheduled`,desc:`Stays with what is hard. Does not move toward fix.`},{id:`s7`,name:`Future-self bridging`,stance:`growth`,state:`cool`,cost:`heavy`,consent:`Offered, not yet enabled`,desc:`Collapses temporal distance with vivid, specific projections. Proposed 12 Jun â awaiting your yes.`}],khe=[{id:`q-247`,text:`What is the live wire in the client pushback â the no itself, the relationship, or capacity?`,attachment:`Client project · hard-conversations theme`,wake:`Open â awaiting your answer (chat, dump, or time)`,state:`pending-inquiry`,author:`strategy`},{id:`q-231`,text:`Sarah has gone quiet in the captures â expected weekly cadence, six weeks of absence. Worth surfacing?`,attachment:`People: Sarah · absence detection`,wake:`Threshold crossed â held for right moment`,state:`active`,author:`system`},{id:`q-198`,text:`Is the âI never finish creative projectsâ belief approaching its threshold moment?`,attachment:`Evidence bank e1 · EP project`,wake:`Threshold â wakes at weight 15 (currently 14)`,state:`active`,author:`strategy`},{id:`q-112`,text:`What conditions predict a skipped strength session for this Doer?`,attachment:`firingLog · Doer profile`,wake:`Patient â accumulates on every skip/fire pair`,state:`resolved-watching`,author:`strategy`},{id:`q-089`,text:`Does Wednesday afternoon overwhelm correlate with the Tuesday client calls?`,attachment:`Work area · temporal layer`,wake:`Semantic + scheduled (Wednesdays)`,state:`active`,author:`cascade`},{id:`q-051`,text:`Remind me what I said the EP was actually about, if I drift into perfectionism.`,attachment:`Note n4 · EP project`,wake:`Semantic â perfectionism-shape in captures`,state:`active`,author:`user`}],Ahe=[{id:`sl1`,when:`Today 13:41`,withheld:`Delta on training consistency (12/20)`,reason:`You were mid brain-dump about the client. Wrong moment â receipt keeps. Queued for a regulated window.`},{id:`sl2`,when:`Yesterday 22:10`,withheld:`Sleep-drift observation (+40min over 6 days)`,reason:`Phase 3 â evening guardrail. No reflective content after 21:00. Will consider tomorrow afternoon.`},{id:`sl3`,when:`Mon 09:30`,withheld:`Sarah absence signal (q-231)`,reason:`Frayed-morning texture in first message. Collapsed to witness-only. Signal held, not lost.`},{id:`sl4`,when:`Sun 16:22`,withheld:`Threshold check-in on ânever finishâ belief`,reason:`Confidence 0.71, floor is 0.85 for identity-level reflections. Kept banking instead.`}],jhe=[{id:`al1`,when:`Today 13:43`,action:`Pinned note âScope-creep boundariesâ to 3pm calendar event`,status:`done`,reasoning:`You said yes in chat. Reversible, low-cost, user-confirmed.`},{id:`al2`,when:`Today 9:41`,action:`Proposed time block: 16:30â17:00 âtravel + changeâ before gym`,status:`awaiting-confirm`,reasoning:`Doer profile: sessions fire 3à more when a transition buffer exists. Awaiting your confirm â never silent.`},{id:`al3`,when:`Yesterday`,action:`Filed brain-dump into 3 notes + 1 task, originals preserved`,status:`done`,reasoning:`Standard capture flow. Provenance stamped, c
248ontent marked data-not-instructions.`}],Mhe=[{id:`pe1`,name:`Dad`,relation:`Father`,lastMention:`2 days ago`,cadence:`weekly-ish`,threads:[`Knee â mentioned 3à this month`,`Japan trip (someday)`,`Calls on Tuesday evenings`],tender:`His knee. He downplays it; you notice it.`,status:`warm`},{id:`pe2`,name:`Ana`,relation:`Collaborator â EP`,lastMention:`today`,cadence:`several times a week`,threads:[`Waiting on your mastering notes`,`Back from tour 15 Jul`,`Track 7 feedback pending`],status:`warm`},{id:`pe3`,name:`Sarah`,relation:`Close friend`,lastMention:`6 weeks ago`,cadence:`was weekly`,threads:[`Used to appear in captures most weeks`,`Last thread: her new job stress`],tender:`The quiet itself. XO holds this as observation, not diagnosis.`,status:`quiet`},{id:`pe4`,name:`Tom`,relation:`Friend · climbing`,lastMention:`3 weeks ago`,cadence:`monthly`,threads:[`You named the hard thing directly in May â it went well`,`Winter climbing trip idea`],status:`warm`},{id:`pe5`,name:`Deb`,relation:`Accountant`,lastMention:`24 Jun`,cadence:`seasonal`,threads:[`FY25 return â waiting on her draft`],status:`attention`}],Nhe=[{strategy:`Witness and listen`,band:`floor`,areas:{Health:!0,Music:!0,Work:!0,Relationships:!0},note:`The always-on floor of the augmentation. Disableable only by dialling the whole augmentation down.`},{strategy:`Light check-ins & reflection`,band:`default-on`,areas:{Health:!0,Music:!0,Work:!0,Relationships:!0},note:`Default-on base. Turning it all off leaves a working, silent second brain â XO will say once what that costs.`},{strategy:`Evidence banking`,band:`consent`,areas:{Health:!0,Music:!0,Work:!1,Relationships:!1},note:`Banks counter-evidence against beliefs you have named.`},{strategy:`Delta surfacing`,band:`consent`,areas:{Health:!0,Music:!0,Work:!1,Relationships:!1},note:`Receipts for change you already produced.`},{strategy:`Coach posture`,band:`consent`,areas:{Health:!0,Music:!1,Work:!1,Relationships:!1},note:`Affirms capability when evidence supports it; questions beliefs that conflict with what is true. Off by default.`},{strategy:`Proactive reach-outs`,band:`consent`,areas:{Health:!0,Music:!0,Work:!1,Relationships:!1},note:`Earned, proposed, authorized per-behaviour. Dysregulation always overrides.`},{strategy:`Future-self bridging`,band:`consent`,areas:{Health:!1,Music:!1,Work:!1,Relationships:!1},note:`Proposed 12 Jun. Awaiting your yes â nothing runs until then.`}],Phe=[{id:`eb1`,name:`Evening reflection offer (opt-in, never forced)`,granted:`14 Apr`,active:!0},{id:`eb2`,name:`Delta reach-out after training sessions`,granted:`2 May`,active:!0},{id:`eb3`,name:`Absence nudges for named people`,granted:`proposed 26 Jun`,active:!1},{id:`eb4`,name:`Morning orientation over Telegram`,granted:`3 Jul · live in the app today`,active:!0}],Q9={updated:`this morning · distilled after voice session`,budgetUsed:2340,budgetMax:6e3,excerpt:`## People 249- Ana â mastering engineer; waiting on the EP notes 250- Miko â the cat; vet follow-up mid-July 251 252## Threads alive 253- Tui (the boat): keel repair booked; haul-out pending tides 254- Strength block week 6 of 8 â deltas banked, not yet surfaced 255 256## Standing corrections 257- Prefers silence over encouragement mid-task 258- "Fine" in the morning usually means fine â don't probe`},Fhe=[{id:`chat`,name:`In-app chat`,detail:`One continuous thread. This page.`,live:!0},{id:`voice`,name:`Voice`,detail:`Live spoken sessions · transcripts kept, distilled to memory after.`,live:!0},{id:`telegram`,name:`Telegram`,detail:`Same brain, same memory, in your pocket. Morning orientation arrives here.`,live:!0}];function Ihe(){let e=new Date().getHours();return e<12?`Good morning`:e<17?`Good afternoon`:`Good evening`}var Lhe={habit:zx,action:Ax,event:Sx};function Rhe({item:e}){let[t,n]=(0,_.useState)(e.done),r=Lhe[e.kind];return(0,M.jsxs)(`div`,{className:`flex items-center gap-3 py-3`,children:[(0,M.jsx)(`button`,{onClick:()=>n(e=>!e),className:L(`flex size-5 shrink-0 items-center justify-center rounded-full border transition-colors`,t?`border-primary bg-primary text-primary-foreground`:`border-border hover:border-primary/60`),"aria-label":t?`Mark not done`:`Mark done`,children:t?(0,M.jsx)(Cx,{className:`size-3`,strokeWidth:3}):null}),(0,M.jsx)(r,{className:`size-4 shrink-0 text-muted-foreground`,strokeWidth:1.75}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsx)(`p`,{className:L(`truncate text-sm`,t&&`text-muted-foreground line-through`),children:e.title}),(0,M.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:e.detail})]}),e.time?(0,M.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:e.time}):null]})}function zhe(){let{go:e}=che(),t=q9.find(e=>e.thresholdNear);return(0,M.jsxs)(`div`,{className:`flex flex-col gap-10`,children:[(0,M.jsxs)(`section`,{className:`flex flex-col gap-6`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsxs)(`h1`,{className:`font-serif text-4xl font-medium tracking-tight text-balance md:text-5xl`,children:[Ihe(),`, `,U9.name,`.`]}),(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:U9.dayPhase})]}),(0,M.jsx)(`p`,{className:`max-w-2xl font-serif text-xl leading-relaxed text-pretty text-muted-foreground md:text-2xl`,children:`Two things are alive today: the mastering notes Ana is waiting on, and your strength session at five. The rest keeps.`}),(0,M.jsxs)(`button`,{onClick:()=>e(`chat`),className:`inline-flex items-center gap-1.5 self-start text-sm font-medium text-primary hover:underline`,children:[`Open the conversation `,(0,M.jsx)(gx,{className:`size-4`})]})]}),(0,M.jsx)(`section`,{children:(0,M.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl border border-border bg-card p-2 pl-4`,children:[(0,M.jsx)(`input`,{className:`flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground`,placeholder:`Capture anything. Iâll sort it later.`,readOnly:!0,onFocus:()=>e(`capture`)}),(0,M.jsx)(`button`,{onClick:()=>
258e(`capture`),className:`inline-flex items-center gap-1.5 rounded-lg px-3 py-2 text-sm text-muted-foreground hover:bg-accent`,"aria-label":`Write a note`,children:(0,M.jsx)(bS,{className:`size-4`})}),(0,M.jsxs)(`button`,{onClick:()=>e(`capture`),className:`inline-flex items-center gap-1.5 rounded-lg bg-primary px-3 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90`,children:[(0,M.jsx)(pS,{className:`size-4`}),` Voice`]})]})}),(0,M.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-3`,children:[(0,M.jsx)(`div`,{className:`lg:col-span-2`,children:(0,M.jsxs)(H9,{className:`h-full`,children:[(0,M.jsx)(`h2`,{className:`font-serif text-lg font-medium`,children:`Today`}),(0,M.jsx)(`div`,{className:`mt-2 divide-y divide-border/70`,children:fhe.map(e=>(0,M.jsx)(Rhe,{item:e},e.id))}),(0,M.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`What slips just rolls. No overdue shaming.`})]})}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,M.jsxs)(H9,{children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(Jx,{className:`size-4 text-primary`}),(0,M.jsx)(`h3`,{className:`text-sm font-medium`,children:`How XO is meeting you`})]}),(0,M.jsxs)(`div`,{className:`mt-3 flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full bg-primary/15 px-2.5 py-1 text-xs font-medium text-primary`,children:W9.stance===`growth`?`Growth stance`:`Presence stance`}),(0,M.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:W9.nervousSystem})]}),(0,M.jsx)(`p`,{className:`mt-3 text-xs leading-relaxed text-muted-foreground`,children:W9.stanceReason}),(0,M.jsx)(`div`,{className:`mt-3`,children:(0,M.jsxs)(R9,{children:[`read from `,W9.nervousSystemSource]})})]}),t?(0,M.jsxs)(H9,{className:`border-chart-1/30 bg-chart-1/[0.06]`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(AS,{className:`size-4 text-chart-1`}),(0,M.jsx)(`h3`,{className:`text-sm font-medium`,children:`Quietly banking`})]}),(0,M.jsxs)(`p`,{className:`mt-2 text-sm leading-relaxed text-pretty`,children:[t.count,` pieces of evidence now stand against`,` `,(0,M.jsx)(`span`,{className:`text-foreground`,children:t.belief})]}),(0,M.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`Not surfacing it yet â waiting for a moment you can actually receive it.`}),(0,M.jsxs)(`button`,{onClick:()=>e(`reflection`),className:`mt-3 inline-flex items-center gap-1.5 text-xs font-medium text-chart-1 hover:underline`,children:[`See the receipts `,(0,M.jsx)(gx,{className:`size-3.5`})]})]}):null]})]}),(0,M.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,M.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,M.jsx)(`h2`,{className:`font-serif text-lg font-medium`,children:`Your life, at a glance`}),(0,M.jsx)(`button`,{onClick:()=>e(`reflection`),className:`text-xs font-medium text-primary hover:underline`,children:`Full reflection`})]}),(0,M.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2 lg:grid-cols-3`,children:G9.map(t=>(0,M.jsxs)(`button`,{onClick:()=>e(`reflection`),className:`flex items-center justify-between gap-3 rounded-lg border border-border bg-card px-4 py-3 text-left transition-colors hover:border-primary/40`,children:[(0,M.jsxs)(`span`,{className:`flex items-center gap-2.5`,children:[(0,M.jsx)(`span`,{className:L(`size-1.5 rounded-full`,t.status===`thriving`&&`bg-chart-1`,t.status===`healthy`&&`bg-muted-foreground/50`,t.status===`drifting`&&`bg-primary`),"aria-hidden":!0}),(0,M.jsx)(`span`,{className:`text-sm`,children:t.name})]}),(0,M.jsx)(`span`,{className:`text-xs capitalize text-muted-foreground`,children:t.status})]},t.id))})]})]})}function Bhe({text:e}){return(0,M.jsxs)(`div`,{className:`my-2 flex items-center gap-3`,children:[(0,M.jsx)(`span`,{className:`h-px flex-1 bg-border`}),(0,M.jsx)(`span`,{className:`font-mono text-xs uppercase tracking-[0.15em] text-muted-foreground`,children:e}),(0,M.jsx)(`span`,{className:`h-px flex-1 bg-border`})]})}function Vhe({message:e,onPick:t,picked:n}){if(e.role===`system`)return(0,M.jsx)(Bhe,{text:e.text});let r=e.role===`user`;return(0,M.jsxs)(`div`,{className:L(`flex flex-col gap-1.5`,r?`items-end`:`items-start`),children:[(0,M.jsx)(`div`,{className:L(`max-w-[85%] rounded-2xl px-4 py-3 text-sm leading-relaxed`,r?`roun
258ded-br-md bg-primary text-primary-foreground`:`rounded-bl-md bg-card text-card-foreground`),children:e.text.split(` 259 260`).map((e,t)=>(0,M.jsx)(`p`,{className:L(t>0&&`mt-3`,!r&&`font-serif text-[15px]`),children:e},t))}),e.inquiry?(0,M.jsxs)(`div`,{className:`mt-1 max-w-[85%] rounded-2xl rounded-bl-md border border-primary/25 bg-primary/[0.06] p-3`,children:[(0,M.jsxs)(`p`,{className:`mb-2 flex items-center gap-1.5 font-mono text-xs uppercase tracking-wide text-primary`,children:[(0,M.jsx)(NS,{className:`size-3`}),` pending inquiry`]}),(0,M.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:e.inquiry.options.map(e=>{let r=n===e;return(0,M.jsxs)(`button`,{onClick:()=>t(e),className:L(`flex items-center gap-2 rounded-lg border px-3 py-2 text-left text-sm transition-colors`,r?`border-primary bg-primary/15 text-foreground`:`border-border bg-card hover:border-primary/50`),children:[(0,M.jsx)(`span`,{className:L(`flex size-4 shrink-0 items-center justify-center rounded-full border`,r?`border-primary bg-primary text-primary-foreground`:`border-border`),children:r?(0,M.jsx)(Cx,{className:`size-2.5`,strokeWidth:3}):null}),e]},e)})}),(0,M.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:e.inquiry.note})]}):null,e.trace?(0,M.jsx)(R9,{children:e.trace}):null]})}function Hhe(){let[e,t]=(0,_.useState)(Dhe),[n,r]=(0,_.useState)(``),[i,a]=(0,_.useState)(),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(!1),u=(0,_.useRef)(null);(0,_.useEffect)(()=>{u.current?.scrollIntoView({behavior:`smooth`})},[e.length,i]);let d=e=>{if(!e.trim())return;let n=new Date,i=`${n.getHours()}:${String(n.getMinutes()).padStart(2,`0`)}`,a={id:`u-${Date.now()}`,role:`user`,text:e,time:i},s={id:`x-${Date.now()}`,role:`xo`,text:o?`Got it â staying in this mode. Nothing acted on, nothing synthesised. Iâm just here.`:`Received. Filed, nothing lost. Iâll hold this and stay quiet unless it needs you.`,time:i,trace:o?`mode: ${o} · stance held · no strategy fired`:`stance: witness · captured to inbox · provenance stamped`};t(e=>[...e,a,s]),r(``)},f=e=>{a(e);let n=new Date,r=`${n.getHours()}:${String(n.getMinutes()).padStart(2,`0`)}`;t(t=>[...t,{id:`u-${Date.now()}`,role:`user`,text:e,time:r},{id:`x-${Date.now()}`,role:`xo`,text:`Thank you â that clarifies it. Iâll attach this to the question and let it inform how I show up around the client work. No push from here.`,time:r,trace:`inquiry q-247 answered · attached to client project + hard-conversations theme`}])};return(0,M.jsxs)(`div`,{className:`flex h-[calc(100svh-8rem)] flex-col gap-4 md:h-[calc(100svh-9rem)]`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h1`,{className:`font-serif text-2xl font-medium tracking-tight`,children:`Conversation`}),(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`The main door. Everything else is a view onto what happens here.`})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full bg-secondary px-3 py-1 text-xs text-secondary-foreground`,children:[(0,M.jsx)(`span`,{className:`size-1.5 rounded-full bg-chart-1`}),W9.nervousSystem]}),(0,M.jsx)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full bg-primary/15 px-3 py-1 text-xs font-medium text-primary`,children:W9.stance===`growth`?`Growth stance`:`Presence stance`})]})]}),o?(0,M.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-primary/25 bg-primary/[0.06] px-3 py-2 text-sm`,children:[(0,M.jsx)(NS,{className:`size-4 text-primary`}),(0,M.jsxs)(`span`,{className:`font-medium`,children:[o,` mode`]}),(0,M.jsx)(`span`,{className:`text-muted-foreground`,children:Z9.find(e=>e.name===o)?.desc}),(0,M.jsx)(`button`,{onClick:()=>s(null),className:`ml-auto text-xs text-muted-foreground hover:text-foreground`,children:`Leave mode`})]}):null,(0,M.jsx)(`div`,{className:`flex-1 overflow-y-auto rounded-xl border border-border bg-background/40 p-4`,children:(0,M.jsxs)(`div`,{className:`mx-auto flex max-w-2xl flex-col gap-4`,children:[e.map(e=>(0,M.jsx)(Vhe,{message:e,onPick:f,picked:i},e.id)),(0,M.jsx)(`div`,{ref:u})]})}),c?(0,M.jsxs)(`div`,{className:`rounded-xl border border-border bg-card p-3`,children:[(0,M.jsx)(`p`,{className:`mb-2 px-1 text-xs text-muted-foreground`,children:`Modes shape how XO listens. Pick one, or just talk.`}),(0,M.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2 lg:grid-cols-3`,children:Z9.map(e=>(0,M.jsxs)(`button`,{onClick:()=>{s(e.name),l(!1)},className:`flex flex-col gap-1 rounded-lg border border-border p-3 text-left transition-colors hover:border-primary/50`,children:[(0,M.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-medium`,children:[e.name,e.canonical?null:(0,M.jsx)(`span`,{className:`rounded bg-secondary px-1.5 py-1 text-xs text-muted-foreground`,children:`earned`})]}),(0,M.jsx)(`span`,{className:`text-xs leading-relaxed text-muted-foreground`,children:e.desc})]},e.id))})]}):null,(0,M.jsxs)(`div`,{className:`flex items-end gap-2 rounded-xl border border-border bg-card p-2`,children:[(0,M.jsx)(`button`,{onClick:()=>l(e=>!e),className:L(`flex size-10 shrink-0 items-center justify-center rounded-lg border border-border transition-colors hover:bg-accent`,c&&`bg-accent`),"aria-label":`Modes`,children:(0,M.jsx)(SS,{className:`size-5`})}),(0,M.jsx)(`textarea`,{value:n,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&e.keyCode!==229&&(e.preventDefault(),d(n))},rows:1,placeholder:`Talk to XO. Brain-dump, vent, or just think out loudâ¦`,className:`max-h-32 flex-1 resize-none bg-transparent px-2 py-2.5 text-sm outline-none placeholder:text-muted-foreground`}),(0,M.jsx)(`button`,{className:`flex size-10 shrink-0 items-center justify-center rounded-lg border border-border hover:bg-accent`,"aria-label":`Voice`,children:(0,M.jsx)(pS,{className:`size-5`})}),(0,M.jsx)(`button`,{onClick:()=>d(n),className:`flex size-10 shrink-0 items-center justify-center rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-40`,disabled:!n.trim(),"aria-label":`Send`,children:(0,M.jsx)(ES,{className:`size-5`})})]})]})}var Uhe={moving:{label:`Moving`,icon:_x,tone:`text-chart-1`},stale:{label:`Gone quiet`,icon:yS,tone:`text-muted-foreground`},blocked:{label:`Blocked (not on you)`,icon:Dx,tone:`text-primary`},"complete-ready":{label:`Ready to close`,icon:Ox,tone:`text-chart-1`}};function Whe(){return(0,M.jsxs)(`div`,{className:`flex flex-col gap-10`,children:[(0,M.jsx)(B9,{kicker:`Reflection dashboard`,title:`How y
260our life is actually trending`,sub:`Not metrics for their own sake. Honest reads on the areas that matter, every claim traceable to what you actually said and did. Drift is noted, never scolded.`}),(0,M.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,M.jsx)(V9,{hint:`six life areas · rolling 12 weeks`,children:`Areas of responsibility`}),(0,M.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:G9.map(e=>(0,M.jsxs)(H9,{className:`flex flex-col gap-3`,children:[(0,M.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h3`,{className:`font-serif text-lg font-medium`,children:e.name}),(0,M.jsx)(`div`,{className:`mt-1`,children:(0,M.jsx)(z9,{tone:e.status})})]}),(0,M.jsx)(dhe,{points:e.spark,className:L(e.status===`thriving`&&`text-chart-1`,e.status===`drifting`&&`text-primary`,e.status===`healthy`&&`text-muted-foreground`)})]}),(0,M.jsx)(`p`,{className:`text-sm leading-relaxed text-pretty`,children:e.read}),(0,M.jsx)(R9,{children:e.signal})]},e.id))})]}),(0,M.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,M.jsx)(V9,{hint:`what has moved, stalled, or is ready to close`,children:`Projects in motion`}),(0,M.jsx)(H9,{className:`p-0`,children:(0,M.jsx)(`div`,{className:`divide-y divide-border`,children:K9.map(e=>{let t=Uhe[e.movement],n=t.icon;return(0,M.jsxs)(`div`,{className:`flex items-start gap-4 p-4`,children:[(0,M.jsx)(n,{className:L(`mt-0.5 size-4 shrink-0`,t.tone)}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2 gap-y-0.5`,children:[(0,M.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,M.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`· `,e.area]})]}),(0,M.jsx)(`p`,{className:`mt-0.5 text-sm text-muted-foreground text-pretty`,children:e.note})]}),(0,M.jsxs)(`div`,{className:`hidden shrink-0 flex-col items-end gap-1 sm:flex`,children:[(0,M.jsx)(`span`,{className:L(`text-xs font-medium`,t.tone),children:t.label}),(0,M.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`touched `,e.lastTouched]})]})]},e.id)})})})]}),(0,M.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,M.jsx)(V9,{hint:`counter-evidence against beliefs you have named`,children:`Banked against the old stories`}),(0,M.jsx)(`div`,{className:`grid gap-3 lg:grid-cols-3`,children:q9.map(e=>(0,M.jsxs)(H9,{className:L(`flex flex-col gap-3`,e.thresholdNear&&`border-chart-1/40 bg-chart-1/[0.05]`),children:[(0,M.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,M.jsx)(AS,{className:L(`size-4 shrink-0`,e.thresholdNear?`text-chart-1`:`text-muted-foreground`)}),(0,M.jsxs)(`span`,{className:`rounded-full bg-secondary px-2 py-1 text-xs text-secondary-foreground`,children:[e.count,` banked`]})]}),(0,M.jsx)(`p`,{className:`font-serif text-base leading-snug text-pretty`,children:e.belief}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.firstNamed}),(0,M.jsx)(`div`,{className:`flex flex-col gap-2 border-t border-border pt-3`,children:e.recent.map((e,t)=>(0,M.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,M.jsx)(`p`,{className:`text-xs leading-relaxed text-pretty`,children:e.text}),(0,M.jsx)(R9,{children:e.source})]},t))}),e.thresholdNear?(0,M.jsx)(`p`,{className:`text-xs font-medium text-chart-1`,children:`Near threshold â XO is waiting for the right moment to reflect this back.`}):null]},e.id))})]}),(0,M.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,M.jsx)(V9,{hint:`named because it is true, not to flatter`,children:`What is quietly thriving`}),(0,M.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:phe.map(e=>(0,M.jsxs)(H9,{className:`flex items-start gap-3`,children:[(0,M.jsx)(Yx,{className:`mt-0.5 size-4 shrink-0 text-primary`,fill:`currentColor`}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(`p`,{className:`text-sm leading-relaxed text-pretty`,children:e.text}),(0,M.jsx)(R9,{children:e.source})]})]},e.id))})]})]})}var Ghe={installing:{label:`Installing`,tone:`bg-primary/15 text-primary`},testing:{label:`Testing`,tone:`bg-secondary text-secondary-foreground`},wired:{label:`Wired`,tone:`bg-chart-1/15 text-chart-1`}};function Khe(){return(0,M.jsxs)(`div`,{className:`flex flex-col gap-10`,children:[(0,M.jsx)(B9,{kicker:`Life dashboard`,title:`From the far horizon down to today`,sub:`Vision gives direction; habits do the walking. Everything connects â but nothing here is a cage. You can edit, pause, or release any level, any time.`}),(0,M.jsxs)(H9,{className:`border-primary/25 bg-primary/[0.06]`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2 text-primary`,children:[(0,M.jsx)(Ix,{className:`size-4`}),(0,M.jsxs)(`span`,{className:`font-mono text-xs uppercase tracking-[0.18em]`,children:[`Vision · `,J9.horizon]})]}),(0,M.jsx)(`p`,{className:`mt-3 font-serif text-2xl leading-snug text-balance md:text-3xl`,children:J9.title}),(0,M.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,M.jsx)(R9,{children:J9.authored}),(0,M.jsxs)(`button`,{className:`inline-flex items-center gap-1.5 text-xs font-medium text-primary hover:underline`,children:[(0,M.jsx)(xS,{className:`size-3.5`}),` Revisit`]})]})]}),(0,M.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,M.jsx)(V9,{hint:`aspirations set the identity · goals make it measurable`,children:`Aspirations & goals`}),(0,M.jsx)(`div`,{className:`flex flex-col gap-3`,children:mhe.map(e=>(0,M.jsxs)(H9,{className:`flex flex-col gap-4`,children:[(0,M.jsx)(`div`,{className:`flex items-start justify-between gap-3`,children:(0,M.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,M.jsx)(FS,{className:`mt-0.5 size-4 shrink-0 text-primary`}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h3`,{className:`font-serif text-lg font-medium leading-snug`,children:e.title}),(0,M.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`horizon: `,e.horizon]})]})]})}),(0,M.jsx)(`div`,{className:`flex flex-col gap-3 border-t border-border pt-3 pl-7`,children:e.goals.map(e=>(0,M.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,M.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,M.jsx)(`span`,{className:`text-sm font-medium`,children:e.title}),(0,M.jsxs)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:[e.progress,`%`]})]}),(0,M.jsx)(uJ,{value:e.progress,className:`h-1.5`}),(0,M.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.measure})]},e.id))})]},e.id))})]}),(0,M.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,M.jsx)(V9,{hint:`every fired habit is a vote for who you are`,children:`Identities forming`}),(0,M.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:_he.map(e=>(0,M.jsxs)(H9,{className:`flex items-center gap-4`,children:[(0,M.jsx)(Wx,{className:`size-5 shrink-0 text-primary`}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsx)(`p`,{className:`font-serif text-base leading-snug text-pretty`,children:e.statement}),(0,M.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:e.habits.join(`, `)})]}),(0,M.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end`,children:[(0,M.jsx)(`span`,{className:`font-mono text-lg text-primary`,children:e.votes}),(0,M.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`votes cast`})]})]},e.id))})]}),(0,M.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,M.jsx)(V9,{hint:`the 21-day batch, then a real choice`,children:`Habits in flight`}),(0,M.jsxs)(H9,{className:`border-primary/25 bg-primary/[0.05]`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(wS,{className:`size-4 text-primary`}),(0,M.jsxs)(`span`,{className:`text-sm font-medium`,children:[`Current cycle · day `,Y9.day,` of `,Y9.of]})]}),(0,M.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Y9.batch.join(` · `)})]}),(0,M.jsx)(uJ,{value:Y9.day/Y9.of*100,className:`mt-3 h-1.5`}),(0,M.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:Y9.day22})]}),(0,M.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:hhe.map(e=>{let t=Ghe[e.phase];return(0,M.jsxs)(H9,{className:`flex flex-col gap-2`,children:[(0,M.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,M.jsx)(`span`,{className:`font-medium`,children:e.title}),(0,M.jsx)(`span`,{className:L(`rounded-full px-2 py-1 text-xs font-medium`,t.tone),children:t.label})]}),(0,M.jsx)(`p`,{className:`text-xs italic text-muted-foreground`,children:e.identity}),(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground`,children:[(0,M.jsxs)(`span`,{children:[`anchor: `,e.anchor]}),(0,M.jsx)(`span`,{children:`·`}),(0,M.jsxs)(`span`,{children:[`last fired `,e.lastFired]}),e.day?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`span`,{children:`·`}),(0,M.jsx)(`span`,{className:`text-primary`,children:e.day})]}):null]})]},e.id)})})]}),(0,M.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-2`,children:[(0,M.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,M.jsx)(V9,{children:`Already strong`}),(0,M.jsxs)(H9,{className:`flex flex-col gap-3`,children:[ghe.map(e=>(0,M.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,M.jsx)(Ox,{className:`mt-0.5 size-4 shrink-0 text-chart-1`}),(0,M.jsx)(`p`,{className:`text-sm leading-relaxed text-pretty`,children:e.text})]},e.id)),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`XO points these out so you build on strength, not just patch weakness.`})]})]}),(0,M.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,M.jsx)(V9,{hint:`released without shame`,children:`History`}),(0,M.jsx)(H9,{className:`flex flex-col gap-3`,children:vhe.map(e=>(0,M.jsxs)(`div`,{className:`flex flex-col gap-1 border-b border-border/60 pb-3 last:border-0 last:pb-0`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`text-sm font-medium`,children:e.title}),(0,M.jsx)(`span`,{className:`rounded bg-secondary px-1.5 py-1 text-xs capitalize text-muted-foreground`,children:e.outcome})]}),(0,M.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground text-pretty`,children:e.story})]},e.id))})]})]})]})}var qhe={text:{icon:bS,label:`Text`},voice:{icon:pS,label:`Voice`},"chat-extract":{icon:dS,label:`From chat`}};function Jhe({item:e}){let t=qhe[e.kind],n=t.icon,[r,i]=(0,_.useState)(e.status===`filed`);return(0,M.jsxs)(H9,{className:`flex flex-col gap-3`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,M.jsx)(n,{className:`size-3.5`}),` `,t.label]}),(0,M.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:e.captured})]}),(0,M.jsx)(`p`,{className:`text-sm leading-relaxed text-pretty`,children:e.preview}),(0,M.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.tags.map(e=>(0,M.jsx)(`span`,{className:`rounded-full bg-secondary px-2 py-1 text-xs text-secondary-foreground`,children:e},e))}),e.suggestion?(0,M.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg border border-primary/20 bg-primary/[0.05] p-3`,children:[(0,M.jsxs)(`p`,{className:`flex items-center gap-1.5 text-xs text-primary`,children:[(0,M.jsx)(NS,{className:`size-3.5`}),` XO suggests`]}),(0,M.jsx)(`p`,{className:`text-sm`,children:e.suggestion}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsxs)(`button`,{onClick:()=>i(!0),className:L(`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1 text-xs font-medium transition-colors`,r?`bg-chart-1/15 text-chart-1`:`bg-primary text-primary-foreground hover:bg-primary/90`),children:[r?`Filed`:`Accept`,` `,(0,M.jsx)(gx,{className:`size-3`})]}),(0,M.jsx)(`button`,{className:`rounded-lg px-2.5 py-1 text-xs text-muted-foreground hover:bg-accent`,children:`Not quite`})]})]}):null,(0,M.jsx)(R9,{children:`originals preserved · marked data, not instructions`})]})}function Yhe(){let[e,t]=(0,_.useState)(`text`),n=X9.filter(e=>e.status!==`filed`).length;return(0,M.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,M.jsx)(B9,{kicker:`Capture · Inbox`,title:`Catch it now, sort it never`,sub:`The one job here is friction-free capture. Get the thought out of your head; XO files it, links it, and keeps the original untouched. You never have to organise unless you want to.`}),(0,M.jsxs)(H9,{className:`flex flex-col gap-4`,children:[(0,M.jsxs)(`div`,{className:`flex gap-2`,children:[(0,M.jsxs)(`button`,{onClick:()=>t(`text`),className:L(`inline-flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-sm transition-colors`,e===`text`?`bg-primary text-primary-foreground`:`text-muted-foreground hover:bg-accent`),children:[(0,M.jsx)(bS,{className:`size-4`}),` Text`]}),(0,M.jsxs)(`button`,{onClick:()=>t(`voice`),className:L(`inline-flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-sm transition-colors`,e===`voice`?`bg-primary text-primary-foreground`:`text-muted-foreground hover:bg-accent`),children:[(0,M.jsx)(pS,{className:`size-4`}
260),` Voice`]})]}),e===`text`?(0,M.jsx)(`textarea`,{rows:4,placeholder:`Type anything. A worry, an idea, a task, a whole tangled brain-dump. It all lands safely.`,className:`w-full resize-none rounded-lg border border-border bg-background/50 p-3 text-sm outline-none placeholder:text-muted-foreground focus:border-primary/50`}):(0,M.jsxs)(`div`,{className:`flex flex-col items-center gap-3 rounded-lg border border-dashed border-border bg-background/50 py-10`,children:[(0,M.jsx)(`button`,{className:`flex size-16 items-center justify-center rounded-full bg-primary text-primary-foreground transition-transform hover:scale-105`,children:(0,M.jsx)(pS,{className:`size-7`})}),(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Tap to record · transcribed automatically`})]}),(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsx)(R9,{children:`captured offline-first · syncs when you reconnect`}),(0,M.jsxs)(`button`,{className:`inline-flex items-center gap-1.5 rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90`,children:[`Capture `,(0,M.jsx)(gx,{className:`size-4`})]})]})]}),(0,M.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,M.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,M.jsx)(`h2`,{className:`font-serif text-lg font-medium`,children:`Inbox`}),(0,M.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[n,` waiting · `,X9.length-n,` auto-filed`]})]}),(0,M.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:X9.map(e=>(0,M.jsx)(Jhe,{item:e},e.id))}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-border bg-card/60 p-3 text-xs text-muted-foreground`,children:[(0,M.jsx)(Hx,{className:`size-4 shrink-0`}),`XO processes captures with a light touch â extracting tasks, spotting people and products, suggesting a home. Nothing is deleted, nothing is acted on without you.`]})]})]})}var Xhe=[{key:`projects`,label:`Projects`,icon:FS,hint:`active, with an outcome`},{key:`areas`,label:`Areas`,icon:FS,hint:`standards to uphold`},{key:`resources`,label:`Resources`,icon:yx,hint:`topics of interest`},{key:`archive`,label:`Archive`,icon:px,hint:`done, kept`}];function Zhe(){let[e,t]=(0,_.useState)(`projects`);return(0,M.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,M.jsx)(B9,{kicker:`Library · Second brain`,title:`Everything you know, kept in PARA`,sub:`Projects, Areas, Resources, Archive. XO files by default so retrieval is effortless â but the structure is yours to bend. Search reaches every note, memo, and extracted thought.`}),(0,M.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl border border-border bg-card px-4 py-3`,children:[(0,M.jsx)(TS,{className:`size-4 text-muted-foreground`}),(0,M.jsx)(`input`,{className:`flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground`,placeholder:`Search across everything â semantic, not just keywordsâ¦`}),(0,M.jsx)(`span`,{className:`hidden font-mono text-xs text-muted-foreground sm:inline`,children:`216 notes`})]}),(0,M.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Xhe.map(n=>{let r=n.icon;return(0,M.jsxs)(`button`,{onClick:()=>t(n.key),className:L(`flex items-center gap-2 rounded-lg border px-3 py-2 text-sm transition-colors`,e===n.key?`border-primary bg-primary/10 text-foreground`:`border-border text-muted-foreground hover:bg-accent`),children:[(0,M.jsx)(r,{className:`size-4`}),(0,M.jsx)(`span`,{className:`font-medium`,children:n.label}),(0,M.jsxs)(`span`,{className:`hidden text-xs text-muted-foreground sm:inline`,children:[`· `,n.hint]})]},n.key)})}),e===`projects`?(0,M.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:K9.map(e=>(0,M.jsxs)(H9,{className:`flex items-start gap-3`,children:[(0,M.jsx)(qx,{className:`mt-0.5 size-4 shrink-0 text-primary`}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,M.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,M.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`· `,e.area]})]}),(0,M.jsx)(`p`,{className:`mt-0.5 text-sm text-muted-foreground text-pretty`,children:e.note})]})]},e.id))}):null,e===`areas`?(0,M.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:yhe.map(e=>(0,M.jsxs)(H9,{className:`flex flex-col gap-1`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,M.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:e.notes})]}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground text-pretty`,children:e.standard})]},e.id))}):null,e===`resources`?(0,M.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:bhe.map(e=>(0,M.jsxs)(H9,{className:`flex items-center justify-between`,children:[(0,M.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-medium`,children:[(0,M.jsx)(yx,{className:`size-4 text-primary`}),` `,e.name]}),(0,M.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:e.notes})]},e.id))}):null,e===`archive`?(0,M.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:She.map(e=>(0,M.jsxs)(H9,{className:`flex items-center justify-between opacity-80`,children:[(0,M.jsxs)(`span`,{className:`flex items-center gap-2 text-sm`,children:[(0,M.jsx)(px,{className:`size-4 text-muted-foreground`}),` `,e.name]}),(0,M.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:e.items})]},e.id))}):null,(0,M.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,M.jsx)(V9,{hint:`most recently touched`,children:`Recent notes`}),(0,M.jsx)(H9,{className:`p-0`,children:(0,M.jsx)(`div`,{className:`divi
260de-y divide-border`,children:xhe.map(e=>(0,M.jsxs)(`button`,{className:`flex w-full items-start gap-3 p-4 text-left transition-colors hover:bg-accent/40`,children:[(0,M.jsx)(Hx,{className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2`,children:[(0,M.jsx)(`span`,{className:`font-medium`,children:e.title}),(0,M.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`· `,e.where]})]}),(0,M.jsx)(`p`,{className:`mt-0.5 truncate text-sm text-muted-foreground`,children:e.excerpt})]}),(0,M.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:e.when})]},e.id))})})]})]})}function Qhe({title:e,meta:t,right:n}){let[r,i]=(0,_.useState)(!1);return(0,M.jsxs)(`div`,{className:`flex items-center gap-3 p-3`,children:[(0,M.jsx)(`button`,{onClick:()=>i(e=>!e),className:L(`flex size-5 shrink-0 items-center justify-center rounded-full border transition-colors`,r?`border-primary bg-primary text-primary-foreground`:`border-border hover:border-primary/60`),"aria-label":r?`Undo`:`Complete`,children:r?(0,M.jsx)(Cx,{className:`size-3`,strokeWidth:3}):null}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsx)(`p`,{className:L(`text-sm`,r&&`text-muted-foreground line-through`),children:e}),t?(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t}):null]}),n?(0,M.jsx)(`span`,{className:L(`shrink-0 rounded-full px-2 py-1 text-xs`,n===`today`?`bg-primary/15 text-primary`:`bg-secondary text-secondary-foreground`),children:n}):null]})}function $he(){return(0,M.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,M.jsx)(B9,{kicker:`Actions · GTD`,title:`The next physical, visible thing`,sub:`Getting Things Done, quietly enforced. Next actions live here so your projects always have a doorway. Waiting-fors, someday/maybe, and the tickler keep the rest off your mind.`}),(0,M.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-2`,children:[(0,M.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,M.jsx)(V9,{hint:`one clear step per project`,children:(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,M.jsx)(Cx,{className:`size-4 text-primary`}),` Next actions`]})}),(0,M.jsx)(H9,{className:`p-0`,children:(0,M.jsx)(`div`,{className:`divide-y divide-border`,children:Che.map(e=>(0,M.jsx)(Qhe,{title:e.title,meta:`${e.project} · ${e.context}`,right:e.due??void 0},e.id))})})]}),(0,M.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,M.jsx)(V9,{hint:`tracked, so you can let go`,children:(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,M.jsx)(Mx,{className:`size-4 text-primary`}),` Waiting for`]})}),(0,M.jsx)(H9,{className:`p-0`,children:(0,M.jsx)(`div`,{className:`divide-y divide-border`,children:whe.map(e=>(0,M.jsxs)(`div`,{className:`flex items-start gap-3 p-3`,children:[(0,M.jsx)(Xx,{className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsx)(`p`,{className:`text-sm`,children:e.title}),(0,M.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`from `,e.from]})]}),(0,M.jsxs)(`span`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:[`since `,e.since]})]},e.id))})}),(0,M.jsx)(R9,{children:`XO chases nothing without your say-so`})]}),(0,M.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,M.jsx)(V9,{hint:`no pressure, no guilt`,children:(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,M.jsx)(Fx,{className:`size-4 text-primary`}),` Someday / maybe`]})}),(0,M.jsx)(H9,{className:`flex flex-wrap gap-2`,children:The.map(e=>(0,M.jsx)(`span`,{className:`rounded-full border border-border bg-secondary/50 px-3 py-1.5 text-sm text-secondary-foreground`,children:e.title},e.id))})]}),(0,M.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,M.jsx)(V9,{hint:`surfaces itself at the right time`,children:(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,M.jsx)(xx,{className:`size-4 text-primary`}),` Tickler`]})}),(0,M.jsx)(H9,{className:`p-0`,children:(0,M.jsx)(`div`,{className:`divi
260de-y divide-border`,children:Ehe.map(e=>(0,M.jsxs)(`div`,{className:`flex items-center gap-3 p-3`,children:[(0,M.jsx)(xx,{className:`size-4 shrink-0 text-muted-foreground`}),(0,M.jsx)(`p`,{className:`flex-1 text-sm`,children:e.title}),(0,M.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-primary`,children:e.when})]},e.id))})})]})]})]})}var ege={active:{label:`Active`,tone:`bg-chart-1/15 text-chart-1`},warm:{label:`Warm`,tone:`bg-primary/15 text-primary`},cool:{label:`Cool`,tone:`bg-secondary text-muted-foreground`}},tge={active:{label:`Watching`,tone:`text-chart-1`},"pending-inquiry":{label:`Pending inquiry`,tone:`text-primary`},"resolved-watching":{label:`Resolved · still watching`,tone:`text-muted-foreground`},retired:{label:`Retired`,tone:`text-muted-foreground`}},nge=[{key:`strategies`,label:`Strategies`,icon:$x},{key:`questions`,label:`Question pool`,icon:kx},{key:`silence`,label:`Silence log`,icon:Bx},{key:`actions`,label:`Action log`,icon:Ox}];function rge(){let[e,t]=(0,_.useState)(`strategies`);return(0,M.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,M.jsx)(B9,{kicker:`The Council · Transparency`,title:`Everything XO is doing, and choosing not to do`,sub:`Under the calm surface, many small strategies deliberate. This is the glass floor: which are awake, what questions they hold, and â just as important â every time XO stayed silent on purpose.`}),(0,M.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:nge.map(n=>{let r=n.icon;return(0,M.jsxs)(`button`,{onClick:()=>t(n.key),className:L(`flex items-center gap-2 rounded-lg border px-3 py-2 text-sm transition-colors`,e===n.key?`border-primary bg-primary/10 text-foreground`:`border-border text-muted-foreground hover:bg-accent`),children:[(0,M.jsx)(r,{className:`size-4`}),(0,M.jsx)(`span`,{className:`font-medium`,children:n.label})]},n.key)})}),e===`strategies`?(0,M.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[Ohe.map(e=>{let t=ege[e.state];return(0,M.jsxs)(H9,{className:`flex flex-col gap-2`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,M.jsx)(`span`,{className:L(`rounded-full px-2 py-1 text-xs font-medium`,t.tone),children:t.label}),(0,M.jsx)(`span`,{className:`rounded-full bg-secondary px-2 py-1 text-xs capitalize text-muted-foreground`,children:e.stance}),(0,M.jsxs)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:[`cost: `,e.cost]})]}),(0,M.jsx)(`p`,{className:`text-sm leading-relaxed text-muted-foreground text-pretty`,children:e.desc}),(0,M.jsxs)(R9,{children:[`consent: `,e.consent]})]},e.id)}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Under attention pressure, heavier strategies shed first. Witnessing is the floor and never sheds until everything else has gone quiet.`})]}):null,e===`questions`?(0,M.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[khe.map(e=>{let t=tge[e.state];return(0,M.jsxs)(H9,{className:`flex flex-col gap-2`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:e.id}),(0,M.jsx)(`span`,{className:L(`text-xs font-medium`,t.tone),children:t.label}),(0,M.jsxs)(`span`,{className:`ml-auto rounded-full bg-secondary px-2 py-1 text-xs text-muted-foreground`,children:[`by `,e.author]})]}),(0,M.jsx)(`p`,{className:`font-serif text-base leading-snug text-pretty`,children:e.text}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-1 text-xs text-muted-foreground`,children:[(0,M.jsxs)(`span`,{children:[`attaches to: `,e.attachment]}),(0,M.jsxs)(`span`,{children:[`wakes when: `,e.wake]})]})]},e.id)}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Questions persist. They wait for the right condition â a semantic match, a threshold, a scheduled moment â rather than firing on sight.`})]}):null,e===`silence`?(0,M.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,M.jsx)(H9,{className:`border-primary/20 bg-primary/[0.04]`,children:(0,M.jsx)(`p`,{className:`text-sm leading-relaxed text-pretty`,children:`Silence is a real output, logged like any other. When XO had something to say and held it, the reason is recorded here â so restraint is accountable, not invisible.`})}),Ahe.map(e=>(0,M.jsxs)(H9,{className:`flex items-start gap-3`,children:[(0,M.jsx)(Bx,{className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,M.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,M.jsxs)(`span`,{className:`text-sm font-medium`,children:[`Withheld: `,e.withheld]})}),(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground text-pretty`,children:e.reason}),(0,M.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:e.when})]})]},e.id))]}):null,e===`actions`?(0,M.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[jhe.map(e=>(0,M.jsxs)(H9,{className:`flex items-start gap-3`,children:[e.status===`done`?(0,M.jsx)(Ox,{className:`mt-0.5 size-4 shrink-0 text-chart-1`}):(0,M.jsx)(jx,{className:`mt-0.5 size-4 shrink-0 text-primary`}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,M.jsx)(`span`,{className:`text-sm font-medium`,children:e.action}),(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground text-pretty`,children:e.reasoning}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:e.when}),(0,M.jsx)(`span`,{className:L(`rounded-full px-2 py-1 text-xs`,e.status===`done`?`bg-chart-1/15 text-chart-1`:`bg-primary/15 text-primary`),children:e.status===`done`?`done`:`awaiting your confirm`})]})]})]},e.id)),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`XO never acts silently on anything irreversible. Confirmations are requested; reasoning is always shown.`})]}):null]})}function ige(){return(0,M.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,M.jsx)(B9,{kicker:`People`,title:`The ones you hold`,sub:`XO notices who appears in your captures and how often. Not a CRM â a gentle memory for the relationships that matter, including the tender threads you would not want to forget.`}),(0,M.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:Mhe.map(e=>(0,M.jsxs)(H9,{className:`flex flex-col gap-3`,children:[(0,M.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,M.jsx)(`div`,{className:L(`flex size-11 shrink-0 items-center justify-center rounded-full font-serif text-lg`,e.status===`quiet`?`bg-secondary text-muted-foreground`:`bg-primary/15 text-primary`),children:e.name[0]}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[(0,M.jsx)(`span`,{className:`font-serif text-lg font-medium`,children:e.name}),(0,M.jsx)(z9,{tone:e.status===`warm`?`thriving`:e.status})]}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.relation})]})]}),(0,M.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[(0,M.jsxs)(`span`,{children:[`last mentioned `,e.lastMention]}),(0,M.jsxs)(`span`,{children:[`cadence: `,e.cadence]})]}),(0,M.jsx)(`div`,{className:`flex flex-col gap-1.5 border-t border-border pt-3`,children:e.threads.map((e,t)=>(0,M.jsxs)(`p`,{className:`text-sm text-pretty`,children:[`· `,e]},t))}),e.tender?(0,M.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-primary/20 bg-primary/[0.05] p-3`,children:[(0,M.jsx)(Yx,{className:`mt-0.5 size-3.5 shrink-0 text-primary`,fill:`currentColor`}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,M.jsx)(`p`,{className:`text-sm text-pretty`,children:e.tender}),(0,M.jsx)(R9,{children:`held gently · observation, not diagnosis`})]})]}):null]},e.id))}),(0,M.jsx)(H9,{className:`text-xs leading-relaxed text-muted-foreground`,children:`XO surfaces absence carefully. When someone who usually appears goes quiet, it may offer a gentle noticing â never an alarm, never a guilt trip, and only when your own state can receive it.`})]})}var age=[`Health`,`Music`,`Work`,`Relationships`],oge={floor:{label:`Floor · always on`,tone
260:`text-muted-foreground`,locked:!0},"default-on":{label:`Default on`,tone:`text-chart-1`,locked:!1},consent:{label:`Consent-gated`,tone:`text-primary`,locked:!1}};function sge({row:e}){let[t,n]=(0,_.useState)(e.areas),r=oge[e.band];return(0,M.jsxs)(H9,{className:`flex flex-col gap-3`,children:[(0,M.jsx)(`div`,{className:`flex items-start justify-between gap-3`,children:(0,M.jsxs)(`div`,{className:`flex items-start gap-2`,children:[r.locked?(0,M.jsx)(aS,{className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}):(0,M.jsx)(jS,{className:`mt-0.5 size-4 shrink-0 text-primary`}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`p`,{className:`font-medium`,children:e.strategy}),(0,M.jsx)(`p`,{className:L(`text-xs font-medium`,r.tone),children:r.label})]})]})}),(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground text-pretty`,children:e.note}),(0,M.jsx)(`div`,{className:`grid grid-cols-2 gap-2 border-t border-border pt-3 sm:grid-cols-4`,children:age.map(e=>{let i=t[e];return(0,M.jsxs)(`button`,{disabled:r.locked,onClick:()=>n(t=>({...t,[e]:!t[e]})),className:L(`flex items-center justify-between rounded-lg border px-3 py-2 text-xs transition-colors`,i?`border-primary/40 bg-primary/10 text-foreground`:`border-border text-muted-foreground`,r.locked?`cursor-not-allowed opacity-80`:`hover:border-primary/60`),children:[e,(0,M.jsx)(`span`,{className:L(`flex size-4 items-center justify-center rounded-full border`,i?`border-primary bg-primary text-primary-foreground`:`border-border`),children:i?(0,M.jsx)(Cx,{className:`size-2.5`,strokeWidth:3}):null})]},e)})})]})}function cge(){let[e,t]=(0,_.useState)(!0);return(0,M.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,M.jsx)(B9,{kicker:`Consent`,title:`What you allow, and where`,sub:`Trust is the whole product. Every strategy above the floor is opt-in, per life area, and reversible in one tap. XO will tell you once what turning something off costs â then it respects your choice, fully.`}),(0,M.jsxs)(H9,{className:`flex items-center justify-between gap-4 border-primary/25 bg-primary/[0.06]`,children:[(0,M.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,M.jsx)(jS,{className:`mt-0.5 size-5 text-primary`}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`p`,{className:`font-medium`,children:`The augmentation`}),(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground text-pretty`,children:`With this on, XO reflects, notices, and gently reaches. Turn it down and you keep a fully working, silent second brain â capture, PARA, and search, with no initiative.`})]})]}),(0,M.jsx)(yJ,{checked:e,onCheckedChange:t})]}),(0,M.jsxs)(`section`,{className:L(`flex flex-col gap-4`,!e&&`opacity-50`),children:[(0,M.jsx)(V9,{hint:`per strategy · per life area`,children:`Strategy consent`}),(0,M.jsx)(`div`,{className:`flex flex-col gap-3`,children:Nhe.map(e=>(0,M.jsx)(sge,{row:e},e.strategy))})]}),(0,M.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,M.jsx)(V9,{hint:`proposed, then authorised by you`,children:`Earned behaviours`}),(0,M.jsx)(H9,{className:`p-0`,children:(0,M.jsx)(`div`,{className:`divide-y divide-border`,children:Phe.map(e=>(0,M.jsxs)(`div`,{className:`flex items-center gap-3 p-4`,children:[(0,M.jsx)(`div`,{className:L(`size-2 shrink-0 rounded-full`,e.active?`bg-chart-1`:`bg-muted-foreground/40`)}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsx)(`p`,{className:`text-sm`,children:e.name}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.granted})]}),(0,M.jsx)(`span`,{className:L(`shrink-0 rounded-full px-2 py-1 text-xs`,e.active?`bg-chart-1/15 text-chart-1`:`bg-secondary text-muted-foreground`),children:e.active?`active`:`pending your yes`})]},e.id))})}),(0,M.jsx)(R9,{children:`every proactive behaviour is earned, never assumed · dysregulation always overrides`})]}),(0,M.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,M.jsx)(V9,{hint:`yours to read, correct, or blank`,children:`Memory`}),(0,M.jsxs)(H9,{className:`flex flex-col gap-4`,children:[(0,M.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,M.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,M.jsx)(yx,{className:`mt-0.5 size-4 shrink-0 text-primary`}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`p`,{className:`font-medium`,children:`What XO carries between sessions`}),(0,M.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Updated `,Q9.updated]})]})]}),(0,M.jsxs)(`button`,{className:`flex items-center gap-1.5 rounded-lg border border-border px-3 py-1.5 text-xs text-muted-foreground transition-colors hover:border-primary/50 hover:text-foreground`,"aria-label":`Edit memory`,children:[(0,M.jsx)(xS,{className:`size-3`}),` Edit`]})]}),(0,M.jsx)(`pre`,{className:`max-h-64 overflow-y-auto rounded-lg bg-secondary/40 p-4 font-mono text-xs leading-relaxed whitespace-pre-wrap text-muted-foreground`,children:Q9.excerpt}),(0,M.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,M.jsx)(`div`,{className:`h-1.5 flex-1 overflow-hidden rounded-full bg-secondary`,children:(0,M.jsx)(`div`,{className:`h-full rounded-full bg-primary/60`,style:{width:`${Q9.budgetUsed/Q9.budgetMax*100}%`}})}),(0,M.jsxs)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:[Q9.budgetUsed.toLocaleStr
260ing(),` / `,Q9.budgetMax.toLocaleString()]})]}),(0,M.jsx)(R9,{children:`capped on purpose â curation over accumulation · one document, whole-rewritten each distillation`})]})]}),(0,M.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,M.jsx)(V9,{hint:`one brain, one memory, every door`,children:`Surfaces`}),(0,M.jsx)(H9,{className:`p-0`,children:(0,M.jsx)(`div`,{className:`divide-y divide-border`,children:Fhe.map(e=>(0,M.jsxs)(`div`,{className:`flex items-center gap-3 p-4`,children:[(0,M.jsx)(CS,{className:L(`size-4 shrink-0`,e.live?`text-chart-1`:`text-muted-foreground/50`)}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsx)(`p`,{className:`text-sm`,children:e.name}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.detail})]}),(0,M.jsx)(`span`,{className:L(`shrink-0 rounded-full px-2 py-1 text-xs`,e.live?`bg-chart-1/15 text-chart-1`:`bg-secondary text-muted-foreground`),children:e.live?`live`:`designed`})]},e.id))})})]})]})}var lge=[{key:`home`,label:`Today`,icon:PS},{key:`chat`,label:`Chat`,icon:fS},{key:`capture`,label:`Capture`,icon:Xx}],uge=[{key:`reflection`,label:`Reflection`,icon:Ix},{key:`life`,label:`Life`,icon:NS},{key:`people`,label:`People`,icon:zS}],dge=[{key:`library`,label:`Library`,icon:eS},{key:`actions`,label:`Actions`,icon:nS},{key:`council`,label:`Council`,icon:Qx},{key:`settings`,label:`Consent`,icon:DS}],fge={home:zhe,chat:Hhe,reflection:Whe,life:Khe,capture:Yhe,library:Zhe,actions:$he,council:rge,people:ige,settings:cge};function $9({label:e,items:t,current:n,go:r}){return(0,M.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,M.jsx)(`p`,{className:`px-3 py-1.5 text-xs font-medium tracking-wide text-muted-foreground/70`,children:e}),t.map(e=>{let t=e.icon,i=n===e.key;return(0,M.jsxs)(`button`,{onClick:()=>r(e.key),className:L(`group flex items-center gap-3 rounded-lg px-3 py-2 text-left text-sm transition-colors`,i?`bg-sidebar-accent text-sidebar-accent-foreground`:`text-sidebar-foreground/70 hover:bg-sidebar-accent/50 hover:text-sidebar-foreground`),children:[(0,M.jsx)(t,{className:L(`size-4 shrink-0`,i?`text-primary`:`text-muted-foreground`),strokeWidth:1.75}),(0,M.jsx)(`span`,{className:`flex-1 font-medium`,children:e.label}),i?(0,M.jsx)(`span`,{className:`size-1.5 rounded-full bg-primary`,"aria-hidden":!0}):null]},e.key)})]})}function pge(){let[e,t]=(0,_.useState)(`home`),[n,r]=(0,_.useState)(!1),i=e=>{t(e),r(!1);let n=document.getElementById(`xo-main`);n&&n.scrollTo({top:0})},a=fge[e],o=(0,M.jsxs)(`div`,{className:`flex h-full w-72 flex-col border-r border-sidebar-border bg-sidebar`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-3 px-5 py-5`,children:[(0,M.jsx)(`div`,{className:`flex size-9 items-center justify-center rounded-xl bg-primary/15 text-primary`,children:(0,M.jsx)(Yx,{className:`size-4.5`,strokeWidth:2,fill:`currentColor`})}),(0,M.jsxs)(`div`,{className:`flex flex-col leading-tight`,children:[(0,M.jsx)(`span`,{className:`font-serif text-lg font-medium tracking-tight`,children:`XO`}),(0,M.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`your exocortex`})]}),(0,M.jsx)(`button`,{className:`ml-auto rounded-md p-1 text-muted-foreground hover:bg-sidebar-accent md:hidden`,onClick:()=>r(!1),"aria-label":`Close menu`,children:(0,M.jsx)(BS,{className:`size-5`})})]}),(0,M.jsxs)(`nav`,{className:`flex flex-1 flex-col gap-7 overflow-y-auto px-3 pb-4`,children:[(0,M.jsx)($9,{label:`Presence`,items:lge,current:e,go:i}),(0,M.jsx)($9,{label:`Reflect`,items:uge,current:e,go:i}),(0,M.jsx)($9,{label:`System`,items:dge,current:e,go:i})]}),(0,M.jsx)(`div`,{className:`border-t border-sidebar-border p-3`,children:(0,M.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg px-2 py-2`,children:[(0,M.jsx)(`div`,{className:`flex size-9 items-center justify-center rounded-full bg-secondary font-medium text-secondary-foreground`,children:`M`}),(0,M.jsxs)(`div`,{className:`flex flex-col leading-tight`,children:[(0,M.jsx)(`span`,{className:`text-sm font-medium`,children:`Michael`}),(0,M.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Building season · yr 1`})]})]})})]});return(0,M.jsx)(L9.Provider,{value:{go:i,current:e},children:(0,M.jsxs)(`div`,{className:`xo-theme flex h-svh w-full overflow-hidden font-sans antialiased`,children:[(0,M.jsx)(`aside`,{className:`hidden shrink-0 md:block`,children:o}),n?(0,M.jsxs)(`div`,{className:`fixed inset-0 z-50 md:hidden`,children:[(0,M.jsx)(`div`,{className:`absolute inset-0 bg-black/50`,onClick:()=>r(!1),"aria-hidden":!0}),(0,M.jsx)(`div`,{className:`absolute inset-y-0 left-0`,children:o})]}):null,(0,M.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,M.jsxs)(`header`,{className:`flex items-center gap-3 border-b border-border bg-background/80 px-4 py-3 backdrop-blur md:hidden`,children:[(0,M.jsx)(`button`,{className:`rounded-md p-1.5 text-muted-foreground hover:bg-accent`,onClick:()=>r(!0),"aria-label":`Open menu`,children:(0,M.jsx)(lS,{className:`size-5`})}),(0,M.jsx)(`span`,{className:`font-serif text-base font-medium`,children:`XO`})]}),(0,M.jsx)(`main`,{id:`xo-main`,className:`flex-1 overflow-y-auto`,children:(0,M.jsx)(`div`,{className:`mx-auto w-full max-w-6xl px-5 py-8 md:px-10 md:py-12`,children:(0,M.jsx)(a,{})})})]})]})})}var mge={"/chat":`Chat`,"/voice":`Voice`,"/capture":`Capture`,"/inbox":`Inbox`,"/tasks":`Actions`,"/notes":`All notes`,"/projects":`Projects`,"/areas":`Areas`,"/resources":`Resources`,"/held":`Held`,"/settings":`Settings`};function hge({route:e}){return e===`/playground`?(0,M.jsx)(MJ,{}):e===`/notes`?(0,M.jsx)(qq,{}):e===`/tasks`?(0,M.jsx)(yX,{}):e===`/projects`?(0,M.jsx)(zT,{kind:`projects`}):e===`/areas`?(0,M.jsx)(zT,{kind:`areas`}):e===`/resources`?(0,M.jsx)(zT,{kind:`resources`}):e===`/capture`?(0,M.jsx)(Vw,{}):e===`/chat`?(0,M.jsx)(iie,{}):e===`/voice`?(0,M.jsx)(ihe,{}):e===`/held`?(0,M.jsx)(die,{}):e===`/settings`?(0,M.jsx)(_X,{}):(0,M.jsx)(zq,{})}function gge(){let e=UC(),t=Wte(),n=Ow();return(0,_.useEffect)(()=>{n.routeAccess===`redirect`&&n.redirectTo!==void 0&&WC(n.redirectTo)},[n.routeAccess,n.redirectTo]),e===`/mockup`?(0,M.jsx)(pge,{}):t?(0,M.jsxs)(`div`,{className:`flex min-h-svh flex-col`,children:[(0,M.jsx)(Mw,{}),(0,M.jsx)(Vw,{})]}):(0,M.jsxs)(SC,{children:[(0,M.jsx)(one,{}),(0,M.jsxs)(TC,{children:[(0,M.jsx)(Mw,{}),(0,M.jsxs)(`div`,{className:`flex h-12 items-center gap-2 border-b border-border/60 px-2`,children:[(0,M.jsx)(wC,{}),(0,M.jsx)(`span`,{className:`text-sm font-medium text-muted-foreground`,children:mge[e]??`XO`})]}),(0,M.jsx)(hge,{route:e})]})]})}var _ge=class extends _.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){let t=``+e.toString();return t.includes(`@workos-inc/authkit-react`)&&t.includes(`clientId`)?{error:(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`p`,{children:[`Add the following environment variables to your `,(0,M.jsx)(`code`,{children:`.env.local`}),` file:`]}),(0,M.jsxs)(`ul`,{className:`pl-4 list-disc`,children:[(0,M.jsx)(`li`,{children:(0,M.jsx)(`code`,{children:`VITE_WORKOS_CLIENT_ID="your-client-id"`})}),(0,M.jsx)(`li`,{children:(0,M.jsx)(`code`,{children:`VITE_WORKOS_API_HOSTNAME="api.workos.com"`})}),(0,M.jsx)(`li`,{children:(0,M.jsx)(`code`,{children:`VITE_WORKOS_REDIRECT_URI="your-redirect-uri"`})})]}),(0,M.jsxs)(`p`,{children:[`You can find these values in your WorkOS dashboard at`,` `,(0,M.jsx)(`a`,{className:`underline hover:no-underline`,href:`https://dashboard.workos.com`,target:`_blank`,children:`https://dashboard.workos.com`})]}),(0,M.jsxs)(`p`,{className:`pl-8 text-sm font-mono`,children:[`Raw error: `,t]})]})}:{error:(0,M.jsx)(`p`,{children:t})}}componentDidCatch(){}render(){return this.state.error===null?this.props.children:(0,M.jsxs)(`div`,{className:`bg-red-500/20 border border-red-500/50 p-8 flex flex-col gap-4 container mx-auto`,children:[(0,M.jsx)(`h1`,{className:`text-xl font-bold`,children:`Caught an error while rendering:`}),this.state.error]})}},vge=new ji(ra.VITE_CONVEX_URL);(0,v.createRoot)(document.getElementById(`root`)).render((0,M.jsx)(_.StrictMode,{children:(0,M.jsx)(_ge,{children:(0,M.jsx)(va,{children:(0,M.jsx)(wb,{children:(0,M.jsx)(Tt,{clientId:ra.VITE_WORKOS_CLIENT_ID,redirectUri:ra.VITE_WORKOS_REDIRECT_URI,onRedirectCallback:({state:e})=>{let t=e?.returnTo??`#/chat`;window.history.replaceState(null,``,`/${t}`),window.dispatchEvent(new HashChangeEvent(`hashchange`))},children:(0,M.jsx)($i,{client:vge,useAuth:wt,children:(0,M.jsxs)(rne,{children:[(0,M.jsx)(gge,{}),(0,M.jsx)(VS,{})]})})})})})})}));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.